/**
 * MindBridge Institute â€” Premium Fluid Bottom Navigation & Profile Sheet System
 * File: public/bottom-nav.css
 * 
 * Features:
 * - Ultra-smooth 60 FPS transitions & hardware-accelerated transforms
 * - Obsidian Black & Metallic Gold glassmorphism matching MindBridge design system
 * - Safe-area inset support (iOS notch & Android edge-to-edge gesture navigation bar)
 * - Subtle active glow pill, gold indicator bar, micro-elevations
 * - Interactive Profile Action Sheet with user card, My Profile, Settings, and Logout
 * - Zero layout shifting, clean touch targets (48px+ touch ergonomically optimized)
 */

:root {
  --bnav-bg: rgba(10, 12, 18, 0.92);
  --bnav-bg-blur: 20px;
  --bnav-border: rgba(212, 175, 55, 0.18);
  --bnav-shadow: 0 -8px 32px rgba(0, 0, 0, 0.65), 0 -1px 0 rgba(255, 255, 255, 0.04);
  --bnav-item-idle: #94A3B8;
  --bnav-item-active: #F8DF93;
  --bnav-gold-primary: #D4AF37;
  --bnav-gold-glow: rgba(212, 175, 55, 0.28);
  --bnav-height: 64px;
}

/* ============================================================
   1. BOTTOM NAVIGATION BAR
============================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--bnav-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bnav-bg);
  backdrop-filter: blur(var(--bnav-bg-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--bnav-bg-blur)) saturate(180%);
  border-top: 1px solid var(--bnav-border);
  box-shadow: var(--bnav-shadow);
  display: flex !important;
  align-items: center;
  justify-content: space-around;
  padding-left: max(4px, env(safe-area-inset-left, 0px));
  padding-right: max(4px, env(safe-area-inset-right, 0px));
  z-index: 1000;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  contain: layout style;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

/* Hide on desktop when sidebar layout is active */
@media (min-width: 1024px) {
  body.has-desktop-sidebar .bottom-nav {
    display: none !important;
  }
}

/* Ensure body has proper bottom padding so content is never obscured */
body {
  padding-bottom: calc(var(--bnav-height) + env(safe-area-inset-bottom, 0px) + 12px) !important;
}

@media (min-width: 1024px) {
  body.has-desktop-sidebar {
    padding-bottom: 32px !important;
  }
}

/* ============================================================
   2. NAVIGATION ITEMS & TOUCH TARGETS
============================================================ */
.bnav-item {
  position: relative;
  flex: 1;
  min-width: 0;
  height: 100%;
  max-height: var(--bnav-height);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 2px 4px;
  color: var(--bnav-item-idle);
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.2s cubic-bezier(0.2, 0, 0, 1), transform 0.15s ease;
  font-family: inherit;
}

.bnav-item:active {
  transform: scale(0.93);
}

.bnav-item:hover {
  color: #E2E8F0;
}

/* Active Top Indicator Line */
.bnav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 2.5px;
  border-radius: 999px;
  background: linear-gradient(90deg, #FFE89D 0%, #D4AF37 50%, #B88E28 100%);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.7);
  animation: bnavIndicatorPop 0.24s cubic-bezier(0.2, 0, 0, 1);
}

@keyframes bnavIndicatorPop {
  0% {
    width: 0;
    opacity: 0;
  }
  100% {
    width: 22px;
    opacity: 1;
  }
}

/* Icon Wrapper & Smooth Active Glow */
.bnav-icon-wrap,
.bnav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 28px;
  border-radius: 14px;
  border: 1px solid transparent;
  transition: transform 0.22s cubic-bezier(0.2, 0, 0, 1),
              background 0.22s ease,
              border-color 0.22s ease,
              box-shadow 0.22s ease,
              color 0.22s ease;
}

.bnav-icon-wrap svg,
.bnav-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease;
}

.bnav-label {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.015em;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  transition: color 0.2s ease, font-weight 0.2s ease;
}

/* ============================================================
   3. ACTIVE STATE (PREMIUM METALLIC HIGHLIGHT)
============================================================ */
.bnav-item.active {
  color: var(--bnav-item-active);
}

.bnav-item.active .bnav-icon-wrap,
.bnav-item.active .bnav-icon {
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.22) 0%, rgba(212, 175, 55, 0.05) 100%);
  border-color: rgba(212, 175, 55, 0.38);
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.28), inset 0 1px 1px rgba(255, 241, 194, 0.35);
  color: #FFF1C2;
  transform: translateY(-2px);
}

.bnav-item.active .bnav-icon-wrap svg,
.bnav-item.active .bnav-icon svg {
  stroke: #FFF1C2;
}

.bnav-item.active .bnav-label {
  color: #F8DF93;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
}

/* Small screen tweaks (320px - 360px) */
@media (max-width: 360px) {
  .bnav-icon-wrap,
  .bnav-icon {
    width: 34px;
    height: 26px;
  }
  .bnav-icon-wrap svg,
  .bnav-icon svg {
    width: 18px;
    height: 18px;
  }
  .bnav-label {
    font-size: 0.61rem;
    letter-spacing: 0;
  }
}

/* ============================================================
   4. PREMIUM PROFILE ACTION SHEET (MODAL / POPUP)
============================================================ */
.mbi-profile-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 8, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.28s;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.mbi-profile-sheet-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mbi-profile-sheet {
  width: 100%;
  max-width: 500px;
  background: linear-gradient(180deg, #131722 0%, #0A0C12 100%);
  border: 1px solid rgba(212, 175, 55, 0.24);
  border-bottom: none;
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.85),
              0 0 32px rgba(212, 175, 55, 0.12),
              inset 0 1px 1px rgba(255, 241, 194, 0.15);
  padding: 14px 20px max(24px, calc(16px + env(safe-area-inset-bottom, 0px)));
  box-sizing: border-box;
  transform: translate3d(0, 100%, 0);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.mbi-profile-sheet-overlay.active .mbi-profile-sheet {
  transform: translate3d(0, 0, 0);
}

/* Desktop popup presentation (floating dialog) */
@media (min-width: 640px) {
  .mbi-profile-sheet-overlay {
    align-items: center;
    padding: 24px;
  }
  .mbi-profile-sheet {
    border-radius: 24px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.24);
    transform: translate3d(0, 24px, 0) scale(0.96);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    padding: 20px 24px 24px;
  }
  .mbi-profile-sheet-overlay.active .mbi-profile-sheet {
    transform: translate3d(0, 0, 0) scale(1);
  }
}

/* Grab handle for bottom sheet on mobile */
.mbi-sheet-handle {
  width: 44px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  margin: 0 auto 14px;
}

@media (min-width: 640px) {
  .mbi-sheet-handle {
    display: none;
  }
}

/* Sheet Header & User Card */
.mbi-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mbi-sheet-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.mbi-sheet-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.3) 0%, rgba(212, 175, 55, 0.05) 100%);
  border: 1.5px solid rgba(212, 175, 55, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: #FFF1C2;
  flex-shrink: 0;
  overflow: hidden;
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.2);
}

.mbi-sheet-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mbi-sheet-user-info {
  min-width: 0;
  flex: 1;
}

.mbi-sheet-name {
  font-size: 0.98rem;
  font-weight: 700;
  color: #F8FAFC;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mbi-sheet-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: #D4AF37;
  font-weight: 600;
  margin-top: 2px;
}

.mbi-sheet-tag-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.8);
}

.mbi-sheet-close-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94A3B8;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.mbi-sheet-close-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
}

/* Menu Actions List */
.mbi-sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mbi-sheet-action-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  text-decoration: none;
  cursor: pointer;
  outline: none;
  font-family: inherit;
  transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
  -webkit-tap-highlight-color: transparent;
  width: 100%;
  box-sizing: border-box;
}

.mbi-sheet-action-item:hover,
.mbi-sheet-action-item:focus-visible {
  background: rgba(212, 175, 55, 0.08);
  border-color: rgba(212, 175, 55, 0.3);
  transform: translateY(-1px);
}

.mbi-sheet-action-item:active {
  transform: scale(0.98);
}

.mbi-sheet-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-align: left;
}

.mbi-sheet-item-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.mbi-sheet-action-item:hover .mbi-sheet-item-icon {
  transform: scale(1.06);
}

.mbi-sheet-item-icon.profile-gold {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.25) 0%, rgba(212, 175, 55, 0.06) 100%);
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: #FFF1C2;
}

.mbi-sheet-item-icon.settings-blue {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.22) 0%, rgba(59, 130, 246, 0.05) 100%);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #93C5FD;
}

.mbi-sheet-item-icon.logout-red {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.22) 0%, rgba(239, 68, 68, 0.05) 100%);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #FCA5A5;
}

.mbi-sheet-item-text {
  min-width: 0;
}

.mbi-sheet-item-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #F8FAFC;
  line-height: 1.25;
}

.mbi-sheet-action-item.logout-action .mbi-sheet-item-title {
  color: #F87171;
}

.mbi-sheet-item-desc {
  font-size: 0.74rem;
  color: #94A3B8;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mbi-sheet-arrow {
  color: #64748B;
  transition: transform 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.mbi-sheet-action-item:hover .mbi-sheet-arrow {
  color: #D4AF37;
  transform: translateX(3px);
}

.mbi-sheet-action-item.logout-action:hover .mbi-sheet-arrow {
  color: #EF4444;
}
