/* ============================================================
   SISTEM INFORMASI SEKOLAH — Sistem desain
   Warna sekolah: navy #1F3864, emas #BF9000
   ============================================================ */

@font-face { font-display: swap; }

:root {
  --navy-900: #101C33;
  --navy:     #1F3864;
  --navy-600: #2E4E86;
  --navy-050: #EAEFF8;
  --gold:     #BF9000;
  --gold-050: #FBF3DC;

  --paper:    #F3F5FA;
  --surface:  #FFFFFF;
  --surface-2:#F8FAFD;
  --line:     #DCE3F0;
  --ink:      #14203A;
  --muted:    #5B6880;

  --free:  #15803D;
  --busy:  #B42318;
  --soon:  #B54708;
  --off:   #64748B;

  --free-bg: #E8F6EC;
  --busy-bg: #FCEBEA;
  --soon-bg: #FDF1E1;
  --off-bg:  #EFF1F5;

  --radius:   10px;
  --radius-sm: 6px;
  --shadow:   0 1px 2px rgba(16, 28, 51, .06);
  --shadow-lg:0 12px 32px rgba(16, 28, 51, .14);
  --wrap:     1240px;
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="dark"] {
  --navy-900: #060B15;
  --navy:     #16233D;
  --navy-600: #3A5B99;
  --navy-050: #1B2942;
  --gold:     #E0B03A;
  --gold-050: #2A2313;

  --paper:    #0B1220;
  --surface:  #121D31;
  --surface-2:#16233B;
  --line:     #253453;
  --ink:      #E6ECF7;
  --muted:    #9AA8C0;

  --free: #4ADE80; --busy: #FCA5A5; --soon: #FBBF24; --off: #94A3B8;
  --free-bg: #16301F; --busy-bg: #33191A; --soon-bg: #33260F; --off-bg: #1C2740;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
}

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

body {
  margin: 0;
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p  { margin: 0 0 1em; max-width: 72ch; }
a  { color: var(--navy-600); text-decoration: none; }
a:hover { text-decoration: underline; }
small { font-size: .82rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.15em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------- Header ---------------- */
.topbar { background: var(--navy-900); color: #fff; }
.topbar .wrap { display: flex; align-items: center; gap: 16px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand img, .brand .crest {
  width: 42px; height: 42px; border-radius: 8px; object-fit: contain;
  background: linear-gradient(150deg, var(--gold), #8C6A00);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .95rem;
}
.brand b { display: block; font-size: 1.02rem; font-weight: 700; letter-spacing: -.01em; }
.brand span { display: block; font-size: .76rem; color: #A9B7D0; }
.topbar .spacer { margin-left: auto; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.18); background: transparent; color: #fff; cursor: pointer;
}
.icon-btn:hover { background: rgba(255,255,255,.1); }

.mainnav { background: var(--navy); border-bottom: 3px solid var(--gold); }
.mainnav .wrap { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.mainnav .wrap::-webkit-scrollbar { display: none; }
.mainnav a {
  color: #D7E0F2; padding: 12px 14px; font-size: .9rem; font-weight: 600; white-space: nowrap;
  display: flex; align-items: center; gap: 7px; border-bottom: 3px solid transparent; margin-bottom: -3px;
}
.mainnav a:hover { color: #fff; text-decoration: none; background: rgba(255,255,255,.07); }
.mainnav a.active { color: #fff; border-bottom-color: var(--gold); }

/* ---------------- Papan jam (hero) ---------------- */
.board {
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-900) 100%);
  color: #fff; position: relative; overflow: hidden;
}
.board::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 4px; background: rgba(255,255,255,.12);
}
.board .progress {
  position: absolute; left: 0; bottom: 0; height: 4px; background: var(--gold); z-index: 2;
  width: 0; transition: width 1s linear;
}
.board-grid {
  display: grid; grid-template-columns: minmax(240px, 340px) 1fr; gap: 32px;
  padding: 26px 0 30px; align-items: start;
}
.clock-time {
  font-size: clamp(2.6rem, 7vw, 3.6rem); font-weight: 800; letter-spacing: -.02em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.clock-time .sec { font-size: .5em; color: var(--gold); font-weight: 700; }
.clock-date { font-size: 1rem; color: #C6D2E8; margin-top: 6px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; padding: 6px 12px;
  border-radius: 999px; font-size: .82rem; font-weight: 700; background: rgba(255,255,255,.12);
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: #4ADE80; }
.status-pill.libur .dot, .status-pill.selesai .dot { background: #94A3B8; }
.status-pill.istirahat .dot { background: #FBBF24; }

.now-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 16px; }
.now-period { font-size: 1.5rem; font-weight: 800; }
.now-time { font-size: 1rem; color: #C6D2E8; font-variant-numeric: tabular-nums; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: .78rem; font-weight: 700;
  background: rgba(74,222,128,.16); color: #86EFAC; padding: 4px 10px; border-radius: 999px; }
.live .dot { width: 7px; height: 7px; border-radius: 50%; background: #4ADE80; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

.lesson-card {
  margin-top: 14px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--radius); padding: 16px 18px;
}
.lesson-subject { font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.lesson-meta { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 8px; color: #C6D2E8; font-size: .92rem; }
.lesson-meta b { color: #fff; font-weight: 600; }
.next-line { margin-top: 12px; font-size: .92rem; color: #C6D2E8; }
.next-line b { color: #fff; }
.countdown { font-variant-numeric: tabular-nums; color: var(--gold); font-weight: 800; }

.class-picker { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.class-picker label { font-size: .82rem; color: #A9B7D0; }
.class-picker select {
  background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.22);
  border-radius: 8px; padding: 6px 10px; font: inherit; font-size: .88rem;
}
.class-picker select option { color: #14203A; }

/* ---------------- Running text ---------------- */
.marquee {
  background: var(--gold-050); border-bottom: 1px solid var(--line); color: #6B4E00;
  display: flex; align-items: center; gap: 12px; padding: 8px 0; overflow: hidden;
}
html[data-theme="dark"] .marquee { color: var(--gold); }
.marquee .tag {
  flex: none; background: var(--gold); color: #fff; font-size: .72rem; font-weight: 800;
  padding: 3px 10px; border-radius: 999px; margin-left: 20px;
}
.marquee-track { display: flex; gap: 60px; white-space: nowrap; animation: slide 45s linear infinite; font-size: .9rem; font-weight: 600; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes slide { from { transform: translateX(0) } to { transform: translateX(-50%) } }

/* ---------------- Kartu & bagian ---------------- */
.section { padding: 26px 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-head h2 { display: flex; align-items: center; gap: 9px; margin: 0; }
.section-head .link { font-size: .88rem; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: 2fr 1fr; align-items: start; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px;
}
.card.tight { padding: 14px 16px; }
.card h3 { margin-bottom: .35em; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .value { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .label { color: var(--muted); font-size: .86rem; }
.stat .sub { font-size: .8rem; color: var(--muted); }

/* Kartu ruangan */
.room {
  border: 1px solid var(--line); border-left: 4px solid var(--off); border-radius: var(--radius);
  background: var(--surface); padding: 14px 16px;
}
.room.is-free { border-left-color: var(--free); }
.room.is-busy { border-left-color: var(--busy); }
.room.is-soon { border-left-color: var(--soon); }
.room.is-off  { border-left-color: var(--off); background: var(--surface-2); }
.room h3 { font-size: .98rem; margin: 0; }
.room .type { font-size: .78rem; color: var(--muted); }
.room .act { margin-top: 8px; font-size: .88rem; }
.room .act b { display: block; font-weight: 600; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: .74rem; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; background: var(--off-bg); color: var(--off); white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.free { background: var(--free-bg); color: var(--free); }
.badge.busy { background: var(--busy-bg); color: var(--busy); }
.badge.soon { background: var(--soon-bg); color: var(--soon); }
.badge.info { background: var(--navy-050); color: var(--navy-600); }
.badge.gold { background: var(--gold-050); color: #8C6A00; }
html[data-theme="dark"] .badge.gold { color: var(--gold); }

/* Daftar ringkas */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; padding-top: 0; }
.list .when {
  flex: none; width: 62px; font-variant-numeric: tabular-nums; font-weight: 700; font-size: .9rem; color: var(--navy-600);
}
.list .body { min-width: 0; }
.list .body b { display: block; font-weight: 600; }
.list .body small { color: var(--muted); }

/* Prestasi */
.trophy-card { display: flex; gap: 14px; align-items: flex-start; }
.trophy-badge {
  flex: none; width: 46px; height: 46px; border-radius: 10px; display: grid; place-items: center;
  background: var(--gold-050); color: var(--gold);
}
.trophy-card h3 { font-size: 1rem; margin-bottom: 2px; }
.trophy-card .who { font-weight: 600; }
.trophy-card .meta { font-size: .84rem; color: var(--muted); }

/* Tabel */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.data th, table.data td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data thead th { background: var(--surface-2); font-size: .78rem; color: var(--muted); font-weight: 700; position: sticky; top: 0; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr.now { background: var(--gold-050); }
table.data tbody tr.done td { color: var(--muted); }
table.data td.num, table.data th.num { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Form */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .84rem; font-weight: 600; margin-bottom: 5px; }
.field .hint { font-size: .78rem; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date],
input[type=time], input[type=datetime-local], input[type=search], input[type=file], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-size: .92rem;
}
textarea { min-height: 110px; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
.checkline { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: .9rem; }
.checkline input { width: 16px; height: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer;
  padding: 9px 16px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--navy); color: #fff; font: inherit; font-size: .9rem; font-weight: 600;
}
.btn:hover { background: var(--navy-600); text-decoration: none; color: #fff; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.gold { background: var(--gold); }
.btn.gold:hover { background: #A87E00; }
.btn.danger { background: var(--busy); }
.btn.danger:hover { background: #8E1B12; }
.btn.sm { padding: 6px 11px; font-size: .82rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filters .field { margin: 0; min-width: 150px; }

.alert { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; border: 1px solid; display: flex; gap: 10px; font-size: .9rem; }
.alert.success { background: var(--free-bg); border-color: var(--free); color: var(--free); }
.alert.error   { background: var(--busy-bg); border-color: var(--busy); color: var(--busy); }
.alert.warning { background: var(--soon-bg); border-color: var(--soon); color: var(--soon); }
.alert.info    { background: var(--navy-050); border-color: var(--navy-600); color: var(--navy-600); }

.empty { text-align: center; padding: 34px 20px; color: var(--muted); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; }

.pagination { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pagination .page {
  padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); font-size: .86rem; color: var(--ink);
}
.pagination .page.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.pagination .page.disabled { opacity: .45; }
.pagination a:hover { text-decoration: none; background: var(--surface-2); }

/* Denah */
.floorplan {
  position: relative; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
  aspect-ratio: 16 / 7; min-height: 260px; overflow: hidden;
}
.floorplan .corridor {
  position: absolute; left: 2%; right: 2%; top: 44%; height: 12%; background: var(--navy-050);
  border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line);
  display: grid; place-items: center; font-size: .74rem; color: var(--muted); letter-spacing: .08em;
}
.plan-room {
  position: absolute; border-radius: 8px; border: 1px solid var(--line); border-left: 4px solid var(--off);
  background: var(--surface); padding: 8px 10px; text-align: left; cursor: pointer; overflow: hidden;
  font: inherit; color: var(--ink); display: flex; flex-direction: column; gap: 4px; justify-content: center;
}
.plan-room:hover { box-shadow: var(--shadow-lg); z-index: 3; }
.plan-room b { font-size: .84rem; font-weight: 700; }
.plan-room small { font-size: .7rem; color: var(--muted); }
.plan-room.is-free { border-left-color: var(--free); }
.plan-room.is-busy { border-left-color: var(--busy); background: var(--busy-bg); }
.plan-room.is-soon { border-left-color: var(--soon); background: var(--soon-bg); }
.plan-room.is-off  { border-left-color: var(--off);  background: var(--off-bg); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 12px 0; font-size: .84rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* Dialog detail ruangan */
dialog {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 0; width: min(520px, 92vw);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(16, 28, 51, .55); }
dialog .dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
dialog .dlg-body { padding: 18px; }
dialog h3 { margin: 0; }

/* Kalender */
.calendar { width: 100%; border-collapse: collapse; background: var(--surface); }
.calendar th { padding: 8px; font-size: .78rem; color: var(--muted); border-bottom: 1px solid var(--line); }
.calendar td { border: 1px solid var(--line); height: 92px; vertical-align: top; padding: 6px; width: 14.28%; }
.calendar td .d { font-size: .82rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.calendar td.other { background: var(--surface-2); color: var(--muted); }
.calendar td.today { background: var(--gold-050); }
.calendar td.today .d { color: #8C6A00; }
.cal-item { display: block; font-size: .7rem; padding: 2px 5px; border-radius: 4px; margin-top: 3px;
  background: var(--navy-050); color: var(--navy-600); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item.libur { background: var(--busy-bg); color: var(--busy); }
.cal-item.ujian { background: var(--soon-bg); color: var(--soon); }
.cal-item.kegiatan { background: var(--free-bg); color: var(--free); }

/* Footer */
.footer { background: var(--navy-900); color: #A9B7D0; margin-top: 34px; padding: 26px 0; font-size: .86rem; }
.footer a { color: #D7E0F2; }
.footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }
.footer b { color: #fff; display: block; margin-bottom: 6px; }

/* ---------------- Responsif ---------------- */
@media (max-width: 980px) {
  .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.side   { grid-template-columns: 1fr; }
  .board-grid  { grid-template-columns: 1fr; gap: 18px; }
  .footer .cols{ grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .brand span { display: none; }
  .clock-time { font-size: 2.6rem; }
  .lesson-subject { font-size: 1.3rem; }
  .calendar td { height: 64px; }
}

@media print {
  .topbar, .mainnav, .marquee, .footer, .btn, .filters, .pagination { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .card, .table-wrap { border: 1px solid #999; box-shadow: none; break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
