/* ==========================================================================
   Platform Belajar AI - Design System (Modern Clean SaaS)
   Responsive, Elegant, Professional, Zero-Emoji Architecture
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  /* Typography */
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  /* Color Palette: Modern Slate & Vibrant Indigo */
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-subtle: #f5f3ff;
  --primary-ring: rgba(79, 70, 229, 0.2);

  --bg-main: #f8fafc;
  --surface: #ffffff;
  --surface-hover: #fbfcfe;
  --surface-muted: #f1f5f9;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;

  --border: #e2e8f0;
  --border-focus: #818cf8;
  --border-subtle: #f1f5f9;

  /* Functional Status Colors */
  --success: #059669;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --success-text: #065f46;

  --warning: #d97706;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --warning-text: #92400e;

  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  --danger-text: #991b1b;

  --info: #0284c7;
  --info-bg: #f0f9ff;
  --info-border: #bae6fd;
  --info-text: #075985;

  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.07), 0 1px 2px -1px rgba(15, 23, 42, 0.07);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 15px -3px rgba(15, 23, 42, 0.07), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.04);

  /* Layout Measurements */
  --nav-height: 64px;
  --mobile-bar-height: 66px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.55;
  letter-spacing: -0.011em;
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  touch-action: manipulation;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text-main);
  letter-spacing: -0.025em;
  font-weight: 700;
  line-height: 1.25;
}

p {
  line-height: 1.6;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}

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

/* ==========================================================================
   Header & Top Navigation (Glassmorphic)
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: box-shadow 0.2s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
  opacity: 0.92;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
  flex-shrink: 0;
}

.brand-name {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.brand-name-ai {
  background: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}

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

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.15s ease;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--surface-muted);
  color: var(--text-main);
  text-decoration: none;
}

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

.nav-points-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  background: var(--primary-light);
  border: 1px solid rgba(79, 70, 229, 0.2);
  border-radius: var(--radius-full);
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  transition: all 0.15s ease;
}

.nav-points-badge:hover {
  background: rgba(79, 70, 229, 0.15);
  color: var(--primary-hover);
  text-decoration: none;
}

.nav-user-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.65rem 0.35rem 0.45rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  color: var(--text-main);
  font-weight: 600;
  margin-left: 0.25rem;
  text-decoration: none;
  transition: all 0.15s ease;
}

.nav-user-badge:hover,
.nav-user-badge.active {
  background: var(--surface);
  border-color: var(--primary);
  text-decoration: none;
}

.nav-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
}

.nav-avatar-img {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--primary-light);
}

.nav-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--danger-text);
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.nav-logout-btn:hover {
  background: #fee2e2;
  color: var(--danger-text);
  text-decoration: none;
}

/* ==========================================================================
   Site Footer
   ========================================================================== */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 2.75rem 1.5rem 2.25rem;
  margin-top: auto;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.site-footer-container {
  max-width: 920px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  align-items: center;
}

.site-footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  color: var(--text-main);
}

.site-footer-tagline {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 700;
  background: var(--primary-light);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--primary-ring);
  letter-spacing: 0.03em;
}

.site-footer-creator {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-main);
}

.site-footer-creator strong {
  color: var(--primary);
  font-weight: 700;
}

.site-footer-academic {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  line-height: 1.5;
}

.site-footer-copy {
  font-size: 0.775rem;
  color: #94a3b8;
  margin-top: 0.35rem;
}

/* Minimalist Initiative Tag for Landing Hero (Centered on Desktop/Browser, Left-Aligned on Android/Mobile) */
.hero-initiative-container {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
  width: 100%;
}

@media (max-width: 768px) {
  .hero-initiative-container {
    justify-content: flex-start;
    margin-bottom: 1.5rem;
  }
}

.hero-initiative-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.32rem 0.72rem;
  border-radius: 3px;
  font-size: 0.775rem;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  max-width: 100%;
  flex-wrap: wrap;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: default;
}

.hero-initiative-tag:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.06);
}

.hero-initiative-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 1px;
  flex-shrink: 0;
}

.hero-initiative-title {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.75rem;
  letter-spacing: -0.01em;
}

.hero-initiative-divider {
  display: inline-block;
  width: 1px;
  height: 11px;
  background: var(--border);
  flex-shrink: 0;
}

.hero-initiative-subtitle {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.75rem;
}

.cycle-step-card {
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.cycle-step-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px -4px rgba(79, 70, 229, 0.1), 0 4px 8px -2px rgba(15, 23, 42, 0.04) !important;
  border-color: rgba(99, 102, 241, 0.35) !important;
}

.founder-contact-chip {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.founder-contact-chip:hover {
  color: var(--primary) !important;
  border-color: rgba(99, 102, 241, 0.4) !important;
  background: #f8faff !important;
  transform: translateY(-1.5px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.08);
}

.footer-chip {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.footer-chip:hover {
  color: var(--primary) !important;
  border-color: var(--primary-ring) !important;
  background: var(--primary-light) !important;
  transform: translateY(-1px);
}

/* ==========================================================================
   Mobile Bottom Navigation Bar (Hidden on Desktop)
   ========================================================================== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  padding: 0.4rem 0.5rem calc(0.4rem + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.04);
}

.mobile-nav-container {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 500px;
  margin: 0 auto;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.35rem 0.25rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  flex: 1 1 0;
  min-width: 0;
  max-width: 80px;
  position: relative;
  text-decoration: none;
  transition: all 0.15s ease;
  touch-action: manipulation;
}

.mobile-nav-item:hover,
.mobile-nav-item:focus {
  text-decoration: none;
  color: var(--text-main);
}

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

.mobile-nav-item svg {
  width: 20px;
  height: 20px;
  stroke-width: 2px;
  transition: transform 0.15s ease;
}

.mobile-nav-item.active svg {
  stroke: var(--primary);
  transform: translateY(-1px);
}

.mobile-nav-badge {
  position: absolute;
  top: 2px;
  right: 14px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid #ffffff;
}

/* ==========================================================================
   Layout & Container
   ========================================================================== */
.container {
  max-width: 1120px;
  margin: 2rem auto;
  padding: 0 1.25rem;
  flex: 1;
  width: 100%;
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

/* ==========================================================================
   Buttons & Interactive Elements
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease-in-out;
  text-decoration: none;
  touch-action: manipulation;
  white-space: nowrap;
}

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

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;
  text-decoration: none;
  box-shadow: 0 4px 8px rgba(79, 70, 229, 0.3);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-main);
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  background: var(--surface-muted);
  border-color: #cbd5e1;
  color: var(--text-main);
  text-decoration: none;
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.btn-danger:hover {
  background: #fee2e2;
  color: #7f1d1d;
  text-decoration: none;
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.825rem;
  border-radius: var(--radius-xs);
}

.btn-lg {
  padding: 0.8rem 1.75rem;
  font-size: 1rem;
  border-radius: var(--radius);
}

/* ==========================================================================
   Form Controls
   ========================================================================== */
.form-group {
  margin-bottom: 1.25rem;
}

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

.form-control {
  width: 100%;
  padding: 0.65rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.925rem;
  background-color: var(--surface);
  color: var(--text-main);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--primary-ring);
}

.form-control::placeholder {
  color: var(--text-subtle);
}

textarea.form-control {
  resize: vertical;
  min-height: 90px;
}

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  padding-right: 2.25rem;
  -webkit-appearance: none;
  appearance: none;
}

/* ==========================================================================
   Badges & Status Pills
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  line-height: 1.3;
  letter-spacing: 0.02em;
}

.badge-ready {
  background: var(--success-bg);
  color: var(--success-text);
  border: 1px solid var(--success-border);
}

.badge-processing {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid var(--warning-border);
}

.badge-failed {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

.badge-pending {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

/* ==========================================================================
   Dashboard Stats Grid
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: all 0.2s ease;
}

.stat-card:hover {
  box-shadow: var(--shadow);
  border-color: #cbd5e1;
}

.stat-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-val {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.stat-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* ==========================================================================
   Grid & Responsive Tables
   ========================================================================== */
.grid-materi {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 1.25rem;
}

.materi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.materi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

/* Desktop & Mobile Responsive Table */
.table-container {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.responsive-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.925rem;
}

.responsive-table thead tr {
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
}

.responsive-table th {
  padding: 0.9rem 1.15rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.responsive-table td {
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

.responsive-table tbody tr:last-child td {
  border-bottom: none;
}

.responsive-table tbody tr {
  transition: background-color 0.15s ease;
}

.responsive-table tbody tr:hover {
  background-color: var(--surface-hover);
}

/* ==========================================================================
   Materi Detail Header & Action Toolbar
   ========================================================================== */
.materi-header {
  margin-bottom: 1.75rem;
}

.materi-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
  text-decoration: none;
  transition: color 0.15s ease;
}

.materi-breadcrumb:hover {
  color: var(--primary);
  text-decoration: none;
}

.materi-breadcrumb svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.materi-header-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
}

.materi-header-info {
  flex: 1;
  min-width: 0;
}

.materi-header-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.materi-header-title {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin: 0;
  word-break: break-word;
  overflow-wrap: break-word;
}

.materi-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  padding-top: 0.2rem;
}

.materi-action-delete-form {
  display: inline-flex;
  margin: 0;
  padding: 0;
}

/* Unified Action Buttons: Edit, Chat Tutor AI, Hapus */
.btn-action-edit,
.btn-action-chat,
.btn-action-delete {
  height: 40px;
  min-height: 40px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  vertical-align: middle;
  transition: all 0.15s ease-in-out;
  white-space: nowrap;
}

.btn-action-edit {
  gap: 0.45rem;
  padding: 0 1rem;
  background: var(--surface);
  color: var(--text-main);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.btn-action-edit:hover {
  background: var(--surface-muted);
  border-color: #cbd5e1;
  color: var(--text-main);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

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

.btn-action-edit svg {
  flex-shrink: 0;
}

.btn-action-chat {
  gap: 0.5rem;
  padding: 0 1.25rem;
  background: var(--primary);
  color: #ffffff;
  border: 1px solid var(--primary);
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.22);
}

.btn-action-chat:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.32);
}

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

.btn-action-chat svg {
  flex-shrink: 0;
}

.btn-action-delete {
  width: 40px;
  padding: 0;
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid var(--danger-border);
}

.btn-action-delete:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.15);
}

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

.btn-action-delete svg {
  flex-shrink: 0;
}

.materi-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.quiz-attempt-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.85rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.15s ease;
}

.quiz-attempt-item:hover {
  border-color: #cbd5e1;
}

/* ==========================================================================
   Quiz History Page - Modern SaaS & Mobile Android First
   ========================================================================== */
.quiz-history-wrapper {
  max-width: 860px;
  margin: 1rem auto 3rem;
  padding: 0 1rem;
}

.quiz-history-nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.quiz-history-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.825rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}
.quiz-history-back-btn:hover {
  background: var(--surface-muted);
  color: var(--text-main);
  border-color: #cbd5e1;
  transform: translateX(-1px);
}

.quiz-history-new-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  border: 1px solid #c7d2fe;
  color: var(--primary);
  font-size: 0.825rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.15s ease;
}
.quiz-history-new-btn:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.quiz-history-header {
  margin-bottom: 1.5rem;
}

.quiz-history-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #4338ca;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.quiz-history-title {
  font-size: clamp(1.4rem, 4.5vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #0f172a;
  line-height: 1.25;
  margin: 0 0 0.4rem 0;
}

.quiz-history-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 0;
}

/* 3-Column Responsive Stats Row */
.quiz-history-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.quiz-history-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.quiz-history-stat-card .stat-icon-wrapper {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quiz-history-stat-card .stat-number {
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.15;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.quiz-history-stat-card .stat-title {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.15rem;
}

/* History Section Box & Attempt Cards */
.quiz-history-card-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.quiz-history-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.85rem;
  margin-bottom: 1.25rem;
}

.quiz-history-section-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
  margin: 0;
}

.quiz-history-count-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--surface-muted);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
}

.quiz-history-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.quiz-attempt-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.15rem;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}
.quiz-attempt-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.quiz-attempt-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  margin-bottom: 0.85rem;
}

.quiz-attempt-header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quiz-attempt-num {
  font-size: 0.875rem;
  font-weight: 800;
  color: #0f172a;
}

.quiz-attempt-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.725rem;
  font-weight: 700;
}
.quiz-attempt-status-pill.status-pass {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #10b981;
}
.quiz-attempt-status-pill.status-review {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #f43f5e;
}

.quiz-attempt-date {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  color: var(--text-subtle);
  font-weight: 500;
}

.quiz-attempt-body {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.quiz-score-badge-box {
  width: 62px;
  height: 62px;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1.5px solid transparent;
}
.quiz-score-badge-box.score-pass {
  background: #ecfdf5;
  border-color: #10b981;
  color: #047857;
}
.quiz-score-badge-box.score-review {
  background: #fff1f2;
  border-color: #f43f5e;
  color: #be123c;
}

.quiz-score-num {
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

.quiz-score-lbl {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  margin-top: 0.15rem;
  letter-spacing: 0.02em;
}

.quiz-attempt-details {
  flex: 1;
  min-width: 0;
}

.quiz-attempt-quiz-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quiz-attempt-pills {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.quiz-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.quiz-stat-pill.pill-correct {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}
.quiz-stat-pill.pill-wrong {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.quiz-stat-pill.pill-perfect {
  background: #eef2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}
.quiz-stat-pill.pill-total {
  background: #f8fafc;
  color: #64748b;
  border: 1px solid var(--border);
}

.quiz-attempt-footer {
  display: flex;
  justify-content: flex-end;
}

.btn-review-attempt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: var(--primary);
  color: #ffffff;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.2);
}
.btn-review-attempt:hover {
  background: var(--primary-hover);
  box-shadow: 0 3px 8px rgba(79, 70, 229, 0.3);
  transform: translateY(-1px);
}

/* Android & Mobile Screens (<640px) */
@media (max-width: 640px) {
  .quiz-history-wrapper {
    padding: 0 0.75rem;
    margin: 0.75rem auto 2.5rem;
  }
  .quiz-history-stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.45rem;
    margin-bottom: 1.25rem;
  }
  .quiz-history-stat-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.7rem 0.35rem;
    gap: 0.3rem;
  }
  .quiz-history-stat-card .stat-icon-wrapper {
    width: 32px;
    height: 32px;
  }
  .quiz-history-stat-card .stat-number {
    font-size: 1.1rem;
  }
  .quiz-history-stat-card .stat-title {
    font-size: 0.68rem;
  }
  .quiz-history-card-box {
    padding: 1rem 0.85rem;
    border-radius: var(--radius-sm);
  }
  .quiz-attempt-card {
    padding: 0.95rem 0.85rem;
  }
  .quiz-score-badge-box {
    width: 52px;
    height: 52px;
  }
  .quiz-score-num {
    font-size: 1.15rem;
  }
  .quiz-score-lbl {
    font-size: 0.58rem;
  }
  .btn-review-attempt {
    width: 100%;
    padding: 0.7rem 1rem;
    font-size: 0.875rem;
  }
}

/* ==========================================================================
   Flashcard SM-2 Scene
   ========================================================================== */
.flashcard-scene {
  perspective: 1200px;
  margin: 1.25rem auto;
  max-width: 600px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.flashcard {
  width: 100%;
  min-height: 320px;
  position: relative;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.flashcard.is-flipped {
  transform: rotateY(180deg);
}

.flashcard-face {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  padding: 1.75rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-sizing: border-box;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* Custom subtle scrollbar */
.flashcard-face::-webkit-scrollbar {
  width: 5px;
}
.flashcard-face::-webkit-scrollbar-track {
  background: transparent;
}
.flashcard-face::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 10px;
}

.flashcard-content-wrap {
  margin: auto 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.flashcard-face-back {
  transform: rotateY(180deg);
  background: #ffffff;
  border-color: #cbd5e1;
}

.ratings-group {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* ==========================================================================
   Chat Interface (AI Tutor)
   ========================================================================== */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 240px);
  min-height: 480px;
  max-height: 720px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
  background: #fafbfc;
}

.chat-bubble {
  max-width: 82%;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  line-height: 1.55;
  box-shadow: var(--shadow-xs);
  word-break: break-word;
}

.chat-bubble-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.chat-bubble-assistant {
  align-self: flex-start;
  background: var(--surface);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.chat-rujukan {
  margin-top: 0.65rem;
  font-size: 0.8rem;
  color: #64748b;
  border-top: 1px dashed var(--border);
  padding-top: 0.45rem;
}

.chat-input-bar {
  display: flex;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  gap: 0.75rem;
  align-items: center;
}

/* ==========================================================================
   Markdown & Content Formatting
   ========================================================================== */
.markdown-content p,
.chat-bubble p {
  margin-bottom: 0.65rem;
  line-height: 1.6;
}

.markdown-content p:last-child,
.chat-bubble p:last-child {
  margin-bottom: 0;
}

.markdown-content strong,
.chat-bubble strong {
  font-weight: 700;
  color: inherit;
}

.markdown-content ul,
.markdown-content ol,
.chat-bubble ul,
.chat-bubble ol {
  margin: 0.45rem 0 0.75rem 1.35rem;
  padding-left: 0.25rem;
  line-height: 1.6;
}

.markdown-content li,
.chat-bubble li {
  margin-bottom: 0.35rem;
}

.markdown-content li:last-child,
.chat-bubble li:last-child {
  margin-bottom: 0;
}

.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

.markdown-content,
.chat-bubble {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.markdown-content pre,
.chat-bubble pre {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  margin: 0.85rem 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
}

.markdown-content code,
.chat-bubble code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface-muted);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  word-break: break-word;
}

.markdown-content pre code,
.chat-bubble pre code {
  background: transparent;
  padding: 0;
  border: none;
  white-space: pre;
  word-break: normal;
}

.markdown-content table,
.chat-bubble table {
  width: 100%;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
  margin: 1rem 0;
}

.markdown-content th,
.markdown-content td,
.chat-bubble th,
.chat-bubble td {
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  font-size: 0.875rem;
}

.markdown-content th,
.chat-bubble th {
  background: var(--surface-muted);
  font-weight: 700;
}

.markdown-content blockquote,
.chat-bubble blockquote {
  border-left: 4px solid var(--primary);
  background: var(--surface-muted);
  padding: 0.65rem 1rem;
  margin: 0.85rem 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-muted);
}

.markdown-content img,
.chat-bubble img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Spinners & Animations
   ========================================================================== */
.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(79, 70, 229, 0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==========================================================================
   MOBILE RESPONSIVENESS (< 768px)
   ========================================================================== */
@media (max-width: 768px) {
  /* Prevent iOS Safari auto-zooming into inputs on focus */
  input, select, textarea, .form-control {
    font-size: 16px !important;
  }

  /* Show Mobile Bottom Navigation */
  .mobile-bottom-nav {
    display: block;
  }

  /* Compact Navbar for Mobile */
  .navbar {
    padding: 0 0.85rem;
    height: 58px;
  }

  .brand {
    font-size: 1.05rem;
    gap: 0.45rem;
    flex-shrink: 0;
  }

  .brand-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }

  .nav-links {
    gap: 0.35rem;
    flex-shrink: 1;
    min-width: 0;
    justify-content: flex-end;
  }

  /* Hide Desktop Nav Links on Mobile */
  .nav-links .nav-item {
    display: none;
  }

  .nav-points-badge {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav-user-badge {
    padding: 0.25rem 0.4rem;
    margin-left: 0;
    font-size: 0.8rem;
  }

  .nav-user-badge .nav-user-name {
    display: none; /* Hide name on phone screen; avatar is sufficient */
  }

  .nav-logout-btn {
    padding: 0.35rem 0.5rem;
    min-height: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .nav-logout-btn .nav-logout-text {
    display: none; /* Icon-only logout on mobile */
  }

  /* Safe Padding for Mobile Screen & Prevent Viewport Overflow */
  .container {
    padding: 0 0.85rem;
    margin: 1rem auto;
    padding-bottom: calc(var(--mobile-bar-height) + 2.5rem);
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Card padding on mobile */
  .card {
    padding: 1.25rem 1rem;
    margin-bottom: 1.15rem;
    border-radius: var(--radius-sm);
  }

  .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .card-header .btn {
    width: 100%;
    justify-content: center;
  }

  /* Make buttons thumb-friendly (min 44px) */
  .btn {
    min-height: 44px;
    padding: 0.65rem 1rem;
    touch-action: manipulation;
  }

  .btn-sm {
    min-height: 38px;
    padding: 0.45rem 0.75rem;
    touch-action: manipulation;
  }

  /* Dashboard Filter Bar Mobile */
  .dashboard-filter-bar {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0.65rem;
    align-items: stretch;
  }

  .dashboard-filter-query,
  .dashboard-filter-pills,
  .dashboard-filter-select,
  .dashboard-filter-select select {
    width: 100%;
    min-width: 0;
  }

  /* Khusus mobile: Sembunyikan tombol toggle List/Grid, gunakan tampilan kartu default */
  .dashboard-filter-view-switch {
    display: none !important;
  }

  .dashboard-filter-actions .btn {
    flex: 1;
    justify-content: center;
  }

  /* Stack stats grid into 1 or 2 columns */
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .stat-card {
    padding: 1.15rem;
  }

  /* Table to Cards Transformation for Mobile */
  .table-responsive-cards {
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .table-responsive-cards thead {
    display: none; /* Hide header row on phone */
  }

  .table-responsive-cards, 
  .table-responsive-cards tbody, 
  .table-responsive-cards tr, 
  .table-responsive-cards td {
    display: block;
    width: 100%;
  }

  .table-responsive-cards tr {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
  }

  .table-responsive-cards td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0;
    border: none;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.9rem;
    word-break: break-word;
  }

  .table-responsive-cards td:last-child {
    border-bottom: none;
    padding-top: 0.85rem;
    justify-content: flex-end;
  }

  .table-responsive-cards td::before {
    content: attr(data-label);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    margin-right: 1rem;
    flex-shrink: 0;
  }

  /* Two Column Responsive Grids */
  .grid-2col-resp {
    grid-template-columns: 1fr !important;
  }

  /* Grid Materi on Small Screen */
  .grid-materi {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Chat Box on Small Screen */
  .chat-container {
    height: calc(100vh - 210px);
    max-height: 600px;
    border-radius: var(--radius);
  }

  .chat-bubble {
    max-width: 92%;
    padding: 0.85rem 1rem;
    font-size: 0.92rem;
  }

  .chat-input-bar {
    padding: 0.75rem 0.85rem;
    gap: 0.5rem;
  }

  /* Flashcard Scene on Mobile (Android & iOS) */
  .flashcard-scene {
    width: 100%;
    max-width: 100%;
    margin: 0.75rem auto 1rem;
  }

  .flashcard {
    min-height: 290px;
    width: 100%;
  }

  .flashcard-face {
    padding: 1.25rem 1rem;
    border-radius: var(--radius);
    overflow-y: auto;
    word-break: break-word;
  }

  .flashcard-face h3 {
    font-size: 1.15rem !important;
    line-height: 1.4 !important;
  }

  .flashcard-face p {
    font-size: 0.95rem !important;
    line-height: 1.55 !important;
  }

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

  .ratings-group .btn {
    min-height: 44px;
    font-size: 0.8rem;
    padding: 0.4rem 0.35rem;
    line-height: 1.2;
    white-space: normal;
  }

  /* Auth / Login container */
  .auth-card-wrapper {
    margin: 1.25rem auto !important;
    padding: 0 0.25rem;
    width: 100%;
  }

  /* Materi Header & Action Toolbar Mobile */
  .materi-header-main {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }

  .materi-header-title {
    font-size: 1.45rem;
    line-height: 1.3;
    word-break: break-word;
  }

  .materi-header-actions {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 0.5rem;
    padding-top: 0;
    flex-wrap: wrap;
  }

  .btn-action-edit,
  .btn-action-chat,
  .btn-action-delete {
    height: 44px;
    min-height: 44px;
  }

  .btn-action-edit {
    flex-shrink: 0;
    padding: 0 0.85rem;
    font-size: 0.85rem;
  }

  .btn-action-chat {
    flex: 1;
    padding: 0 0.9rem;
    font-size: 0.85rem;
    justify-content: center;
  }

  .btn-action-delete {
    width: 44px;
    min-height: 44px;
    flex-shrink: 0;
  }

  .materi-action-delete-form {
    flex-shrink: 0;
  }

  .quiz-attempt-item {
    flex-direction: column;
    align-items: stretch;
  }

  .quiz-attempt-item .btn {
    width: 100%;
    justify-content: center;
  }

  .site-footer {
    padding: 1.75rem 1rem calc(var(--mobile-bar-height) + 1.5rem);
  }
}

@media (max-width: 480px) {
  .ratings-group {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.45rem;
  }

  .materi-header-actions {
    gap: 0.4rem;
  }

  .btn-action-edit {
    padding: 0 0.75rem;
    font-size: 0.825rem;
  }
}

@media (max-width: 360px) {
  .btn-action-edit {
    width: 44px;
    padding: 0;
    justify-content: center;
  }
  .btn-action-edit span {
    display: none;
  }

  .navbar {
    padding: 0 0.5rem;
  }

  .brand-name {
    font-size: 0.95rem;
  }
}

/* ==========================================================================
   Modal Dialog System
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1050;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  transform: scale(0.95) translateY(8px);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 0.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.modal-close-btn:hover {
  background: var(--surface-muted);
  color: var(--text-main);
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  background: var(--surface-muted);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ==========================================================================
   Dashboard Unified Filter Bar & Modern Petite Green Done Badge
   ========================================================================== */
.dashboard-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
}

.dashboard-filter-query {
  flex: 1 1 200px;
  min-width: 180px;
  position: relative;
}

.dashboard-filter-query .form-control {
  height: 38px;
  font-size: 0.875rem;
  padding: 0.4rem 0.75rem 0.4rem 2.25rem;
  border-radius: var(--radius-sm);
  background-color: var(--surface);
}

.dashboard-filter-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.dashboard-filter-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.dashboard-filter-select select.form-control {
  height: 38px;
  font-size: 0.85rem;
  padding: 0.4rem 2rem 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  cursor: pointer;
  min-width: 135px;
  color: var(--text-main);
  font-weight: 500;
}

.dashboard-filter-reset {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  transition: all 0.15s ease;
  height: 38px;
  white-space: nowrap;
}

.dashboard-filter-reset:hover {
  color: var(--danger);
  border-color: #fca5a5;
  background: #fee2e2;
  text-decoration: none;
}

.dashboard-filter-view-switch {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

/* Petite Modern Status Done Badge (Kecil, Border Hijau Halus) */
.status-badge-done {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #10b981;
  padding: 0.14rem 0.42rem;
  border-radius: 4px;
  line-height: 1;
}

.status-dot-done {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  flex-shrink: 0;
}

.btn-pelajari {
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: color 0.15s ease, transform 0.15s ease;
}

.btn-pelajari:hover {
  color: var(--primary-hover);
  transform: translateX(2px);
  text-decoration: none;
}


