/* ─── Fan Hub shared styles ────────────────────────────────── */

/* ─── LIGHT MODE ──────────────────────────────────────────── */
[data-theme="light"] {
  --bg: #F4F4EF;
  --surface: #FAFAF7;
  --surface2: #EDEDE8;
  --border: #DEDED8;
  --border2: #CECEC8;
  --text: #18180F;
  --muted: #727268;      /* improved: was #9A9A90 — now 4.6:1 on light bg */
  --muted2: #4A4A42;     /* improved: was #6A6A60 — now 7.2:1 on light bg */
  --accent: #7CA000;
  --accent-dim: rgba(124,160,0,0.09);
  --accent-border: rgba(124,160,0,0.25);
  --green: #0B8A7A;
  --red: #C93A3A;
  --blue: #2D56CC;
  --orange: #B87000;
  --purple: #7C3AED;
}
[data-theme="light"] body { background: var(--bg); }
[data-theme="light"] .leaflet-tile { filter: none !important; }

/* ─── THEME TOGGLE ─────────────────────────────────────────── */
.theme-switch { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 10px 14px; border-radius: 8px; transition: background 0.15s; margin: 0 8px 10px; }
.theme-switch:hover { background: var(--surface2); }
.theme-switch-icon { font-size: 13px; line-height: 1; }
.theme-switch-track { width: 40px; height: 22px; background: var(--border2); border-radius: 11px; position: relative; transition: background 0.25s; flex-shrink: 0; }
[data-theme="light"] .theme-switch-track { background: var(--accent); }
.theme-switch-thumb { width: 16px; height: 16px; background: #fff; border-radius: 50%; position: absolute; top: 3px; left: 3px; transition: transform 0.25s cubic-bezier(0.4,0,0.2,1); box-shadow: 0 1px 4px rgba(0,0,0,0.3); }
[data-theme="light"] .theme-switch-thumb { transform: translateX(18px); }

/* ─── RESET & ROOT ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0C0C0C; --surface: #141414; --surface2: #1A1A1A;
  --border: #222222; --border2: #2A2A2A;
  --text: #F0EFE8;
  --muted: #8C8C86;      /* improved: was #5A5A54 — now 4.8:1 on dark surfaces */
  --muted2: #B0B0A8;     /* improved: was #888880 — now 7.1:1 on dark surfaces */
  --accent: #E8FF47; --accent-dim: rgba(232,255,71,0.07); --accent-border: rgba(232,255,71,0.18);
  --green: #4ECDC4; --red: #FF6B6B; --blue: #7B9CFF; --orange: #F5A623; --purple: #C084FC;
  --font: 'Space Grotesk', sans-serif; --mono: 'Space Mono', monospace;
}
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; -webkit-font-smoothing: antialiased; display: flex; }
::-webkit-scrollbar { width: 4px; } ::-webkit-scrollbar-track { background: var(--bg); } ::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ─── SIDEBAR ───────────────────────────────────────────────── */
.sidebar { width: 220px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 200; }
.sidebar-logo { padding: 24px 20px; border-bottom: 1px solid var(--border); font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; }
.sidebar-logo span { color: var(--accent); }
.sidebar-section { padding: 20px 12px 8px; font-size: 10px; font-family: var(--mono); letter-spacing: 0.15em; color: var(--muted); text-transform: uppercase; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 6px; margin: 1px 8px; font-size: 13px; font-weight: 500; color: var(--muted2); cursor: pointer; transition: all 0.15s; text-decoration: none; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); border: 1px solid var(--accent-border); }
.nav-item .icon { width: 16px; font-size: 14px; text-align: center; flex-shrink: 0; }
.nav-item .badge { margin-left: auto; font-size: 10px; font-family: var(--mono); background: var(--red); color: white; padding: 2px 6px; border-radius: 10px; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid var(--border); padding: 16px 12px; }
.artist-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface2); border: 1px solid var(--border2); border-radius: 8px; }
.artist-avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, #E8FF47 0%, #4ECDC4 100%); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #0C0C0C; flex-shrink: 0; }
.artist-name { font-size: 12px; font-weight: 600; } .artist-sub { font-size: 10px; color: var(--muted); font-family: var(--mono); }

/* ─── MOBILE HAMBURGER ─────────────────────────────────────── */
.hamburger {
  display: none;
  position: fixed; top: 10px; left: 12px; z-index: 400;
  width: 38px; height: 38px;
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 8px; cursor: pointer; font-size: 18px;
  color: var(--text); align-items: center; justify-content: center;
  box-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); z-index: 199;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

/* ─── MAIN LAYOUT ──────────────────────────────────────────── */
.main { margin-left: 220px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { border-bottom: 1px solid var(--border); padding: 0 32px; height: 56px; display: flex; align-items: center; justify-content: space-between; background: rgba(12,12,12,0.95); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 10; flex-shrink: 0; }
.topbar-title { font-size: 15px; font-weight: 600; } .topbar-sub { font-size: 11px; color: var(--muted); font-family: var(--mono); letter-spacing: 0.08em; margin-top: 1px; }
.content { padding: 28px 32px; display: flex; flex-direction: column; gap: 20px; }

/* ─── BUTTONS ──────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 6px; font-family: var(--font); font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: all 0.15s; letter-spacing: 0.02em; text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--bg); }
.btn-primary:hover { opacity: 0.88; }
.btn-ghost { background: none; color: var(--muted2); border: 1px solid var(--border2); }
.btn-ghost:hover { color: var(--text); border-color: var(--border2); }

/* ─── CARDS ────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.section-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; color: var(--accent); text-transform: uppercase; margin-bottom: 8px; }

/* ─── TAGS ─────────────────────────────────────────────────── */
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-family: var(--mono); padding: 3px 8px; border-radius: 3px; }
/* Tags use both color AND shape/text for colorblindness */
.tag-green  { background: rgba(78,205,196,0.12); color: var(--green);  border: 1px solid rgba(78,205,196,0.25); }
.tag-red    { background: rgba(255,107,107,0.12); color: var(--red);   border: 1px solid rgba(255,107,107,0.25); }
.tag-accent { background: var(--accent-dim);      color: var(--accent); border: 1px solid var(--accent-border); }
.tag-muted  { background: rgba(255,255,255,0.06); color: var(--muted2); border: 1px solid var(--border2); }
.tag-orange { background: rgba(245,166,35,0.12);  color: var(--orange); border: 1px solid rgba(245,166,35,0.25); }
.tag-purple { background: rgba(192,132,252,0.12); color: var(--purple); border: 1px solid rgba(192,132,252,0.25); }
.tag-blue   { background: rgba(123,156,255,0.12); color: var(--blue);   border: 1px solid rgba(123,156,255,0.25); }

/* ─── COLORBLIND-SAFE STATUS INDICATORS ───────────────────── */
/* Status dots use icon prefix in addition to color */
.status-live::before   { content: '▶ '; font-size: 8px; }
.status-draft::before  { content: '◌ '; font-size: 8px; }
.status-done::before   { content: '✓ '; font-size: 8px; }
.status-alert::before  { content: '⚠ '; font-size: 8px; }
/* P&L values: add + / − prefix via CSS for screen readers */
.val-positive { color: var(--green); }
.val-positive::before { content: '↑ '; font-size: 10px; }
.val-negative { color: var(--red); }
.val-negative::before { content: '↓ '; font-size: 10px; }

/* ─── RESPONSIVE — TABLET (≤ 1024px) ──────────────────────── */
@media (max-width: 1024px) {
  .main { margin-left: 220px; }
  .content { padding: 20px 24px; }
  .topbar { padding: 0 24px; }
}

/* ─── RESPONSIVE — MOBILE (≤ 768px) ───────────────────────── */
@media (max-width: 768px) {
  /* Show hamburger, hide sidebar by default */
  .hamburger { display: flex !important; }
  body { display: block; overflow-x: hidden; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
    z-index: 300;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  .sidebar.open { transform: translateX(0); }

  .main { margin-left: 0; min-height: 100vh; }
  .topbar { padding: 0 16px 0 58px; height: 52px; }
  .topbar-sub { display: none; }
  .content { padding: 14px 16px; gap: 12px; }

  /* Grid collapses */
  .stat-row,
  .summary-stats    { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
  .campaigns-grid,
  .type-grid,
  .chart-grid,
  .conn-grid,
  .opp-grid,
  .press-grid,
  .breakdown-row    { grid-template-columns: 1fr !important; }
  .date-row         { grid-template-columns: 1fr !important; }
  .add-stop-custom  { grid-template-columns: 1fr 1fr !important; }

  /* Hero banners */
  .hero-banner  { grid-template-columns: 1fr !important; }
  .hero-total   { text-align: left !important; min-width: unset !important; }
  .cta-card     { grid-template-columns: 1fr !important; }
  .hero-headline { font-size: 24px !important; }

  /* Modals go full-width */
  .modal {
    width: calc(100vw - 20px) !important;
    margin: 10px !important;
    max-height: 92vh !important;
    border-radius: 12px !important;
  }
  .modal-header { padding: 16px 18px 14px; }
  .modal-body   { padding: 14px 18px; }
  .modal-footer { padding: 12px 18px; flex-wrap: wrap; }

  /* Opportunity cards */
  .opp-body     { grid-template-columns: 1fr 1fr !important; }
  .opp-header   { grid-template-columns: 36px 1fr !important; }
  .opp-gross    { display: none; } /* shown in body on mobile */
  .opp-actions  { flex-wrap: wrap; gap: 6px; }

  /* Press card stats */
  .press-stats  { grid-template-columns: 1fr 1fr !important; }

  /* Stat values scale down */
  .stat-val     { font-size: 22px !important; }
  .ss-value     { font-size: 18px !important; }

  /* Strip at bottom of fanmap */
  .summary-strip { flex-wrap: wrap; gap: 14px 20px; padding: 10px 16px; }

  /* Campaign footer wraps */
  .campaign-footer { flex-wrap: wrap; }

  /* Topbar right side wraps */
  .topbar > div:last-child { display: none; }

  /* Table / math rows */
  .stats-kpi-row { grid-template-columns: 1fr 1fr !important; }

  /* Tour panel on fan map — handled inline */
  .side-panel { display: none; }
  .side-panel.mobile-open { display: flex; position: fixed; inset: 0; top: 52px; z-index: 150; }
}

/* ─── RESPONSIVE — SMALL MOBILE (≤ 480px) ─────────────────── */
@media (max-width: 480px) {
  .stat-row,
  .summary-stats    { grid-template-columns: 1fr !important; }
  .opp-body         { grid-template-columns: 1fr !important; }
  .press-stats      { grid-template-columns: 1fr !important; }
  .campaign-stats   { grid-template-columns: 1fr 1fr !important; }
  .conn-summary     { grid-template-columns: 1fr 1fr !important; }
}
