/* ============================================================================
 * Evotic Broadcasting System — thème CLAIR (forcé)
 * Phase Broadcast Console 2026-05-26 — light theme rev. 2026-05-26
 *
 * Pas de prefers-color-scheme : la régie reste toujours en clair pour
 * éviter les surprises de lisibilité quand l'OS de l'opérateur est en dark.
 * ============================================================================ */

:root, :root[data-theme="dark"] {
  --ebs-bg-0: #F4F5F8;    /* fond global doux gris-clair */
  --ebs-bg-1: #FFFFFF;    /* cards */
  --ebs-bg-2: #F8F9FB;    /* header cards / toolbar */
  --ebs-bg-3: #EEF0F4;    /* boutons secondaires / tabs actives */
  --ebs-border: #DDE1E8;
  --ebs-text: #0F172A;     /* titres */
  --ebs-text-dim: #4B5563; /* labels */
  --ebs-text-mute: #94A3B8;/* hints / muted */
  --ebs-brand: #6750A4;
  --ebs-brand-2: #FFB300;
  --ebs-live: #FF3030;
  --ebs-warn: #F5B027;
  --ebs-ok: #16A34A;
  --ebs-danger: #DC2626;
  --ebs-radius: 10px;
  --ebs-radius-s: 6px;
  --ebs-shadow: 0 4px 16px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; padding: 0; }

body.ebs-body {
  background: var(--ebs-bg-0);
  color: var(--ebs-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== HEADER ============================================================ */
.ebs-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  background: var(--ebs-bg-1);
  border-bottom: 1px solid var(--ebs-border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.ebs-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--ebs-text);
}
.ebs-brand i { color: var(--ebs-brand); }
.ebs-brand strong { letter-spacing: .3px; }
.ebs-brand-sub {
  color: var(--ebs-text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  border-left: 1px solid var(--ebs-border);
  padding-left: 8px;
  margin-left: 4px;
}
.ebs-channel-switch {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--ebs-bg-2);
  border-radius: 8px;
  border: 1px solid var(--ebs-border);
  margin-left: 24px;
}
.ebs-chip {
  background: transparent;
  color: var(--ebs-text-dim);
  border: 0;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
}
.ebs-chip:hover { color: var(--ebs-text); }
.ebs-chip.active {
  background: var(--ebs-brand);
  color: #fff;
}
.ebs-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--ebs-text-dim);
}
.ebs-status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ebs-ok);
  box-shadow: 0 0 0 2px rgba(22,163,74,.2);
}
.ebs-status-dot.ko { background: var(--ebs-danger); box-shadow: 0 0 0 2px rgba(220,38,38,.2); }
.ebs-icon-btn {
  background: transparent;
  color: var(--ebs-text-dim);
  border: 1px solid var(--ebs-border);
  border-radius: 6px;
  width: 30px; height: 30px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.ebs-icon-btn:hover {
  color: var(--ebs-text);
  border-color: var(--ebs-brand);
}

/* ===== MAIN GRID ========================================================= */
.ebs-main {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr 280px;
  gap: 14px;
  padding: 14px;
  min-height: 0;
}
.ebs-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

/* ===== CARD ============================================================= */
.ebs-card {
  background: var(--ebs-bg-1);
  border: 1px solid var(--ebs-border);
  border-radius: var(--ebs-radius);
  overflow: hidden;
}
.ebs-card-h {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--ebs-text-dim);
  background: var(--ebs-bg-2);
  border-bottom: 1px solid var(--ebs-border);
}
.ebs-card-h i { color: var(--ebs-brand); }
.ebs-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--ebs-text-mute);
  font-style: italic;
  font-size: 12px;
}

/* ===== PREVIEW ========================================================== */
.ebs-preview-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ebs-preview-frame iframe,
.ebs-preview-frame video,
.ebs-preview-frame audio {
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}
.ebs-preview-frame.audio-mode {
  aspect-ratio: auto;
  height: 80px;
  padding: 0 14px;
  background: var(--ebs-bg-2);
}
.ebs-preview-frame.audio-mode audio { background: transparent; }
.ebs-pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ebs-live);
  margin-left: 8px;
  animation: ebs-pulse 1.4s infinite;
}
@keyframes ebs-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,48,48,.7); }
  50%      { box-shadow: 0 0 0 8px rgba(255,48,48,0); }
}
.ebs-live-dot { color: var(--ebs-live) !important; animation: ebs-pulse 1.4s infinite; }

/* ===== NOW PLAYING ====================================================== */
.ebs-now-body { padding: 14px; }
.ebs-now-title { font-size: 16px; font-weight: 700; margin: 0 0 4px; color: var(--ebs-text); }
.ebs-now-host { font-size: 12px; color: var(--ebs-text-dim); margin: 0 0 8px; }
.ebs-now-time { font-size: 11px; color: var(--ebs-brand-2); font-family: ui-monospace, monospace; }
.ebs-now-actions {
  display: flex;
  gap: 8px;
  padding: 0 14px 14px;
}

/* ===== CHANNEL META ===================================================== */
.ebs-meta {
  margin: 0;
  padding: 14px;
  font-size: 12px;
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 6px 12px;
}
.ebs-meta dt { color: var(--ebs-text-mute); }
.ebs-meta dd { margin: 0; color: var(--ebs-text); word-break: break-all; }
.ebs-mono { font-family: ui-monospace, monospace; font-size: 11px; }
.ebs-mute { color: var(--ebs-text-mute); font-size: 11px; }

/* ===== TOOLBAR ========================================================== */
.ebs-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ebs-bg-1);
  border: 1px solid var(--ebs-border);
  border-radius: var(--ebs-radius);
  padding: 8px;
}
.ebs-tabs {
  display: flex;
  gap: 2px;
  flex: 1;
}
.ebs-tab {
  background: transparent;
  color: var(--ebs-text-dim);
  border: 0;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .15s;
}
.ebs-tab:hover { color: var(--ebs-text); background: var(--ebs-bg-2); }
.ebs-tab.active {
  background: var(--ebs-bg-3);
  color: var(--ebs-text);
  border-bottom: 2px solid var(--ebs-brand);
}

/* ===== BUTTONS ========================================================== */
.ebs-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ebs-bg-3);
  color: var(--ebs-text);
  border: 1px solid var(--ebs-border);
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.ebs-btn:hover { background: var(--ebs-bg-2); border-color: var(--ebs-brand); }
.ebs-btn:disabled { opacity: .5; cursor: not-allowed; }
.ebs-btn-primary {
  background: var(--ebs-brand);
  color: #fff;
  border-color: var(--ebs-brand);
}
.ebs-btn-primary:hover { background: #FF7A1A; }
.ebs-btn-danger {
  background: var(--ebs-danger);
  color: #fff;
  border-color: var(--ebs-danger);
}
.ebs-btn-danger:hover { background: #B91C1C; }
.ebs-btn-warn {
  background: var(--ebs-warn);
  color: #1A1A1A;
  border-color: var(--ebs-warn);
}
.ebs-btn-warn:hover { background: #D49717; }

/* ===== TIMELINE 24H ===================================================== */
.ebs-timeline-card { position: relative; }
.ebs-timeline {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  position: relative;
  border-top: 1px solid var(--ebs-border);
  border-bottom: 1px solid var(--ebs-border);
  background: var(--ebs-bg-2);
  height: 56px;
}
.ebs-timeline-hour {
  border-right: 1px solid var(--ebs-border);
  font-size: 9px;
  color: var(--ebs-text-mute);
  padding: 2px 4px;
  text-align: left;
  user-select: none;
}
.ebs-timeline-hour:last-child { border-right: 0; }
.ebs-timeline-progs {
  position: relative;
  min-height: 70px;
  padding: 12px;
}
.ebs-tl-bar {
  position: absolute;
  height: 28px;
  border-radius: 4px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: transform .12s;
}
.ebs-tl-bar:hover { transform: translateY(-1px); box-shadow: var(--ebs-shadow); z-index: 2; }
.ebs-tl-bar.scheduled { background: var(--ebs-bg-3); color: var(--ebs-text); border: 1px solid var(--ebs-border); }
.ebs-tl-bar.live      { background: var(--ebs-live); animation: ebs-pulse 1.4s infinite; }
.ebs-tl-bar.ended     { background: var(--ebs-bg-2); color: var(--ebs-text-dim); border: 1px solid var(--ebs-border); opacity: .7; }
.ebs-tl-bar.cancelled { background: var(--ebs-bg-2); color: var(--ebs-danger); border: 1px dashed var(--ebs-danger); opacity: .5; text-decoration: line-through; }
.ebs-tl-now {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--ebs-brand-2);
  box-shadow: 0 0 8px var(--ebs-brand-2);
  pointer-events: none;
  z-index: 3;
}
.ebs-tl-now::after {
  content: '';
  position: absolute;
  top: 0;
  left: -5px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--ebs-brand-2);
}

/* ===== PROG LIST CARDS ================================================== */
.ebs-prog-list { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.ebs-prog-row {
  display: grid;
  grid-template-columns: 80px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--ebs-bg-2);
  border: 1px solid var(--ebs-border);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color .12s;
}
.ebs-prog-row:hover { border-color: var(--ebs-brand); }
.ebs-prog-time {
  font-family: ui-monospace, monospace;
  color: var(--ebs-brand-2);
  font-weight: 700;
}
.ebs-prog-title { font-weight: 600; }
.ebs-prog-host { color: var(--ebs-text-dim); font-size: 11px; }
.ebs-prog-status {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 700;
}
.ebs-prog-status.scheduled { background: var(--ebs-bg-3); color: var(--ebs-text-dim); }
.ebs-prog-status.live      { background: var(--ebs-live); color: #fff; }
.ebs-prog-status.ended     { background: transparent; color: var(--ebs-text-mute); border: 1px solid var(--ebs-border); }
.ebs-prog-status.cancelled { background: transparent; color: var(--ebs-danger); }
.ebs-prog-stats {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  color: var(--ebs-text-dim);
  display: flex;
  gap: 8px;
}
.ebs-prog-stats i { color: var(--ebs-brand); }

/* ===== KPI ============================================================== */
.ebs-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--ebs-border);
}
.ebs-kpi {
  background: var(--ebs-bg-1);
  padding: 12px;
  text-align: center;
}
.ebs-kpi-v {
  font-size: 22px;
  font-weight: 700;
  color: var(--ebs-brand-2);
  font-family: ui-monospace, monospace;
}
.ebs-kpi-l {
  font-size: 10px;
  color: var(--ebs-text-mute);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 4px;
}

/* ===== TIPS ============================================================= */
.ebs-tips {
  margin: 0;
  padding: 14px 14px 14px 32px;
  font-size: 12px;
  color: var(--ebs-text-dim);
  line-height: 1.8;
}
.ebs-tips kbd {
  background: var(--ebs-bg-3);
  border: 1px solid var(--ebs-border);
  border-radius: 3px;
  padding: 1px 6px;
  font-family: ui-monospace, monospace;
  font-size: 10px;
  color: var(--ebs-text);
}

/* ===== MODAL ============================================================ */
.ebs-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.ebs-modal[hidden] { display: none; }
.ebs-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(2px);
}
.ebs-modal-card {
  position: relative;
  background: var(--ebs-bg-1);
  border: 1px solid var(--ebs-border);
  border-radius: var(--ebs-radius);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--ebs-shadow);
}
.ebs-modal-h {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--ebs-border);
}
.ebs-modal-h h2 { margin: 0; font-size: 15px; flex: 1; }
.ebs-modal-f {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--ebs-border);
  background: var(--ebs-bg-2);
}

/* ===== FORM ============================================================= */
.ebs-form { padding: 14px 18px; flex: 1; overflow: auto; }
.ebs-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.ebs-field-row { display: flex; gap: 12px; }
.ebs-field-row .ebs-field { flex: 1; }
.ebs-lbl { font-size: 11px; color: var(--ebs-text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.ebs-lbl em { color: var(--ebs-live); font-style: normal; }
.ebs-field input, .ebs-field textarea, .ebs-field select {
  background: var(--ebs-bg-2);
  color: var(--ebs-text);
  border: 1px solid var(--ebs-border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  transition: border-color .12s;
}
.ebs-field input:focus, .ebs-field textarea:focus, .ebs-field select:focus {
  outline: none;
  border-color: var(--ebs-brand);
}
.ebs-upload {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--ebs-bg-2);
  border: 1px dashed var(--ebs-border);
  border-radius: 6px;
  margin-bottom: 12px;
}

/* ===== TOASTS =========================================================== */
.ebs-toasts {
  position: fixed;
  top: 70px;
  right: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.ebs-toast {
  background: var(--ebs-bg-2);
  border: 1px solid var(--ebs-border);
  border-left: 4px solid var(--ebs-brand);
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--ebs-text);
  min-width: 240px;
  max-width: 360px;
  box-shadow: var(--ebs-shadow);
  pointer-events: auto;
  animation: ebs-slide-in .25s ease;
}
.ebs-toast.ok      { border-left-color: var(--ebs-ok); }
.ebs-toast.warn    { border-left-color: var(--ebs-warn); }
.ebs-toast.error   { border-left-color: var(--ebs-danger); }
@keyframes ebs-slide-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ===== RESPONSIVE ======================================================== */
@media (max-width: 1100px) {
  .ebs-main { grid-template-columns: 1fr; }
  .ebs-col-left, .ebs-col-right { order: 2; }
  .ebs-col-center { order: 1; }
}
@media (max-width: 640px) {
  .ebs-header { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .ebs-channel-switch { margin-left: 0; order: 3; flex-basis: 100%; }
  .ebs-brand-sub { display: none; }
  .ebs-main { padding: 8px; gap: 8px; }
  .ebs-prog-row { grid-template-columns: 70px 1fr; }
  .ebs-prog-stats, .ebs-prog-status { grid-column: span 2; }
  .ebs-modal-card { max-height: 100vh; border-radius: 0; }
}
