/* =====================================================
   SahiHisab — Sidebar Redesign (index12 Sea Blue Theme)

   Design DNA from index12.html:
   · Plus Jakarta Sans 800 headings + DM Sans 500 body
   · Sea blue 9-shade palette (#062C4E → #E1F5FE)
   · --r: 14px radius, --sh-* shadow scale
   · Pill-shaped badges, gradient accent bars
   · Hover: translateY + scale + rotate micro-interactions
   · Glass overlays with rgba borders

   Uses body .selector specificity — NO !important.
   ===================================================== */


/* ─────────────────────────────────────────────────────
   1. SIDEBAR SHELL
   Deep ocean gradient with layered depth effects.
   Matches index12's .dash-card and dark section aesthetic.
   ───────────────────────────────────────────────────── */

body .sidebar {
  width: var(--sidebar-width, 260px);
  background: #062C4E;
  color: #E1F5FE;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid rgba(2, 119, 189, 0.1);
}

/* Ambient light — radial gradient wash, top-left corner
   Same technique as index12's hero::before diagonal wash */
body .sidebar::before {
  content: '';
  position: absolute;
  top: -60px; left: -40px;
  width: 220px; height: 220px;
  background: radial-gradient(
    ellipse at center,
    rgba(41, 182, 246, 0.08) 0%,
    rgba(2, 136, 209, 0.04) 40%,
    transparent 70%
  );
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

/* Bottom ambient — warm glow to prevent flat feeling */
body .sidebar::after {
  content: '';
  position: absolute;
  bottom: -80px; right: -50px;
  width: 200px; height: 200px;
  background: radial-gradient(
    circle,
    rgba(3, 155, 229, 0.06) 0%,
    transparent 65%
  );
  pointer-events: none;
  z-index: 0;
}

body .sidebar > * {
  position: relative;
  z-index: 1;
}

/* Scrollbar — barely visible, matches index12's minimal chrome */
body .sidebar::-webkit-scrollbar { width: 3px; }
body .sidebar::-webkit-scrollbar-track { background: transparent; }
body .sidebar::-webkit-scrollbar-thumb {
  background: rgba(129, 212, 250, 0.15);
  border-radius: 3px;
}
body .sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(129, 212, 250, 0.3);
}


/* ─────────────────────────────────────────────────────
   2. BRAND HEADER
   index12's .logo pattern: icon with gradient bg + text pair.
   Plus Jakarta Sans 800, tight letter-spacing.
   ───────────────────────────────────────────────────── */

body .sidebar-brand {
  padding: 22px 20px 20px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
}

/* Subtle shimmer line at bottom — like index12's nav.scrolled border */
body .sidebar-brand::after {
  content: '';
  position: absolute;
  bottom: 0; left: 20px; right: 20px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(41, 182, 246, 0.2) 30%,
    rgba(129, 212, 250, 0.15) 50%,
    rgba(41, 182, 246, 0.2) 70%,
    transparent 100%
  );
}

body .sidebar-brand .brand-icon {
  width: 38px; height: 38px;
  background: #0277BD;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: #fff;
  box-shadow:
    0 3px 12px rgba(2, 136, 209, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

/* index12 .f-card:hover .f-icon pattern */
body .sidebar-brand:hover .brand-icon {
  transform: scale(1.05) rotate(-3deg);
}

body .sidebar-brand h1 {
  font-family: 'Plus Jakarta Sans', 'DM Sans', system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  line-height: 1.15;
}

body .sidebar-brand small {
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.65rem;
  color: rgba(122, 172, 207, 0.6);
  font-weight: 400;
  display: block;
  letter-spacing: 0.05em;
  margin-top: 2px;
}


/* ─────────────────────────────────────────────────────
   3. NAVIGATION CONTAINER
   ───────────────────────────────────────────────────── */

body .sidebar-nav {
  flex: 1;
  padding: 12px 10px 20px;
}


/* ─────────────────────────────────────────────────────
   4. SECTION LABELS
   index12's .sec-tag pattern: tiny, uppercase, tracked.
   Uses --haze equivalent (#7AACCF at low opacity).
   ───────────────────────────────────────────────────── */

body .sidebar .nav-section-label {
  font-family: 'Plus Jakarta Sans', 'DM Sans', system-ui, sans-serif;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(122, 172, 207, 0.4);
  padding: 20px 14px 7px;
  font-weight: 700;
  position: relative;
}

/* First section label needs less top padding */
body .sidebar .nav-section-label:first-child {
  padding-top: 4px;
}


/* ─────────────────────────────────────────────────────
   5. NAV ITEMS — The core interactive element
   Inspired by index12's .nav-links hover behavior +
   .f-card hover (translateY, shadow escalation).
   ───────────────────────────────────────────────────── */

body .sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 14px;
  border-radius: 10px;
  color: rgba(179, 229, 252, 0.55);
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.86rem;
  font-weight: 500;
  transition:
    background 200ms ease,
    color 200ms ease,
    transform 200ms ease,
    box-shadow 200ms ease;
  margin-bottom: 1px;
  position: relative;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
}

/* Hover — glass card effect from index12's .biz-pill:hover */
body .sidebar .nav-item:hover {
  background: rgba(2, 119, 189, 0.1);
  border-color: rgba(2, 119, 189, 0.08);
  color: #E1F5FE;
  transform: translateX(2px);
}

/* ── ACTIVE STATE ──
   Matches index12's .f-card.accent: gradient bg + white text.
   Left bar = index12's .mc-bar.hi gradient pattern. */

body .sidebar .nav-item.active {
  background: rgba(2, 119, 189, 0.15);
  color: #fff;
  border-color: rgba(41, 182, 246, 0.1);
  box-shadow: 0 2px 10px rgba(2, 136, 209, 0.12);
}

/* Active accent bar — gradient from --sky to --ocean */
body .sidebar .nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 5px; bottom: 5px;
  width: 3px;
  background: linear-gradient(180deg, #29B6F6, #0277BD);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 10px rgba(41, 182, 246, 0.45);
}

/* Active accent dot — right side, subtle "you are here" */
body .sidebar .nav-item.active::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 5px; height: 5px;
  background: #29B6F6;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(41, 182, 246, 0.5);
  animation: sb-pulse 3s ease-in-out infinite;
}

@keyframes sb-pulse {
  0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
  50%      { opacity: 0.5; transform: translateY(-50%) scale(0.7); }
}


/* ─────────────────────────────────────────────────────
   6. ICON STYLES
   index12's .f-icon: 44x44, rounded, tinted bg.
   Active icon gets index12's --sky (#29B6F6) color.
   ───────────────────────────────────────────────────── */

body .sidebar .nav-item .material-symbols-rounded {
  font-size: 1.2rem;
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
  font-variation-settings: 'FILL' 0, 'wght' 400;
  transition:
    font-variation-settings 150ms ease,
    background 200ms ease,
    transform 200ms ease,
    color 200ms ease;
}

body .sidebar .nav-item:hover .material-symbols-rounded {
  color: #81D4FA;
  background: rgba(129, 212, 250, 0.08);
  transform: scale(1.06) rotate(-3deg);
}

body .sidebar .nav-item.active .material-symbols-rounded {
  font-variation-settings: 'FILL' 1, 'wght' 500;
  color: #29B6F6;
  background: rgba(41, 182, 246, 0.12);
}


/* ─────────────────────────────────────────────────────
   7. BADGE — Notification count
   index12's pill pattern: border-radius: 100px, tight padding.
   ───────────────────────────────────────────────────── */

body .sidebar .nav-item .badge {
  margin-left: auto;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  font-family: 'DM Sans', system-ui, sans-serif;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 100px;
  min-width: 18px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
  line-height: 1.3;
}


/* ─────────────────────────────────────────────────────
   8. SIDEBAR FOOTER — Version / Pro badge
   Optional: shows version number or plan tier at bottom.
   ───────────────────────────────────────────────────── */

body .sidebar-nav::after {
  content: '';
  display: block;
  height: 24px;
}


/* ─────────────────────────────────────────────────────
   9. MOBILE — Slide-in drawer
   index12's backdrop: deep navy overlay.
   ───────────────────────────────────────────────────── */

@media (max-width: 768px) {
  body .sidebar {
    transform: translateX(-100%);
    z-index: 1050;
    width: 280px;
    box-shadow: none;
    transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1);
  }

  body .sidebar.open {
    transform: translateX(0);
    box-shadow:
      8px 0 32px rgba(5, 30, 56, 0.55),
      20px 0 80px rgba(5, 30, 56, 0.3);
  }

  /* Close button — glass-morphic, index12's .btn-outline style */
  body .sidebar-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border: 1px solid rgba(129, 212, 250, 0.12);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    color: rgba(179, 229, 252, 0.6);
    cursor: pointer;
    margin-left: auto;
    flex-shrink: 0;
    transition: all 150ms ease;
  }

  body .sidebar-close-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(129, 212, 250, 0.2);
    color: #E1F5FE;
  }

  body .sidebar-close-btn:active {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0.9);
  }

  /* Backdrop — deep navy overlay matching index12's dark sections */
  body .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(5, 30, 56, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1049;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 250ms ease, visibility 250ms ease;
  }

  body .sidebar-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
  }

  /* Active dot hidden on mobile — saves space */
  body .sidebar .nav-item.active::after {
    display: none;
  }
}


/* ─────────────────────────────────────────────────────
   10. TABLET — Collapsed icon-only sidebar
   Icons centered, tooltips implied by icon meaning.
   ───────────────────────────────────────────────────── */

@media (min-width: 769px) and (max-width: 1024px) {
  body .sidebar {
    width: 72px;
  }

  body .sidebar .sidebar-brand h1,
  body .sidebar .sidebar-brand small,
  body .sidebar .nav-section-label,
  body .sidebar .step-label,
  body .sidebar .nav-item span:not(.material-symbols-rounded):not(.badge) {
    display: none;
  }

  body .sidebar .sidebar-brand {
    justify-content: center;
    padding: 16px;
  }

  body .sidebar .sidebar-brand::after {
    left: 12px;
    right: 12px;
  }

  body .sidebar .nav-item {
    justify-content: center;
    padding: 10px;
  }

  body .sidebar .nav-item .material-symbols-rounded {
    width: 36px; height: 36px;
    font-size: 1.25rem;
  }

  body .sidebar .nav-item.active::before {
    top: 8px;
    bottom: 8px;
  }

  /* Hide active dot in collapsed mode */
  body .sidebar .nav-item.active::after {
    display: none;
  }

  body .main-content {
    margin-left: 72px;
  }

  body .total-bar {
    left: 72px;
  }

  body .wi-wizard-nav {
    left: 72px;
  }
}


/* ─────────────────────────────────────────────────────
   11. FOCUS + ACCESSIBILITY
   High-contrast ring for keyboard navigation.
   ───────────────────────────────────────────────────── */

body .sidebar .nav-item:focus-visible {
  outline: 2px solid rgba(41, 182, 246, 0.7);
  outline-offset: 2px;
  border-radius: 10px;
}


/* ─────────────────────────────────────────────────────
   12. DARK MODE
   Even deeper navy — OLED-friendly blacks.
   ───────────────────────────────────────────────────── */

[data-theme="dark"] .sidebar,
.dark .sidebar {
  background: #041E35;
  border-right-color: rgba(2, 119, 189, 0.06);
}

[data-theme="dark"] .sidebar .nav-item.active,
.dark .sidebar .nav-item.active {
  background: rgba(2, 119, 189, 0.14);
  border-color: rgba(41, 182, 246, 0.08);
}

[data-theme="dark"] .sidebar::before,
.dark .sidebar::before {
  opacity: 0.5;
}


/* ─────────────────────────────────────────────────────
   13. REDUCED MOTION
   Respect prefers-reduced-motion for pulse + transforms.
   ───────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  body .sidebar .nav-item {
    transition: background 200ms ease, color 200ms ease;
  }

  body .sidebar .nav-item:hover {
    transform: none;
  }

  body .sidebar .nav-item:hover .material-symbols-rounded {
    transform: none;
  }

  body .sidebar-brand:hover .brand-icon {
    transform: none;
  }

  @keyframes sb-pulse {
    0%, 100% { opacity: 1; }
  }
}
