/* ============================================================
   VegasBet — Header CSS  (v2 — 2-bar + sport tabs redesign)
   ============================================================ */

/* ── Site Header ────────────────────────────────────────────── */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  /* No background here — each row handles its own background so
     the sidebar can show through the transparent left portion of the tabs row */
  pointer-events: none; /* pass clicks through transparent areas */
}

/* ── Header Bar (top row) ───────────────────────────────────── */
.header-bar {
  height: var(--header-height);
  display: flex; align-items: stretch;
  width: 100%; padding: 0;
  background: rgba(28, 28, 31, 0.97);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
  pointer-events: all;
}

/* Left zone — logo only, width matches sidebar column */
.hdr-left {
  width: calc(14px + var(--sidebar-sport) + 8px);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 0 16px;
}

/* Right zone — nav + actions, starts exactly where content area starts */
.hdr-right {
  flex: 1; min-width: 0;
  display: flex; align-items: center;
  padding-right: 16px;
  gap: 0;
}

/* ── Logo ───────────────────────────────────────────────────── */
.header-logo-link {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; flex-shrink: 0;
}
.header-logo-icon {
  height: 44px; width: auto; display: block; flex-shrink: 0;
}
.header-logo-name {
  font-family: 'Inter', sans-serif;
  font-weight: 800; font-size: 24px;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-primary); line-height: 1;
}

/* ── Main Nav (center) ──────────────────────────────────────── */
.main-nav { display: flex; align-items: center; gap: 0; flex: 1; }
.nav-item {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0 16px; height: var(--header-height);
  font-family: 'Inter', sans-serif; font-weight: 500;
  font-size: 15px; letter-spacing: 0.01em;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  white-space: nowrap;
}
.nav-item:hover { color: var(--text-primary); }
.nav-item.active { color: var(--text-primary); border-bottom-color: var(--purple); }
.nav-item-live { color: var(--red) !important; }
.nav-item-live::before { content: ''; display: inline-block; width: 6px; height: 6px; background: var(--red); border-radius: 50%; animation: pulse-dot 1.4s infinite; }
.nav-item-live:hover { color: #ff6b6b !important; }

/* ── Header Actions (right) ─────────────────────────────────── */
.header-actions { display: flex; align-items: center; gap: 7px; flex-shrink: 0; margin-left: auto; }

/* Responsive: collapse left zone below 1000px */
@media (max-width: 1000px) {
  .hdr-left { width: auto; padding: 0 12px; }
  .hdr-right { border-left: none; }
}

/* Auth buttons */
.hdr-auth-btns { display: flex; align-items: center; gap: 7px; }

/* Balance pill / user widget (logged in) */
.balance-pill {
  display: flex; align-items: center; gap: 10px;
  background: transparent;
  border-radius: 8px; padding: 6px 10px;
  cursor: pointer;
  text-decoration: none; color: inherit;
  margin-right: 24px;
  transition: background var(--transition);
}
.balance-pill:hover { background: rgba(124, 58, 237, 0.1); }
.balance-avatar { width: 36px; height: 36px; background: var(--purple); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-family: 'Inter', sans-serif; font-weight: 800; font-size: 0.85rem; color: #fff; text-transform: uppercase; flex-shrink: 0; }
.header-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(124, 58, 237, 0.08);
  border: 1.5px solid #7c3aed;
  box-shadow: 0 0 8px rgba(124, 58, 237, 0.35),
              0 0 16px rgba(124, 58, 237, 0.15);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; text-decoration: none; flex-shrink: 0;
  color: var(--text-secondary);
  transition: box-shadow 0.2s ease;
}
.header-avatar:hover {
  box-shadow: 0 0 12px rgba(124, 58, 237, 0.6),
              0 0 24px rgba(124, 58, 237, 0.25);
}
.balance-info { display: flex; flex-direction: column; gap: 1px; }
.balance-username { font-size: 14px; font-weight: 600; color: var(--text-secondary); line-height: 1.1; }
.balance-amount  { font-family: 'Inter', sans-serif; font-weight: 700; font-size: 13px; color: var(--green); line-height: 1.1; }

/* ── Logged-in user area ────────────────────────────────────── */
.header-user-area {
  display: flex; align-items: center; gap: 16px; flex-shrink: 0; margin-left: auto;
}

/* Balance block */
.header-balance {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 14px;
  border: 1.5px solid #7c3aed;
  border-radius: 10px;
  background: rgba(124, 58, 237, 0.05);
  box-shadow: 0 0 8px rgba(124, 58, 237, 0.35),
              0 0 16px rgba(124, 58, 237, 0.15);
}
.hdr-bal-label {
  font-family: 'Inter', sans-serif; font-size: 11px;
  color: var(--text-secondary); line-height: 1; text-align: center;
}
.hdr-bal-amount {
  font-family: 'Inter', sans-serif; font-size: 15px; font-weight: 700;
  color: var(--text-primary); line-height: 1; text-align: center;
}

/* Deposit button */
.header-deposit-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--purple); color: #fff;
  font-family: 'Inter', sans-serif; font-weight: 700; font-size: 14px;
  padding: 8px 20px; border-radius: 999px;
  text-decoration: none; white-space: nowrap; flex-shrink: 0;
  transition: background 0.18s ease, transform 0.18s ease;
}
.header-deposit-btn:hover {
  background: var(--accent);
  transform: scale(1.03);
}
.hdr-deposit-icon {
  width: 15px; height: 15px; object-fit: contain;
  filter: brightness(0) invert(1);
  flex-shrink: 0;
}

/* Notification bell */
.notif-wrap { position: relative; }
.notif-btn {
  background: none; border: none; cursor: pointer;
  position: relative; padding: 4px; display: flex;
  align-items: center; justify-content: center;
  color: var(--text-secondary);
  transition: color 0.18s;
}
.notif-btn:hover { color: var(--text-primary); }
.notif-badge {
  position: absolute; top: 0; right: 0;
  width: 8px; height: 8px; border-radius: 50%;
  background: #ef4444;
}

/* Notification dropdown */
.notif-dropdown {
  display: none;
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 300px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 1100;
  overflow: hidden;
}
.notif-dropdown.open { display: block; }

.notif-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.notif-hdr-title {
  font-family: 'Inter', sans-serif; font-weight: 700;
  font-size: 14px; color: var(--text-primary);
}
.notif-mark-read {
  font-family: 'Inter', sans-serif; font-size: 12px;
  color: var(--accent); text-decoration: none;
}
.notif-mark-read:hover { text-decoration: underline; }

.notif-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  text-decoration: none;
}
.notif-item:hover { background: var(--bg-elevated); }

.notif-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0; margin-top: 4px;
}
.notif-content { flex: 1; min-width: 0; }
.notif-title {
  font-family: 'Inter', sans-serif; font-size: 13px;
  font-weight: 700; color: var(--text-primary); margin-bottom: 2px;
}
.notif-subtitle {
  font-family: 'Inter', sans-serif; font-size: 12px;
  color: var(--text-secondary); line-height: 1.4;
}

/* Hamburger */
.hamburger { display: none; flex-direction: column; gap: 5px; padding: 5px; cursor: pointer; border-radius: var(--radius-sm); transition: background var(--transition); flex-shrink: 0; }
.hamburger:hover { background: var(--purple-dim); }
.hamburger-line { display: block; width: 20px; height: 2px; background: var(--text-secondary); border-radius: 2px; transition: all 0.25s ease; }
.hamburger.open .hamburger-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open .hamburger-line:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open .hamburger-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Sport Tabs Bar (second row) ────────────────────────────── */
.sport-tabs-bar {
  height: calc(var(--tabs-height) + 10px);
  padding-top: 10px;
  display: flex; /* stb-inner grows to fill remaining width */
}
.stb-inner {
  /* Start exactly where the content area starts: page-left-pad + sidebar + gap */
  margin-left: calc(14px + var(--sidebar-sport) + 8px);
  flex: 1;
  /* Flex item: must shrink below content width so the inner .sport-tabs-list
     scrolls instead of overflowing the fixed header (last tabs unreachable). */
  min-width: 0;
  /* Spans Main Events + Live Now. Capped at events-grid max-width (1096px)
     so the bar never exceeds the content on wide monitors. */
  max-width: min(calc(100vw - 604px), calc(8 * 130px + 7 * 8px));
  padding: 0 14px; /* equal left/right so arrows are symmetric */
  height: 100%; display: flex; align-items: center; gap: 8px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  border-left: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  pointer-events: all; /* restore clicks for sport tabs */
}

/* Separator */
.stb-sep { width: 1px; height: 22px; background: var(--border-subtle); flex-shrink: 0; }

/* Sport tabs scroll list */
.sport-tabs-list {
  display: flex; align-items: center; gap: 6px;
  overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #7c3aed transparent;
  padding-bottom: 4px;
  flex: 1;
  /* Without this a flex item can't shrink below its content width, so
     overflow-x never engages — the tabs spill past the fixed header and get
     clipped by body{overflow-x:clip}, leaving the last ones unreachable. */
  min-width: 0;
}
.sport-tabs-list::-webkit-scrollbar { height: 4px; }
.sport-tabs-list::-webkit-scrollbar-track { background: transparent; }
.sport-tabs-list::-webkit-scrollbar-thumb { background-color: #7c3aed; border-radius: 4px; }

.spt-item {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 16px; border-radius: 20px;
  font-family: 'Inter', sans-serif; font-weight: 400;
  font-size: 13px; letter-spacing: 0.03em; text-transform: uppercase;
  color: #8884aa; white-space: nowrap; cursor: pointer;
  transition: all 0.25s ease;
  flex-shrink: 0;
  background-color: transparent;
  border: none;
  position: relative;
  overflow: visible;
}
/* Inactive underline placeholder — transparent, ready to animate on hover */
.spt-item::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 10%;
  width: 80%;
  height: 2px;
  background-color: transparent;
  border-radius: 2px;
  box-shadow: none;
  transition: all 0.3s ease;
}
.spt-item:hover {
  color: #f0eeff;
  background-color: transparent;
}
/* Faint underline hint on hover */
.spt-item:hover::after {
  background-color: rgba(168, 85, 247, 0.3);
  box-shadow: 0 0 4px rgba(168, 85, 247, 0.3);
}
.spt-item.active {
  background-color: transparent;
  color: #f0eeff;
  border: none;
  border-radius: 20px;
  padding: 6px 16px;
  font-weight: 700;
  box-shadow: none;
  transition: all 0.25s ease;
}
/* Neon underline for active tab — overrides hover::after via cascade order */
.spt-item.active::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 10%;
  width: 80%;
  height: 2px;
  background-color: #a855f7;
  border-radius: 2px;
  box-shadow: 0 0 6px #a855f7, 0 0 12px rgba(168, 85, 247, 0.6);
  transition: all 0.3s ease;
}
.spt-icon { font-size: 0.9rem; line-height: 1; }
.spt-count {
  background: var(--purple-dim); color: var(--accent);
  border-radius: 10px; padding: 1px 5px;
  font-size: 0.62rem; font-weight: 700;
}

/* ── Mobile Drawer ──────────────────────────────────────────── */
.mob-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1200;
  -webkit-tap-highlight-color: transparent;
}
.mob-overlay.open { display: block; }

.mob-drawer {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 300px; max-width: 85vw;
  background: var(--bg-secondary);
  z-index: 1300;
  transform: translateX(-100%);
  transition: transform 0.28s ease;
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: none;
}
.mob-drawer::-webkit-scrollbar { display: none; }
.mob-drawer.open { transform: translateX(0); }

.mob-drawer-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px;
  height: var(--header-height);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  background: var(--bg-card);
}
.mob-drawer-close {
  background: none; border: none;
  color: var(--text-muted); font-size: 1.5rem;
  cursor: pointer; padding: 4px 8px; line-height: 1;
  border-radius: var(--radius-sm); transition: color 0.2s ease;
}
.mob-drawer-close:hover { color: var(--text-primary); }

.mob-drawer-section {
  padding: 8px;
  flex-shrink: 0;
}
/* Drawer content always visible regardless of breakpoint rules */
.mob-drawer .mob-sport-sidebar {
  display: flex !important;
  overflow: visible !important;
}
.mob-drawer .sidebar-nav-links { display: block !important; }

.mob-drawer-auth {
  margin-top: auto;
  padding: 12px;
  display: flex; gap: 8px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.mob-auth-btn {
  flex: 1; text-align: center; justify-content: center;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1100px) { .main-nav { display: none; } .hamburger { display: flex; } }
/* At ≤1280px the 3rd column disappears → 2-col layout (280|1fr).
   1fr = 100vw - 316px. Same events-grid cap applies. */
@media (max-width: 1280px) {
  .stb-inner {
    max-width: min(calc(100vw - 316px), calc(8 * 130px + 7 * 8px));
  }
}

@media (max-width: 1000px) {
  .stb-inner {
    margin-left: 0; padding-left: 14px;
    border-left: none;
    max-width: none; /* sidebar hidden → full-width tabs bar */
  }
}
@media (max-width: 640px) {
  .header-bar { padding: 0 10px; gap: 10px; }
  .header-logo-name { font-size: 16px; }
  .header-logo-icon { height: 28px; }
}

/* ── Mobile: compact header ─────────────────────────────────── */
@media (max-width: 768px) {
  /* Header bar: fill screen, no overflow */
  .header-bar {
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
    box-sizing: border-box;
    padding: 0 12px;
  }

  /* Hide logo site-name text, keep icon only */
  .hdr-left .header-logo-name {
    display: none;
  }

  /* Shrink logo icon */
  .hdr-left .header-logo-icon {
    height: 32px;
  }

  /* Tighten right user area gap */
  .header-user-area {
    gap: 8px;
  }

  /* Balance block: smaller, hide label, show amount only */
  .header-balance {
    padding: 4px 8px;
    max-width: 90px;
  }
  .hdr-bal-label {
    font-size: 9px;
  }
  .hdr-bal-amount {
    font-size: 11px;
  }

  /* Deposit button: smaller padding/font */
  .header-deposit-btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  /* Avatar: 32x32 */
  .header-avatar {
    width: 32px;
    height: 32px;
  }

  /* Hide notifications bell */
  .notif-wrap {
    display: none;
  }

  /* Ensure hamburger stays visible */
  .hamburger {
    display: flex;
    margin-left: 10px;
  }
}

/* ── Sport Tab SVG Icons ─────────────────────────────────────── */
.sport-tab-icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  filter: invert(40%) sepia(60%) saturate(500%) hue-rotate(230deg) brightness(0.85);
  transition: filter 0.2s;
  flex-shrink: 0;
}

.spt-item.active .sport-tab-icon,
.spt-item:hover .sport-tab-icon {
  filter: invert(60%) sepia(60%) saturate(400%) hue-rotate(220deg) brightness(1.4);
}

/* ── Utility ─────────────────────────────────────────────────── */
.is-hidden { display: none; }

/* ── Balance flash animation ─────────────────────────────────── */
@keyframes balance-flash {
  0%   { color: var(--green); }
  60%  { color: var(--green); }
  100% { color: inherit; }
}
.balance-flash {
  animation: balance-flash 0.8s ease forwards;
}
