/* =====================================================
   ENHANCEMENTS — EOC bar, page KPI, alerts, theme toggle,
   mobile nav, improved collapse affordance
   ===================================================== */

/* ============================================================
   THEME TOGGLE + BELL + MOBILE NAV in topbar
   ============================================================ */
.tb-theme {
  width: 34px; height: 34px; border-radius: 3px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.tb-theme:hover { background: rgba(255,255,255,0.14); color: #fff; border-color: rgba(255,255,255,0.25); }
.tb-theme-glyph { font-size: 16px; line-height: 1; display: block; transition: transform 0.3s ease; }
.tb-theme:active .tb-theme-glyph { transform: rotate(30deg); }

/* Alerts bell */
.tb-bell-wrap { position: relative; }
.tb-bell {
  width: 34px; height: 34px; border-radius: 3px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.tb-bell:hover { background: rgba(255,255,255,0.14); color: #fff; border-color: rgba(255,255,255,0.25); }
.tb-bell-icon { font-size: 18px; line-height: 1; }
.tb-bell-dot {
  position: absolute; top: -4px; right: -4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--af-red); color: #fff;
  font-family: var(--font-display); font-size: 9px; font-weight: 700;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--af-navy);
}
.tb-bell-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 380px; background: var(--bg-1);
  border: 1px solid var(--border-1);
  border-top: 3px solid var(--af-red);
  border-radius: 3px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  z-index: 9500;
}
.tb-bell-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-bottom: 1px solid var(--border-1);
  background: var(--bg-2);
}
.tb-bell-title {
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-1);
}
.tb-bell-sub { font-size: 11px; color: var(--fg-2); margin-top: 2px; }
.tb-bell-mark {
  font-family: var(--font-display); font-size: 10px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--af-red); background: transparent; border: none; cursor: pointer;
}
.tb-bell-list { max-height: 420px; overflow-y: auto; }
.tb-alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 16px; border-bottom: 1px solid var(--border-1);
  cursor: pointer;
}
.tb-alert:hover { background: var(--bg-2); }
.tb-alert.read { opacity: 0.65; }
.tb-alert-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--af-red); margin-top: 5px; flex-shrink: 0;
}
.tb-alert-dot.warn { background: #c27500; }
.tb-alert-dot.info { background: var(--af-sky); }
.tb-alert-body { flex: 1; min-width: 0; }
.tb-alert-title { font-size: 13px; font-weight: 600; color: var(--fg-1); line-height: 1.35; }
.tb-alert-meta {
  font-family: var(--font-display); font-size: 10px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-3); margin-top: 4px;
}
.tb-bell-empty { padding: 40px 20px; text-align: center; }
.tb-bell-empty-title {
  font-family: var(--font-display); font-weight: 700; font-size: 14px;
  letter-spacing: 0.04em; color: var(--af-sky);
}
.tb-bell-empty-sub { font-size: 12px; color: var(--fg-2); margin-top: 6px; }
.tb-bell-foot {
  display: flex; gap: 8px; padding: 10px 12px;
  background: var(--bg-2); border-top: 1px solid var(--border-1);
}
.tb-bell-foot-btn {
  flex: 1; padding: 6px 10px; border-radius: 3px;
  font-family: var(--font-display); font-size: 10px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  background: transparent; border: 1px solid var(--border-1); color: var(--fg-2);
  cursor: pointer;
}
.tb-bell-foot-btn:hover { color: var(--fg-1); border-color: var(--fg-2); }
.tb-bell-foot-btn.primary { background: var(--af-red); color: #fff; border-color: var(--af-red); }

/* Mobile nav trigger */
.tb-mobile-nav {
  display: none; width: 38px; height: 38px;
  background: transparent; border: 1px solid rgba(255,255,255,0.15);
  border-radius: 3px; cursor: pointer;
  flex-direction: column; justify-content: center; align-items: center; gap: 4px;
}
.tb-mobile-nav span { display: block; width: 18px; height: 2px; background: #fff; }

/* ============================================================
   EOC BAR — live festival status strip
   ============================================================ */
.eoc-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  background: linear-gradient(180deg, #12151C 0%, #1a1e28 100%);
  color: #fff;
  padding: 10px 20px;
  border-bottom: 2px solid var(--af-red);
  border-top: 1px solid rgba(255,255,255,0.06);
  position: relative;
  overflow: hidden;
}
.eoc-bar::before {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(-45deg,
    transparent 0, transparent 18px,
    rgba(229,30,37,0.04) 18px, rgba(229,30,37,0.04) 19px);
  pointer-events: none;
}

.eoc-bar.collapsed {
  display: flex; gap: 12px; align-items: center;
  justify-content: center;
  padding: 6px 16px;
  background: #12151C;
  border: none; border-bottom: 1px solid rgba(229,30,37,0.3);
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  font-family: var(--font-display); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; font-weight: 600;
  width: 100%;
}
.eoc-bar.collapsed:hover { background: #1a1e28; color: #fff; }
.eoc-toggle { opacity: 0.6; font-size: 10px; }

.eoc-lead {
  display: flex; align-items: center; gap: 10px;
  padding-right: 16px; border-right: 1px solid rgba(255,255,255,0.1);
  position: relative;
}
.eoc-pulse {
  width: 10px; height: 10px; border-radius: 50%;
  background: #e51e25;
  box-shadow: 0 0 0 0 rgba(229,30,37,0.7);
  animation: eoc-pulse 1.8s infinite;
  flex-shrink: 0;
}
@keyframes eoc-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(229,30,37,0.6); }
  70%  { box-shadow: 0 0 0 12px rgba(229,30,37,0); }
  100% { box-shadow: 0 0 0 0 rgba(229,30,37,0); }
}
.eoc-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: 12px; letter-spacing: 0.16em;
  color: #fff; line-height: 1;
}
.eoc-sub {
  font-size: 10px; color: rgba(255,255,255,0.55);
  letter-spacing: 0.06em; text-transform: uppercase;
  margin-top: 3px;
}

.eoc-cells {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  position: relative;
}
.eoc-cell {
  padding: 2px 14px;
  border-right: 1px solid rgba(255,255,255,0.08);
  display: flex; flex-direction: column; gap: 1px;
  min-width: 0;
}
.eoc-cell:last-child { border-right: none; }
.eoc-cell-lbl {
  font-family: var(--font-display); font-weight: 600;
  font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  line-height: 1;
}
.eoc-cell-val {
  font-family: var(--font-display); font-weight: 700;
  font-size: 15px; letter-spacing: 0.02em; color: #fff;
  line-height: 1.1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.eoc-cell-sub {
  font-size: 10px; color: rgba(255,255,255,0.55);
  line-height: 1.1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.eoc-cell.live .eoc-cell-val { color: var(--af-sky); }
.eoc-cell.warn .eoc-cell-val { color: #ffa940; }
.eoc-cell.urgent .eoc-cell-val { color: #ff5560; }
.eoc-cell.ok .eoc-cell-val { color: #fff; }

.eoc-actions { display: flex; gap: 6px; align-items: center; }
.eoc-action {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 3px;
  background: rgba(229,30,37,0.15);
  border: 1px solid rgba(229,30,37,0.35);
  color: #fff; cursor: pointer;
  font-family: var(--font-display); font-size: 10px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.eoc-action:hover { background: var(--af-red); border-color: var(--af-red); }
.eoc-ext { opacity: 0.7; font-size: 11px; }
.eoc-collapse {
  width: 28px; height: 28px; border-radius: 3px;
  background: transparent; border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7); cursor: pointer;
  font-size: 10px;
}
.eoc-collapse:hover { color: #fff; border-color: rgba(255,255,255,0.4); }

/* ============================================================
   PAGE KPI STRIP — status strip under page header
   ============================================================ */
.page-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--border-1);
  border: 1px solid var(--border-1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 20px;
}
.pkpi-cell {
  background: var(--bg-1);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 3px;
  border-top: 2px solid transparent;
}
.pkpi-cell.green  { border-top-color: var(--af-sky); }
.pkpi-cell.amber  { border-top-color: var(--af-gold); }
.pkpi-cell.red    { border-top-color: var(--af-red); }
.pkpi-cell.navy   { border-top-color: var(--af-navy); }
.pkpi-val {
  font-family: var(--font-display); font-weight: 700;
  font-size: 22px; letter-spacing: 0.02em;
  color: var(--fg-1); line-height: 1;
  display: flex; align-items: baseline; gap: 6px;
}
.pkpi-cell.green .pkpi-val { color: var(--af-sky); }
.pkpi-cell.amber .pkpi-val { color: var(--af-gold); }
.pkpi-cell.red   .pkpi-val { color: var(--af-red); }
.pkpi-delta {
  font-family: var(--font-mono); font-size: 11px; font-weight: 600;
  color: var(--fg-2); letter-spacing: 0;
}
.pkpi-delta.up   { color: var(--af-sky); }
.pkpi-delta.down { color: var(--af-red); }
.pkpi-lbl {
  font-family: var(--font-display); font-weight: 600;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--fg-2);
}
.pkpi-sub { font-size: 11px; color: var(--fg-3); line-height: 1.3; margin-top: 1px; }

/* ============================================================
   ALERT BANNER — inline page-level alert
   ============================================================ */
.alert-banner {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px;
  border-radius: 4px;
  border: 1px solid;
  margin-bottom: 16px;
}
.alert-banner.urgent {
  background: rgba(229,30,37,0.08);
  border-color: rgba(229,30,37,0.4);
  border-left: 4px solid var(--af-red);
}
.alert-banner.warn {
  background: rgba(194,117,0,0.08);
  border-color: rgba(194,117,0,0.4);
  border-left: 4px solid #c27500;
}
.alert-banner.info {
  background: rgba(41,151,219,0.08);
  border-color: rgba(41,151,219,0.4);
  border-left: 4px solid var(--af-sky);
}
.alert-icon {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 12px;
  flex-shrink: 0;
}
.alert-banner.urgent .alert-icon { background: var(--af-red); color: #fff; }
.alert-banner.warn   .alert-icon { background: #c27500; color: #fff; }
.alert-banner.info   .alert-icon { background: var(--af-sky); color: #fff; }
.alert-body { flex: 1; }
.alert-title { font-weight: 600; font-size: 13px; color: var(--fg-1); }
.alert-text { font-size: 12px; color: var(--fg-2); margin-top: 3px; line-height: 1.45; }
.alert-action {
  padding: 6px 12px; border-radius: 3px;
  background: var(--bg-1); border: 1px solid var(--border-1);
  font-family: var(--font-display); font-size: 10px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-1); cursor: pointer;
}
.alert-dismiss {
  background: transparent; border: none; cursor: pointer;
  color: var(--fg-3); font-size: 14px; padding: 2px 6px;
}
.alert-dismiss:hover { color: var(--fg-1); }

/* ============================================================
   IMPROVED COLLAPSE AFFORDANCE (Variation C hybrid)
   Replaces the subtle outline with a big red tab handle.
   ============================================================ */
.c-expand-btn {
  position: absolute !important;
  top: 50% !important;
  left: 76px !important;
  transform: translateY(-50%);
  width: 26px !important; height: 72px !important;
  background: var(--af-red) !important;
  border: none !important;
  border-radius: 0 6px 6px 0 !important;
  color: #fff !important;
  cursor: pointer;
  font-family: var(--font-display); font-weight: 700;
  font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 2px 0 12px rgba(229,30,37,0.25) !important;
  z-index: 50 !important;
  transition: all 0.15s;
}
.c-expand-btn:hover {
  background: #c41b22 !important;
  width: 34px !important;
  box-shadow: 3px 0 16px rgba(229,30,37,0.4) !important;
}
.c-expand-btn::after {
  content: "NAV";
  position: absolute; left: 50%; top: 6px;
  transform: translateX(-50%) rotate(0deg);
  font-size: 8px; letter-spacing: 0.12em;
  color: rgba(255,255,255,0.7);
}

/* Hover-peek — when collapsed + hovering icon rail, peek the secondary */
.shell-c.collapsed .c-rail:hover + .c-secondary,
.shell-c.collapsed .c-secondary:hover {
  transform: translateX(0) !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  position: absolute !important;
  left: 76px; top: 56px; bottom: 0;
  width: 240px;
  z-index: 40;
  box-shadow: 4px 0 24px rgba(0,0,0,0.18);
  grid-area: auto !important;
}
.shell-c.collapsed .c-secondary {
  pointer-events: none;
}

/* Collapse button within secondary */
.c-sec-collapse {
  width: 28px !important; height: 28px !important;
  background: var(--af-red) !important;
  border: none !important;
  color: #fff !important;
  font-weight: 700 !important;
  font-size: 14px !important;
  border-radius: 3px !important;
}
.c-sec-collapse:hover {
  background: #c41b22 !important;
  color: #fff !important;
}

/* ============================================================
   MOBILE / TABLET RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .eoc-cells { grid-template-columns: repeat(3, 1fr); }
  .eoc-cell { padding: 4px 10px; }
  .eoc-cell-val { font-size: 13px; }
}

@media (max-width: 900px) {
  /* Hybrid: stack nav into drawer, show hamburger */
  .shell-c {
    grid-template-columns: 0 0 1fr !important;
    grid-template-rows: 52px 1fr;
    grid-template-areas: "top top top" "main main main";
  }
  .shell-c .c-rail,
  .shell-c .c-secondary {
    position: fixed; left: 0; top: 52px; bottom: 0; z-index: 1000;
    transition: transform 0.2s ease;
  }
  .shell-c .c-rail { width: 76px; transform: translateX(-100%); }
  .shell-c .c-secondary { left: 76px; width: 240px; transform: translateX(-320px); }
  .shell-c.mobile-open .c-rail { transform: translateX(0); }
  .shell-c.mobile-open .c-secondary { transform: translateX(0); }
  .shell-c.mobile-open::after {
    content: ""; position: fixed; inset: 52px 0 0 0;
    background: rgba(0,0,0,0.4); z-index: 999;
  }
  .c-expand-btn { display: none !important; }
  .tb-mobile-nav { display: flex !important; }
  .c-search { display: none !important; }
  .c-brand { flex: 1; }
  .c-wordmark { font-size: 14px; }
  .c-sep, .sys-switch { display: none !important; }

  .eoc-bar {
    grid-template-columns: 1fr;
    padding: 8px 12px;
  }
  .eoc-lead { border-right: none; border-bottom: 1px solid rgba(255,255,255,0.1); padding-right: 0; padding-bottom: 8px; }
  .eoc-cells { grid-template-columns: repeat(2, 1fr); gap: 1px; background: rgba(255,255,255,0.06); }
  .eoc-cell { background: #12151C; border: none; padding: 6px 10px; }
  .eoc-actions { justify-content: flex-end; }

  .page-kpi { grid-template-columns: repeat(2, 1fr); }

  /* Page head on mobile */
  .page-head h1 { font-size: 22px !important; }
  .page-head .actions { width: 100%; }

  /* User chip — just avatar */
  .user-meta { display: none; }

  /* Hide theme button label on mobile */
  .tb-theme, .tb-bell { width: 32px; height: 32px; }
}

@media (max-width: 600px) {
  .page-kpi { grid-template-columns: 1fr 1fr; }
  .eoc-cells { grid-template-columns: 1fr 1fr; }
  .c-right { gap: 6px !important; }
  .phase-chip { font-size: 9px; padding: 3px 7px; }
  .user-chip { display: none; }
}

/* Dark mode tweaks for new components */
html[data-theme="dark"] .tb-bell-menu {
  background: var(--bg-1);
  border-color: var(--border-1);
}
html[data-theme="dark"] .alert-banner.urgent { background: rgba(229,30,37,0.12); }
html[data-theme="dark"] .alert-banner.warn   { background: rgba(194,117,0,0.15); }
html[data-theme="dark"] .alert-banner.info   { background: rgba(41,151,219,0.12); }
