/* ==========================================================================
   IMAM.LAB CENTRAL HUB DASHBOARD — STYLESHEET
   Platform: Papan Interaktif Digital (PID), Desktop, Tablet, Mobile
   Aesthetic: Studio Kurikulum Modern, High-Contrast WCAG AAA, Anti-Slop
   ========================================================================== */

:root {
  /* Dark Mode Tokens (Default: Proyektor & Smartboard Classroom) */
  --bg-app: #0B1120;
  --bg-surface: #0F172A;
  --bg-surface-elevated: #1E293B;
  --bg-surface-subtle: #141E33;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-elevated: #334155;
  --border-focus: #F59E0B;

  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-dim: #64748B;

  --accent-amber: #F59E0B;
  --accent-amber-glow: rgba(245, 158, 11, 0.22);
  --status-ready: #10B981;
  --status-ready-glow: rgba(16, 185, 129, 0.22);

  /* Subject Thematic Colors */
  --subject-informatika: #0D9488;
  --subject-geografi: #059669;
  --subject-sosiologi: #2563EB;
  --subject-utilitas: #7C3AED;
  --subject-sains: #0284C7;
  --subject-matematika: #D97706;
  --subject-umum: #6366F1;

  /* Typography */
  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-code: 'JetBrains Mono', 'Fira Code', monospace;

  /* Elevation */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 15px 35px rgba(0, 0, 0, 0.55);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

[data-theme="light"] {
  /* Light Mode Tokens (Ruang Kelas Terang) */
  --bg-app: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-surface-elevated: #F1F5F9;
  --bg-surface-subtle: #F8FAFC;
  --border-color: #E2E8F0;
  --border-elevated: #CBD5E1;
  --border-focus: #D97706;

  --text-main: #0F172A;
  --text-muted: #475569;
  --text-dim: #94A3B8;

  --accent-amber: #D97706;
  --accent-amber-glow: rgba(217, 119, 6, 0.15);
  --status-ready: #059669;
  --status-ready-glow: rgba(5, 150, 105, 0.15);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 15px 35px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   RESET & LAYOUT BASE
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--bg-app);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  transition: background-color 0.2s ease, color 0.2s ease;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: 13.5px;
}

.hidden { display: none !important; }

/* Dashboard Shell */
.dashboard-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   TOP NAVIGATION BAR (64px)
   ========================================================================== */
.top-nav-bar {
  height: 64px;
  padding: 0 24px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.nav-brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 320px;
}

.brand-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-amber), #EA580C);
  color: #0B1120;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 2px 8px var(--accent-amber-glow);
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-eyebrow {
  font-family: var(--font-code);
  font-size: 9.5px;
  font-weight: 700;
  color: var(--accent-amber);
  letter-spacing: 0.08em;
}

.brand-heading {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

/* Search Bar */
.nav-search-wrap {
  flex: 1;
  max-width: 480px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  font-size: 13px;
  pointer-events: none;
  opacity: 0.6;
}

.search-field {
  width: 100%;
  height: 38px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-elevated);
  border-radius: 20px;
  padding: 0 34px 0 36px;
  color: var(--text-main);
  transition: all 0.15s ease;
}

.search-field:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 10px var(--accent-amber-glow);
  background: var(--bg-surface);
}

.btn-clear-search {
  position: absolute;
  right: 10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--border-elevated);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

/* Nav Tools */
.nav-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-nav-tool {
  height: 36px;
  padding: 0 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-elevated);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  transition: all 0.15s ease;
}

.btn-nav-tool:hover {
  border-color: var(--text-muted);
  transform: translateY(-1px);
}

.btn-icon-only {
  padding: 0 10px;
}

/* ==========================================================================
   METRIC & ACTION STRIP (Sub-header)
   ========================================================================== */
.metric-action-strip {
  padding: 12px 24px;
  background: var(--bg-surface-subtle);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.strip-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text-main);
}

.stat-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-ready);
  box-shadow: 0 0 8px var(--status-ready);
}

.subtle-pill {
  color: var(--text-muted);
  font-size: 12px;
}

.strip-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-action-primary {
  padding: 8px 16px;
  background: var(--accent-amber);
  color: #0B1120;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  box-shadow: 0 2px 8px var(--accent-amber-glow);
}

.btn-action-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-action-secondary {
  padding: 8px 14px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-elevated);
  color: var(--text-main);
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-action-secondary:hover {
  border-color: var(--text-muted);
}

.btn-action-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-muted);
}
.btn-action-icon:hover { color: var(--text-main); }

/* ==========================================================================
   CATEGORY FILTER NAVIGATION PILLS
   ========================================================================== */
.category-filter-section {
  padding: 12px 24px;
  background: var(--bg-app);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
}

.category-pills-list {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-category-pill {
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-category-pill:hover {
  color: var(--text-main);
  border-color: var(--border-elevated);
}

.btn-category-pill.active {
  background: var(--text-main);
  color: var(--bg-app);
  border-color: var(--text-main);
  font-weight: 700;
}

.pill-count {
  font-family: var(--font-code);
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.12);
}

.btn-category-pill.active .pill-count {
  background: var(--bg-app);
  color: var(--text-main);
}

/* ==========================================================================
   MAIN CONTENT STAGE & MEDIA CARDS GRID
   ========================================================================== */
.main-content-stage {
  flex: 1;
  padding: 24px;
  max-width: 1560px;
  margin: 0 auto;
  width: 100%;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
}

/* Media Card Component */
.media-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
}

.media-card:hover {
  transform: translateY(-4px);
  border-color: var(--card-accent, var(--border-elevated));
  box-shadow: var(--shadow-md);
}

.card-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-subject-tag {
  font-family: var(--font-code);
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.04em;
  color: #FFFFFF;
}

.card-grade-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
}

/* Card Body */
.card-body-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-title-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.card-icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  border: 1px solid var(--border-color);
}

.card-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
}

.card-description {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Feature Badges */
.card-features-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.feature-tag-chip {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-dim);
  background: var(--bg-surface-elevated);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

/* Card Actions */
.card-actions-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
}

.btn-launch-primary {
  flex: 1;
  padding: 9px 14px;
  background: var(--card-accent, var(--accent-amber));
  color: #FFFFFF;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-launch-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-launch-preview {
  padding: 9px 12px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-elevated);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.btn-launch-preview:hover {
  border-color: var(--text-muted);
}

.btn-launch-standalone {
  padding: 9px 10px;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 4px;
}
.btn-launch-standalone:hover { color: var(--text-main); border-color: var(--border-elevated); }

/* Empty State */
.empty-state-card {
  text-align: center;
  padding: 60px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-icon {
  font-size: 40px;
  opacity: 0.6;
}

.empty-title {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text-main);
}

.empty-desc {
  font-size: 13px;
  color: var(--text-muted);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.dashboard-footer {
  padding: 16px 24px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
  flex-wrap: wrap;
  gap: 10px;
}

.footer-left strong { color: var(--text-muted); }
.footer-dot { margin: 0 4px; }

/* ==========================================================================
   MODAL WINDOWS & PREVIEW IFRAME
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 17, 32, 0.88);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
  animation: modalFade 0.2s ease;
}

@keyframes modalFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-window {
  background: var(--bg-surface);
  border: 1px solid var(--border-elevated);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Embedded Fullscreen Preview Modal */
.preview-window {
  width: 96vw;
  height: 94vh;
  max-width: 1720px;
}

.preview-header {
  height: 52px;
  padding: 0 16px;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.preview-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.preview-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.btn-preview-tool {
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-elevated);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 5px;
}

.btn-highlight {
  background: var(--accent-amber);
  color: #0B1120;
  font-weight: 700;
}

.btn-preview-close {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  background: #EF4444;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
}

.preview-iframe-wrapper {
  flex: 1;
  background: #000;
  position: relative;
}

.preview-iframe-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

/* Form Window (Tambah Manual) */
.form-window, .help-window {
  max-width: 580px;
  max-height: 90vh;
}

.modal-header {
  padding: 18px 24px 12px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

.header-tag {
  font-family: var(--font-code);
  font-size: 10px;
  font-weight: 800;
  color: var(--accent-amber);
  letter-spacing: 0.08em;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 2px;
}

.btn-close-modal {
  position: absolute;
  top: 18px;
  right: 20px;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface-elevated);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-close-modal:hover { color: var(--text-main); }

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
}

.form-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input, .form-select, .form-textarea {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-elevated);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--text-main);
  width: 100%;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

/* Help Window */
.help-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.help-section h3 {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--text-main);
}

.help-section p {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.code-box {
  background: #000;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-code);
  font-size: 12px;
  color: var(--accent-amber);
}

/* Toast */
.toast-box {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--accent-amber);
  box-shadow: var(--shadow-lg);
  padding: 10px 18px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  z-index: 300;
  animation: toastIn 0.2s ease;
}

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

/* Responsive Breakpoints */
@media (max-width: 800px) {
  .top-nav-bar {
    height: auto;
    padding: 12px 16px;
    flex-wrap: wrap;
  }
  .nav-brand-group {
    min-width: unset;
  }
  .nav-search-wrap {
    order: 3;
    max-width: 100%;
    width: 100%;
    margin-top: 8px;
  }
  .metric-action-strip {
    padding: 12px 16px;
  }
  .main-content-stage {
    padding: 16px;
  }
  .media-grid {
    grid-template-columns: 1fr;
  }
}

