:root {
  --primary-blue: #001f3f;
  --primary-blue-dark: #001529;
  --primary-blue-light: #002b57;
  --secondary-gold: #d4af37;
  --secondary-gold-dark: #b8941f;
  --secondary-gold-light: #e6c966;

  --white: #ffffff;
  --light-gray: #f3f4f6;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --dark-gray: #1f2937;
  --black: #000000;

  --success-green: #10b981;
  --error-red: #ef4444;
  --warning-amber: #f59e0b;
  --info-blue: #3b82f6;

  --font-primary: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-secondary: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;

  --spacing-1: 0.5rem;
  --spacing-2: 1rem;
  --spacing-3: 1.5rem;
  --spacing-4: 2rem;
  --spacing-6: 3rem;
  --spacing-8: 4rem;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);

  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;

  --header-height: 70px;
  --container-max: 1200px;
}


*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-secondary);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--dark-gray);
  background-color: var(--light-gray);
  min-height: 100vh;
}

.exam-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--primary-blue-dark);
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

.header-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--spacing-3);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo {
  font-family: var(--font-primary);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--white);
  text-decoration: none;
}

.header-logo .logo-gold {
  color: var(--secondary-gold);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
}

.header-user {
  display: flex;
  align-items: center;
  gap: var(--spacing-1);
  color: var(--white);
  font-size: var(--text-sm);
}

.header-user i {
  color: var(--secondary-gold);
}

.btn-logout {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--white);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: all var(--transition-base);
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--secondary-gold);
}

.exam-main {
  padding-top: calc(var(--header-height) + var(--spacing-4));
  padding-bottom: var(--spacing-6);
  min-height: 100vh;
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--spacing-3);
}

.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--spacing-4);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-3);
  padding-bottom: var(--spacing-2);
  border-bottom: 1px solid var(--gray-200);
}

.card-title {
  font-family: var(--font-primary);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--dark-gray);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-1);
  padding: 12px 24px;
  font-family: var(--font-secondary);
  font-size: var(--text-base);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  min-height: 44px;
  min-width: 44px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--secondary-gold) 0%, var(--secondary-gold-dark) 100%);
  color: var(--white);
  border-color: var(--secondary-gold);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--white);
  color: var(--primary-blue);
  border-color: var(--primary-blue);
}

.btn-secondary:hover {
  background: var(--primary-blue);
  color: var(--white);
}

.btn-outline {
  background: transparent;
  color: var(--gray-600);
  border-color: var(--gray-300);
}

.btn-outline:hover {
  background: var(--gray-100);
  border-color: var(--gray-500);
}

.btn-lg {
  padding: 16px 32px;
  font-size: var(--text-lg);
}

.btn-block {
  width: 100%;
}

.form-group {
  margin-bottom: var(--spacing-3);
}

.form-label {
  display: block;
  font-weight: 500;
  color: var(--dark-gray);
  margin-bottom: var(--spacing-1);
  font-size: var(--text-sm);
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-secondary);
  font-size: var(--text-base);
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-md);
  background: var(--white);
  transition: all var(--transition-base);
  min-height: 44px;
}

.form-input:focus {
  outline: none;
  border-color: var(--secondary-gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
}

.form-input.error {
  border-color: var(--error-red);
}

.form-error {
  color: var(--error-red);
  font-size: var(--text-sm);
  margin-top: 4px;
}

.alert {
  padding: var(--spacing-2) var(--spacing-3);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-3);
  display: flex;
  align-items: center;
  gap: var(--spacing-1);
}

.alert-error {
  background: #fef2f2;
  color: var(--error-red);
  border: 1px solid #fecaca;
}

.alert-success {
  background: #ecfdf5;
  color: var(--success-green);
  border: 1px solid #a7f3d0;
}

.alert-warning {
  background: #fffbeb;
  color: var(--warning-amber);
  border: 1px solid #fde68a;
}

.alert-info {
  background: #eff6ff;
  color: var(--info-blue);
  border: 1px solid #bfdbfe;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--secondary-gold) 0%, var(--secondary-gold-dark) 100%);
  border-radius: var(--radius-full);
  transition: width var(--transition-base);
}

.progress-fill.success {
  background: linear-gradient(90deg, var(--success-green) 0%, #059669 100%);
}

.progress-fill.warning {
  background: linear-gradient(90deg, var(--warning-amber) 0%, #d97706 100%);
}

.progress-fill.error {
  background: linear-gradient(90deg, var(--error-red) 0%, #dc2626 100%);
}

.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.data-table th,
.data-table td {
  padding: var(--spacing-2);
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}

.data-table th {
  font-weight: 600;
  color: var(--gray-600);
  background: var(--gray-100);
}

.data-table tbody tr:hover {
  background: var(--gray-100);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background: #ecfdf5;
  color: var(--success-green);
}

.badge-error {
  background: #fef2f2;
  color: var(--error-red);
}

.badge-warning {
  background: #fffbeb;
  color: var(--warning-amber);
}

.badge-info {
  background: #eff6ff;
  color: var(--info-blue);
}

.badge-gold {
  background: rgba(212, 175, 55, 0.15);
  color: var(--secondary-gold-dark);
}

.loading-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--secondary-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  display: none;
}

.modal-backdrop.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: var(--spacing-3);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: var(--font-primary);
  font-size: var(--text-xl);
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--gray-500);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.modal-body {
  padding: var(--spacing-3);
}

.modal-footer {
  padding: var(--spacing-3);
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: var(--spacing-2);
  justify-content: flex-end;
}

@media (max-width: 768px) {
  :root {
    --text-4xl: 1.75rem;
    --text-3xl: 1.5rem;
    --text-2xl: 1.25rem;
  }

  .card {
    padding: var(--spacing-3);
  }

  .header-user span {
    display: none;
  }

  .btn {
    padding: 10px 16px;
    font-size: var(--text-sm);
  }

  .btn-lg {
    padding: 12px 24px;
    font-size: var(--text-base);
  }

  .data-table th,
  .data-table td {
    padding: var(--spacing-1);
  }
}

body {
  overflow-x: hidden;
}

@media (max-width: 768px) {

  .form-input,
  select,
  textarea {
    font-size: 16px;
  }
}

.pagination-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-2);
  margin-top: var(--spacing-3);
  padding-top: var(--spacing-3);
  border-top: 1px solid var(--gray-200);
}

.pagination-info {
  font-size: var(--text-sm);
  color: var(--gray-600);
}

.pagination-info strong {
  color: var(--dark-gray);
  font-weight: 600;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
}

.pagination-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-btn {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gray-300);
  background: var(--white);
  color: var(--dark-gray);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
}

.pagination-btn:hover:not(.disabled):not(.active) {
  background: var(--primary-blue);
  color: var(--white);
  border-color: var(--primary-blue);
}

.pagination-btn.active {
  background: var(--primary-blue);
  color: var(--white);
  border-color: var(--primary-blue);
  font-weight: 600;
}

.pagination-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-ellipsis {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  font-weight: bold;
}

@media (max-width: 768px) {
  .pagination-container {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-1);
  }

  .pagination-controls {
    justify-content: center;
  }

  .pagination-info {
    text-align: center;
  }

  .pagination-buttons {
    justify-content: center;
    flex-wrap: wrap;
  }
}


.theme-toggle {
  position: relative;
  width: 60px;
  height: 30px;
  background: linear-gradient(135deg, #87CEEB 0%, #4682B4 100%);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.4s ease;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.theme-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.theme-toggle::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(135deg, #87CEEB 0%, #4682B4 100%);
  opacity: 1;
  transition: opacity 0.4s ease;
  z-index: 1;
}

.theme-toggle::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 1;
}

.theme-toggle-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  background: var(--white);
  border-radius: 50%;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.theme-toggle-slider::before {
  content: '\f072';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 10px;
  color: #4682B4;
  transition: transform 0.4s ease;
  transform: rotate(-45deg);
}

body.dark-mode .theme-toggle {
  border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .theme-toggle::before {
  opacity: 0;
}

body.dark-mode .theme-toggle::after {
  opacity: 1;
}

body.dark-mode .theme-toggle-slider {
  left: calc(100% - 24px);
  background: var(--secondary-gold);
}

body.dark-mode .theme-toggle-slider::before {
  content: '\f072';
  color: #1e293b;
  transform: rotate(45deg);
}


body.dark-mode {
  --bg-primary: #0a1929;
  --bg-secondary: #0d2137;
  --bg-card: #132d4a;
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --border-color: rgba(255, 255, 255, 0.1);

  background-color: var(--bg-primary);
  color: var(--text-primary);
}

body.dark-mode .exam-main {
  background-color: var(--bg-primary);
}

body.dark-mode .exam-header {
  background: #00152a;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode .card,
body.dark-mode .topic-card,
body.dark-mode .stat-card,
body.dark-mode .dashboard-card {
  background: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-primary);
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
  color: var(--text-primary) !important;
}

body.dark-mode p,
body.dark-mode span,
body.dark-mode div,
body.dark-mode label,
body.dark-mode li {
  color: inherit;
}

body.dark-mode .text-muted,
body.dark-mode .text-secondary,
body.dark-mode small {
  color: var(--text-secondary) !important;
}

body.dark-mode a {
  color: var(--secondary-gold);
}

body.dark-mode a:hover {
  color: var(--secondary-gold-light);
}

body.dark-mode .card-title,
body.dark-mode .stat-label,
body.dark-mode .topic-name,
body.dark-mode .section-title {
  color: var(--text-primary) !important;
}

body.dark-mode .card-subtitle,
body.dark-mode .stat-value,
body.dark-mode .topic-desc {
  color: var(--text-secondary) !important;
}

body.dark-mode time,
body.dark-mode .date,
body.dark-mode .timestamp {
  color: var(--text-secondary) !important;
}

body.dark-mode .topic-card:hover {
  background: var(--bg-card);
}

body.dark-mode .topic-name,
body.dark-mode .card-title,
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3 {
  color: var(--text-primary);
}

body.dark-mode .topic-questions,
body.dark-mode .progress-label,
body.dark-mode .topic-stats,
body.dark-mode .topic-not-started {
  color: var(--text-secondary);
}

body.dark-mode .progress-value {
  color: var(--text-primary);
}

body.dark-mode .progress-bar {
  background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .pagination-info {
  color: rgba(255, 255, 255, 0.9);
}

body.dark-mode .pagination-info strong {
  color: var(--text-primary);
}

body.dark-mode .pagination-btn {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-color);
}

body.dark-mode .pagination-btn:hover:not(.disabled):not(.active) {
  background: var(--primary-blue);
  color: var(--white);
  border-color: var(--primary-blue);
}

body.dark-mode .pagination-ellipsis {
  color: var(--text-secondary);
}

body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-primary);
}

body.dark-mode input:focus,
body.dark-mode select:focus,
body.dark-mode textarea:focus {
  border-color: var(--secondary-gold);
}

body.dark-mode .toast {
  background: var(--bg-card);
  color: var(--text-primary);
  border-left-width: 4px;
}

body.dark-mode .loading-overlay {
  background: rgba(10, 25, 41, 0.9);
}

body.dark-mode .modal-content {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

body.dark-mode .modal-header {
  border-bottom-color: var(--border-color);
}

body.dark-mode .modal-footer {
  border-top-color: var(--border-color);
}

body.dark-mode .btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-primary);
}

body.dark-mode .btn-outline:hover {
  background: var(--bg-card);
  border-color: var(--secondary-gold);
  color: var(--secondary-gold);
}

body.dark-mode .btn-secondary {
  background: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-primary);
}

body.dark-mode .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

body.dark-mode table {
  background: var(--bg-card);
}

body.dark-mode th {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-color: var(--border-color);
}

body.dark-mode td {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-color);
}

body.dark-mode tr:hover td {
  background: rgba(255, 255, 255, 0.08) !important;
  color: var(--text-primary) !important;
}

body.dark-mode .data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}

body.dark-mode .data-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.08) !important;
  color: #ffffff !important;
}

body.dark-mode tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

body.dark-mode .badge {
  border-color: var(--border-color);
}

body.dark-mode .badge-success {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
}

body.dark-mode .badge-error {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

body.dark-mode .badge-warning {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

body.dark-mode .badge-info {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
}

body.dark-mode .alert,
body.dark-mode .alert-info {
  background: rgba(59, 130, 246, 0.15) !important;
  color: #60a5fa !important;
  border-color: rgba(59, 130, 246, 0.3) !important;
}

body.dark-mode .alert-warning {
  background: rgba(251, 191, 36, 0.15) !important;
  color: #fbbf24 !important;
  border-color: rgba(251, 191, 36, 0.3) !important;
}

body.dark-mode .alert-error {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #f87171 !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}

body.dark-mode .alert-success {
  background: rgba(34, 197, 94, 0.15) !important;
  color: #4ade80 !important;
  border-color: rgba(34, 197, 94, 0.3) !important;
}

body.dark-mode .info-banner,
body.dark-mode .resume-banner,
body.dark-mode [class*="banner"] {
  background: rgba(59, 130, 246, 0.15) !important;
  color: #60a5fa !important;
}


body.dark-mode .exam-progress {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
}

body.dark-mode .topic-name {
  color: var(--secondary-gold) !important;
}

body.dark-mode .progress-stats {
  color: var(--text-secondary) !important;
}

body.dark-mode .question-card,
body.dark-mode section.question-card,
body.dark-mode div.question-card,
body.dark-mode .exam-main .question-card {
  background: #0d2137 !important;
  background-color: #0d2137 !important;
  color: #ffffff !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
}

body.dark-mode .question-header {
  border-bottom-color: var(--border-color) !important;
}

body.dark-mode .question-number {
  color: var(--secondary-gold) !important;
}

body.dark-mode .question-text {
  color: var(--text-primary) !important;
}

body.dark-mode .option-item {
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

body.dark-mode .option-item:hover {
  background: rgba(212, 175, 55, 0.1) !important;
  border-color: var(--secondary-gold-light) !important;
}

body.dark-mode .option-item.selected {
  background: rgba(212, 175, 55, 0.15) !important;
  border-color: var(--secondary-gold) !important;
}

body.dark-mode .option-letter {
  color: var(--text-secondary) !important;
}

body.dark-mode .option-text {
  color: var(--text-primary) !important;
}

body.dark-mode .option-radio {
  border-color: var(--text-secondary) !important;
}

body.dark-mode .nav-buttons .btn-outline {
  background: transparent !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

body.dark-mode .nav-buttons .btn-outline:hover {
  background: var(--bg-card) !important;
  border-color: var(--secondary-gold) !important;
}

body.dark-mode .saving-indicator {
  color: var(--text-secondary) !important;
}

body.dark-mode .saving-indicator.saved {
  color: #4ade80 !important;
}

body.dark-mode .modal {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

body.dark-mode .modal-header {
  border-bottom-color: var(--border-color) !important;
}

body.dark-mode .modal-title {
  color: var(--text-primary) !important;
}

body.dark-mode .modal-body {
  color: var(--text-primary) !important;
}

body.dark-mode .modal-body p {
  color: var(--text-primary) !important;
}

body.dark-mode .modal-footer {
  border-top-color: var(--border-color) !important;
}

body.dark-mode .modal-close {
  color: var(--text-secondary) !important;
}

body.dark-mode .modal-close:hover {
  color: var(--text-primary) !important;
}


body.dark-mode .page-header {
  background: linear-gradient(135deg, #0d2137 0%, #001529 100%) !important;
}

body.dark-mode .topic-card {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

body.dark-mode .topic-card:hover {
  background: var(--bg-card) !important;
  border-color: var(--secondary-gold) !important;
}

body.dark-mode .topic-card.not-started {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

body.dark-mode .topic-card.in-progress {
  background: rgba(217, 119, 6, 0.1) !important;
  border-color: #d97706 !important;
}

body.dark-mode .topic-card.completed {
  background: rgba(34, 197, 94, 0.1) !important;
  border-color: #22c55e !important;
}

body.dark-mode .topic-name {
  color: var(--text-primary) !important;
}

body.dark-mode .topic-questions {
  color: var(--text-secondary) !important;
}

body.dark-mode .topic-progress-text {
  color: var(--text-secondary) !important;
}

body.dark-mode .topic-stats {
  color: var(--text-secondary) !important;
}

body.dark-mode .attempts-info {
  color: var(--text-secondary) !important;
}

body.dark-mode .nav-links a {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

body.dark-mode .nav-links a:hover {
  border-color: var(--secondary-gold) !important;
  color: var(--secondary-gold) !important;
}

body.dark-mode .nav-links a.active {
  background: var(--primary-blue) !important;
  border-color: var(--primary-blue) !important;
  color: white !important;
}

body.dark-mode .session-header {
  background: #00152a !important;
}

body.dark-mode .session-topic {
  color: var(--text-primary) !important;
}

body.dark-mode .session-timer {
  color: var(--text-primary) !important;
}

body.dark-mode .session-progress {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

body.dark-mode .progress-page {
  color: var(--text-secondary) !important;
}

body.dark-mode .progress-answered {
  color: var(--text-secondary) !important;
}

body.dark-mode .progress-page strong,
body.dark-mode .progress-answered strong {
  color: var(--text-primary) !important;
}

body.dark-mode .progress-bar {
  background: var(--bg-primary) !important;
}

body.dark-mode .progress-fill {
  background: var(--secondary-gold) !important;
}

body.dark-mode .question-map {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

body.dark-mode .map-title {
  color: var(--text-primary) !important;
}

body.dark-mode .map-item {
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-secondary) !important;
}

body.dark-mode .map-item.answered {
  background: var(--secondary-gold) !important;
  color: #1e293b !important;
}

body.dark-mode .map-item.current {
  outline-color: var(--secondary-gold) !important;
}

body.dark-mode .page-btn {
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

body.dark-mode .page-btn:hover {
  border-color: var(--secondary-gold) !important;
}

body.dark-mode .page-btn.active {
  background: var(--primary-blue) !important;
  border-color: var(--primary-blue) !important;
  color: white !important;
}

body.dark-mode .complete-section .unanswered-warning {
  color: var(--text-secondary) !important;
}

body.dark-mode .btn-pause {
  background: #d97706 !important;
  color: white !important;
}

body.dark-mode .btn-end {
  background: #dc2626 !important;
  color: white !important;
}

.btn-exit,
.btn-logout {
  background: #dc2626 !important;
  color: white !important;
  border: none !important;
}

.btn-exit:hover,
.btn-logout:hover {
  background: #ef4444 !important;
}

body.dark-mode .btn-exit,
body.dark-mode .btn-logout {
  background: #dc2626 !important;
  color: white !important;
  border: none !important;
}

body.dark-mode .btn-exit:hover,
body.dark-mode .btn-logout:hover {
  background: #ef4444 !important;
}

body.dark-mode .btn-primary {
  background: var(--secondary-gold) !important;
  color: #1e293b !important;
}

body.dark-mode .btn-secondary {
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}


body.dark-mode .results-content {
  background: var(--bg-primary) !important;
}

body.dark-mode .performance-card {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

body.dark-mode .performance-title {
  color: var(--text-primary) !important;
}

body.dark-mode .performance-label {
  color: var(--text-secondary) !important;
}

body.dark-mode .performance-bar-container {
  background: var(--bg-card) !important;
}

body.dark-mode .topic-performance-card {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

body.dark-mode .topic-item {
  background: var(--bg-card) !important;
}

body.dark-mode .topic-item:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}

body.dark-mode .topic-info h4 {
  color: var(--text-primary) !important;
}

body.dark-mode .topic-meta {
  color: var(--text-secondary) !important;
}

body.dark-mode .topic-progress-bar {
  background: var(--bg-primary) !important;
}

body.dark-mode .next-topic-card {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

body.dark-mode .next-topic-btn {
  background: var(--secondary-gold) !important;
  color: #1e293b !important;
}

body.dark-mode .next-topic-title {
  color: var(--text-primary) !important;
}

body.dark-mode .action-btn.secondary {
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

body.dark-mode .action-btn.outline {
  background: transparent !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

body.dark-mode .accordion-header {
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

body.dark-mode .accordion-content {
  background: var(--bg-secondary) !important;
  border-color: var(--border-color) !important;
}

body.dark-mode .question-review-card {
  background: var(--bg-card) !important;
  border-color: var(--border-color) !important;
}

body.dark-mode .review-question-text {
  color: var(--text-primary) !important;
}

body.dark-mode .review-option {
  background: var(--bg-primary) !important;
  border-color: var(--border-color) !important;
  color: var(--text-primary) !important;
}

body.dark-mode .question-status {
  color: var(--success-green) !important;
}

body.dark-mode .review-option.correct {
  background: rgba(34, 197, 94, 0.15) !important;
  border-color: #22c55e !important;
}

body.dark-mode .review-option.wrong {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: #ef4444 !important;
}

.lang-toggle {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.lang-toggle-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.lang-toggle-btn:hover {
  color: rgba(255, 255, 255, 0.9);
}

.lang-toggle-btn.active {
  background: var(--secondary-gold);
  color: var(--primary-blue-dark);
  font-weight: 600;
}

.lang-toggle-divider {
  color: rgba(255, 255, 255, 0.3);
  font-size: var(--text-xs);
  user-select: none;
}

.login-page .lang-toggle,
.login-card .lang-toggle {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
}

body:not(.dark-mode) .admin-header .lang-toggle {
  background: rgba(0, 31, 63, 0.1);
  border-color: rgba(0, 31, 63, 0.2);
}

body:not(.dark-mode) .admin-header .lang-toggle-btn {
  color: var(--gray-600);
}

body:not(.dark-mode) .admin-header .lang-toggle-btn:hover {
  color: var(--dark-gray);
}

body:not(.dark-mode) .admin-header .lang-toggle-divider {
  color: var(--gray-400);
}

.lang-toggle {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 3px;
  gap: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  margin-right: 1rem;
  transition: all 0.3s ease;
}

.lang-toggle-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  padding: 6px 14px;
  font-family: var(--font-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  letter-spacing: 0.5px;
}

.lang-toggle-btn:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
}

.lang-toggle-btn.active {
  background: var(--secondary-gold);
  color: var(--primary-blue-dark);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
  font-weight: 700;
}

.lang-toggle-btn.active:hover {
  background: var(--secondary-gold-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.lang-toggle-divider {
  display: none;
}

body.dark-mode .lang-toggle {
  background: rgba(15, 23, 42, 0.4);
  border-color: rgba(255, 255, 255, 0.05);
}

body.dark-mode .lang-toggle-btn {
  color: rgba(255, 255, 255, 0.6);
}

body.dark-mode .lang-toggle-btn:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .lang-toggle-btn.active {
  background: var(--secondary-gold);
  color: var(--primary-blue-dark);
}

.history-filters {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  animation: slideDown 0.3s ease-out;
}

body.dark-mode .history-filters {
  background: rgba(30, 41, 59, 0.5);
  border-color: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
}

.filter-row {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-width: 150px;
}

.filter-select,
.filter-input {
  width: 100%;
  padding: 0.625rem;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  background: var(--white);
  color: var(--dark-gray);
  font-size: 0.875rem;
  font-family: var(--font-secondary);
  transition: all 0.2s;
  height: 40px;
}

.filter-select:focus,
.filter-input:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0, 31, 63, 0.1);
}

body.dark-mode .filter-select,
body.dark-mode .filter-input {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

body.dark-mode .filter-select:focus,
body.dark-mode .filter-input:focus {
  border-color: var(--secondary-gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
  height: 40px;
}

.btn-filter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1rem;
}

.btn-filter.primary {
  background: var(--primary-blue);
  color: var(--white);
}

.btn-filter.primary:hover {
  background: var(--primary-blue-light);
  transform: translateY(-1px);
}

.btn-filter.secondary {
  background: transparent;
  border-color: var(--gray-300);
  color: var(--gray-600);
}

.btn-filter.secondary:hover {
  background: var(--gray-100);
  color: var(--error-red);
  border-color: var(--error-red);
}

body.dark-mode .btn-filter.primary {
  background: var(--secondary-gold);
  color: var(--primary-blue-dark);
}

body.dark-mode .btn-filter.primary:hover {
  background: var(--secondary-gold-light);
}

body.dark-mode .btn-filter.secondary {
  border-color: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.6);
}

body.dark-mode .btn-filter.secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--error-red);
  border-color: var(--error-red);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 768px) {
  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-actions {
    justify-content: flex-end;
  }
}