* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --theme: #1e5aa8;          /* biru utama (identitas sekolah) */
  --theme-dark: #143f78;
  --green: #16a34a;          /* aksen hijau */
  --green-dark: #12803b;
  --text: #1c2b45;
  --muted: #5b6b84;
  --card: #ffffff;
  --bg1: #eef3fc;
  --bg2: #e2ecfa;
  --shadow: rgba(28, 43, 69, 0.14);
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, var(--bg1), var(--bg2));
}

/* Kontainer skala responsif — zoom diatur JS agar proporsional di 1080p & 4K */
.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 18px 26px 0;
}

/* ---------- Fullscreen hint ---------- */
#fullscreenHint {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 29, 58, 0.82);
  z-index: 100;
  font-size: 2rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  text-align: center;
  letter-spacing: 0.5px;
  transition: opacity .4s;
}
#fullscreenHint.hidden { opacity: 0; pointer-events: none; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-radius: 18px;
  flex-shrink: 0;
  position: relative;
  background: linear-gradient(120deg, var(--theme), #2f6fc0, var(--theme-dark));
  background-size: 200% 100%;
  animation: headerFlow 14s ease-in-out infinite;
  box-shadow: 0 10px 28px rgba(30, 90, 168, 0.28);
}
@keyframes headerFlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.topbar::after {
  content: '';
  position: absolute;
  left: 24px; right: 24px; bottom: 0;
  height: 4px;
  border-radius: 2px 2px 0 0;
  background: var(--green);
  box-shadow: 0 0 14px rgba(22, 163, 74, 0.5);
}
.brand { display: flex; align-items: center; gap: 16px; }
.brand-text { display: flex; flex-direction: column; }
.logo {
  height: 70px; width: auto; border-radius: 12px;
  background: #fff;
  padding: 4px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}
.school-name {
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
.greeting {
  font-size: 1.02rem;
  font-weight: 600;
  color: #b6f0c8;
  margin-top: 3px;
  letter-spacing: 0.6px;
}
.quote {
  font-size: 1.05rem;
  font-style: italic;
  color: rgba(255, 255, 255, 0.92);
  margin-top: 8px;
  max-width: 900px;
  letter-spacing: 0.3px;
  line-height: 1.4;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  opacity: 0;
}
.quote-in { animation: quoteFade 1.2s ease forwards; }
@keyframes quoteFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.top-right { display: flex; align-items: center; gap: 22px; }
.clock-wrap { display: flex; flex-direction: column; align-items: flex-end; }

/* Cuaca di samping jam */
.top-weather {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  padding: 8px 16px;
  backdrop-filter: blur(4px);
}
.top-weather .tw-icon { width: 30px; height: 30px; color: #fff; }
.tw-main { display: flex; flex-direction: column; align-items: flex-end; }
.tw-city {
  font-size: .78rem; font-weight: 700; letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.85);
  text-transform: uppercase;
  margin-bottom: 2px;
}
.tw-temp {
  font-size: 1.9rem; font-weight: 800; color: #ffffff;
  line-height: 1; letter-spacing: 0.5px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
.tw-desc { font-size: .95rem; color: rgba(255, 255, 255, 0.92); margin-top: 3px; }
.tw-meta {
  display: flex; gap: 10px;
  font-size: .76rem; color: rgba(255, 255, 255, 0.72);
  margin-top: 3px;
}

.clock {
  font-size: 2.7rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #ffffff;
  line-height: 1;
  letter-spacing: 1px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
.date { font-size: 1.12rem; margin-top: 5px; color: rgba(255, 255, 255, 0.88); letter-spacing: 0.4px; }

/* ---------- Grid layout ---------- */
.grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  min-height: 0;
  margin-top: 16px;
}

.main-area {
  background: var(--card);
  border-radius: 18px;
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(28, 43, 69, 0.08);
  box-shadow: 0 14px 36px var(--shadow);
}

.slide-container { position: absolute; inset: 0; }
.slide {
  position: absolute; inset: 0; opacity: 0;
  transform: translateX(28px);
  transition: opacity .9s ease, transform .9s ease;
  pointer-events: none;
}
.slide.active { opacity: 1; transform: translateX(0); pointer-events: auto; }
.slide img, .slide video {
  width: 100%; height: 100%; display: block;
}
.slide img { object-fit: contain; }
.slide video {
  object-fit: cover; /* video memenuhi seluruh layar (fullscreen) */
  background: #000; /* video gagal/loading tampil hitam, bukan putih polos */
}
.slide.video-failed {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111827;
}
.slide.video-failed video { display: none; }
.video-fallback {
  color: #f3f4f6;
  font-size: 2.2rem;
  font-weight: 700;
  text-align: center;
  padding: 40px;
  line-height: 1.5;
}
.video-fallback small {
  display: block;
  margin-top: 14px;
  font-size: 1.2rem;
  font-weight: 400;
  color: #9ca3af;
}
/* Slide PDF — canvas dirender PDF.js, di tengah dengan latar putih */
.slide.pdf-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  overflow: hidden;
}
.pdf-canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 6px 24px rgba(28, 43, 69, 0.18);
}
.pdf-error {
  font-size: 1.4rem;
  color: #b91c1c;
  font-weight: 600;
  text-align: center;
  padding: 30px;
}
.slide-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 30px;
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-align: center;
  color: var(--theme);
  background: linear-gradient(135deg, #ffffff, #e8f0fd);
}

.slide-caption {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(11, 29, 58, 0.85));
  padding: 50px 26px 22px;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-align: center;
  color: #fff;
}

/* announcement frames (large) */
.announce-frame {
  position: absolute; inset: 0; opacity: 0;
  transform: translateX(28px);
  transition: opacity .9s ease, transform .9s ease;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  padding: 50px;
  text-align: center;
  pointer-events: none;
  background: linear-gradient(135deg, #ffffff, #e8f0fd);
}
.announce-frame.active { opacity: 1; transform: translateX(0); pointer-events: auto; }
.announce-frame h2 {
  font-size: 2.6rem;
  margin-bottom: 24px;
  color: var(--theme);
}
.announce-frame p {
  font-size: 1.9rem;
  line-height: 1.65;
  max-width: 90%;
  white-space: pre-line;
  color: var(--text);
}

/* Pengumuman PENTING — tampil besar dan mencolok */
.announce-frame.important {
  background: linear-gradient(135deg, #fff5f5, #ffe3e3);
  border: 6px solid #dc2626;
  box-shadow: inset 0 0 120px rgba(220, 38, 38, 0.10), 0 18px 46px rgba(220, 38, 38, 0.35);
}
.announce-frame.important h2 { color: #b91c1c; }
.announce-frame.important p { color: #7f1d1d; }
.imp-badge {
  display: inline-block;
  background: #dc2626;
  color: #fff;
  font-weight: 800;
  letter-spacing: 3px;
  font-size: 1.5rem;
  padding: 12px 34px;
  border-radius: 999px;
  margin-bottom: 26px;
  text-transform: uppercase;
  animation: pulseRed 1.4s ease-in-out infinite;
}
@keyframes pulseRed {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45); }
  50% { transform: scale(1.06); box-shadow: 0 0 0 20px rgba(220, 38, 38, 0); }
}

/* ---------- Side panel ---------- */
.side-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}
.side-panel::-webkit-scrollbar { display: none; }

.panel {
  background: var(--card);
  border-radius: 16px;
  padding: 18px;
  flex-shrink: 0;
  border: 1px solid rgba(28, 43, 69, 0.08);
  box-shadow: 0 8px 24px var(--shadow);
  animation: fadeUp .6s ease both;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--theme);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px;
}
.icon {
  width: 19px; height: 19px;
  color: var(--green);
  flex-shrink: 0;
}

.schedule-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.schedule-list li {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 10px;
  align-items: center;
  background: #f4f8fe;
  border-radius: 12px;
  padding: 11px 14px;
  border-left: 4px solid var(--theme);
  transition: background .3s ease;
}
.schedule-list li.current {
  border-left-color: var(--green);
  background: linear-gradient(90deg, rgba(22, 163, 74, 0.12), rgba(22, 163, 74, 0.03));
}
.sched-time { font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.sched-subject { font-size: 1.02rem; font-weight: 600; color: var(--text); }
.sched-class { font-size: .82rem; color: #8b9bb4; }

.events-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.events-list li {
  display: flex; gap: 12px; align-items: baseline;
  background: #f4f8fe;
  border-radius: 12px;
  padding: 10px 14px;
}
.ev-date {
  font-size: .82rem; color: var(--green); font-weight: 700;
  flex-shrink: 0; min-width: 86px;
}
.ev-title { font-size: .98rem; color: var(--text); }

.contact-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.contact-list li {
  display: flex; gap: 12px; align-items: baseline;
  background: #f4f8fe;
  border-radius: 12px;
  padding: 10px 14px;
}
.contact-label {
  font-size: .82rem; color: var(--green); font-weight: 700;
  flex-shrink: 0; min-width: 96px;
}
.contact-value { font-size: .95rem; color: var(--text); word-break: break-word; }

.hidden { display: none !important; }

/* ---------- Ticker ---------- */
.ticker {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  background: linear-gradient(180deg, var(--theme), var(--theme-dark));
  border-radius: 14px 14px 0 0;
  margin-top: 16px;
  height: 58px;
  overflow: hidden;
  box-shadow: 0 -8px 22px rgba(30, 90, 168, 0.2);
}
.ticker-label {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: #fff;
  font-weight: 800; padding: 0 22px;
  height: 100%; display: flex; align-items: center; gap: 8px;
  font-size: 1.05rem; letter-spacing: 1.4px;
  flex-shrink: 0;
  text-transform: uppercase;
  position: relative;
  z-index: 1;
  box-shadow: 8px 0 20px rgba(0, 0, 0, 0.25);
}
.ticker-label .icon { color: #fff; }
.ticker-track { overflow: hidden; flex: 1; position: relative; height: 100%; }
.ticker-text {
  position: absolute; white-space: nowrap;
  font-size: 1.4rem; line-height: 58px;
  color: #ffffff;
  animation: scroll-left 60s linear infinite; /* durasi disesuaikan JS agar kecepatan konstan */
}
@keyframes scroll-left {
  0% { transform: translateX(100vw); }
  100% { transform: translateX(-100%); }
}
