/* Custom styles for Trading Notional Calculator */

/* Theme-aware CSS variables */
[data-bs-theme='light'] {
  --upload-bg: #f8f9fa;
  --upload-border: #dee2e6;
  --upload-hover-bg: #e7f1ff;
  --upload-hover-border: #0d6efd;
  --upload-dragover-bg: #cfe2ff;
  --filter-header-bg: #f8f9fa;
  --filter-header-hover-bg: #e9ecef;
  --filter-border: #dee2e6;
  --card-shadow: rgba(0, 0, 0, 0.15);
  --card-glow-primary: rgba(13, 110, 253, 0.5);
  --card-glow-success: rgba(25, 135, 84, 0.5);
  --card-glow-info: rgba(13, 202, 240, 0.5);
}

[data-bs-theme='dark'] {
  --upload-bg: #2b3035;
  --upload-border: #495057;
  --upload-hover-bg: #1e3a5f;
  --upload-hover-border: #0d6efd;
  --upload-dragover-bg: #1a4971;
  --filter-header-bg: #2b3035;
  --filter-header-hover-bg: #343a40;
  --filter-border: #495057;
  --card-shadow: rgba(0, 0, 0, 0.3);
  --card-glow-primary: rgba(13, 110, 253, 0.4);
  --card-glow-success: rgba(25, 135, 84, 0.4);
  --card-glow-info: rgba(13, 202, 240, 0.4);
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

/* Collapsible disclaimer chevron rotation */
[data-bs-toggle='collapse']:not(.collapsed) .bi-chevron-down {
  transform: rotate(180deg);
}

[data-bs-toggle='collapse']:hover {
  opacity: 1 !important;
}

/* Upload area styling */
.upload-area {
  border: 2px dashed var(--upload-border);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: var(--upload-bg);
}

.upload-area:hover {
  border-color: var(--upload-hover-border);
  background-color: var(--upload-hover-bg);
}

.upload-area.drag-over {
  border-color: var(--upload-hover-border);
  background-color: var(--upload-dragover-bg);
}

/* Card hover effects */
.card {
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.card:hover {
  box-shadow: 0 0.5rem 1rem var(--card-shadow);
}

/* Summary cards - Enhanced hover with lift and glow */
.summary-card {
  transition:
    transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1),
    box-shadow 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
  cursor: default;
}

.summary-card:hover {
  transform: translateY(-10px) scale(1.02) !important;
  box-shadow: 0 1.5rem 3rem var(--card-shadow) !important;
}

.summary-card.bg-primary:hover {
  box-shadow: 0 1.5rem 3rem var(--card-glow-primary) !important;
}

.summary-card.bg-success:hover {
  box-shadow: 0 1.5rem 3rem var(--card-glow-success) !important;
}

.summary-card.bg-info:hover {
  box-shadow: 0 1.5rem 3rem var(--card-glow-info) !important;
}

/* Staggered fade-in animation for cards */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeInUp 0.6s ease-out forwards;
  opacity: 0;
}

.animate-delay-1 {
  animation-delay: 0.1s;
}
.animate-delay-2 {
  animation-delay: 0.2s;
}
.animate-delay-3 {
  animation-delay: 0.3s;
}
.animate-delay-4 {
  animation-delay: 0.4s;
}
.animate-delay-5 {
  animation-delay: 0.5s;
}

/* Count-up number styling */
.count-up {
  display: inline-block;
}

/* Progress bar animation */
@keyframes progressGrow {
  from {
    width: 0;
  }
}

.progress-animated .progress-bar {
  animation: progressGrow 1.2s ease-out forwards;
  animation-delay: 0.6s;
  width: 0;
}

/* Staggered progress bar animation */
tr:nth-child(1) .progress-bar {
  animation-delay: 0.7s;
}
tr:nth-child(2) .progress-bar {
  animation-delay: 0.8s;
}
tr:nth-child(3) .progress-bar {
  animation-delay: 0.9s;
}
tr:nth-child(4) .progress-bar {
  animation-delay: 1s;
}
tr:nth-child(5) .progress-bar {
  animation-delay: 1.1s;
}
tr:nth-child(6) .progress-bar {
  animation-delay: 1.2s;
}
tr:nth-child(7) .progress-bar {
  animation-delay: 1.3s;
}
tr:nth-child(8) .progress-bar {
  animation-delay: 1.4s;
}

/* Pulse animation for icons - transform-only for smooth compositing */
@keyframes iconPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12);
  }
}

.summary-card .bi {
  animation: iconPulse 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  display: inline-block;
  will-change: transform;
}

.summary-card:hover .bi {
  animation: none;
  transform: scale(1.15);
  opacity: 0.9 !important;
  transition: transform 0.3s ease;
}

/* Table improvements */
.table th {
  white-space: nowrap;
}

.table-responsive {
  max-height: 500px;
  overflow-y: auto;
}

#tradesTable thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Badge styling */
.badge {
  font-weight: 500;
}

/* Chart container */
#pieChart {
  width: 100%;
}

/* Pie chart segment hover glow effect */
#pieChart .slice path {
  transition: filter 0.3s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .card-title {
    font-size: 1.25rem;
  }

  .display-4 {
    font-size: 2rem;
  }
}

/* Footer styling */
.footer {
  margin-top: auto;
}

/* Flash messages */
.alert {
  border-radius: 0.5rem;
}

/* Navbar branding */
.navbar-brand {
  font-weight: 600;
}

/* Theme toggle button */
#themeToggle {
  border: none;
  background: transparent;
  transition: transform 0.3s ease;
}

#themeToggle:hover {
  transform: rotate(20deg) scale(1.1);
}

#themeToggle:focus {
  box-shadow: none;
}

/* Form styling */
.form-label {
  /* Color handled by Bootstrap theme */
}

.form-text {
  font-size: 0.85rem;
}

/* Loading state */
.spinner-border-sm {
  width: 1rem;
  height: 1rem;
}

/* Date Range Filter Styles */
.filter-card {
  border: 1px solid var(--filter-border);
  transition: box-shadow 0.3s ease;
}

.filter-card:hover {
  box-shadow: 0 0.25rem 0.5rem var(--card-shadow);
}

.filter-card .card-header {
  background-color: var(--filter-header-bg);
  border-bottom: 1px solid var(--filter-border);
}

.filter-card .card-header:hover {
  background-color: var(--filter-header-hover-bg);
}

.collapse-icon {
  transition: transform 0.3s ease;
  font-size: 0.8rem;
}

.filter-status-badge {
  font-size: 0.75rem;
}

/* Preset button group */
#presetButtons {
  gap: 0.25rem;
}

#presetButtons .btn {
  border-radius: 0.375rem !important;
  font-size: 0.875rem;
  padding: 0.375rem 0.75rem;
}

.filter-status {
  font-size: 0.875rem;
}

/* Responsive adjustments for filter */
@media (max-width: 992px) {
  #presetButtons {
    width: 100%;
  }

  #presetButtons .btn {
    flex: 1;
    min-width: 70px;
  }
}

@media (max-width: 576px) {
  #presetButtons .btn {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }

  .filter-card .card-body .d-flex {
    flex-direction: column;
    align-items: stretch !important;
  }

  .filter-card input[type='date'] {
    max-width: 100% !important;
  }
}
