:root {
  --gold: #d4af37;
  --gold-light: #f7e98e;
  --gold-dark: #8b6914;
  --orange: #f97316;
  --orange-light: #fb923c;
  --dark-bg: #050505;
  --card-bg: rgba(20, 20, 20, 0.8);
  --border-color: rgba(212, 175, 55, 0.2);

  /* Spacing tokens — 4/8px scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* Easing tokens */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

body {
  background-color: var(--dark-bg);
  background-image:
    radial-gradient(
      ellipse at 20% 10%,
      rgba(249, 115, 22, 0.08) 0%,
      transparent 50%
    ),
    radial-gradient(
      ellipse at 80% 90%,
      rgba(212, 175, 55, 0.06) 0%,
      transparent 50%
    ),
    radial-gradient(circle at center, #0a0a0a 0%, #000000 100%);
  color: #e5e5e5;
  font-family: "Rajdhani", sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Grid Background Effect */
.grid-bg {
  background-image:
    linear-gradient(rgba(212, 175, 55, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212, 175, 55, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
}

/* Glow Effects */
.glow-gold {
  box-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}

.glow-orange {
  box-shadow: 0 0 20px rgba(249, 115, 22, 0.3);
}

/* Bento Card Styles */
.bento-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 8px 24px rgba(0, 0, 0, 0.3);
  transition: border-color 0.25s var(--ease-out),
              transform 0.25s var(--ease-out),
              box-shadow 0.25s var(--ease-out);
  overflow: hidden;
}

.bento-card:hover {
  border-color: rgba(212, 175, 55, 0.4);
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 16px 48px rgba(0, 0, 0, 0.45),
    0 0 20px rgba(212, 175, 55, 0.12);
}

.bento-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.bento-card-body {
  padding: 20px;
}

/* Sidebar Styles */
.sidebar {
  background: linear-gradient(
    180deg,
    rgba(10, 10, 10, 0.98) 0%,
    rgba(5, 5, 5, 0.98) 100%
  );
  border-right: 1px solid var(--border-color);
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  margin: 4px 8px;
  border-radius: 10px;
  color: #9ca3af;
  transition: background 0.2s var(--ease-out),
              color 0.2s var(--ease-out),
              border-color 0.2s var(--ease-out);
  cursor: pointer;
  text-decoration: none;
}

.nav-item:hover {
  background: rgba(249, 115, 22, 0.1);
  color: var(--orange-light);
}

.nav-item.active {
  background: linear-gradient(
    135deg,
    rgba(249, 115, 22, 0.2) 0%,
    rgba(212, 175, 55, 0.1) 100%
  );
  color: var(--gold-light);
  border-left: 3px solid var(--orange);
}

/* Settings Submenu */
.submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s var(--ease-in-out);
  background: rgba(0, 0, 0, 0.2);
  margin: 0 8px;
  border-radius: 0 0 10px 10px;
}

.submenu.open {
  max-height: 250px;
  margin-bottom: 8px;
}

.submenu-item {
  display: flex;
  align-items: center;
  padding: 8px 16px 8px 44px;
  color: #9ca3af;
  font-size: 0.9em;
  transition: color 0.2s var(--ease-out), background 0.2s var(--ease-out);
  cursor: pointer;
  text-decoration: none;
  border-radius: 6px;
}

.submenu-item:hover {
  color: var(--gold-light);
  background: rgba(212, 175, 55, 0.05);
}

.nav-item .chevron-icon {
  margin-left: auto;
  transition: transform 0.3s var(--ease-out);
}

.nav-item.submenu-open .chevron-icon {
  transform: rotate(180deg);
}

/* Quick Stat Cards */
.stat-card {
  background: linear-gradient(
    135deg,
    rgba(30, 30, 30, 0.9) 0%,
    rgba(20, 20, 20, 0.9) 100%
  );
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 20px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 4px 16px rgba(0, 0, 0, 0.25);
  transition: border-color 0.25s var(--ease-out),
              box-shadow 0.25s var(--ease-out),
              transform 0.25s var(--ease-out);
}

.stat-card:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 12px 32px rgba(0, 0, 0, 0.35),
    0 0 24px rgba(212, 175, 55, 0.12);
}

/* Activity Feed */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
}

/* Button Styles */
.btn-primary {
  background: linear-gradient(135deg, var(--orange) 0%, var(--gold) 100%);
  color: #000;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  min-height: 44px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s var(--ease-out),
              box-shadow 0.2s var(--ease-out);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.4),
    0 8px 24px rgba(249, 115, 22, 0.35);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #e5e5e5;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.15);
  cursor: pointer;
  min-height: 44px;
  transition: background 0.2s var(--ease-out),
              border-color 0.2s var(--ease-out);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: var(--gold);
}

/* FAQ Accordion */
.faq-item {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  margin-bottom: 8px;
  overflow: hidden;
}

.faq-question {
  padding: 16px;
  background: rgba(30, 30, 30, 0.5);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.2s;
}

.faq-question:hover {
  background: rgba(40, 40, 40, 0.6);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: rgba(20, 20, 20, 0.5);
}

.faq-answer.open {
  max-height: 200px;
}

.faq-answer-content {
  padding: 16px;
  color: #9ca3af;
}

/* Invoice Table */
.invoice-table {
  width: 100%;
  border-collapse: collapse;
}

.invoice-table th {
  text-align: left;
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--gold);
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.invoice-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* Status Badges */
.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75em;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-success {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.badge-pending {
  background: rgba(249, 115, 22, 0.2);
  color: var(--orange);
}

.badge-info {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

/* Section Tabs */
.section-tab {
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  color: #9ca3af;
}

.section-tab.active {
  background: rgba(249, 115, 22, 0.2);
  color: var(--orange-light);
}

.section-tab:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
}

/* Mobile Nav Backdrop */
.mobile-nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.mobile-nav-backdrop.open { display: block; }

/* Mobile Responsive */
@media (max-width: 1024px) {
  .sidebar-desktop {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
  }

  .sidebar-desktop.open {
    transform: translateX(0);
    box-shadow: 4px 0 40px rgba(0, 0, 0, 0.8);
  }

  .mobile-header {
    display: flex !important;
  }
}

@media (min-width: 1025px) {
  .mobile-header {
    display: none !important;
  }
}

/* Mobile viewport & performance fixes */
@media (max-width: 480px) {
  /* Reduce heavy blur on mobile GPUs */
  .bento-card {
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
  }

  /* Safe area inset for iOS home indicator */
  #main-content-area {
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
  }

  /* Prevent long text from overflowing cards */
  .bento-card {
    overflow-wrap: break-word;
    word-break: break-word;
  }

  /* Chatbot window: full-width on small phones, no overflow */
  #chatbot-window {
    position: fixed !important;
    bottom: 5rem !important;
    right: 1rem !important;
    left: 1rem !important;
    width: auto !important;
    height: 70dvh !important;
  }

  /* Fluid stat card numbers */
  .stat-card p.text-2xl {
    font-size: clamp(1.1rem, 5vw, 1.5rem);
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--gold-dark) 0%, var(--gold) 100%);
  border-radius: 4px;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

/* Section Content Visibility */
.section-content {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

.section-content.active {
  display: flex;
  flex-direction: column;
  opacity: 1;
  transform: translateY(0);
}

/* Responsive spacing additions */
@media (max-width: 768px) {
  #main-content-area {
    padding: 1rem;
  }
  .stat-card {
    padding: 15px;
  }
}

/* Scroll-reveal — staggered entrance */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--ease-out),
              transform 0.6s var(--ease-out);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger siblings */
.reveal:nth-child(1) { transition-delay: 0ms; }
.reveal:nth-child(2) { transition-delay: 60ms; }
.reveal:nth-child(3) { transition-delay: 120ms; }
.reveal:nth-child(4) { transition-delay: 180ms; }
.reveal:nth-child(5) { transition-delay: 240ms; }
.reveal:nth-child(6) { transition-delay: 300ms; }

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
