/* ============ TOKENS + RESET (pola portal kampus) ============ */
:root {
  --font-head: "Readex Pro", system-ui, sans-serif;
  --font-body: "Open Sans", system-ui, sans-serif;

  --color-primary: #0047bb;
  --color-primary-2: #0a5de0;
  --color-horizon: #6cace4;
  --color-gold: #cba052;
  --color-gold-earth: #886b25;
  --color-danger: #c62828;
  --color-success: #2e7d32;

  --bg: #f4f7fb;
  --bg-soft: #eaf0f8;
  --bg-2: #e7eef8;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --text: #101a2b;
  --text-soft: #4a5a74;
  --text-faint: #8494ad;
  --border: rgba(16, 26, 43, .10);
  --border-strong: rgba(16, 26, 43, .18);
  --shadow-sm: 0 2px 10px rgba(16, 26, 43, .06);
  --shadow-md: 0 10px 30px rgba(16, 26, 43, .10);
  --shadow-lg: 0 24px 60px rgba(16, 26, 43, .16);

  --glass: rgba(255, 255, 255, .72);
  --glass-border: rgba(255, 255, 255, .55);
  --header-height: 74px;
  --radius: 16px;
  --radius-lg: 22px;
  --container: 1200px;
  --container-wide: 1440px;

  --video-bg: #0a0f16;
  --osd: #e8f0fb;
}

[data-theme="dark"] {
  --bg: #0b1424;
  --bg-soft: #0e1a30;
  --bg-2: #091120;
  --surface: #121f36;
  --surface-2: #16243e;
  --text: #e9eef8;
  --text-soft: #a9b7ce;
  --text-faint: #7b8aa5;
  --border: rgba(233, 238, 248, .12);
  --border-strong: rgba(233, 238, 248, .22);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, .35);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, .45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
  --glass: rgba(18, 31, 54, .72);
  --glass-border: rgba(233, 238, 248, .14);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
#app, main { flex: 1 0 auto; width: 100%; }
img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--color-primary); text-decoration: none; }
button { font: inherit; cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.25; margin: 0 0 .5em; letter-spacing: .01em; }
p { margin: 0 0 1em; }
ul { margin: 0; padding: 0; list-style: none; }
[hidden] { display: none !important; }

.container { width: min(var(--container), calc(100% - 40px)); margin-inline: auto; }
.container-wide { width: min(var(--container-wide), calc(100% - 40px)); margin-inline: auto; }
[data-layout="full"] .container,
[data-layout="full"] .container-wide { width: calc(100% - 32px); max-width: none; }

.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ============ BADGES ============ */
.badge-gold, .badge-blue, .badge-soft {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-head); font-size: 12px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase;
  padding: 6px 14px; border-radius: 999px;
}
.badge-gold {
  color: var(--color-gold-earth); background: rgba(203, 160, 82, .14);
  border: 1px solid rgba(203, 160, 82, .45);
}
[data-theme="dark"] .badge-gold { color: var(--color-gold); background: rgba(203, 160, 82, .12); }
.badge-blue {
  color: var(--color-primary); background: rgba(0, 71, 187, .08);
  border: 1px solid rgba(0, 71, 187, .28);
}
[data-theme="dark"] .badge-blue { color: var(--color-horizon); background: rgba(108, 172, 228, .1); border-color: rgba(108, 172, 228, .3); }
.badge-soft { color: var(--text-soft); background: var(--bg-soft); border: 1px solid var(--border); }
.text-gold { color: var(--color-gold); }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-head); font-weight: 600; font-size: 15px;
  padding: 13px 26px; border-radius: 12px; border: 1px solid transparent;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-sm { padding: 9px 16px; font-size: 13.5px; border-radius: 10px; }
.btn-primary { background: var(--color-primary); color: #fff; box-shadow: 0 8px 22px rgba(0, 71, 187, .28); }
.btn-primary:hover { background: var(--color-primary-2); }
.btn-danger { background: var(--color-danger, #c0392b); color: #fff; box-shadow: 0 8px 22px rgba(192, 57, 43, .28); }
.btn-danger:hover { background: var(--color-danger-2, #a93226); }
.btn-chalky { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-chalky:hover { background: var(--bg-soft); }
[data-theme="dark"] .btn-chalky { background: rgba(233, 238, 248, .08); color: var(--text); border-color: var(--border-strong); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* ============ FORM ============ */
.input {
  font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 9px 12px; min-width: 0;
}
.input:focus { outline: 2px solid rgba(0, 71, 187, .35); outline-offset: 1px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; flex: 1; }
.field > span { font-size: 12.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); }
.field-row { display: flex; gap: 14px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; margin-bottom: 10px; color: var(--text-soft); }
.check input { width: 17px; height: 17px; accent-color: var(--color-primary); }

input[type="range"] { accent-color: var(--color-primary); width: 100%; }

/* ============ CARDS ============ */
.stdi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  padding: 26px;
}
.glass-card {
  background: var(--glass); border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* ============ SECTION HEADER ============ */
.section-header { max-width: 780px; margin: 0 auto 20px; }
.section-header h2 {
  font-size: clamp(24px, 3.4vw, 36px); font-weight: 700;
  text-transform: uppercase; margin-top: 16px; letter-spacing: .02em;
}
.section-header p { color: var(--text-soft); font-size: 16px; margin: 0; }
.divider-accent {
  width: 92px; height: 4px; margin: 18px auto; border-radius: 4px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-gold));
}
.text-center { text-align: center; }

/* ============ PAGE SHELL ============ */
.page { padding: calc(var(--header-height) + 26px) 0 0; min-height: 70vh; }
#page-beranda { padding-top: var(--header-height); padding-bottom: 0; min-height: 0; }
#page-live { padding-top: var(--header-height); padding-bottom: 0; min-height: 0; }
#page-admin {
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
#page-admin.admin-console .container {
  width: 100%;
  flex: 1 0 auto;
}
.page-head {
  display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end;
  justify-content: space-between; margin-bottom: 26px;
}
.page-title { font-size: clamp(24px, 3vw, 34px); text-transform: uppercase; margin: 12px 0 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar-group {
  display: inline-flex; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 11px; padding: 4px; gap: 4px;
}
.chip {
  border: 0; background: transparent; color: var(--text-soft);
  font-family: var(--font-head); font-weight: 600; font-size: 13.5px;
  padding: 6px 14px; border-radius: 8px; transition: background .15s, color .15s;
}
.chip:hover { color: var(--text); background: var(--bg-soft); }
.chip.is-active { background: var(--color-primary); color: #fff; }

/* ============ TOAST ============ */
.toast-stack {
  position: fixed; right: 20px; bottom: 20px; z-index: 120;
  display: flex; flex-direction: column; gap: 10px; max-width: min(360px, calc(100vw - 40px));
}
.toast {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-left: 4px solid var(--color-gold);
  border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow-lg);
  font-size: 14px; animation: toastIn .28s ease;
}
.toast strong { display: block; font-family: var(--font-head); font-size: 13.5px; letter-spacing: .04em; text-transform: uppercase; }
.toast small { color: var(--text-faint); }
.toast.is-out { animation: toastOut .3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* ============ MODAL ============ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 130; display: none;
  align-items: center; justify-content: center; padding: 20px;
  background: rgba(6, 12, 22, .6); backdrop-filter: blur(4px);
}
.modal-backdrop.is-open { display: flex; }
.modal {
  width: min(560px, 100%); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); animation: toastIn .25s ease;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 16px; letter-spacing: .1em; text-transform: uppercase; flex: 1; min-width: 0; }
.modal-head .icon-btn { flex-shrink: 0; }
.modal-body { padding: 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.input.audit-search { min-width: 160px; flex: 1 1 180px; }
@media (max-width: 900px) {
  .page-head { flex-direction: column; align-items: flex-start; }
  .input.audit-search { width: 100%; flex: 1 1 100%; }
}

/* ============ RTL (Arabic) ============ */
html[dir="rtl"] body { direction: rtl; }
html[dir="rtl"] .navbar { flex-direction: row-reverse; }
html[dir="rtl"] .nav-menu { flex-direction: row-reverse; }
html[dir="rtl"] .mega-col { text-align: right; }
html[dir="rtl"] .footer-grid { direction: rtl; }
html[dir="rtl"] .admin-shell { direction: rtl; }
html[dir="rtl"] .admin-side { border-right: none; border-left: 1px solid var(--border); }
html[dir="rtl"] .admin-tab-btn { text-align: right; }
html[dir="rtl"] .eventdash-layout { direction: rtl; }
html[dir="rtl"] .eventdash-sidebar { order: -1; }
html[dir="rtl"] .lang-select { direction: ltr; }
.th-sort{cursor:pointer;user-select:none;white-space:nowrap}
.th-sort:hover{color:var(--gold,#d4af37)}
.th-sort::after{content:' ⇅';font-size:10px;opacity:.35}
.th-sort.is-sort::after{content:' ↑';opacity:.9}
.th-sort.is-sort.is-desc::after{content:' ↓';opacity:.9}
/* Rekaman: player custom dengan segmen di bar kontrol */
.rec-player{position:relative;background:#000;border-radius:8px;overflow:visible}
.rec-player .rec-video{display:block;width:100%;max-height:62vh;background:#000;border-radius:8px 8px 0 0}
.rec-player:fullscreen{width:100%;height:100%;background:#000;border-radius:0;display:flex;flex-direction:column;overflow:hidden}
.rec-player:-webkit-full-screen{width:100%;height:100%;background:#000;border-radius:0;display:flex;flex-direction:column;overflow:hidden}
.rec-player:-moz-full-screen{width:100%;height:100%;background:#000;border-radius:0;display:flex;flex-direction:column;overflow:hidden}
.rec-player:fullscreen .rec-video{width:100%;flex:1;min-height:0;max-height:none;object-fit:contain;border-radius:0}
.rec-player:-webkit-full-screen .rec-video{width:100%;flex:1;min-height:0;max-height:none;object-fit:contain;border-radius:0}
.rec-player:-moz-full-screen .rec-video{width:100%;flex:1;min-height:0;max-height:none;object-fit:contain;border-radius:0}
.rec-controls{display:flex;align-items:center;gap:8px;padding:8px 10px;background:#111;color:#fff;font-size:12px;position:relative;border-radius:0 0 8px 8px}
.rec-player:fullscreen .rec-controls{position:relative;border-radius:0;background:rgba(0,0,0,.9)}
.rec-player:-webkit-full-screen .rec-controls{position:relative;border-radius:0;background:rgba(0,0,0,.9)}
.rec-player:-moz-full-screen .rec-controls{position:relative;border-radius:0;background:rgba(0,0,0,.9)}
.rec-ctl-btn{background:none;border:0;color:#fff;cursor:pointer;font-size:16px;line-height:1;padding:4px 6px;border-radius:4px}
.rec-ctl-btn:hover{background:rgba(255,255,255,.15)}
.rec-ctl-time{white-space:nowrap;font-variant-numeric:tabular-nums;opacity:.9;min-width:90px}
.rec-ctl-progress{flex:1;position:relative;height:8px;background:rgba(255,255,255,.2);border-radius:4px;cursor:pointer}
.rec-ctl-progress-fill{position:absolute;left:0;top:0;bottom:0;width:0;background:rgba(255,255,255,.7);border-radius:4px;pointer-events:none}
.rec-hover-preview{position:absolute;bottom:16px;transform:translateX(-50%);width:180px;background:#111;border:1px solid rgba(255,255,255,.15);border-radius:8px;overflow:hidden;box-shadow:0 8px 24px rgba(0,0,0,.45);pointer-events:none;z-index:5}
.rec-hover-preview[hidden]{display:none!important}
.rec-hover-preview img{display:block;width:100%;height:101px;object-fit:cover;background:#000}
.rec-hover-preview span{display:block;padding:4px 6px;color:#fff;font-size:11px;text-align:center;font-family:ui-monospace,SFMono-Regular,Menlo,monospace}
.rec-seg-track{position:absolute;inset:0;border-radius:4px;overflow:visible}
.rec-seg-track .rec-seg-mark{position:absolute;top:0;bottom:0;min-width:2px;background:rgba(212,175,55,.85);border-radius:2px;border:0;padding:0;cursor:pointer}
.rec-seg-track .rec-seg-mark:hover{background:#fff;z-index:2}
.rec-seg-track .rec-seg-mark.is-active{background:#d4af37;box-shadow:0 0 0 1px #fff;z-index:2}
.rec-seg-track .rec-seg-tip{position:absolute;bottom:14px;transform:translateX(-50%);background:#111;color:#fff;font-size:11px;padding:2px 6px;border-radius:4px;white-space:nowrap;pointer-events:none;opacity:0}
.rec-seg-track .rec-seg-mark:hover .rec-seg-tip{opacity:1}
/* Rekaman OSD waktu */
.rec-osd{position:absolute;top:12px;left:12px;z-index:3;padding:6px 10px;border-radius:8px;background:rgba(7,12,22,.55);backdrop-filter:blur(4px);color:#f4f7fb;font:600 13px/1.3 ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:.02em;box-shadow:0 2px 10px rgba(0,0,0,.25);pointer-events:none;white-space:nowrap}
.rec-osd:empty{display:none}
.rec-osd .rec-osd-date{display:block;font-size:11px;font-weight:500;color:rgba(244,247,251,.78);letter-spacing:.04em}
.rec-osd .rec-osd-time{display:block;font-size:15px;font-weight:700;color:#fff}
.rec-osd .rec-osd-live{display:inline-block;width:7px;height:7px;border-radius:50%;background:#ff4d5a;margin-right:6px;vertical-align:middle;box-shadow:0 0 0 3px rgba(255,77,90,.18)}
