/* ============================================================
   SHARED HEADER — CocoPredict
   Sticky dark navy bar with brand, nav, dropdowns, user chip
   + shared logout modal styling
   ============================================================ */

:root {
  --brand-primary: #8B5CF6;
  --brand-primary-soft: #F5F3FF;
  --brand-primary-hover: #7C3AED;
  --brand-dark: #0F172A;
  --brand-green: #16A34A;
  --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);
}

/* ==================== HEADER (STICKY) ==================== */
.header,
header.header,
#cocoHeader {
  background: var(--brand-dark);
  position: sticky !important;
  top: 0 !important;
  z-index: 1000 !important;
  width: 100%;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.header-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}

/* ==================== BRAND ==================== */
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: white;
  font-weight: 900;
  font-size: 19px;
  letter-spacing: -0.6px;
  flex-shrink: 0;
}
.brand-accent { color: var(--brand-primary); }
.brand-dot { color: var(--brand-primary); opacity: 0.6; }

/* ==================== DESKTOP NAV ==================== */
.nav-desktop {
  display: none;
  gap: 4px;
  align-items: center;
  flex: 1;
  justify-content: center;
}
@media (min-width: 900px) {
  .nav-desktop { display: flex; }
}

.nav-link {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  font-family: var(--font);
  cursor: pointer;
  white-space: nowrap;
}
.nav-link:hover {
  color: white;
  background: rgba(255, 255, 255, 0.08);
}
.nav-link.active {
  color: white;
  background: var(--brand-primary);
}
.nav-link .caret {
  font-size: 9px;
  opacity: 0.7;
  margin-left: 2px;
}

/* ==================== HEADER ACTIONS ==================== */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-login {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: none;
  transition: var(--transition);
}
@media (min-width: 640px) {
  .btn-login { display: inline-flex; }
}
.btn-login:hover {
  color: white;
  border-color: rgba(255, 255, 255, 0.4);
}

.btn-signup {
  padding: 8px 18px;
  border-radius: var(--radius-full);
  background: var(--brand-primary);
  color: white;
  border: none;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}
.btn-signup:hover {
  background: var(--brand-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

.mobile-menu-btn {
  display: flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 10px;
  color: white;
  font-size: 16px;
  cursor: pointer;
  transition: var(--transition);
}
.mobile-menu-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}
@media (min-width: 900px) {
  .mobile-menu-btn { display: none; }
}

/* ==================== DESKTOP DROPDOWNS ==================== */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 260px;
  background: white;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08);
  border: 1px solid var(--ink-100);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
  z-index: 200;
}

.nav-dropdown:hover > .nav-dropdown-panel,
.nav-dropdown.open > .nav-dropdown-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s;
}

.nav-dropdown-panel::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
}

.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink-900);
  font-size: 13px;
  font-weight: 700;
  transition: background 0.12s ease, color 0.12s ease;
  background: none;
  border: none;
  font-family: var(--font);
  cursor: pointer;
  width: 100%;
  text-align: left;
}
.nav-dropdown-item:hover {
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
}
.nav-dropdown-item i.icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.nav-dropdown-item.dark i.icon {
  background: var(--brand-dark);
  color: white;
}
.nav-dropdown-item.danger { color: var(--loss); }
.nav-dropdown-item.danger i.icon {
  background: #FEE2E2;
  color: var(--loss);
}
.nav-dropdown-item .label-wrap { line-height: 1.25; }
.nav-dropdown-item small {
  display: block;
  font-size: 11.2px;
  font-weight: 500;
  color: var(--ink-500);
  margin-top: 1px;
}
.nav-dropdown-item:hover small {
  color: var(--brand-primary);
  opacity: 0.85;
}
.nav-dropdown-item.danger:hover { background: #FEE2E2; }
.nav-dropdown-item.danger:hover small { color: var(--loss); }

/* ==================== USER CHIP ==================== */
.user-chip { position: relative; }

.user-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  color: white;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
.user-chip-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.user-name { display: none; }
@media (min-width: 640px) {
  .user-name { display: inline; }
}
.user-chip-btn > i {
  font-size: 10px;
  opacity: 0.7;
}

.user-chip-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 300px;
  max-width: 340px;
  background: white;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08);
  border: 1px solid var(--ink-100);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
  z-index: 200;
}
.user-chip:hover .user-chip-dropdown,
.user-chip.open .user-chip-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s;
}
.user-chip-dropdown::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 0;
  right: 0;
  height: 10px;
}

.user-chip-dropdown-head {
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--ink-100);
  margin-bottom: 6px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.user-chip-dropdown-head .avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 900;
  flex-shrink: 0;
}
.user-chip-dropdown-head .info { min-width: 0; flex: 1; }
.user-chip-dropdown-head .name {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-chip-dropdown-head .email {
  font-size: 11.5px;
  color: var(--ink-500);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-chip-dropdown-head .plan {
  font-size: 11.2px;
  font-weight: 700;
  color: var(--brand-primary);
  margin-top: 4px;
  line-height: 1.4;
}

/* Plan pills shown in the account dropdown head */
.plan-pills-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}
.plan-pill-mini {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--brand-primary-soft);
  color: var(--brand-primary);
  letter-spacing: 0.2px;
  border: 1px solid transparent;
}
.plan-pill-mini.pending {
  background: #FEF3C7;
  color: #D97706;
  border-color: #FDE68A;
}
.plan-pill-mini.active {
  background: #D1FAE5;
  color: #059669;
  border-color: #A7F3D0;
}

/* ==================== MOBILE STICKY OVERRIDES ==================== */
@media (max-width: 899px) {
  .header,
  header.header,
  #cocoHeader {
    position: sticky !important;
    top: 0 !important;
  }
  .header-inner {
    height: 60px;
    padding: 0 14px;
  }
  .brand {
    font-size: 17px;
  }
}

/* ============================================================
   SHARED LOGOUT MODAL
   ============================================================ */
.coco-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.coco-modal-backdrop.active { display: flex; }

.coco-modal {
  background: #ffffff;
  border-radius: 24px;
  padding: 28px 24px 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  animation: cocoModalPop 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  text-align: center;
  box-sizing: border-box;
}
@keyframes cocoModalPop {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

.coco-logout-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #FEE2E2;
  color: #DC2626;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin: 4px auto 18px;
}

.coco-logout-title {
  font-size: 19px;
  font-weight: 900;
  letter-spacing: -0.4px;
  margin: 0 0 8px;
  color: #0F172A;
  line-height: 1.25;
}

.coco-logout-text {
  font-size: 13.5px;
  color: #64748B;
  line-height: 1.55;
  margin: 0 0 24px;
}

.coco-logout-actions {
  display: flex;
  gap: 10px;
}

.coco-logout-btn {
  flex: 1;
  padding: 12px 16px;
  border-radius: 9999px;
  border: none;
  font-family: inherit;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
}
.coco-logout-btn.cancel {
  background: #F1F5F9;
  color: #334155;
}
.coco-logout-btn.cancel:hover {
  background: #E2E8F0;
}
.coco-logout-btn.confirm {
  background: #8B5CF6;
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(139, 92, 246, 0.3);
}
.coco-logout-btn.confirm:hover {
  background: #7C3AED;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(139, 92, 246, 0.4);
}