/* ============================================
   Analysis Soal - Premium Dark Theme
   ============================================ */

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

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: rgba(18, 18, 30, 0.8);
  --bg-card-hover: rgba(25, 25, 40, 0.9);
  --bg-input: rgba(255, 255, 255, 0.05);
  --bg-input-focus: rgba(255, 255, 255, 0.08);

  --text-primary: #f0f0f5;
  --text-secondary: #9394a5;
  --text-muted: #5a5b6e;

  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.3);
  --accent-subtle: rgba(99, 102, 241, 0.1);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);

  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px var(--accent-glow);

  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --sidebar-width: 240px;
}

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

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Pages --- */
.page {
  display: none;
  min-height: 100vh;
}
.page.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

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

.hidden { display: none !important; }

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  padding: 2rem;
}

/* --- Animated Background --- */
.bg-animation {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.4;
}

.orb-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, #6366f1 0%, transparent 70%);
  top: -200px;
  right: -100px;
  animation: orbFloat1 20s ease-in-out infinite;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #8b5cf6 0%, transparent 70%);
  bottom: -150px;
  left: -100px;
  animation: orbFloat2 25s ease-in-out infinite;
}

.orb-3 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, #06b6d4 0%, transparent 70%);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: orbFloat3 18s ease-in-out infinite;
}

.grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}

@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-80px, 60px) scale(1.1); }
  66% { transform: translate(40px, -40px) scale(0.9); }
}

@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(60px, -80px) scale(1.15); }
  66% { transform: translate(-50px, 30px) scale(0.85); }
}

@keyframes orbFloat3 {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.3); }
}

/* --- Login Card --- */
.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  box-shadow: var(--shadow-lg), 0 0 80px rgba(99, 102, 241, 0.05);
  animation: cardSlideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardSlideUp {
  from { opacity: 0; transform: translateY(40px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Login Header --- */
.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon { animation: logoPulse 3s ease-in-out infinite; }

@keyframes logoPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.app-title {
  font-size: 1.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.app-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* --- Form --- */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  transition: color var(--transition-fast);
  pointer-events: none;
  z-index: 1;
}

.input-wrapper input,
.input-wrapper select {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 2.75rem;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  outline: none;
  transition: all var(--transition-normal);
}

.input-wrapper input:not(:placeholder-shown) {
  background: var(--bg-input-focus);
}

.input-wrapper:focus-within .input-icon { color: var(--accent); }

.input-wrapper input::placeholder { color: var(--text-muted); }

.input-wrapper input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-select {
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  outline: none;
  transition: all var(--transition-normal);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%239394a5' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 2.5rem;
}

.form-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.form-hint a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.form-hint a:hover { color: var(--accent-hover); }

/* Password toggle */
.toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
  z-index: 1;
}

.toggle-password:hover { color: var(--text-secondary); }
.toggle-password .hidden { display: none; }

/* --- Error / Success Message --- */
.error-message {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--error-bg);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  color: var(--error);
  font-size: 0.8125rem;
  animation: shakeIn 0.4s ease;
}

@keyframes shakeIn {
  0% { transform: translateX(-8px); opacity: 0; }
  25% { transform: translateX(6px); }
  50% { transform: translateX(-4px); }
  75% { transform: translateX(2px); }
  100% { transform: translateX(0); opacity: 1; }
}

.success-message {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: var(--success-bg);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--radius-sm);
  color: var(--success);
  font-size: 0.8125rem;
  animation: fadeIn 0.3s ease;
}

/* --- Login Button --- */
.login-btn {
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: linear-gradient(135deg, var(--accent) 0%, #8b5cf6 100%);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
  margin-top: 0.5rem;
}

.login-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
  filter: brightness(1.1);
}

.login-btn:active:not(:disabled) { transform: translateY(0); }

.login-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.login-btn .btn-text,
.login-btn .btn-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* --- Login Footer --- */
.login-footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.login-footer p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */
.dashboard-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#dashboard-page.active {
  display: flex;
  flex-direction: column;
}

/* --- Navbar --- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sidebar-toggle:hover {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: rgba(99, 102, 241, 0.3);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.nav-right {
  display: flex;
  align-items: center;
}

/* --- User Menu --- */
.user-menu { position: relative; }

.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-menu-btn:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.12);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.8125rem;
  color: white;
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem;
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  box-shadow: var(--shadow-lg);
  animation: dropdownSlide 0.2s ease;
}

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

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.625rem 0.75rem;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dropdown-item:hover {
  background: var(--accent-subtle);
  color: var(--text-primary);
}

.dropdown-item.logout:hover {
  background: var(--error-bg);
  color: var(--error);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0.25rem 0;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
  position: fixed;
  top: 53px;
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - 53px);
  background: rgba(12, 12, 20, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--border);
  z-index: 90;
  overflow-y: auto;
  transition: transform var(--transition-normal);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 0.75rem;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sidebar-item:hover {
  background: var(--accent-subtle);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
  border-color: rgba(99, 102, 241, 0.2);
}

.sidebar-item svg {
  flex-shrink: 0;
}

/* Collapsed sidebar */
.sidebar.collapsed {
  transform: translateX(-100%);
}

.main-content.has-sidebar {
  margin-left: var(--sidebar-width);
  padding: 2rem 1.5rem;
  transition: margin-left var(--transition-normal);
}

.sidebar.collapsed ~ .main-content.has-sidebar {
  margin-left: 0;
}

/* ============================================
   DASHBOARD CONTENT
   ============================================ */
.dashboard-container {
  max-width: 1200px;
  margin: 0 auto;
}

/* --- Section Header --- */
.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

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

.section-desc {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* --- Welcome Card --- */
.welcome-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.1) 100%);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
}

.welcome-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.welcome-card span {
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-card p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

/* --- Stats Grid --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--transition-normal);
}

.stat-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

.stat-icon.purple {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
}

.stat-icon.blue {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.stat-icon.green {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.stat-info h3 {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ============================================
   UPLOAD AREA
   ============================================ */
.upload-area {
  margin-bottom: 1.5rem;
}

.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition-normal);
  text-align: center;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.05);
}

.upload-zone.dragover {
  transform: scale(1.01);
  box-shadow: 0 0 30px rgba(99, 102, 241, 0.15);
}

.upload-icon {
  color: var(--text-muted);
  margin-bottom: 1rem;
  transition: color var(--transition-fast);
}

.upload-zone:hover .upload-icon { color: var(--accent); }

.upload-zone h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.upload-zone p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.upload-browse {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--transition-fast);
}

.upload-browse:hover { color: var(--accent-hover); }

.upload-formats {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.format-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.format-badge.pdf {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.format-badge.docx {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

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

/* --- File Preview --- */
.file-preview {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  animation: fadeIn 0.3s ease;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

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

.file-icon.pdf-icon {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.file-icon.docx-icon {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.file-details {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.file-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.file-remove {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  margin-left: auto;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.file-remove:hover {
  background: var(--error-bg);
  border-color: rgba(239, 68, 68, 0.2);
  color: var(--error);
}

/* ============================================
   ACTION AREA
   ============================================ */
.action-area {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0;
  animation: fadeIn 0.3s ease;
}

.analyze-btn {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 2rem;
  background: linear-gradient(135deg, var(--accent) 0%, #8b5cf6 100%);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.analyze-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow), 0 8px 30px rgba(99, 102, 241, 0.3);
  filter: brightness(1.1);
}

.analyze-btn:active:not(:disabled) { transform: translateY(0); }

.analyze-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.analyze-btn .btn-text,
.analyze-btn .btn-loader {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ============================================
   PROGRESS BAR
   ============================================ */
.progress-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  animation: fadeIn 0.3s ease;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.progress-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}

.progress-percent {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-mono);
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, #8b5cf6 50%, #a78bfa 100%);
  border-radius: 100px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-sublabel {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* ============================================
   RESULTS
   ============================================ */
.results-container {
  animation: fadeIn 0.4s ease;
}

/* ============================================
   RESULTS — PREMIUM REDESIGN
   ============================================ */

/* --- Results Container --- */
.results-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: resultsReveal 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* --- Summary Hero --- */
.results-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 0;
  overflow: hidden;
  position: relative;
}

.results-summary::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #10b981, #3b82f6, #8b5cf6, #f59e0b, #ef4444, #ec4899);
  opacity: 0.8;
}

.summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 2rem 1rem;
}

.summary-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.625rem;
  letter-spacing: -0.01em;
}

.summary-title-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-subtle);
  border-radius: var(--radius-sm);
  font-size: 1.125rem;
}

.summary-export-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.summary-export-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.12);
}

.summary-body {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2rem;
  padding: 0 2rem 2rem;
  align-items: start;
}

/* --- Donut Chart --- */
.donut-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.donut-chart {
  position: relative;
  width: 170px;
  height: 170px;
}

.donut-chart svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.donut-chart .donut-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.04);
  stroke-width: 20;
}

.donut-chart .donut-segment {
  fill: none;
  stroke-width: 20;
  stroke-linecap: round;
  transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.donut-center-count {
  font-size: 2.25rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
  line-height: 1;
}

.donut-center-label {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.25rem;
}

/* --- Stats Grid (right side of summary) --- */
.summary-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.625rem;
}

.summary-stat {
  position: relative;
  padding: 1rem;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  overflow: hidden;
}

.summary-stat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  border-radius: 0 2px 2px 0;
  opacity: 0.6;
}

.summary-stat:hover {
  border-color: var(--border);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.summary-stat-count {
  font-size: 1.75rem;
  font-weight: 800;
  font-family: var(--font-mono);
  line-height: 1;
  margin-bottom: 0.375rem;
}

.summary-stat-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.summary-stat-sublabel {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-family: var(--font-mono);
}

.summary-stat.is-total::before {
  background: var(--accent);
}

/* --- Distribution Panel --- */
.distribution-chart {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.5rem 2rem 2rem;
}

.dist-title {
  font-size: 1.125rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.dist-title-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-subtle);
  border-radius: var(--radius-sm);
  font-size: 1.125rem;
}

.dist-bars {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.dist-row {
  display: grid;
  grid-template-columns: 130px 1fr 50px;
  align-items: center;
  gap: 1rem;
}

.dist-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.dist-label span {
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.dist-bar-track {
  height: 32px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
}

.dist-bar-fill {
  height: 100%;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0.75rem;
  min-width: 0;
  position: relative;
  overflow: hidden;
}

.dist-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08));
  pointer-events: none;
}

.dist-bar-fill.animated {
  animation: barGrow 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes barGrow {
  from { width: 0 !important; }
}

.dist-bar-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  font-family: var(--font-mono);
  white-space: nowrap;
  position: relative;
  z-index: 1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.dist-percent {
  text-align: right;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* ============================================
   QUESTION CARDS — PREMIUM REDESIGN
   ============================================ */
.questions-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.questions-title {
  font-size: 1.125rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.questions-title-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-subtle);
  border-radius: var(--radius-sm);
  font-size: 1.125rem;
}

.questions-filters {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-wrap: wrap;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: 100px;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.filter-chip:hover {
  color: var(--text-secondary);
  border-color: var(--border);
}

.filter-chip.active {
  background: var(--accent-subtle);
  color: var(--accent);
  border-color: rgba(99, 102, 241, 0.3);
}

.filter-chip-count {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.6875rem;
  opacity: 0.7;
}

/* --- Question Card --- */
.questions-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-normal);
  position: relative;
}

.question-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  border-radius: 2px 0 0 2px;
}

.question-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.question-card-header {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
}

.question-number {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9375rem;
  font-family: var(--font-mono);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.question-number::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  pointer-events: none;
}

.question-level-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  position: relative;
}

.question-level-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}

.question-confidence {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.confidence-bar {
  width: 48px;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
}

.confidence-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.confidence-high .confidence-bar-fill { background: var(--success); }
.confidence-medium .confidence-bar-fill { background: var(--warning); }
.confidence-low .confidence-bar-fill { background: var(--error); }

.confidence-value {
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  min-width: 32px;
  text-align: right;
}

.confidence-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.confidence-high { color: var(--success); }
.confidence-high .confidence-dot { background: var(--success); }
.confidence-medium { color: var(--warning); }
.confidence-medium .confidence-dot { background: var(--warning); }
.confidence-low { color: var(--error); }
.confidence-low .confidence-dot { background: var(--error); }

.review-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  background: var(--warning-bg);
  color: var(--warning);
  border-radius: 100px;
  font-size: 0.6875rem;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid rgba(245, 158, 11, 0.15);
}

.question-expand-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: transform var(--transition-normal);
  flex-shrink: 0;
}

.question-card.expanded .question-expand-icon {
  transform: rotate(180deg);
}

/* --- Question Card Body --- */
.question-card-body {
  padding: 0 1.25rem;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
}

.question-card.expanded .question-card-body {
  max-height: 600px;
  padding: 0 1.25rem 1.25rem;
}

.question-text {
  font-size: 0.9375rem;
  color: var(--text-primary);
  line-height: 1.7;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
  position: relative;
}

.question-text-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.question-reasoning {
  padding: 1rem 1.25rem;
  background: rgba(99, 102, 241, 0.04);
  border-radius: var(--radius-md);
  border: 1px solid rgba(99, 102, 241, 0.08);
  margin-bottom: 0.875rem;
}

.reasoning-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
  opacity: 0.8;
}

.reasoning-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

.question-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.keyword-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.625rem;
  background: var(--accent-subtle);
  color: var(--accent);
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: var(--font-mono);
  border: 1px solid rgba(99, 102, 241, 0.12);
  transition: all var(--transition-fast);
}

.keyword-tag:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.25);
}

/* --- Results Action Bar --- */
.results-action-bar {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.results-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  border: 1px solid transparent;
}

.results-action-btn.save-btn {
  background: var(--accent);
  color: #fff;
}

.results-action-btn.save-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
  transform: translateY(-1px);
}

.results-action-btn.pdf-btn {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.2);
}

.results-action-btn.pdf-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.3);
  transform: translateY(-1px);
}

.results-action-btn.new-btn {
  background: var(--bg-input);
  color: var(--text-secondary);
  border-color: var(--border);
}

.results-action-btn.new-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.results-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.results-action-btn .spinner {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

#save-status {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
}

#save-status.success {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

#save-status.error {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ============================================
   HISTORY — PREMIUM DESIGN
   ============================================ */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.history-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 1.25rem;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.history-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--accent), #8b5cf6);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.history-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
}

.history-card:hover::before {
  opacity: 1;
}

.history-file-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.history-file-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
  pointer-events: none;
}

.history-file-icon.pdf { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.history-file-icon.docx { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }

.history-file-icon svg {
  flex-shrink: 0;
}

.history-info {
  min-width: 0;
}

.history-file-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.history-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.history-meta-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.5;
}

.history-dist-mini {
  display: flex;
  gap: 0.375rem;
  flex-shrink: 0;
}

.history-dist-dot {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  background: var(--bg-input);
  border-radius: 100px;
  font-size: 0.6875rem;
  font-weight: 600;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.history-dist-dot span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.history-actions {
  display: flex;
  gap: 0.375rem;
  flex-shrink: 0;
}

.history-action-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.history-action-btn:hover {
  color: var(--text-primary);
  border-color: var(--border);
  background: var(--bg-card-hover);
}

.history-action-btn.delete:hover {
  color: var(--error);
  background: var(--error-bg);
  border-color: rgba(239, 68, 68, 0.2);
}

/* --- History Detail Modal --- */
.history-detail-modal .modal-content {
  max-width: 900px;
  max-height: 90vh;
}

.history-detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 1.5rem 0;
}

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

.history-detail-header-info h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-detail-header-info p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.history-detail-body {
  padding: 1.25rem 1.5rem 1.5rem;
  overflow-y: auto;
  max-height: calc(90vh - 80px);
}

.history-detail-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.history-detail-summary-item {
  text-align: center;
  padding: 0.75rem 0.5rem;
  background: var(--bg-input);
  border-radius: var(--radius-md);
  border-left: 3px solid;
}

.history-detail-summary-count {
  font-size: 1.5rem;
  font-weight: 800;
  font-family: var(--font-mono);
  line-height: 1;
}

.history-detail-summary-label {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

@media (max-width: 768px) {
  .history-card {
    grid-template-columns: auto 1fr;
    gap: 1rem;
  }

  .history-dist-mini {
    display: none;
  }

  .history-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

@media (max-width: 640px) {
  .history-card {
    padding: 1rem;
  }
}


/* ============================================
   MODALS
   ============================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  animation: modalSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content.modal-lg {
  max-width: 640px;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.5rem 0;
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.close-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.close-btn:hover {
  background: var(--error-bg);
  border-color: rgba(239, 68, 68, 0.2);
  color: var(--error);
}

.modal-body {
  padding: 1.5rem;
}

.settings-section h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

/* --- API Settings Tabs --- */
.api-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  padding: 0.375rem;
  background: var(--bg-input);
  border-radius: var(--radius-md);
}

.api-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.625rem 0.75rem;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.api-tab:hover { color: var(--text-secondary); }

.api-tab.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.api-config {
  display: none;
}

.api-config.active {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: fadeIn 0.2s ease;
}

/* --- Save Button --- */
.save-btn {
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: linear-gradient(135deg, var(--accent) 0%, #8b5cf6 100%);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
  margin-top: 1rem;
}

.save-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow);
  filter: brightness(1.1);
}

.save-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.save-btn .btn-text,
.save-btn .btn-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* ============================================
   API STATUS
   ============================================ */
.api-status-text {
  font-size: 0.875rem !important;
}

.api-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.375rem;
}

.api-status-dot.online { background: var(--success); }
.api-status-dot.offline { background: var(--error); }

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-muted);
}

.empty-state svg {
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state p {
  font-size: 0.9375rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  .main-content.has-sidebar {
    margin-left: 0;
  }

  .section-title {
    font-size: 1.375rem;
  }

  .api-tab {
    font-size: 0.75rem;
    padding: 0.5rem;
  }

  .summary-body {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .donut-container {
    flex-direction: row;
    justify-content: center;
  }

  .summary-header {
    padding: 1.25rem 1.25rem 0.75rem;
  }

  .summary-body {
    padding: 0 1.25rem 1.25rem;
  }

  .distribution-chart {
    padding: 1.25rem;
  }

  .dist-row {
    grid-template-columns: 100px 1fr 40px;
    gap: 0.625rem;
  }

  .dist-label {
    font-size: 0.75rem;
  }

  .questions-filters {
    display: none;
  }
}

@media (max-width: 640px) {
  .login-card {
    padding: 1.75rem 1.5rem;
    border-radius: var(--radius-lg);
  }

  .app-title { font-size: 1.5rem; }

  .navbar { padding: 0.625rem 1rem; }

  .user-menu-btn span:not(.user-avatar) { display: none; }

  .main-content { padding: 1.25rem 1rem; }

  .welcome-card { padding: 1.25rem; }
  .welcome-card h2 { font-size: 1.25rem; }

  .stats-grid { grid-template-columns: 1fr; }

  .modal-content {
    max-width: 100%;
    margin: 0.5rem;
    border-radius: var(--radius-lg);
  }

  .upload-zone { padding: 2rem 1rem; }

  .summary-stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .donut-chart {
    width: 140px;
    height: 140px;
  }

  .donut-center-count {
    font-size: 1.75rem;
  }

  .question-card-header {
    flex-wrap: wrap;
  }

  .question-confidence {
    width: 100%;
    justify-content: flex-end;
    margin-top: 0.25rem;
  }
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* --- Selection --- */
::selection {
  background: var(--accent-glow);
  color: white;
}
