/* ============================================================
   DSNG Reporter System - Classic Newsroom Light Theme
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Roboto+Mono:wght@400;600&display=swap');

:root {
  --primary:    #1a3a5c;
  --primary-lt: #2563a8;
  --accent:     #c0392b;
  --accent-lt:  #e74c3c;
  --success:    #27ae60;
  --warning:    #f39c12;
  --danger:     #c0392b;
  --info:       #2980b9;
  --body-bg:    #f4f6f9;
  --card-bg:    #ffffff;
  --border:     #dce1e8;
  --text:       #1c2833;
  --text-muted: #6c7a89;
  --sidebar-bg: #1a3a5c;
  --sidebar-txt:#ecf0f1;
  --topbar-bg:  #ffffff;
  --tally-live: #e74c3c;
  --tally-stby: #f39c12;
  --tally-off:  #7f8c8d;
  --radius:     6px;
  --shadow:     0 2px 8px rgba(0,0,0,.10);
  --shadow-md:  0 4px 16px rgba(0,0,0,.14);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--body-bg);
  color: var(--text);
  margin: 0; padding: 0;
  font-size: 14px;
}

a { color: var(--primary-lt); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Sidebar ---- */
#sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: fixed; left: 0; top: 0; bottom: 0;
  display: flex; flex-direction: column;
  z-index: 1000;
  box-shadow: 2px 0 8px rgba(0,0,0,.15);
  transition: transform .25s ease;
}
#sidebar .brand {
  padding: 18px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.12);
  display: flex; align-items: center; gap: 10px;
}
#sidebar .brand img { width: 34px; height: 34px; }
#sidebar .brand span {
  color: #fff; font-weight: 700; font-size: 15px; line-height: 1.2;
}
#sidebar .brand small { color: rgba(255,255,255,.55); font-size: 10px; display: block; }
#sidebar nav { flex: 1; padding: 10px 0; overflow-y: auto; }
#sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,.78);
  font-size: 13.5px; font-weight: 500;
  transition: background .18s, color .18s;
  border-left: 3px solid transparent;
  text-decoration: none;
}
#sidebar nav a i { width: 18px; text-align: center; font-size: 15px; }
#sidebar nav a:hover, #sidebar nav a.active {
  background: rgba(255,255,255,.12);
  color: #fff;
  border-left-color: var(--accent);
}
#sidebar .sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.5);
  font-size: 11px;
}

/* ---- Main content ---- */
#main { margin-left: 240px; min-height: 100vh; display: flex; flex-direction: column; }

/* ---- Topbar ---- */
#topbar {
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 58px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 900;
  box-shadow: var(--shadow);
}
#topbar .page-title { font-weight: 700; font-size: 16px; color: var(--primary); }
#topbar .topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-user { font-size: 13px; color: var(--text-muted); }
.topbar-user strong { color: var(--text); }

/* ---- Content area ---- */
.content { padding: 24px; flex: 1; }

/* ---- Cards ---- */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 14px;
  background: #f9fafb;
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex; align-items: center; gap: 8px;
}
.card-body { padding: 18px; }

/* ---- Stat boxes ---- */
.stat-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow);
}
.stat-box .stat-icon {
  width: 48px; height: 48px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff; flex-shrink: 0;
}
.stat-box .stat-val { font-size: 26px; font-weight: 700; line-height: 1; }
.stat-box .stat-lbl { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ---- Tally indicators ---- */
.tally {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 4px;
  font-weight: 700; font-size: 11px; letter-spacing: .8px; text-transform: uppercase;
}
.tally.live   { background: var(--tally-live); color: #fff; }
.tally.standby{ background: var(--tally-stby); color: #fff; }
.tally.offline{ background: var(--tally-off);  color: #fff; }
.tally-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.tally.live .tally-dot   { animation: blink 1s infinite; }

@keyframes blink {
  0%,100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* ---- Reporter Cards (Admin grid) ---- */
.reporter-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .2s;
  cursor: pointer;
}
.reporter-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.reporter-card.is-live { border-color: var(--tally-live); border-width: 2px; }
.reporter-card .card-video {
  position: relative; background: #111; height: 160px; overflow: hidden;
}
.reporter-card .card-video video {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.reporter-card .card-video .no-video {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #555; font-size: 13px; flex-direction: column; gap: 6px;
}
.reporter-card .card-video .no-video i { font-size: 32px; color: #444; }
.reporter-card .card-tally {
  position: absolute; top: 8px; left: 8px;
}
.reporter-card .card-duration {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(0,0,0,.6); color: #fff;
  font-size: 11px; padding: 2px 7px; border-radius: 3px;
  font-family: 'Roboto Mono', monospace;
}
.reporter-card .card-info { padding: 12px 14px; }
.reporter-card .card-name { font-weight: 600; font-size: 14px; margin: 0 0 2px; }
.reporter-card .card-desig { font-size: 12px; color: var(--text-muted); margin: 0 0 8px; }
.reporter-card .card-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.quality-bar { display: flex; gap: 2px; align-items: flex-end; height: 16px; }
.quality-bar span {
  width: 4px; background: #ccc; border-radius: 2px;
  display: inline-block;
}
.quality-bar span:nth-child(1) { height: 5px; }
.quality-bar span:nth-child(2) { height: 9px; }
.quality-bar span:nth-child(3) { height: 13px; }
.quality-bar span:nth-child(4) { height: 16px; }
.quality-bar.q-good span { background: var(--success); }
.quality-bar.q-fair span:nth-child(-n+3) { background: var(--warning); }
.quality-bar.q-poor span:nth-child(-n+2) { background: var(--danger); }
.quality-bar.q-none span { background: #ccc; }

/* ---- Reporter Dashboard (reporter view) ---- */
.reporter-dash {
  max-width: 760px; margin: 30px auto; padding: 0 16px;
}
.reporter-tally-big {
  text-align: center; padding: 30px 20px 20px;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.reporter-tally-big .big-indicator {
  font-size: 42px; font-weight: 800; letter-spacing: 3px;
  text-transform: uppercase; margin: 8px 0;
  transition: color .3s;
}
.big-live    { color: var(--tally-live); }
.big-standby { color: var(--tally-stby); }
.big-offline { color: var(--text-muted); }

.reporter-preview {
  position: relative; background: #111; border-radius: var(--radius);
  overflow: hidden; margin-bottom: 20px;
  aspect-ratio: 16/9;
  box-shadow: var(--shadow);
}
.reporter-preview video { width: 100%; height: 100%; object-fit: cover; }
.reporter-preview .preview-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 10px; color: #888; font-size: 14px;
}
.reporter-preview .preview-overlay i { font-size: 48px; color: #555; }

/* ---- Buttons ---- */
.btn-live-start {
  background: var(--success); color: #fff; border: none;
  padding: 12px 32px; border-radius: var(--radius);
  font-weight: 700; font-size: 16px; cursor: pointer;
  transition: background .2s, transform .1s;
}
.btn-live-start:hover { background: #219a52; transform: scale(1.02); }
.btn-live-start:disabled {
  background: #bdc3c7; cursor: not-allowed; transform: none;
}
.btn-live-stop {
  background: var(--danger); color: #fff; border: none;
  padding: 12px 32px; border-radius: var(--radius);
  font-weight: 700; font-size: 16px; cursor: pointer;
  transition: background .2s;
}
.btn-live-stop:hover { background: #a93226; }

/* ---- Tables ---- */
.table-dsng { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table-dsng th {
  background: #f0f3f7; padding: 10px 14px;
  text-align: left; font-weight: 600; color: var(--primary);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.table-dsng td {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table-dsng tr:last-child td { border-bottom: none; }
.table-dsng tr:hover td { background: #f8f9fb; }

/* ---- Badges ---- */
.badge-perm-on  { background: #d5f5e3; color: #1e8449; border-radius:4px; padding:2px 8px; font-size:11px; font-weight:600; }
.badge-perm-off { background: #fadbd8; color: #922b21; border-radius:4px; padding:2px 8px; font-size:11px; font-weight:600; }
.badge-suspended{ background: #fdebd0; color: #935116; border-radius:4px; padding:2px 8px; font-size:11px; font-weight:600; }
.badge-online   { background: #d5f5e3; color: #1e8449; border-radius:4px; padding:2px 8px; font-size:11px; font-weight:600; }
.badge-offline  { background: #f0f3f7; color: #7f8c8d; border-radius:4px; padding:2px 8px; font-size:11px; font-weight:600; }

/* ---- Login page ---- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1a3a5c 0%, #2563a8 60%, #1a3a5c 100%);
  padding: 20px;
}
.login-box {
  background: #fff; border-radius: 8px; padding: 40px 36px;
  width: 100%; max-width: 420px; box-shadow: 0 8px 32px rgba(0,0,0,.22);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-badge {
  display: inline-block; background: var(--primary);
  color: #fff; font-weight: 800; font-size: 22px;
  padding: 10px 22px; border-radius: 6px; letter-spacing: 2px; margin-bottom: 12px;
}
.login-logo h1 { font-size: 20px; font-weight: 700; color: var(--primary); margin: 0 0 4px; }
.login-logo p  { font-size: 12px; color: var(--text-muted); margin: 0; }
.form-label-dsng { font-weight: 600; font-size: 13px; margin-bottom: 5px; display: block; }
.form-control-dsng {
  width: 100%; padding: 10px 13px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 14px; font-family: inherit;
  transition: border .2s, box-shadow .2s;
  outline: none;
}
.form-control-dsng:focus { border-color: var(--primary-lt); box-shadow: 0 0 0 3px rgba(37,99,168,.15); }
.btn-login {
  width: 100%; padding: 11px; background: var(--primary);
  color: #fff; border: none; border-radius: var(--radius);
  font-weight: 700; font-size: 15px; cursor: pointer;
  transition: background .2s;
}
.btn-login:hover { background: var(--primary-lt); }
.alert-dsng {
  padding: 10px 14px; border-radius: var(--radius);
  margin-bottom: 16px; font-size: 13px;
}
.alert-dsng.err { background: #fadbd8; color: #922b21; border: 1px solid #f1948a; }
.alert-dsng.ok  { background: #d5f5e3; color: #1e8449; border: 1px solid #82e0aa; }

/* ---- Modal ---- */
.modal-dsng-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 9000; padding: 20px;
}
.modal-dsng {
  background: #fff; border-radius: 8px; width: 100%; max-width: 500px;
  box-shadow: 0 8px 32px rgba(0,0,0,.22); overflow: hidden;
}
.modal-dsng .modal-header {
  padding: 16px 20px; background: var(--primary); color: #fff;
  font-weight: 700; font-size: 15px; display: flex;
  align-items: center; justify-content: space-between;
}
.modal-dsng .modal-body { padding: 20px; }
.modal-dsng .modal-footer {
  padding: 12px 20px; background: #f9fafb;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ---- Call popup (IFB) ---- */
.call-popup {
  position: fixed; bottom: 30px; right: 30px;
  background: #fff; border: 2px solid var(--primary);
  border-radius: 8px; padding: 20px 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
  z-index: 9999; max-width: 300px;
  animation: slideUp .3s ease;
}
@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.call-popup .call-icon { font-size: 36px; text-align: center; margin-bottom: 8px; }
.call-popup h4 { font-size: 15px; font-weight: 700; margin: 0 0 4px; }
.call-popup p  { font-size: 13px; color: var(--text-muted); margin: 0 0 14px; }

/* ---- Feed viewer ---- */
.feed-page {
  background: #000; min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
}
.feed-page video { width: 100%; height: 100vh; object-fit: contain; display: block; }
.feed-offline {
  color: #fff; text-align: center;
  font-family: 'Roboto Mono', monospace;
}
.feed-offline h2 { font-size: 18px; letter-spacing: 2px; margin-bottom: 8px; }

/* ---- Connection status ---- */
.conn-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 4px 10px;
  border-radius: 20px;
}
.conn-status.connected    { background: #d5f5e3; color: #1e8449; }
.conn-status.disconnected { background: #fadbd8; color: #922b21; }
.conn-status.connecting   { background: #fef9e7; color: #9a7d0a; }
.conn-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.connected .conn-dot { animation: pulse 1.5s infinite; }
@keyframes pulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.4); opacity: .6; }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  #sidebar { transform: translateX(-240px); }
  #sidebar.open { transform: translateX(0); }
  #main { margin-left: 0; }
  .content { padding: 16px; }
  .reporter-dash { margin: 16px auto; }
}

/* ---- Misc ---- */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.page-header h2 { font-size: 18px; font-weight: 700; margin: 0; color: var(--primary); }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.text-mono { font-family: 'Roboto Mono', monospace; }
.w-100 { width: 100%; }
.mb-0 { margin-bottom: 0; }
.mt-3 { margin-top: 12px; }
.gap-2 { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
