/* ==========================================================================
   HAFALORGANISASI - STYLESHEET
   Design System, Glassmorphism, Micro-interactions & Responsive UI
   ========================================================================== */

/* --- CSS Variables / Design Tokens --- */
:root {
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  
  /* Primary & Accents (Tailored Modern Palette) */
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-200: #c7d2fe;
  --primary-400: #818cf8;
  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --primary-700: #4338ca;
  --primary-900: #312e81;

  /* Neutrals & Surfaces */
  --bg-body: #0b0f19;
  --bg-body-mesh: radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.15) 0px, transparent 50%),
                  radial-gradient(at 100% 0%, rgba(16, 185, 129, 0.10) 0px, transparent 50%),
                  radial-gradient(at 50% 100%, rgba(139, 92, 246, 0.12) 0px, transparent 50%);
  --surface-card: rgba(18, 24, 38, 0.85);
  --surface-card-hover: rgba(28, 36, 54, 0.95);
  --surface-elevated: rgba(30, 41, 59, 0.90);
  --surface-inset: rgba(10, 14, 23, 0.65);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);

  /* Semantic Feedback */
  --emerald-400: #34d399;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-bg: rgba(16, 185, 129, 0.15);
  --emerald-border: rgba(16, 185, 129, 0.4);

  --rose-400: #fb7185;
  --rose-500: #f43f5e;
  --rose-600: #e11d48;
  --rose-bg: rgba(244, 63, 94, 0.15);
  --rose-border: rgba(244, 63, 94, 0.4);

  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.15);
  --amber-border: rgba(245, 158, 11, 0.4);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* Radii & Shadows */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px -4px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 36px -6px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 24px rgba(99, 102, 241, 0.35);

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-body);
  background-image: var(--bg-body-mesh);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-body);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

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

/* Canvas Confetti */
#confetti-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
}

/* --- Header & Navigation --- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  transition: var(--transition-normal);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
  transition: transform var(--transition-fast);
}
.brand:hover {
  transform: translateY(-1px);
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

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

.brand-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(120deg, #ffffff 40%, var(--primary-200));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-badge {
  font-size: 0.725rem;
  font-weight: 600;
  color: var(--emerald-400);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.3rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-btn svg {
  stroke-width: 2.2;
}

.nav-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.nav-btn.active {
  color: #ffffff;
  background: var(--primary-600);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

/* --- Main Layout & View Transitions --- */
.main-content {
  flex: 1;
  padding-top: 2rem;
  padding-bottom: 4rem;
}

.view-section {
  display: none;
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

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

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

/* --- Typography & Global Elements --- */
h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

p {
  color: var(--text-secondary);
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.75rem;
  margin-bottom: 0.35rem;
}

.section-desc {
  font-size: 0.95rem;
  max-width: 680px;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.925rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  user-select: none;
  white-space: nowrap;
}
.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-400), var(--primary-500));
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.12);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-subtle);
}
.btn-outline:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: var(--rose-600);
  color: #fff;
}
.btn-danger:hover {
  background: var(--rose-500);
}

.btn-ghost-danger {
  background: transparent;
  color: var(--rose-400);
  border-color: transparent;
}
.btn-ghost-danger:hover {
  background: var(--rose-bg);
  color: var(--rose-500);
}

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

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

.btn-xl {
  padding: 1.1rem 2.2rem;
  font-size: 1.15rem;
  border-radius: var(--radius-xl);
}

/* --- Badges & Pills --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-full);
}
.badge-indigo {
  background: rgba(99, 102, 241, 0.18);
  color: var(--primary-400);
  border: 1px solid rgba(99, 102, 241, 0.3);
}
.badge-emerald {
  background: var(--emerald-bg);
  color: var(--emerald-400);
  border: 1px solid var(--emerald-border);
}
.badge-slate {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-secondary);
  border: 1px solid rgba(148, 163, 184, 0.2);
}
.badge-amber {
  background: var(--amber-bg);
  color: var(--amber-400);
  border: 1px solid var(--amber-border);
}

/* ==========================================================================
   VIEW 1: HERO & HOME
   ========================================================================== */
.hero-card {
  background: var(--surface-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 3.5rem 2.5rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.hero-card::before {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--primary-400);
  margin-bottom: 1rem;
}

.hero-title {
  font-size: 2.8rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #ffffff 40%, var(--primary-100) 80%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.125rem;
  max-width: 720px;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.hero-stats-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.stat-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1.5rem;
  display: flex;
  flex-direction: column;
}
.stat-pill.highlight {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
}

.stat-num {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
}
.stat-pill.highlight .stat-num {
  color: var(--primary-400);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.hero-cta-group {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: transform var(--transition-normal), border-color var(--transition-normal);
}
.feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.18);
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 1.25rem;
}
.bg-indigo { background: rgba(99, 102, 241, 0.2); }
.bg-emerald { background: rgba(16, 185, 129, 0.2); }
.bg-amber { background: rgba(245, 158, 11, 0.2); }

.feature-title {
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}
.feature-desc {
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ==========================================================================
   VIEW 2: INPUT DATA
   ========================================================================== */
.guide-accordion {
  margin-bottom: 1.5rem;
}

.guide-details {
  background: var(--surface-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.guide-summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  font-weight: 600;
}

.guide-badge {
  color: var(--amber-400);
}
.guide-toggle-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.guide-content {
  padding: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
}

.guide-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.guide-col h4 {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.guide-col pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  font-family: 'SFMono-Regular', Consolas, Menlo, monospace;
  font-size: 0.825rem;
  color: #cbd5e1;
  overflow-x: auto;
}

.guide-footer-note {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.input-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
}

.input-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-weight: 600;
}
.label-badge {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.org-textarea {
  width: 100%;
  background: var(--surface-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  color: var(--text-primary);
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  resize: vertical;
  min-height: 320px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.org-textarea:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.parser-live-status {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 0.85rem;
  font-size: 0.85rem;
}
.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.status-indicator.ready { background: var(--emerald-400); box-shadow: 0 0 8px var(--emerald-400); }
.status-indicator.warning { background: var(--amber-400); box-shadow: 0 0 8px var(--amber-400); }

.input-card-footer {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

/* ==========================================================================
   VIEW 3: PREVIEW & VALIDASI
   ========================================================================== */
.alert {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
}
.alert-warning {
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  color: #fef3c7;
}
.alert-info {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #e0e7ff;
}
.alert-icon {
  font-size: 1.5rem;
}
.alert-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.alert-list {
  font-size: 0.875rem;
  margin: 0.5rem 0 0.5rem 1.25rem;
}
.alert-sub {
  font-size: 0.825rem;
  opacity: 0.9;
}

.stats-overview-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-card-icon {
  font-size: 2rem;
}
.stat-card-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.stat-card-lbl {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.hierarchy-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hierarchy-section {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.hierarchy-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}
.hierarchy-section-title {
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.member-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
}

.member-preview-card {
  background: var(--surface-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.member-preview-card.is-leader {
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.08);
}

.member-avatar-chip {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-600);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.member-avatar-chip.leader {
  background: linear-gradient(135deg, var(--amber-500), var(--rose-500));
}

.member-info-col {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.member-role-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary-400);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.member-name-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: normal;
  word-break: break-word;
}

.member-class-tag {
  font-size: 0.775rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
  font-weight: 500;
}

.hierarchy-group-sub {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary-300);
  margin-top: 0.25rem;
}

.hierarchy-subgroup {
  margin-top: 1.25rem;
}

.hierarchy-subgroup-title {
  font-size: 0.825rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.badge-order {
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.725rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  color: var(--primary-300);
}





/* ==========================================================================
   VIEW 4: SETTINGS
   ========================================================================== */
.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.setting-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
}

.setting-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.setting-icon {
  font-size: 1.75rem;
}
.setting-title {
  font-size: 1.2rem;
  margin-bottom: 0.2rem;
}
.setting-desc {
  font-size: 0.875rem;
}

.options-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.options-radio-group.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.options-radio-group.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.radio-chip {
  position: relative;
  background: var(--surface-inset);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: all var(--transition-fast);
  user-select: none;
}
.radio-chip input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.radio-chip:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
}
.radio-chip.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--primary-500);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
}
.radio-chip strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}
.radio-chip small {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.settings-start-cta {
  text-align: center;
}

/* ==========================================================================
   VIEW 5: QUIZ ENGINE
   ========================================================================== */
.quiz-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.quiz-topbar-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.quiz-progress-text {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.quiz-topbar-score {
  display: flex;
  gap: 1rem;
  font-size: 0.95rem;
  font-weight: 700;
}
.score-correct { color: var(--emerald-400); }
.score-wrong { color: var(--rose-400); }

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 2rem;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-500), var(--emerald-400));
  border-radius: var(--radius-full);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.question-card {
  background: var(--surface-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.question-tag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.question-badge-type {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary-400);
  background: rgba(99, 102, 241, 0.12);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.question-number-pill {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.question-prompt {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.35;
  color: #ffffff;
}

.options-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.option-btn {
  background: var(--surface-inset);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  position: relative;
  user-select: none;
}
.option-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}
.option-btn:disabled {
  cursor: default;
}

.option-key-badge {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.option-text {
  flex: 1;
  word-break: break-word;
}

/* Option States */
.option-btn.correct {
  background: var(--emerald-bg) !important;
  border-color: var(--emerald-500) !important;
  color: #ffffff !important;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.4);
}
.option-btn.correct .option-key-badge {
  background: var(--emerald-500);
  color: #ffffff;
}

.option-btn.wrong {
  background: var(--rose-bg) !important;
  border-color: var(--rose-500) !important;
  color: #ffffff !important;
  animation: shake 0.35s ease-in-out;
  box-shadow: 0 0 16px rgba(244, 63, 94, 0.4);
}
.option-btn.wrong .option-key-badge {
  background: var(--rose-500);
  color: #ffffff;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* Feedback Card */
.feedback-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  gap: 1rem;
  animation: fadeIn 0.25s ease;
}
.feedback-card.correct-feedback {
  border-color: var(--emerald-border);
  background: var(--emerald-bg);
}
.feedback-card.wrong-feedback {
  border-color: var(--rose-border);
  background: var(--rose-bg);
}

.feedback-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 800;
  flex-shrink: 0;
}
.correct-feedback .feedback-icon {
  background: var(--emerald-500);
  color: #fff;
}
.wrong-feedback .feedback-icon {
  background: var(--rose-500);
  color: #fff;
}

.feedback-title {
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}
.feedback-details {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-primary);
}

.question-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.keyboard-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}
kbd {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  padding: 0.15rem 0.4rem;
  font-family: inherit;
  font-size: 0.75rem;
  color: var(--text-primary);
}

/* ==========================================================================
   VIEW 6: RESULT
   ========================================================================== */
.result-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 3rem 2rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  margin-bottom: 2.5rem;
}

.result-badge-icon {
  font-size: 3.5rem;
  margin-bottom: 0.5rem;
}

.result-title {
  font-size: 2.25rem;
  margin-bottom: 0.35rem;
}

.result-category-label {
  display: inline-block;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.4rem 1.25rem;
  border-radius: var(--radius-full);
  margin-bottom: 2rem;
}
.result-category-label.score-excel { background: var(--emerald-bg); color: var(--emerald-400); border: 1px solid var(--emerald-border); }
.result-category-label.score-good { background: rgba(99, 102, 241, 0.2); color: var(--primary-400); border: 1px solid rgba(99, 102, 241, 0.4); }
.result-category-label.score-avg { background: var(--amber-bg); color: var(--amber-400); border: 1px solid var(--amber-border); }
.result-category-label.score-poor { background: var(--rose-bg); color: var(--rose-400); border: 1px solid var(--rose-border); }

.result-score-circle {
  margin-bottom: 2rem;
}
.score-percentage {
  font-size: 4rem;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(135deg, #ffffff, var(--primary-200));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.score-ratio {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.result-stats-row {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-bottom: 2.5rem;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1.5rem 0;
}
.result-stat-item {
  display: flex;
  flex-direction: column;
}
.result-stat-item .stat-val {
  font-size: 1.75rem;
  font-weight: 800;
}
.result-stat-item .stat-lbl {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.mistake-review-container {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2rem;
}
.mistake-section-title {
  font-size: 1.25rem;
  margin-bottom: 1.25rem;
  color: var(--rose-400);
}
.mistake-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.mistake-item-card {
  background: var(--surface-inset);
  border: 1px solid var(--rose-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}
.mistake-q {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: #fff;
}
.mistake-ans-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.875rem;
}
.ans-right { color: var(--emerald-400); }
.ans-user { color: var(--rose-400); text-decoration: line-through; }

/* ==========================================================================
   VIEW 7: DRILL MODE (SALAH) & VIEW 8: DIRECTORY
   ========================================================================== */
.empty-state {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 4rem 2rem;
  text-align: center;
}
.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}
.empty-title {
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
}
.empty-desc {
  max-width: 480px;
  margin: 0 auto 1.5rem;
  font-size: 0.95rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.drill-card {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.drill-wrong-badge {
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--rose-bg);
  color: var(--rose-400);
  border: 1px solid var(--rose-border);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
}

.search-box {
  position: relative;
  width: 280px;
}
.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  color: var(--text-muted);
}
.search-input {
  width: 100%;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.6rem 1rem 0.6rem 2.4rem;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
}
.search-input:focus {
  border-color: var(--primary-500);
}

.directory-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ==========================================================================
   MODAL & TOAST
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease;
}

.modal-card {
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-card.modal-sm {
  max-width: 420px;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title {
  font-size: 1.15rem;
}
.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
}
.modal-close-btn:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
}
.modal-section {
  margin-bottom: 1rem;
}
.modal-section h4 {
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}
.modal-section p {
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.modal-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 1.25rem 0;
}

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

.btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}
.toast {
  background: var(--surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: slideToast 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  pointer-events: auto;
}
.toast.success { border-color: var(--emerald-border); }
.toast.error { border-color: var(--rose-border); }

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

/* --- Footer --- */
.app-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  background: rgba(11, 15, 25, 0.6);
  padding: 1.5rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.footer-links {
  display: flex;
  gap: 0.5rem;
}

/* --- Utilities --- */
.hidden { display: none !important; }
.text-emerald { color: var(--emerald-400); }
.text-rose { color: var(--rose-400); }
.text-indigo { color: var(--primary-400); }
.text-amber { color: var(--amber-400); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.mt-2 { margin-top: 0.5rem; }

/* ==========================================================================
   RESPONSIVE DESIGN (Breakpoints)
   ========================================================================== */
@media (max-width: 900px) {
  .hero-title {
    font-size: 2.2rem;
  }
  .header-inner {
    height: auto;
    padding: 0.75rem 0;
    flex-wrap: wrap;
  }
  .nav-links {
    order: 3;
    width: 100%;
    justify-content: space-around;
    overflow-x: auto;
  }
  .nav-btn span {
    display: none;
  }
  .nav-btn {
    padding: 0.6rem 0.85rem;
  }
}

@media (max-width: 600px) {
  .hero-title {
    font-size: 1.75rem;
  }
  .hero-card {
    padding: 2rem 1.25rem;
  }
  .hero-cta-group {
    flex-direction: column;
  }
  .hero-cta-group .btn {
    width: 100%;
  }
  .question-card {
    padding: 1.5rem;
  }
  .question-prompt {
    font-size: 1.2rem;
  }
  .options-container {
    grid-template-columns: 1fr;
  }
  .result-stats-row {
    gap: 1.5rem;
  }
  .result-score-circle .score-percentage {
    font-size: 3rem;
  }
}
