/* ===================================================================
   PORTAL CBT UJIAN SEKOLAH - ROYAL CLASSIC ACADEMIC DESIGN SYSTEM
   Typography: Times New Roman
   Color Palette: Pure White, Antique Gold, Deep Obsidian Black
   Theme: Formal, Prestigious, Dignified, Light & Dark Responsive
   =================================================================== */

:root {
  --font-main: 'Times New Roman', Times, 'Georgia', serif;
  --font-serif: 'Times New Roman', Times, 'Georgia', serif;

  /* TEMA TERANG FULL (DEFAULT) - Paduan Dasar Putih, Hitam, dan Emas (Gold) */
  --bg-main: #fcfbf9;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f9f8f2;
  --bg-glass: rgba(197, 160, 89, 0.08);

  --gold: #b3882a;
  --gold-light: #d4af37;
  --gold-dark: #8c6a15;
  --gold-muted: rgba(197, 160, 89, 0.12);
  --gold-border: rgba(184, 134, 11, 0.38);
  --gold-border-bright: #b8860b;

  --primary: #c5a059;
  --primary-hover: #b08d42;
  --primary-light: rgba(197, 160, 89, 0.15);

  --text-primary: #111111;
  --text-secondary: #2d2d2d;
  --text-muted: #5a5a5a;

  --border: rgba(184, 134, 11, 0.32);
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-double: 3px double rgba(184, 134, 11, 0.5);

  --success: #1e7e44;
  --success-bg: rgba(30, 126, 68, 0.12);
  --warning: #b3882a;
  --warning-bg: rgba(179, 136, 42, 0.14);
  --danger: #b91c1c;
  --danger-bg: rgba(185, 28, 28, 0.12);

  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.08), 0 0 1px rgba(184, 134, 11, 0.3);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.12), 0 0 2px rgba(184, 134, 11, 0.4);

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 10px;

  --transition: all 0.22s ease-in-out;
}

/* Alternate Dark Theme Palette - Royal Obsidian & Burnished Gold */
html.dark-theme, body.dark-theme {
  --bg-main: #0a0a0d;
  --bg-surface: #121216;
  --bg-card: #16161c;
  --bg-card-hover: #1e1e26;
  --bg-glass: rgba(212, 175, 55, 0.04);

  --gold: #d4af37;
  --gold-light: #f5e39b;
  --gold-dark: #99751e;
  --gold-muted: rgba(212, 175, 55, 0.15);
  --gold-border: rgba(212, 175, 55, 0.35);
  --gold-border-bright: #d4af37;

  --primary: #c5a059;
  --primary-hover: #b08d42;
  --primary-light: rgba(197, 160, 89, 0.15);

  --text-primary: #faf8f5;
  --text-secondary: #c9c5ba;
  --text-muted: #858175;

  --border: rgba(212, 175, 55, 0.28);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-double: 3px double rgba(212, 175, 55, 0.45);

  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.55), 0 0 1px rgba(212, 175, 55, 0.3);
  --shadow-lg: 0 12px 36px rgba(0, 0, 0, 0.7), 0 0 2px rgba(212, 175, 55, 0.4);
}

/* Base Reset & Typography */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 10% 10%, rgba(212, 175, 55, 0.035) 0%, transparent 50%),
    radial-gradient(circle at 90% 90%, rgba(212, 175, 55, 0.035) 0%, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.01em;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.03em;
}

/* Container */
.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Top Navbar with Gold Hairline Trim */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-surface);
  border-bottom: 2px solid var(--gold-border);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  padding: 0.85rem 0;
  transition: var(--transition);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  color: var(--text-primary);
}

.brand-crest {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-crest img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-text span {
  font-size: 0.75rem;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  display: block;
  margin-top: 0.15rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Buttons with Formal Gold Embellishments */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-main);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  letter-spacing: 0.04em;
}

.btn-primary {
  background: linear-gradient(135deg, #d4af37, #99751e);
  color: #0a0a0c;
  border-color: #d4af37;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(212, 175, 55, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #f5e08c, #c5a059);
  color: #000000;
  border-color: #f5e08c;
  box-shadow: 0 4px 16px rgba(212, 175, 55, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--gold);
  color: var(--gold);
}

.btn-outline {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-border);
}

.btn-outline:hover {
  background: var(--gold-muted);
  border-color: var(--gold);
  color: var(--gold-light);
}

.btn-success {
  background: var(--success);
  color: #ffffff;
  border-color: rgba(47, 163, 100, 0.4);
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
  border-color: rgba(201, 59, 59, 0.4);
}

.btn-sm {
  padding: 0.35rem 0.85rem;
  font-size: 0.825rem;
}

.btn-lg {
  padding: 0.8rem 1.75rem;
  font-size: 1.05rem;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Formal Cards & Accents */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  position: relative;
  transition: var(--transition);
}

.card:hover {
  border-color: var(--gold);
}

/* Formal Gold Line Accent */
.gold-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 1.5rem 0;
  border: none;
}

/* Form Controls with Clean Academic Border */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--gold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: var(--font-main);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-muted);
}

select.form-control {
  cursor: pointer;
}

/* Badges with Gold Framing */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge-primary {
  background: var(--gold-muted);
  color: var(--gold);
  border-color: var(--gold-border);
}

.badge-success {
  background: var(--success-bg);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.4);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--gold);
  border-color: var(--gold);
}

.badge-danger {
  background: var(--danger-bg);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}

.badge-muted {
  background: var(--bg-glass);
  color: var(--text-muted);
  border-color: var(--border-subtle);
}

/* Live Time & Date Banner */
.live-clock-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.live-clock-time {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.05em;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: var(--bg-surface);
  border: 1px solid var(--gold-border);
  color: var(--gold);
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  background: var(--gold-muted);
  border-color: var(--gold);
  color: var(--gold-light);
}

/* Modal Dialogs */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-surface);
  border: 2px solid var(--gold-border);
  border-radius: var(--radius-md);
  max-width: 560px;
  width: 100%;
  padding: 2.25rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  transform: scale(0.96);
  transition: transform 0.2s ease;
}

.modal-overlay.active .modal-content {
  transform: scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--gold-border);
  padding-bottom: 0.75rem;
}

.modal-header h3 {
  font-size: 1.35rem;
  color: var(--gold);
  letter-spacing: 0.04em;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.75rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--gold);
}

.modal-footer {
  margin-top: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  padding-top: 1rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 420px;
}

.toast {
  background: var(--bg-surface);
  border-left: 4px solid var(--gold);
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  animation: slideInToast 0.3s ease forwards;
}

.toast.toast-danger {
  border-left-color: var(--danger);
}

.toast.toast-success {
  border-left-color: var(--success);
}

.toast.toast-warning {
  border-left-color: var(--gold);
}

@keyframes slideInToast {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive Grids */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

@media (max-width: 900px) {
  .grid-3, .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
  .nav-container {
    flex-direction: column;
    align-items: flex-start;
  }
  .nav-links {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}
