/* ==========================================================================
   GuruCerdas - Core App Design System
   ========================================================================== */

:root, [data-theme="zamrud"] {
  /* TEMA UTAMA: Zamrud Cerdas (Eksklusif: Deep Pine Emerald & Radiant Amber) */
  --primary: #0a4f47;
  --primary-dark: #06352f;
  --primary-light: #11685e;
  --primary-subtle: #edf7f5;

  /* Aliases untuk kompatibilitas penuh */
  --navy: var(--primary);
  --navy-dark: var(--primary-dark);
  --navy-light: var(--primary-light);
  --navy-subtle: var(--primary-subtle);

  --cream: #f4f7f6;
  --cream-card: #ffffff;

  --gold: #f59e0b;
  --gold-dark: #d97706;
  --gold-light: #fef3c7;

  --teal: #0d9488;
  --teal-light: #f0fdfa;
  --rose: #e11d48;
  --rose-light: #fff1f2;
  --emerald: #10b981;
  --emerald-light: #ecfdf5;

  --text-main: #132220;
  --text-muted: #536b67;
  --text-inverse: #ffffff;

  --border: #dbe5e3;
  --border-strong: #bac8c6;
  --header-gradient: linear-gradient(135deg, #052c27 0%, #0a4f47 60%, #0e6157 100%);
  --card-shadow: 0 4px 12px -2px rgba(10, 79, 71, 0.08), 0 2px 6px -1px rgba(10, 79, 71, 0.04);

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.08);

  --sidebar-w: 260px;
  --header-h: 60px;
}

[data-theme="safir"] {
  /* TEMA 2: Safir Indigo (Modern EdTech & Electric Coral) */
  --primary: #25287a;
  --primary-dark: #171954;
  --primary-light: #383caa;
  --primary-subtle: #f0f1ff;

  --navy: var(--primary);
  --navy-dark: var(--primary-dark);
  --navy-light: var(--primary-light);
  --navy-subtle: var(--primary-subtle);

  --cream: #f6f7fb;
  --cream-card: #ffffff;

  --gold: #f43f5e;
  --gold-dark: #e11d48;
  --gold-light: #ffe4e6;

  --text-main: #181938;
  --text-muted: #5e6080;
  --border: #e0e2f0;
  --border-strong: #c2c6dc;
  --header-gradient: linear-gradient(135deg, #151648 0%, #25287a 60%, #35399e 100%);
  --card-shadow: 0 4px 12px -2px rgba(37, 40, 122, 0.08);
}

[data-theme="karamel"] {
  /* TEMA 3: Kopi Karamel (Hangat, Bersahaja & Gaya Nordik) */
  --primary: #4a2c1b;
  --primary-dark: #2e1b10;
  --primary-light: #673d26;
  --primary-subtle: #faf4ef;

  --navy: var(--primary);
  --navy-dark: var(--primary-dark);
  --navy-light: var(--primary-light);
  --navy-subtle: var(--primary-subtle);

  --cream: #f7f3ee;
  --cream-card: #ffffff;

  --gold: #d97706;
  --gold-dark: #b45309;
  --gold-light: #fef3c7;

  --text-main: #24160e;
  --text-muted: #6e584a;
  --border: #e6ded7;
  --border-strong: #cfc2b6;
  --header-gradient: linear-gradient(135deg, #24140b 0%, #4a2c1b 60%, #5e3722 100%);
  --card-shadow: 0 4px 12px -2px rgba(74, 44, 27, 0.08);
}

[data-theme="lembayung"], [data-theme="dark"] {
  /* TEMA 4: Lembayung Senja (Royal Amethyst & Sunset Coral) */
  --primary: #4c1d95;
  --primary-dark: #310f6b;
  --primary-light: #6d28d9;
  --primary-subtle: #f5f3ff;

  --navy: var(--primary);
  --navy-dark: var(--primary-dark);
  --navy-light: var(--primary-light);
  --navy-subtle: var(--primary-subtle);

  --cream: #faf7ff;
  --cream-card: #ffffff;

  --gold: #f97316;
  --gold-dark: #ea580c;
  --gold-light: #ffedd5;

  --text-main: #1e1338;
  --text-muted: #64557d;
  --border: #e6ddfa;
  --border-strong: #cdbbf5;
  --header-gradient: linear-gradient(135deg, #230b49 0%, #4c1d95 60%, #6d28d9 100%);
  --card-shadow: 0 4px 12px -2px rgba(76, 29, 149, 0.08);
}

[data-theme="delima"] {
  /* TEMA 5: Mawar Delima (Ruby Crimson & Soft Blossom Rose) */
  --primary: #881337;
  --primary-dark: #4c0519;
  --primary-light: #9f1239;
  --primary-subtle: #fff1f2;

  --navy: var(--primary);
  --navy-dark: var(--primary-dark);
  --navy-light: var(--primary-light);
  --navy-subtle: var(--primary-subtle);

  --cream: #fff8f8;
  --cream-card: #ffffff;

  --gold: #f59e0b;
  --gold-dark: #d97706;
  --gold-light: #fef3c7;

  --text-main: #270813;
  --text-muted: #784a56;
  --border: #f9d5dc;
  --border-strong: #f4abb9;
  --header-gradient: linear-gradient(135deg, #3d0513 0%, #881337 60%, #be123c 100%);
  --card-shadow: 0 4px 12px -2px rgba(136, 19, 55, 0.08);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--cream);
  color: var(--text-main);
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Header */
.app-header {
  height: var(--header-h);
  background: var(--header-gradient, var(--navy));
  color: var(--text-inverse);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: var(--gold);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-badge {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background-color: rgba(255, 255, 255, 0.2);
  margin-left: 6px;
  text-transform: uppercase;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-select {
  background-color: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
}
.theme-select:hover {
  background-color: rgba(255, 255, 255, 0.25);
}
.theme-select option {
  color: #1e293b;
  background: #ffffff;
}

.rombel-select {
  background-color: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
}
.rombel-select option {
  color: var(--text-main);
  background: #fff;
}

.btn-license-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}
.btn-license-badge.demo {
  background-color: var(--gold);
  color: var(--navy-dark);
}
.btn-license-badge.active {
  background-color: var(--emerald);
  color: #fff;
}

.menu-toggle-btn {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  padding: 6px;
  cursor: pointer;
}

/* Layout Container */
.app-layout {
  display: flex;
  flex: 1;
  min-height: calc(100vh - var(--header-h));
}

/* Sidebar Navigation */
.app-sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  height: calc(100vh - var(--header-h));
  position: sticky;
  top: var(--header-h);
}

.sidebar-group {
  padding: 12px 16px 4px;
}
.sidebar-group-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  color: var(--text-main);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all 0.15s ease;
  cursor: pointer;
}
.nav-item:hover {
  background-color: var(--navy-subtle);
  color: var(--navy);
}
.nav-item.active {
  background-color: var(--navy);
  color: #fff;
  font-weight: 600;
}
.nav-item .icon {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
}

/* Main Content Area */
.main-view {
  flex: 1;
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
  .menu-toggle-btn {
    display: block;
  }
  .app-sidebar {
    position: fixed;
    top: var(--header-h);
    left: -100%;
    z-index: 40;
    transition: left 0.25s ease;
    box-shadow: var(--shadow-lg);
  }
  .app-sidebar.open {
    left: 0;
  }
  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--header-h);
    background: rgba(0, 0, 0, 0.4);
    z-index: 35;
  }
  .sidebar-backdrop.open {
    display: block;
  }
  .main-view {
    padding: 16px;
  }
}

/* ==========================================================================
   Print Stylesheet (@media print) - Siap Cetak A4 & PDF Instan Tanpa Word
   ========================================================================== */
@media print {
  /* Sembunyikan elemen antarmuka web yang tidak perlu dicetak */
  .app-header,
  .app-sidebar,
  .sidebar-backdrop,
  .toolbar,
  .btn,
  .modal-overlay,
  .toast,
  .alert-demo-gated,
  #bundleProgressContainer,
  #tahunAjaranNotice {
    display: none !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 10pt;
    line-height: 1.35;
  }

  .app-layout {
    display: block !important;
  }

  .main-view {
    padding: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    width: 100% !important;
  }

  .card {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
  }

  .table-responsive {
    overflow: visible !important;
  }

  .table-dinas {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 9pt !important;
  }

  .table-dinas th,
  .table-dinas td {
    border: 1px solid #000000 !important;
    color: #000000 !important;
    padding: 4px 6px !important;
  }

  .table-dinas th {
    background: #f1f5f9 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  tr {
    page-break-inside: avoid;
  }

  h2, h3, h4 {
    color: #000000 !important;
  }
}
