/* ============================================================
   SHARED MOBILE NAV — CocoPredict
   Bottom nav + slide-up sheets (Free / VIP / Account / Login / Menu)
   ============================================================ */

:root {
  --brand-primary: #8B5CF6;
  --brand-primary-soft: #F5F3FF;
  --brand-primary-hover: #7C3AED;
  --brand-dark: #0F172A;
  --brand-blue: #0EA5E9;
  --ink-900: #0F172A;
  --ink-700: #334155;
  --ink-500: #64748B;
  --ink-400: #94A3B8;
  --ink-300: #CBD5E1;
  --ink-200: #E2E8F0;
  --ink-100: #F1F5F9;
  --ink-50: #F8FAFC;
  --win: #16A34A;
  --loss: #DC2626;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-full: 9999px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== BOTTOM NAV ==================== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--ink-200);
  justify-content: space-around;
  align-items: center;
  padding: 6px 0 max(6px, env(safe-area-inset-bottom));
  z-index: 9000;
  box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.04);
}

@media (max-width: 899px) {
  .bottom-nav {
    display: flex !important;
  }
}
@media (min-width: 900px) {
  .bottom-nav {
    display: none !important;
  }
}

.bn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 14px;
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-400);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  text-decoration: none;
  transition: var(--transition);
  position: relative;
}
.bn-item i { font-size: 20px; }
.bn-item.active { color: var(--brand-primary); }
.bn-item.active i { color: var(--brand-primary); }
.bn-item:hover { color: var(--brand-primary); }
.bn-item.logged-in { color: var(--brand-primary); }

/* ==================== SHEETS — BACKDROP ==================== */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 999999999; /* Higher than widget */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.sheet-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* ==================== SHEETS — PANEL ==================== */
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: white;
  border-radius: 24px 24px 0 0;
  z-index: 1000000000; /* Higher than backdrop */
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}
.sheet.active {
  transform: translateY(0);
  pointer-events: auto;
}

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--ink-200);
  border-radius: 2px;
  margin: 12px auto 4px;
  flex-shrink: 0;
}

.sheet-head {
  padding: 14px 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--ink-100);
  flex-shrink: 0;
}
.sheet-head h3 {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.3px;
  color: var(--ink-900);
}

.sheet-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ink-100);
  border: none;
  color: var(--ink-500);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: var(--transition);
}
.sheet-close:hover {
  background: var(--brand-dark);
  color: white;
}

.sheet-body {
  overflow-y: auto;
  padding: 8px 0 16px;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

/* ==================== SHEET ITEMS ==================== */
.sheet-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: inherit;
  border: none;
  background: none;
  font-family: var(--font);
  width: 100%;
  text-align: left;
}
.sheet-item:hover {
  background: var(--ink-50);
}

.sheet-item-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.sheet-item-icon.dark {
  background: var(--brand-dark);
  color: white;
}
.sheet-item-icon.danger {
  background: #FEE2E2;
  color: var(--loss);
}

.sheet-item-body {
  flex: 1;
  min-width: 0;
}
.sheet-item-body h4 {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 2px;
  color: var(--ink-900);
}
.sheet-item-body p {
  font-size: 12px;
  color: var(--ink-500);
  line-height: 1.4;
}

.sheet-item-arrow {
  color: var(--ink-400);
  font-size: 13px;
  flex-shrink: 0;
}

/* Danger variant (Log Out) */
.sheet-item.danger {
  color: var(--loss);
}
.sheet-item.danger .sheet-item-body h4 {
  color: var(--loss);
}
.sheet-item.danger:hover {
  background: #FEF2F2;
}
.sheet-item.danger .sheet-item-arrow {
  color: var(--loss);
  opacity: 0.6;
}

/* ==================== ACCOUNT SHEET USER BLOCK ==================== */
.account-sheet-user {
  padding: 0 20px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--ink-100);
}

.account-sheet-user .as-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--brand-primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-primary);
  font-size: 20px;
  font-weight: 900;
  flex-shrink: 0;
}
.account-sheet-user .as-info {
  min-width: 0;
  flex: 1;
}
.account-sheet-user .as-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-sheet-user .as-email {
  font-size: 12.5px;
  color: var(--ink-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-sheet-user .as-plan {
  font-size: 11.5px;
  font-weight: 700;
  margin-top: 2px;
  color: var(--brand-primary);
}
.account-sheet-user .as-plan.paid {
  color: var(--win);
}
.account-sheet-user .as-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}
.account-sheet-user .as-pill {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  border: 1px solid transparent;
}
.account-sheet-user .as-pill.pending {
  background: #FEF3C7;
  color: #D97706;
  border-color: #FDE68A;
}
.account-sheet-user .as-pill.active {
  background: #D1FAE5;
  color: #059669;
  border-color: #A7F3D0;
}

/* ==================== LOGIN SHEET ==================== */
.sheet-body-center {
  text-align: center;
  padding: 20px 24px 32px;
}

.login-icon-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--brand-primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  color: var(--brand-primary);
  font-size: 30px;
}

.login-sheet-title {
  font-size: 19px;
  font-weight: 900;
  margin-bottom: 8px;
  color: var(--ink-900);
  letter-spacing: -0.3px;
}

.login-sheet-sub {
  font-size: 13px;
  color: var(--ink-500);
  margin-bottom: 24px;
  line-height: 1.55;
}

.login-sheet-btn {
  display: block;
  padding: 12px;
  border-radius: 9999px;
  text-decoration: none;
  font-weight: 800;
  font-size: 13px;
  text-align: center;
  transition: var(--transition);
}
.login-sheet-btn.primary {
  background: var(--brand-primary);
  color: white;
  box-shadow: 0 6px 16px rgba(139, 92, 246, 0.3);
  margin-bottom: 10px;
}
.login-sheet-btn.primary:hover {
  background: var(--brand-primary-hover);
  transform: translateY(-1px);
}
.login-sheet-btn.secondary {
  background: transparent;
  border: 1.5px solid var(--ink-200);
  color: var(--ink-700);
}
.login-sheet-btn.secondary:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: var(--brand-primary-soft);
}

/* ==================== SAFE AREA ==================== */
@supports (padding: env(safe-area-inset-bottom)) {
  .bottom-nav {
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }
}

/* ==================== BODY LOCK WHEN SHEET OPEN ==================== */
body.sheet-open {
  overflow: hidden;
}