/* ==========================================================================
   IPHI CODING LAB - DESIGN SYSTEM & MAIN STYLESHEET
   Platform Pembelajaran Coding Interaktif - MA IPHI Pamarican
   Guru Pengampu: Idrus Abdul Kholik
   ========================================================================== */

:root {
  /* Color Palette - Modern Blue & Clean Neutral */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-muted: #dbeafe;
  --primary-dark: #1e3a8a;
  
  --secondary: #0ea5e9;
  --secondary-hover: #0284c7;
  --secondary-light: #f0f9ff;
  
  --accent: #f59e0b;
  --accent-hover: #d97706;
  --accent-light: #fef3c7;
  
  --success: #10b981;
  --success-light: #ecfdf5;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --warning: #f59e0b;
  
  /* Neutral scale (Light Mode) */
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-subtle: #f1f5f9;
  --border-color: #e2e8f0;
  --border-focus: #93c5fd;
  
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #94a3b8;
  --text-inverse: #ffffff;
  
  /* Typography */
  --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Courier New', monospace;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-glow: 0 0 20px -3px rgba(37, 99, 235, 0.35);
  
  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Container sizes */
  --container-max: 1240px;
  --header-height: 72px;
}

/* ==========================================================================
   DARK THEME OVERRIDES
   ========================================================================== */
[data-theme="dark"] {
  --bg-body: #0b1120;
  --bg-surface: #131d32;
  --bg-surface-elevated: #1a2744;
  --bg-subtle: #1e293b;
  --border-color: #243556;
  --border-focus: #3b82f6;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  
  --primary-light: #172554;
  --primary-muted: #1e3a8a;
  --secondary-light: #082f49;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5);
  --shadow-glow: 0 0 25px -3px rgba(59, 130, 246, 0.4);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Custom Modern Scrollbars */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--bg-body);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-subtle);
}

/* Accessible Focus Rings */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

img, svg {
  max-width: 100%;
  display: block;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* ==========================================================================
   UTILITY & LAYOUT
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.text-center { text-align: center; }

/* Badges & Tags */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-secondary { background: var(--secondary-light); color: var(--secondary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--accent-light); color: var(--accent-hover); }
.badge-neutral { background: var(--bg-subtle); color: var(--text-muted); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 0.925rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}
.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 8px rgba(37, 99, 235, 0.35);
  color: #ffffff;
}

.btn-secondary {
  background-color: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background-color: var(--border-color);
  color: var(--text-main);
}

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

[data-theme="dark"] .btn-secondary {
  background-color: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-color);
}
[data-theme="dark"] .btn-secondary:hover {
  background-color: #243556;
  color: #ffffff;
}

[data-theme="dark"] .btn-outline {
  border-color: #60a5fa;
  color: #60a5fa;
}
[data-theme="dark"] .btn-outline:hover {
  background-color: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
}

.btn-success {
  background-color: var(--success);
  color: #ffffff;
}
.btn-success:hover {
  background-color: #059669;
}

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}
.btn-danger:hover {
  background-color: #dc2626;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1.05rem;
  border-radius: var(--radius-lg);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.btn-icon:hover {
  background-color: var(--bg-subtle);
  color: var(--text-main);
}

/* ==========================================================================
   APP HEADER & NAVIGATION
   ========================================================================== */
.app-header {
  height: var(--header-height);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-logo-img {
  height: 42px;
  width: auto;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 3px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition-fast);
  cursor: pointer;
  white-space: nowrap;
}

.nav-link svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  flex-shrink: 0;
}

.nav-link:hover {
  color: var(--primary);
  background-color: var(--primary-light);
}

.nav-link.active {
  color: var(--primary);
  background-color: var(--primary-light);
  font-weight: 700;
}

[data-theme="dark"] .nav-link:hover {
  color: #93c5fd;
  background-color: rgba(37, 99, 235, 0.15);
}

[data-theme="dark"] .nav-link.active {
  background-color: var(--primary-muted);
  color: #60a5fa;
}

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

/* Gamification Pill in Header */
.user-xp-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 4px 12px 4px 6px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-xp-pill:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.xp-level-badge {
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.xp-count-text {
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Mobile Nav Toggle */
.mobile-nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  color: var(--text-main);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mobile-nav-toggle:active {
  transform: scale(0.95);
  background: var(--primary-light);
  color: var(--primary);
}

/* ==========================================================================
   MOBILE QUICK MENU DRAWER
   ========================================================================== */
.mobile-menu-drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1100;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.mobile-menu-drawer-backdrop.active {
  opacity: 1;
  visibility: visible;
}

.mobile-menu-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 86%;
  max-width: 360px;
  height: 100%;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-color);
  box-shadow: var(--shadow-xl);
  z-index: 1101;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-normal) cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.mobile-menu-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
}

.drawer-header-brand strong {
  display: block;
  font-size: 1.05rem;
  letter-spacing: -0.3px;
  color: var(--text-main);
}

.drawer-header-brand span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 18px 30px;
}

.drawer-profile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.drawer-profile-card:hover {
  transform: translateY(-1px);
}

.drawer-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.drawer-profile-info strong {
  display: block;
  font-size: 0.95rem;
}

.drawer-section-title {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-subtle);
  margin: 16px 0 8px 4px;
}

.drawer-links-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.drawer-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  text-decoration: none;
  transition: all var(--transition-fast);
}

.drawer-link:hover, .drawer-link:active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.drawer-link-icon {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
}

.drawer-footer-info {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
  text-align: center;
}

.drawer-school-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ==========================================================================
   MOBILE BOTTOM NAVIGATION (5 CORE TABS)
   ========================================================================== */
.mobile-bottom-nav {
  display: none; /* Desktop default: hidden */
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: calc(60px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  z-index: 999;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  justify-content: space-around;
  align-items: stretch;
}

@media (max-width: 1024px) {
  .mobile-bottom-nav {
    display: flex;
  }
  
  body {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  body.body-workspace-active {
    padding-bottom: 0;
  }
  
  body.body-workspace-active .mobile-bottom-nav {
    display: none; /* Hide bottom nav when in Workspace to maximize coding area */
  }
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  padding: 6px 0;
  color: var(--text-muted);
  text-decoration: none;
  font-family: var(--font-sans);
  position: relative;
  transition: all var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-icon-wrap {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  transition: transform var(--transition-fast), background-color var(--transition-fast);
}

.mobile-nav-icon-wrap svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.2;
}

.mobile-nav-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  line-height: 1;
}

.mobile-nav-item.active {
  color: var(--primary);
}

.mobile-nav-item.active .mobile-nav-label {
  font-weight: 800;
}

.mobile-nav-item.active .mobile-nav-icon-wrap {
  background: var(--primary-light);
  transform: translateY(-2px);
}

.mobile-nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  width: 24px;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 4px 4px;
}

/* Special High-Visibility Highlight for Coding Workspace Tab */
.mobile-nav-coding-highlight .mobile-nav-icon-wrap {
  background: rgba(37, 99, 235, 0.12);
  color: var(--primary);
}

.mobile-nav-coding-highlight.active .mobile-nav-icon-wrap {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.4);
}

/* ==========================================================================
   BOTTOM SHEET MODALS (MOBILE FRIENDLY)
   ========================================================================== */
.modal-bottom-sheet {
  width: 100%;
  max-width: 520px;
  border-radius: var(--radius-xl) var(--radius-xl) var(--radius-lg) var(--radius-lg);
}

.sheet-action-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sheet-action-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sheet-action-btn:hover, .sheet-action-btn:active {
  background: var(--primary-light);
  border-color: var(--primary);
}

.sheet-action-icon {
  font-size: 1.4rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.sheet-action-text strong {
  display: block;
  font-size: 0.92rem;
  color: var(--text-main);
}

.sheet-action-text span {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.sheet-action-btn.sheet-action-danger:hover, .sheet-action-btn.sheet-action-danger:active {
  background: var(--danger-light);
  border-color: var(--danger);
}

/* ==========================================================================
   APP SHELL & PAGE VIEWS
   ========================================================================== */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.page-view {
  display: none;
  padding: 32px 0 64px;
  animation: fadeIn 0.25s ease forwards;
}

.page-view.active {
  display: block;
}

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

/* Hero Section */
.hero-section {
  position: relative;
  padding: 40px 0 32px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.04) 0%, rgba(14, 165, 233, 0.06) 100%);
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 36px;
}

.hero-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
}

.hero-content {
  flex: 1;
  max-width: 660px;
}

.school-ident-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  color: var(--text-main);
}

.hero-title .gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 24px;
}

.hero-cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.hero-graphic {
  flex: 0 0 360px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.hero-code-preview {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
  color: #38bdf8;
  background: #0f172a;
  border-radius: var(--radius-md);
  padding: 16px;
  position: relative;
}

.code-window-header {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.code-window-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #10b981; }

/* Dashboard Quick Stats Bar */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.stat-icon-blue { background: var(--primary-light); color: var(--primary); }
.stat-icon-amber { background: var(--accent-light); color: var(--accent); }
.stat-icon-green { background: var(--success-light); color: var(--success); }
.stat-icon-cyan { background: var(--secondary-light); color: var(--secondary); }

.stat-info h3 {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
}

.stat-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Section Headers */
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.section-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Lanjutkan Belajar Card */
.resume-card {
  background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-subtle) 100%);
  border: 1px solid var(--border-color);
  border-left: 5px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 40px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.resume-details h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.resume-details h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.resume-details p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Grid of Cards (Lessons, Challenges, Projects, Templates) */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
  margin-bottom: 40px;
}

.content-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.content-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.card-media {
  height: 160px;
  background-color: var(--bg-subtle);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.card-media-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-badge-float {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

.card-body {
  padding: 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-body h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.4;
}

.card-body p {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: 16px;
  flex: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-subtle);
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
  margin-top: auto;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* ==========================================================================
   MATERI / LESSONS DETAIL VIEW
   ========================================================================== */
.modules-filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 24px;
}

.filter-btn {
  padding: 8px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.filter-btn:hover, .filter-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.module-group {
  margin-bottom: 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.module-header {
  padding: 18px 24px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.module-header-info h3 {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.module-lessons-list {
  padding: 0;
  list-style: none;
}

.lesson-item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  transition: background-color var(--transition-fast);
}

.lesson-item-row:last-child {
  border-bottom: none;
}

.lesson-item-row:hover {
  background-color: var(--primary-light);
}

[data-theme="dark"] .lesson-item-row:hover {
  background-color: var(--primary-muted);
}

.lesson-title-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lesson-status-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--text-subtle);
  flex-shrink: 0;
}

.lesson-status-icon.done {
  background: var(--success-light);
  color: var(--success);
}

/* Modal Reader for Lessons */
.lesson-modal-content {
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
}

.lesson-article h2 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.lesson-objectives {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  padding: 16px;
  border-radius: var(--radius-sm);
  margin: 16px 0 24px;
  font-size: 0.95rem;
}

.lesson-code-block {
  background: #0f172a;
  color: #f8fafc;
  border-radius: var(--radius-md);
  padding: 18px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 16px 0;
  overflow-x: auto;
  position: relative;
}

.copy-code-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.75rem;
}
.copy-code-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.lesson-explanation-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 16px 0;
}

.lesson-quiz-box {
  background: var(--bg-surface);
  border: 2px dashed var(--primary);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin: 24px 0;
}

/* ==========================================================================
   TANTANGAN / CHALLENGES
   ========================================================================== */
.challenge-card {
  border-top: 4px solid var(--primary);
}

.challenge-card.pemula { border-top-color: #10b981; }
.challenge-card.menengah { border-top-color: #3b82f6; }
.challenge-card.lanjutan { border-top-color: #8b5cf6; }

.challenge-modal-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-height: 80vh;
}

.challenge-instructions-panel {
  overflow-y: auto;
  padding-right: 12px;
}

.challenge-editor-panel {
  display: flex;
  flex-direction: column;
}

.checklist-items {
  list-style: none;
  margin: 16px 0;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background: var(--bg-subtle);
}

.checklist-item.pass {
  background: var(--success-light);
  color: var(--success);
  font-weight: 600;
}

.checklist-item.fail {
  background: var(--danger-light);
  color: var(--danger);
}

/* ==========================================================================
   KUIS / QUIZZES
   ========================================================================== */
.quiz-container {
  max-width: 800px;
  margin: 0 auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-md);
}

.quiz-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}

.quiz-question-number {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
}

.quiz-progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  margin-bottom: 24px;
  overflow: hidden;
}

.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  width: 0%;
  transition: width var(--transition-normal);
}

.quiz-question-text {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 24px;
  line-height: 1.5;
}

.quiz-code-snippet {
  background: #0f172a;
  color: #f8fafc;
  padding: 14px;
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  margin-bottom: 20px;
  white-space: pre-wrap;
}

.quiz-options-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.quiz-option-btn {
  padding: 14px 18px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  text-align: left;
  font-size: 0.95rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition-fast);
}

.quiz-option-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.quiz-option-key {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.quiz-option-btn.selected {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.quiz-option-btn.correct {
  border-color: var(--success) !important;
  background-color: var(--success-light) !important;
  color: var(--success) !important;
}

.quiz-option-btn.incorrect {
  border-color: var(--danger) !important;
  background-color: var(--danger-light) !important;
  color: var(--danger) !important;
}

.quiz-explanation-box {
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 16px;
  border-left: 4px solid var(--primary);
  font-size: 0.9rem;
}

/* Quiz Result Score Card */
.quiz-result-view {
  text-align: center;
  padding: 24px 0;
}

.score-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) calc(var(--score-pct) * 1%), var(--bg-subtle) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  position: relative;
}

.score-circle-inner {
  width: 116px;
  height: 116px;
  background: var(--bg-surface);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-number {
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1;
  color: var(--primary);
}

.score-total {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   CATATAN BELAJAR (STUDENT NOTES)
   ========================================================================== */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.note-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: all var(--transition-fast);
}

.note-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.note-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-bottom: 10px;
  display: inline-block;
  width: fit-content;
}

.tag-ringkasan { background: #dbeafe; color: #1e40af; }
.tag-snippet { background: #fef3c7; color: #92400e; }
.tag-error { background: #fee2e2; color: #991b1b; }
.tag-ide { background: #e0e7ff; color: #3730a3; }

.note-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.note-body {
  font-size: 0.875rem;
  color: var(--text-muted);
  white-space: pre-wrap;
  margin-bottom: 16px;
  flex: 1;
}

.note-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
  font-size: 0.75rem;
  color: var(--text-subtle);
}

/* ==========================================================================
   PROFIL & GAMIFIKASI
   ========================================================================== */
.profile-hero {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 32px;
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 36px;
  box-shadow: var(--shadow-sm);
}

.profile-avatar-large {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2.5rem;
  font-weight: 800;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

.profile-level-progress-bar {
  height: 10px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  margin: 10px 0 6px;
  overflow: hidden;
}

.profile-level-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
  border-radius: var(--radius-full);
  transition: width 0.4s ease;
}

/* Badge Showcase */
.badges-shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.badge-item-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: all var(--transition-fast);
}

.badge-item-card.locked {
  opacity: 0.45;
  filter: grayscale(1);
}

.badge-item-card.unlocked {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

.badge-icon-bubble {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
}

.badge-item-name {
  font-size: 0.9rem;
  font-weight: 700;
}

.badge-item-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   MODE PRESENTASI GURU (TEACHER VIEW)
   ========================================================================== */
.teacher-hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
  color: #fff;
  border-radius: var(--radius-xl);
  padding: 36px;
  margin-bottom: 36px;
}

.teacher-hero h2 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.teacher-hero p {
  color: #93c5fd;
  max-width: 700px;
}

.rubric-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-top: 16px;
}

.rubric-table th, .rubric-table td {
  padding: 14px 18px;
  border: 1px solid var(--border-color);
  text-align: left;
}

.rubric-table th {
  background: var(--bg-subtle);
  font-weight: 700;
  font-size: 0.9rem;
}

.rubric-table td {
  font-size: 0.875rem;
}

/* Projector Demo Mode */
.projector-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  background: #0f172a;
  color: #f8fafc;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.projector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid #334155;
  padding-bottom: 12px;
}

.projector-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.projector-editor-text {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  line-height: 1.6;
  background: #1e293b;
  color: #38bdf8;
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid #475569;
  resize: none;
}

.projector-preview-frame {
  width: 100%;
  height: 100%;
  background: #ffffff;
  border-radius: var(--radius-md);
  border: none;
}

/* ==========================================================================
   MODAL COMPONENT
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.modal-backdrop.active {
  display: flex;
  opacity: 1;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 640px;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.97);
  transition: all var(--transition-normal);
}

.modal-backdrop.active .modal-box {
  transform: translateY(0) scale(1);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(85vh - 140px);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: var(--bg-subtle);
}

/* Form inputs inside modals/pages */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-main);
  transition: border-color var(--transition-fast);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 420px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
  animation: slideInToast 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideInToast {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-error { border-left: 4px solid var(--danger); }
.toast.toast-info { border-left: 4px solid var(--primary); }
.toast.toast-warning { border-left: 4px solid var(--accent); }

/* ==========================================================================
   BUTTON LINK UTILITY
   ========================================================================== */
.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}
.btn-link:hover {
  color: var(--primary-hover);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.app-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 40px 0 24px;
  margin-top: auto;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 24px;
}

.footer-school-info {
  max-width: 480px;
}

.footer-school-info h4 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 6px;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
  font-size: 0.8rem;
  color: var(--text-subtle);
}
