/**
 * shared/nav.css — YodhaMind Global Navigation & Auth Styles
 * ═══════════════════════════════════════════════════════════
 *
 * Include on every page via:
 *   <link rel="stylesheet" href="/shared/nav.css" />
 *
 * Covers:
 *   1. Top Navbar (hamburger left, logo center, auth right)
 *   2. Sidebar / Offcanvas menu
 *   3. Auth Modal (Google Sign-In popup)
 *   4. User Avatar dropdown
 *   5. Mobile bottom nav
 */

/* ══════════════════════════════════════════════
   DESIGN TOKENS  (shared across all pages)
══════════════════════════════════════════════ */
:root {
  --ym-primary:      #7C5CBF;
  --ym-accent:       #56CFB2;
  --ym-text:         #2D2D2D;
  --ym-text-light:   #64748b;
  --ym-soft:         #F0EBF8;
  --ym-warm:         #FFF8F0;
  --ym-glass:        rgba(255, 255, 255, 0.92);
  --ym-glass-border: rgba(255, 255, 255, 0.5);
  --ym-topbar-height: 60px;
  --ym-radius-btn:   50px;
  --ym-radius-card:  24px;
  --ym-shadow-soft:  0 20px 40px rgba(0, 0, 0, 0.05);
}

/* ══════════════════════════════════════════════
   1. TOP NAVBAR
══════════════════════════════════════════════ */
.ym-topbar {
  position: fixed;
  top: 0; left: 0; width: 100%;
  height: 60px;
  background: var(--ym-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--ym-glass-border);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  transition: box-shadow 0.3s, height 0.3s;
}
.ym-topbar.scrolled {
  box-shadow: 0 8px 30px rgba(0,0,0,0.06);
  height: 54px;
}

/* Left: Hamburger */
.ym-topbar__hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px; height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  padding: 0;
  z-index: 1001;
  flex-shrink: 0;
}
.ym-topbar__hamburger span {
  display: block;
  width: 22px;
  height: 2.5px;
  background: var(--ym-text);
  border-radius: 2px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Animate to X when sidebar is open */
.ym-topbar__hamburger.open span:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}
.ym-topbar__hamburger.open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.ym-topbar__hamburger.open span:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}

/* Center: Logo */
.ym-topbar__logo {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.3rem;
  font-weight: 800;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, var(--ym-primary), var(--ym-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  white-space: nowrap;
}
.ym-topbar__logo-icon {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--ym-primary), var(--ym-accent));
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  flex-shrink: 0;
  /* Override the gradient text fill for the emoji */
  -webkit-text-fill-color: initial;
}

/* Right: Auth area */
.ym-topbar__right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Sign-in button */
.ym-auth-btn {
  background: linear-gradient(135deg, var(--ym-primary), var(--ym-accent));
  color: white;
  border: none;
  padding: 8px 20px;
  border-radius: var(--ym-radius-btn);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(124, 92, 191, 0.25);
  transition: transform 0.2s, box-shadow 0.2s;
  white-space: nowrap;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ym-auth-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(124, 92, 191, 0.35);
}
.ym-auth-btn:active {
  transform: scale(0.97);
}

/* ══════════════════════════════════════════════
   2. USER AVATAR (logged-in state)
══════════════════════════════════════════════ */
.ym-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2.5px solid var(--ym-accent);
  cursor: pointer;
  object-fit: cover;
  transition: transform 0.2s, box-shadow 0.2s;
  background: var(--ym-soft);
  display: none; /* shown by JS when logged in */
}
.ym-avatar:hover {
  transform: scale(1.08);
  box-shadow: 0 4px 16px rgba(86, 207, 178, 0.35);
}
.ym-avatar-fallback {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2.5px solid var(--ym-accent);
  background: linear-gradient(135deg, var(--ym-primary), var(--ym-accent));
  color: white;
  display: none; /* shown by JS */
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
  transition: transform 0.2s;
}
.ym-avatar-fallback:hover {
  transform: scale(1.08);
}

/* Avatar dropdown */
.ym-avatar-dropdown {
  position: absolute;
  top: 56px;
  right: 12px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  padding: 8px 0;
  min-width: 200px;
  z-index: 1100;
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.ym-avatar-dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}
.ym-avatar-dropdown__header {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.ym-avatar-dropdown__name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ym-text);
}
.ym-avatar-dropdown__email {
  font-size: 0.75rem;
  color: var(--ym-text-light);
  margin-top: 2px;
  word-break: break-all;
}
.ym-avatar-dropdown__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ym-text);
  text-decoration: none;
  transition: background 0.15s;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  font-family: inherit;
  text-align: left;
}
.ym-avatar-dropdown__item:hover {
  background: var(--ym-soft);
}
.ym-avatar-dropdown__divider {
  height: 1px;
  background: rgba(0,0,0,0.06);
  margin: 4px 0;
}
.ym-avatar-dropdown__item--danger {
  color: #EF4444;
}

/* ══════════════════════════════════════════════
   3. SIDEBAR / OFFCANVAS
══════════════════════════════════════════════ */
.ym-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 10, 40, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.ym-sidebar-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.ym-sidebar {
  position: fixed;
  top: 0; left: 0;
  width: 280px;
  max-width: 85vw;
  height: 100vh;
  height: 100dvh;
  background: white;
  z-index: 1050;
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.32, 1.2, 0.64, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  box-shadow: 10px 0 40px rgba(0, 0, 0, 0.1);
}
.ym-sidebar.open {
  transform: translateX(0);
}

.ym-sidebar__header {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  gap: 10px;
}
.ym-sidebar__logo {
  font-size: 1.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--ym-primary), var(--ym-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ym-sidebar__nav {
  padding: 12px 0;
  flex: 1;
}
.ym-sidebar__link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ym-text);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
}
.ym-sidebar__link:hover,
.ym-sidebar__link.active {
  background: var(--ym-soft);
  color: var(--ym-primary);
}
.ym-sidebar__link-icon {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.ym-sidebar__section-label {
  padding: 16px 24px 8px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ym-text-light);
}
.ym-sidebar__divider {
  height: 1px;
  background: rgba(0,0,0,0.06);
  margin: 8px 16px;
}
.ym-sidebar__footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(0,0,0,0.06);
  font-size: 0.75rem;
  color: var(--ym-text-light);
  line-height: 1.5;
}
.ym-sidebar__footer a {
  color: var(--ym-primary);
  text-decoration: none;
  font-weight: 600;
}

/* ══════════════════════════════════════════════
   4. AUTH MODAL
══════════════════════════════════════════════ */
.ym-auth-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 5, 5, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  padding: 16px;
}
.ym-auth-modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.ym-auth-modal {
  background: #0a0a0a;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 28px;
  padding: 40px 36px;
  max-width: 380px;
  width: 100%;
  position: relative;
  transform: scale(0.92) translateY(20px);
  transition: transform 0.35s cubic-bezier(0.32, 1.2, 0.64, 1);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}
.ym-auth-modal-backdrop.open .ym-auth-modal {
  transform: scale(1) translateY(0);
}

/* Subtle glow */
.ym-auth-modal::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 130%;
  height: 130%;
  background: radial-gradient(circle at center, rgba(86, 207, 178, 0.08) 0%, transparent 60%);
  pointer-events: none;
  border-radius: 50%;
  z-index: 0;
}

.ym-auth-modal__close {
  position: absolute;
  top: 14px; right: 14px;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.5);
  font-size: 1.1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s;
  z-index: 2;
}
.ym-auth-modal__close:hover {
  background: rgba(255,255,255,0.12);
  color: white;
  transform: rotate(90deg);
}

.ym-auth-modal__content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.ym-auth-modal__logo {
  font-size: 2.5rem;
  margin-bottom: 8px;
}
.ym-auth-modal__title {
  font-size: 1.6rem;
  font-weight: 300;
  color: white;
  margin-bottom: 6px;
  letter-spacing: -0.03em;
}
.ym-auth-modal__subtitle {
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 32px;
}

/* Google button */
.ym-google-btn {
  width: 100%;
  padding: 16px;
  background: #141414;
  color: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
}
.ym-google-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(86, 207, 178, 0.06), transparent);
  opacity: 0;
  transition: opacity 0.4s;
}
.ym-google-btn:hover {
  border-color: rgba(86, 207, 178, 0.4);
  box-shadow: 0 0 24px rgba(86, 207, 178, 0.12);
  color: white;
  transform: translateY(-2px);
}
.ym-google-btn:hover::before {
  opacity: 1;
}
.ym-google-btn:active {
  transform: scale(0.98);
}
.ym-google-btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.ym-google-btn svg,
.ym-google-btn span {
  position: relative;
  z-index: 1;
}

.ym-auth-modal__error {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.82rem;
  margin-bottom: 18px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: rgba(239, 68, 68, 0.9);
  display: none;
  text-align: left;
}
.ym-auth-modal__error.show {
  display: block;
}

.ym-auth-modal__footer {
  margin-top: 28px;
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.25);
  line-height: 1.7;
}
.ym-auth-modal__footer a {
  color: rgba(255, 255, 255, 0.35);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.1);
  transition: all 0.2s;
}
.ym-auth-modal__footer a:hover {
  color: rgba(255, 255, 255, 0.7);
}

/* Spinner */
.ym-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: white;
  border-radius: 50%;
  animation: ym-spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes ym-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════
   5. BODY OFFSET for fixed navbar
══════════════════════════════════════════════ */
.ym-page-offset {
  padding-top: 60px;
}

/* ══════════════════════════════════════════════
   6. GLOBAL MOBILE POLISH
══════════════════════════════════════════════ */
@media (max-width: 768px) {
  .ym-topbar {
    height: 54px;
    padding: 0 12px;
  }
  .ym-topbar__logo {
    font-size: 1.15rem;
  }
  .ym-auth-btn {
    padding: 7px 14px;
    font-size: 0.8rem;
  }
  .ym-auth-modal {
    padding: 32px 24px;
    border-radius: 24px;
    margin: 8px;
  }
  .ym-auth-modal__title {
    font-size: 1.35rem;
  }
}

/* ── GLOBALISED BREATHING MODAL CSS ── */
.breath-modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(20, 15, 30, 0.5);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            z-index: 2000;
            display: flex;
            justify-content: center;
            align-items: center;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.4s ease;
        }

.breath-modal-overlay.active {
            opacity: 1;
            pointer-events: all;
        }

        .breath-modal-content {
            background: rgba(255, 255, 255, 0.9);
            backdrop-filter: blur(24px);
            -webkit-backdrop-filter: blur(24px);
            border: 1px solid rgba(255,255,255,0.6);
            border-radius: 32px;
            padding: 40px 32px;
            width: 90%;
            max-width: 420px;
            box-shadow: 0 40px 80px rgba(124, 92, 191, 0.15), inset 0 0 0 1px rgba(255,255,255,0.4);
            position: relative;
            transform: translateY(20px) scale(0.95);
            transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            text-align: center;
        }

        .breath-modal-overlay.active .breath-modal-content {
            transform: translateY(0) scale(1);
        }

        .close-modal {
            position: absolute;
            top: 20px;
            right: 24px;
            background: var(--soft);
            border: none;
            width: 32px; height: 32px;
            border-radius: 50%;
            font-size: 1.2rem;
            color: var(--text-light);
            cursor: pointer;
            display: grid;
            place-items: center;
            transition: all 0.2s;
        }

        .close-modal:hover {
            color: var(--text);
            background: #e2d9f3;
            transform: scale(1.1);
        }

        .modal-header {
            display: flex;
            justify-content: center;
            align-items: center;
            gap: 16px;
            margin-bottom: 40px;
            padding-top: 10px;
        }

        .modal-header h3 {
            font-size: 1.4rem;
            font-weight: 800;
            color: var(--text);
            margin: 0;
        }

        .sound-toggle {
            background: var(--soft);
            border: none;
            border-radius: 50%;
            width: 40px;
            height: 40px;
            cursor: pointer;
            font-size: 1.1rem;
            transition: transform 0.2s, background 0.2s;
            display: grid;
            place-items: center;
            color: var(--text);
        }

        .sound-toggle:hover {
            transform: scale(1.1);
            background: #e2d9f3;
        }

        .breath-visual-container {
            position: relative;
            width: 240px;
            height: 240px;
            margin: 0 auto 40px;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .breath-circle {
            width: 86px;
            height: 86px;
            position: relative;
            z-index: 2;
            transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
            display: flex;
            justify-content: center;
            align-items: center;
        }

        #modalSpiritCanvas {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 180px;
            height: 180px;
            pointer-events: none;
            z-index: 1;
        }

        @keyframes spiritAuraMorph {
            0% { border-radius: 55% 45% 48% 52% / 52% 48% 55% 45%; }
            50% { border-radius: 45% 55% 52% 48% / 48% 52% 45% 55%; }
            100% { border-radius: 55% 45% 48% 52% / 52% 48% 55% 45%; }
        }

        .breath-glow {
            position: absolute;
            width: 120px;
            height: 120px;
            border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
            background: linear-gradient(135deg, #56CFB2, #7C5CBF);
            filter: blur(20px);
            opacity: 0.4;
            z-index: 1;
            transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1), opacity 1s ease;
            animation: spiritAuraMorph 7s ease-in-out infinite reverse;
        }

        .breath-text {
            font-size: 1.3rem;
            font-weight: 700;
            color: var(--primary);
            margin-bottom: 32px;
            min-height: 32px;
            transition: opacity 0.3s ease;
        }

        .breath-controls {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .breath-controls .btn-cta { width: 100%; }
        .breath-controls .btn-secondary {
            border: none; background: transparent; color: var(--text-light);
        }
        .breath-controls .btn-secondary:hover {
            background: var(--soft); color: var(--text);
        }

        /* Spirit container mobile enhancements */
        @media (max-width: 768px) {
            .spirit-container {
                min-height: 220px;
                min-width: 220px;
            }
            .spirit-hint {
                top: 0px;
                font-size: 0.82rem;
                padding: 8px 16px;
            }
        }

        /* Modal Responsiveness */
        @media (max-width: 480px) {
            .breath-modal-content {
                padding: 32px 20px; width: 95%; border-radius: 28px;
            }
            .close-modal { top: 16px; right: 16px; }
            .modal-header { margin-bottom: 30px; }
            .modal-header h3 { font-size: 1.25rem; }
            .breath-visual-container {
                width: 200px; height: 200px; margin-bottom: 30px;
            }
            .breath-circle { width: 76px; height: 76px; }
            #modalSpiritCanvas { width: 160px; height: 160px; }
            .breath-glow { width: 110px; height: 110px; }
            .breath-text { font-size: 1.15rem; margin-bottom: 24px; min-height: 28px; }
        }

        @media (max-height: 650px) {
            .breath-modal-content { padding: 24px 20px; }
            .modal-header { margin-bottom: 20px; }
            .breath-visual-container { width: 180px; height: 180px; margin-bottom: 20px; }
            .breath-circle { width: 70px; height: 70px; }
            #modalSpiritCanvas { width: 140px; height: 140px; }
            .breath-glow { width: 100px; height: 100px; }
            .breath-text { margin-bottom: 16px; font-size: 1.1rem; min-height: 26px; }
            .breath-controls { gap: 8px; }
            .breath-controls .btn-cta { min-height: 44px; padding: 10px 20px; }
        }