/*
 * nav2.css — Dual Bar Navigation for hyp.yoga
 *
 * Top bar (38px): logo, site links, auth state
 * Ribbon (48px): contextual Sparkbar-style pills, adapts per page
 * Bottom tabs (54px, mobile only): replaces ribbon on small screens
 *
 * Progressive reveal: pills appear/disappear based on practitioner tier
 * Built to match SparkUI metallic sheen language (spark-ui.css)
 */

/* ========================================
   LAYOUT OFFSETS — injected by nav2.js,
   but defined here as fallback
   ======================================== */
:root {
  --nav2-top-h: 38px;
  --nav2-ribbon-h: 48px;
}

/* ========================================
   SKIP NAVIGATION (accessibility)
   ======================================== */
.nav2-skip {
  position: fixed; top: -100px; left: 16px;
  background: var(--color-accent, #b8860b); color: #fff;
  padding: 8px 16px; border-radius: 0 0 8px 8px;
  font-size: 13px; font-weight: 500; z-index: 1100;
  text-decoration: none; font-family: var(--font-sans, Inter, sans-serif);
  transition: top 0.2s ease;
}
.nav2-skip:focus {
  top: 0;
  outline: 2px solid var(--color-accent, #b8860b);
  outline-offset: 2px;
}

/* ========================================
   TOP BAR (identity strip)
   ======================================== */
.nav2-top {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--nav2-top-h);
  background: var(--color-white, #ffffff);
  border-bottom: 1px solid rgba(224,219,211,0.3);
  z-index: 1001;
  display: flex; align-items: center;
  padding: 0 16px;
}
.nav2-top-inner {
  display: flex; align-items: center;
  width: 100%; max-width: 960px; margin: 0 auto;
}
.nav2-logo {
  font-family: var(--font-serif, 'Cormorant Garamond', Georgia, serif);
  font-size: 1.15rem; font-weight: 600;
  color: var(--color-accent, #b8860b);
  text-decoration: none; flex-shrink: 0;
}
.nav2-logo:hover { opacity: 0.85; }
.nav2-top-flex { flex: 1; }
.nav2-tl {
  font-family: var(--font-sans, Inter, sans-serif);
  font-size: 12px; color: var(--color-text-light, #958e85);
  text-decoration: none; padding: 4px 10px; border-radius: 6px;
  transition: all 0.15s ease; cursor: pointer;
  white-space: nowrap;
}
.nav2-tl:hover {
  color: var(--color-text, #2c2a26);
  background: var(--color-bg-deep, #f0ece6);
}
.nav2-tl--name {
  font-weight: 500;
  color: var(--color-text, #2c2a26);
}
.nav2-tl--cta {
  color: var(--color-accent, #b8860b);
  font-weight: 500;
}
.nav2-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--color-accent-bg, #f5edd8);
  border: 1.5px solid var(--color-border, #e0dbd3);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  color: var(--color-accent, #b8860b);
  cursor: pointer; margin-left: 4px;
  text-decoration: none; flex-shrink: 0;
}

/* ========================================
   RIBBON (contextual Sparkbar nav)
   ======================================== */
.nav2-ribbon {
  position: fixed;
  top: var(--nav2-top-h);
  left: 0; right: 0;
  height: var(--nav2-ribbon-h);
  background: var(--color-bg, #faf8f5);
  border-bottom: 1px solid rgba(224,219,211,0.6);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 0 16px; gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.nav2-ribbon::-webkit-scrollbar { display: none; }
.nav2-ribbon { scrollbar-width: none; }

/* Separator */
.nav2-sep {
  width: 1px; height: 22px;
  background: var(--color-border, #e0dbd3);
  flex-shrink: 0; margin: 0 4px;
}

/* Section label */
.nav2-lbl {
  font-family: var(--font-sans, Inter, sans-serif);
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--color-text-light, #958e85);
  flex-shrink: 0; margin-right: 2px; white-space: nowrap;
}

/* Context chip (e.g. "Ch 1", "Pāda 2") */
.nav2-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 14px;
  font-family: var(--font-sans, Inter, sans-serif);
  font-size: 12px; font-weight: 500; cursor: pointer;
  transition: all 0.15s ease; white-space: nowrap;
  border: 1px solid transparent; background: none;
  color: var(--color-text-muted, #6b6560);
  text-decoration: none;
}
.nav2-chip:hover {
  background: rgba(255,255,255,0.6);
  color: var(--color-text, #2c2a26);
}
.nav2-chip--on {
  background: var(--color-white, #ffffff);
  color: var(--color-accent, #b8860b);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(184,134,11,0.08);
  border-color: rgba(184,134,11,0.2);
}
.nav2-chip--green.nav2-chip--on {
  color: var(--color-question, #4a9e52);
  border-color: rgba(74,158,82,0.2);
  box-shadow: 0 1px 3px rgba(74,158,82,0.08);
}
.nav2-chip--blue { color: #1a7a9e; }
.nav2-chip--blue:hover { color: #15697f; }
.nav2-chip--blue.nav2-chip--on {
  color: #1e88b4;
  border-color: rgba(30,136,180,0.25);
  box-shadow: 0 1px 3px rgba(30,136,180,0.1);
}

/* ========================================
   SPARK PILL (button group container)
   ======================================== */
.nav2-pill {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 3px 5px;
  border: 1px solid rgba(200,195,185,0.6); border-radius: 20px;
  background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(245,242,238,0.9) 100%);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.8);
  flex-shrink: 0;
}

/* ========================================
   SPARK BUTTON (metallic circle)
   ======================================== */
.nav2-btn {
  width: 32px; height: 32px; padding: 5px;
  border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.2s ease; flex-shrink: 0;
  border: none; position: relative;
  font-family: var(--font-sans, Inter, sans-serif);
}
.nav2-btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav2-btn:hover { transform: scale(1.12); }
.nav2-btn:focus-visible {
  outline: 2px solid var(--color-accent, #b8860b);
  outline-offset: 2px;
}

/* Tooltip */
.nav2-btn[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: var(--color-text, #2c2a26);
  color: var(--color-bg, #faf8f5);
  font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 5px;
  white-space: nowrap; pointer-events: none; z-index: 300;
}

/* Active dot indicator */
.nav2-btn--on::before {
  content: ''; position: absolute; bottom: -3px; left: 50%;
  transform: translateX(-50%); width: 4px; height: 4px;
  border-radius: 50%; background: currentColor;
}

/* ── Color variants — metallic sheen ── */
.nav2-btn--gold {
  border: 1.5px solid rgba(184,134,11,0.35);
  background: linear-gradient(160deg, rgba(255,248,230,0.95) 0%, rgba(245,225,180,0.7) 40%, rgba(210,175,90,0.25) 70%, rgba(255,248,230,0.8) 100%);
  color: #b8860b;
  box-shadow: 0 1px 2px rgba(184,134,11,0.12), inset 0 1px 0 rgba(255,255,255,0.6);
}
.nav2-btn--gold:hover { box-shadow: 0 2px 8px rgba(184,134,11,0.25), inset 0 1px 0 rgba(255,255,255,0.7); }

.nav2-btn--blue {
  border: 1.5px solid rgba(30,136,180,0.3);
  background: linear-gradient(160deg, rgba(235,248,255,0.95) 0%, rgba(200,230,245,0.7) 40%, rgba(100,180,210,0.2) 70%, rgba(235,248,255,0.8) 100%);
  color: #1a7a9e;
  box-shadow: 0 1px 2px rgba(30,136,180,0.1), inset 0 1px 0 rgba(255,255,255,0.6);
}
.nav2-btn--blue:hover { box-shadow: 0 2px 8px rgba(30,136,180,0.2), inset 0 1px 0 rgba(255,255,255,0.7); }

.nav2-btn--purple {
  border: 1.5px solid rgba(124,92,191,0.3);
  background: linear-gradient(160deg, rgba(245,240,255,0.95) 0%, rgba(220,210,245,0.7) 40%, rgba(160,130,210,0.2) 70%, rgba(245,240,255,0.8) 100%);
  color: #7c5cbf;
  box-shadow: 0 1px 2px rgba(124,92,191,0.1), inset 0 1px 0 rgba(255,255,255,0.6);
}
.nav2-btn--purple:hover { box-shadow: 0 2px 8px rgba(124,92,191,0.2), inset 0 1px 0 rgba(255,255,255,0.7); }

.nav2-btn--green {
  border: 1.5px solid rgba(90,138,94,0.3);
  background: linear-gradient(160deg, rgba(235,250,237,0.95) 0%, rgba(205,235,210,0.7) 40%, rgba(120,185,130,0.2) 70%, rgba(235,250,237,0.8) 100%);
  color: #4a7a4e;
  box-shadow: 0 1px 2px rgba(90,138,94,0.1), inset 0 1px 0 rgba(255,255,255,0.6);
}
.nav2-btn--green:hover { box-shadow: 0 2px 8px rgba(90,138,94,0.2), inset 0 1px 0 rgba(255,255,255,0.7); }

.nav2-btn--warm {
  border: 1.5px solid rgba(196,122,26,0.3);
  background: linear-gradient(160deg, rgba(255,245,225,0.95) 0%, rgba(245,225,190,0.7) 40%, rgba(200,160,80,0.2) 70%, rgba(255,245,225,0.8) 100%);
  color: #b06a10;
  box-shadow: 0 1px 2px rgba(196,122,26,0.1), inset 0 1px 0 rgba(255,255,255,0.6);
}
.nav2-btn--warm:hover { box-shadow: 0 2px 8px rgba(196,122,26,0.2), inset 0 1px 0 rgba(255,255,255,0.7); }

.nav2-btn--teal {
  border: 1.5px solid rgba(0,150,136,0.3);
  background: linear-gradient(160deg, rgba(230,250,248,0.95) 0%, rgba(195,235,230,0.7) 40%, rgba(80,190,175,0.2) 70%, rgba(230,250,248,0.8) 100%);
  color: #00796b;
  box-shadow: 0 1px 2px rgba(0,150,136,0.1), inset 0 1px 0 rgba(255,255,255,0.6);
}
.nav2-btn--teal:hover { box-shadow: 0 2px 8px rgba(0,150,136,0.2), inset 0 1px 0 rgba(255,255,255,0.7); }

.nav2-btn--coral {
  border: 1.5px solid rgba(224,102,102,0.3);
  background: linear-gradient(160deg, rgba(255,240,240,0.95) 0%, rgba(245,210,210,0.7) 40%, rgba(220,140,140,0.2) 70%, rgba(255,240,240,0.8) 100%);
  color: #d45555;
  box-shadow: 0 1px 2px rgba(224,102,102,0.1), inset 0 1px 0 rgba(255,255,255,0.6);
}
.nav2-btn--coral:hover { box-shadow: 0 2px 8px rgba(224,102,102,0.2), inset 0 1px 0 rgba(255,255,255,0.7); }

.nav2-btn--neutral {
  border: 1.5px solid rgba(200,195,185,0.5);
  background: linear-gradient(160deg, rgba(250,248,245,0.95) 0%, rgba(240,236,230,0.8) 40%, rgba(220,215,205,0.3) 70%, rgba(250,248,245,0.85) 100%);
  color: var(--color-text-muted, #6b6560);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.6);
}
.nav2-btn--neutral:hover {
  color: var(--color-text, #2c2a26);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.7);
}

/* Dimmed (upgrade hint) */
.nav2-btn--dim { opacity: 0.4; cursor: default; }
.nav2-btn--dim:hover { transform: none; opacity: 0.55; }

/* ========================================
   MOBILE BOTTOM TABS
   ======================================== */
.nav2-tabs {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 54px;
  background: var(--color-white, #ffffff);
  border-top: 1px solid var(--color-border, #e0dbd3);
  display: none; align-items: center; justify-content: space-around;
  z-index: 999; padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.nav2-tab {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  color: var(--color-text-light, #958e85);
  font-family: var(--font-sans, Inter, sans-serif);
  font-size: 10px; font-weight: 500;
  padding: 5px 10px; border-radius: 8px;
  cursor: pointer; border: none; background: none;
  transition: all 0.15s ease; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.nav2-tab svg { width: 20px; height: 20px; }
.nav2-tab--on {
  color: var(--color-accent, #b8860b);
  background: var(--color-accent-bg, #f5edd8);
}

/* ========================================
   SEARCH OVERLAY (migrated from nav.js)
   ======================================== */
.nav2-search-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(44,42,38,0.5); backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000; display: none;
  align-items: flex-start; justify-content: center;
  padding-top: 15vh;
}
.nav2-search-overlay.open { display: flex; }
.nav2-search-box {
  background: var(--color-white, #ffffff);
  border-radius: 12px; width: 90%; max-width: 520px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
  overflow: hidden;
}
.nav2-search-input-wrap {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border, #e0dbd3);
}
.nav2-search-input-wrap svg {
  width: 18px; height: 18px; flex-shrink: 0;
  color: var(--color-text-light, #958e85);
}
.nav2-search-input {
  flex: 1; border: none; outline: none;
  font-family: var(--font-sans, Inter, sans-serif);
  font-size: 15px; color: var(--color-text, #2c2a26);
  background: transparent;
}
.nav2-search-input::placeholder { color: var(--color-text-light, #958e85); }
.nav2-search-kbd {
  font-family: var(--font-sans, Inter, sans-serif);
  font-size: 11px; color: var(--color-text-light, #958e85);
  background: var(--color-bg-deep, #f0ece6);
  padding: 2px 6px; border-radius: 4px;
  border: 1px solid var(--color-border, #e0dbd3);
}
.nav2-search-results {
  max-height: 50vh; overflow-y: auto;
  padding: 8px;
}
.nav2-search-result {
  display: block; padding: 10px 12px; border-radius: 8px;
  text-decoration: none; color: var(--color-text, #2c2a26);
  transition: background 0.12s ease; cursor: pointer;
}
.nav2-search-result:hover { background: var(--color-bg-deep, #f0ece6); }
.nav2-search-result-title {
  font-weight: 500; font-size: 14px; margin-bottom: 2px;
}
.nav2-search-result-sub {
  font-size: 12px; color: var(--color-text-muted, #6b6560);
}
.nav2-search-empty {
  padding: 20px 16px; text-align: center;
  font-size: 13px; color: var(--color-text-light, #958e85);
}

/* ========================================
   RESPONSIVE
   ======================================== */
/* ── Collapsible groups (desktop: always open, mobile: tap to expand) ── */
.nav2-group {
  display: contents; /* Desktop: behaves as if wrapper isn't there */
}
.nav2-group-toggle {
  display: none; /* Hidden on desktop */
}

@media (max-width: 768px) {
  .nav2-ribbon {
    gap: 6px;
    padding: 0 10px;
    justify-content: center;
  }

  /* Group becomes a real flex container on mobile */
  .nav2-group {
    display: inline-flex; align-items: center;
    flex-shrink: 0; position: relative;
  }

  /* Show the group toggle — SparkUI metallic pill style */
  .nav2-group-toggle {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 5px 11px 5px 7px;
    border-radius: 20px;
    font-family: var(--font-sans, Inter, sans-serif);
    font-size: 11px; font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer; white-space: nowrap;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
    /* SparkUI metallic pill base */
    border: 1px solid rgba(200,195,185,0.6);
    background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(245,242,238,0.9) 100%);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08), inset 0 1px 0 rgba(255,255,255,0.8);
    color: var(--color-text-muted, #6b6560);
  }
  .nav2-group-toggle svg {
    width: 15px; height: 15px; flex-shrink: 0;
  }
  .nav2-group-toggle:active {
    transform: scale(0.96);
  }

  /* ── Gold variant (Read group) ── */
  .nav2-group-toggle--gold svg { color: #b8860b; }
  .nav2-group-toggle--gold:hover,
  .nav2-group--open .nav2-group-toggle--gold {
    border-color: rgba(184,134,11,0.35);
    background: linear-gradient(160deg, rgba(255,248,230,0.95) 0%, rgba(245,225,180,0.7) 100%);
    color: #b8860b;
    box-shadow: 0 2px 6px rgba(184,134,11,0.15), inset 0 1px 0 rgba(255,255,255,0.7);
  }

  /* ── Blue variant (Reflect group) ── */
  .nav2-group-toggle--blue svg { color: #1a7a9e; }
  .nav2-group-toggle--blue:hover,
  .nav2-group--open .nav2-group-toggle--blue {
    border-color: rgba(30,136,180,0.3);
    background: linear-gradient(160deg, rgba(235,248,255,0.95) 0%, rgba(200,230,245,0.7) 100%);
    color: #1a7a9e;
    box-shadow: 0 2px 6px rgba(30,136,180,0.15), inset 0 1px 0 rgba(255,255,255,0.7);
  }

  /* ── Neutral variant (Study group) ── */
  .nav2-group-toggle--neutral svg { color: var(--color-text-muted, #6b6560); }
  .nav2-group-toggle--neutral:hover,
  .nav2-group--open .nav2-group-toggle--neutral {
    border-color: rgba(200,195,185,0.8);
    background: linear-gradient(160deg, rgba(250,248,245,0.95) 0%, rgba(240,236,230,0.9) 100%);
    color: var(--color-text, #2c2a26);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1), inset 0 1px 0 rgba(255,255,255,0.7);
  }

  /* ── Purple variant (AI Sparks group) ── */
  .nav2-group-toggle--purple svg { color: #7c5cbf; }
  .nav2-group-toggle--purple:hover,
  .nav2-group--open .nav2-group-toggle--purple {
    border-color: rgba(124,92,191,0.3);
    background: linear-gradient(160deg, rgba(245,240,255,0.95) 0%, rgba(220,210,245,0.7) 100%);
    color: #7c5cbf;
    box-shadow: 0 2px 6px rgba(124,92,191,0.15), inset 0 1px 0 rgba(255,255,255,0.7);
  }

  /* Hide the label + pill + sep inside groups by default on mobile */
  .nav2-group .nav2-lbl,
  .nav2-group .nav2-sep { display: none; }
  .nav2-group .nav2-pill {
    display: none;
    align-items: center; gap: 2px;
  }

  /* When group is open, show its pill inline */
  .nav2-group--open .nav2-pill {
    display: inline-flex;
  }

  /* Standalone buttons/seps outside groups stay visible */
  .nav2-ribbon > .nav2-sep { display: none; }
  .nav2-ribbon > .nav2-btn { min-width: 34px; height: 34px; }
  .nav2-ribbon > .nav2-btn svg { width: 16px; height: 16px; }
  .nav2-ribbon > .nav2-pill { gap: 2px; }
  .nav2-ribbon > .nav2-pill .nav2-btn { min-width: 34px; height: 34px; }
  .nav2-ribbon > .nav2-pill .nav2-btn svg { width: 16px; height: 16px; }

  /* Smaller buttons inside expanded group */
  .nav2-group .nav2-btn { min-width: 34px; height: 34px; }
  .nav2-group .nav2-btn svg { width: 16px; height: 16px; }

  .nav2-chip { font-size: 11px; padding: 4px 8px; }

  /* Hide non-essential top bar links on mobile */
  .nav2-tl--hide-mobile { display: none; }
}

@media (max-width: 380px) {
  .nav2-top { padding: 0 10px; }
  .nav2-tl { padding: 4px 6px; font-size: 11px; }
}

/* ========================================
   MOTION & ACCESSIBILITY
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  .nav2-btn, .nav2-tl, .nav2-chip, .nav2-tab, .nav2-skip,
  .nav2-btn::after, .nav2-btn::before {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================================
   PRINT — hide all nav
   ======================================== */
@media print {
  .nav2-top, .nav2-ribbon, .nav2-tabs,
  .nav2-skip, .nav2-search-overlay { display: none !important; }
}
