/* === Aurora Neon Dark Tech Variables === */
:root {
  --primary: #8b5cf6;
  --primary-grad: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
  --secondary: #10b981;
  --danger: #f43f5e;
  --warning: #fbbf24;
  --bg-color: #f4f5f7;
  --surface: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --table-header: #f8fafc;
  --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.03);
  --shadow-float: 0 20px 40px rgba(139, 92, 246, 0.12);
  --radius-lg: 20px;
  --radius-md: 12px;
}

/* === Dark Mode Config === */
body.dark-mode {
  --bg-color: #05050a;
  --surface: #0d0d15;
  --text-main: #fafafa;
  --text-muted: #94a3b8;
  --border-color: rgba(139, 92, 246, 0.15);
  --table-header: #12121e;
  --shadow-soft: 0 10px 40px rgba(0, 0, 0, 0.6);
  --shadow-float: 0 20px 50px rgba(0, 0, 0, 0.8);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  margin: 0;
  padding: 0;
  transition:
    background-color 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: "IBM Plex Sans Arabic", sans-serif;
}

body,
html {
  height: 100%;
  font-family: "IBM Plex Sans Arabic", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  overflow: hidden;
  direction: rtl;
  text-align: right;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(139, 92, 246, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(6, 182, 212, 0.05) 0%, transparent 45%);
  background-attachment: fixed;
}

.app-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
}

/* === Header styling === */
.glass-header {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

body.dark-mode .glass-header {
  background: rgba(13, 13, 21, 0.75);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}

.header-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  flex: 1;
  text-align: center;
}

body.dark-mode .header-title {
  color: #818cf8;
}

.back-btn {
  background: var(--bg-color);
  color: var(--primary);
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: 0.3s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

body.dark-mode .back-btn {
  background: #1e293b;
  color: #818cf8;
}

.back-btn:hover {
  background: var(--primary);
  color: white;
}

body.dark-mode .back-btn:hover {
  background: #4f46e5;
  color: white;
}

.back-btn.hidden {
  opacity: 0;
  pointer-events: none;
}

.header-spacer {
  width: 40px;
}

/* === Main Content Area === */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 25px 20px;
  padding-bottom: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  scroll-behavior: smooth;
}

.container-inner {
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* === Bottom Navigation Bar === */
.bottom-nav {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 450px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 8px;
  border-radius: 40px;
  box-shadow: var(--shadow-float);
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

body.dark-mode .bottom-nav {
  background: rgba(13, 13, 21, 0.75);
  border-color: rgba(139, 92, 246, 0.15);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 8px 16px;
  border-radius: 30px;
  position: relative;
}

.nav-item:hover:not(.active) {
  color: var(--text-main);
}

.nav-item i {
  font-size: 18px;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-item span {
  display: none;
  /* Hide navigation labels on mobile phones */
}

.nav-item.active {
  color: var(--primary);
  background: transparent;
  box-shadow: none;
  transform: none;
}

.nav-item.active i {
  transform: translateY(-2px);
}

.nav-item.active::after {
  content: "";
  position: absolute;
  bottom: 0px;
  width: 4px;
  height: 4px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--primary), 0 0 20px var(--primary);
  animation: pulseIndicator 1.5s infinite;
}

.nav-item.active span {
  display: none;
}

@keyframes pulseIndicator {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.8;
  }

  50% {
    transform: scale(1.4);
    opacity: 1;
  }
}

.screen {
  display: none;
  opacity: 0;
  transform: translateY(15px);
  transition: 0.5s ease;
  width: 100%;
  max-width: 600px;
  /* Default centered maximum width, perfect for login/auth/exam */
  margin: 0 auto;
  box-sizing: border-box;
}

.screen.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
  animation: slideUp 0.5s ease forwards;
}

@keyframes slideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === Cards & Form Fields === */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 30px;
  margin-bottom: 25px;
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-color);
  position: relative;
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
}

.card:hover {
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: 0 20px 40px -15px rgba(139, 92, 246, 0.1);
}

body.dark-mode .card {
  background: linear-gradient(135deg, var(--surface) 0%, rgba(13, 13, 21, 0.8) 100%);
}

body.dark-mode .card:hover {
  border-color: rgba(139, 92, 246, 0.4);
  box-shadow: 0 20px 50px -15px rgba(0, 0, 0, 0.7), 0 0 20px rgba(139, 92, 246, 0.08);
}

.question-card {
  display: none;
}

.question-card.active {
  display: block;
  animation: fadeIn 0.4s ease forwards;
}

.hero-icon {
  width: 80px;
  height: 80px;
  background: var(--primary-grad);
  color: white;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 35px;
  margin: 0 auto 20px auto;
  box-shadow: var(--shadow-float);
  transform: rotate(-5deg);
}

.input-group {
  position: relative;
  margin-bottom: 20px;
}

.input-group i:not(.password-toggle) {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
  z-index: 1;
}

.input-group .password-toggle {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 18px;
  z-index: 2;
  cursor: pointer;
  transition: color 0.2s ease;
}

.input-group .password-toggle:hover {
  color: var(--primary);
}

.input-group:has(.password-toggle) .input-modern {
  padding-left: 45px;
}

.input-modern,
select.input-modern {
  width: 100%;
  padding: 16px 45px 16px 16px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  color: var(--text-main);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
  appearance: none;
  direction: rtl;
  text-align: right;
}

.input-modern:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}

.btn-main {
  width: 100%;
  padding: 14px 24px;
  min-height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  font-size: clamp(14px, 2.5vw, 15px);
  font-weight: 800;
  font-family: inherit;
  background: var(--primary-grad);
  color: white;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 24px -6px rgba(139, 92, 246, 0.3);
  margin-bottom: 15px;
  box-sizing: border-box;
  white-space: normal;
  word-break: break-word;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.btn-main:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px -4px rgba(139, 92, 246, 0.5);
  opacity: 0.95;
}

.btn-main:active {
  transform: translateY(-1px) scale(0.98);
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 8px 24px -6px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  box-shadow: 0 12px 28px -4px rgba(16, 185, 129, 0.55);
}

.btn-danger {
  background: linear-gradient(135deg, #f43f5e 0%, #be123c 100%);
  box-shadow: 0 8px 24px -6px rgba(244, 63, 94, 0.3);
}

.btn-danger:hover {
  box-shadow: 0 12px 28px -4px rgba(244, 63, 94, 0.55);
}

.btn-text {
  background: transparent;
  color: var(--primary);
  box-shadow: none;
  padding: 10px;
}

body.dark-mode .btn-text {
  color: #818cf8;
}

.btn-text:hover {
  background: rgba(67, 56, 202, 0.05);
}

/* === Study Subjects Grid === */
.grid-subjects {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  width: 100%;
}

.subject-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 25px 15px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  position: relative;
  overflow: hidden;
}

.subject-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 100% 0%, rgba(139, 92, 246, 0.05) 0%, transparent 60%);
  pointer-events: none;
}

body.dark-mode .subject-card::before {
  background: radial-gradient(circle at 100% 0%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
}

.subject-card i {
  font-size: 26px;
  color: var(--primary);
  background: rgba(139, 92, 246, 0.08);
  padding: 14px;
  border-radius: 16px;
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

body.dark-mode .subject-card i {
  color: #a78bfa;
  background: rgba(167, 139, 250, 0.1);
}

.subject-card i.subject-text-icon {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-style: normal;
  font-weight: 800;
  font-size: 24px;
}

.subject-card i.subject-text-icon.math-icon {
  font-size: 16px;
  letter-spacing: 0.5px;
}

.subject-card i.subject-text-icon.abc-icon {
  font-size: 18px;
}

.subject-card span {
  font-weight: 800;
  font-size: 15px;
  color: var(--text-main);
  transition: color 0.3s;
}

.subject-card:hover {
  border-color: var(--primary);
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-float);
}

.subject-card:hover i {
  background: var(--primary-grad);
  color: white;
  transform: scale(1.1) rotate(3deg);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

.free-exam-card {
  grid-column: span 2;
  border-color: var(--secondary);
  background: rgba(16, 185, 129, 0.05);
}

.free-exam-card i {
  color: var(--secondary);
  background: rgba(16, 185, 129, 0.15);
}

.subject-card.activated::after {
  content: "\f00c";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  top: 12px;
  left: 12px;
  background: var(--secondary);
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
}

/* === Exam Sheet styling === */
.question-text {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.6;
  margin-bottom: 25px;
  color: var(--text-main);
}

.points-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(67, 56, 202, 0.1);
  color: var(--primary);
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 15px;
}

body.dark-mode .points-badge {
  background: rgba(129, 140, 248, 0.15);
  color: #818cf8;
}

.option-label {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 16px 20px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-weight: 600;
  font-size: 14.5px;
  position: relative;
  overflow: hidden;
}

.option-label:hover {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.02);
  transform: translateY(-2px);
}

.option-label input[type="radio"] {
  display: none;
}

.option-label:has(input[type="radio"]:checked) {
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.06);
  color: var(--primary);
  box-shadow: 0 8px 20px rgba(139, 92, 246, 0.08);
  transform: translateY(-3px);
}

body.dark-mode .option-label:has(input[type="radio"]:checked) {
  background: rgba(139, 92, 246, 0.1);
  color: #fafafa;
}

.option-label:has(input[type="radio"]:checked)::before {
  content: "\f00c";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  left: 20px;
  color: var(--primary);
  font-size: 16px;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  0% {
    transform: scale(0);
  }

  100% {
    transform: scale(1);
  }
}

.timer-wrapper {
  position: fixed;
  top: 0px;
  z-index: 1000;
  margin-bottom: 25px;
  background: var(--bg-color);
  padding: 10px 0;
  width: 100%;
}

.timer-bar {
  background: var(--surface);
  padding: 15px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  font-size: 18px;
  color: var(--text-main);
  transition: 0.3s;
}

.timer-bar.warning {
  border-color: var(--danger);
  color: var(--danger);
  animation: pulseAlert 1s infinite;
}

@keyframes pulseAlert {
  0% {
    box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.4);
  }

  70% {
    box-shadow: 0 0 0 15px rgba(244, 63, 94, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(244, 63, 94, 0);
  }
}

/* === Loader and Results styling === */
#loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(5px);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

body.dark-mode #loader {
  background: rgba(11, 15, 25, 0.9);
}

.custom-spinner {
  width: 90px;
  height: 90px;
  position: relative;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Central Orb */
.custom-spinner::before {
  content: "";
  position: absolute;
  width: 28px;
  height: 28px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 20px var(--primary), 0 0 40px var(--primary);
  animation: pulseOrb 1.2s ease-in-out infinite alternate;
}

/* Outer Rotating Track */
.custom-spinner::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  border: 2px solid rgba(139, 92, 246, 0.1);
  border-top: 2.5px solid var(--primary);
  border-bottom: 2.5px solid var(--primary);
  border-radius: 50%;
  animation: spin3D 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.loader-text {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

body.dark-mode .loader-text {
  color: var(--primary);
  text-shadow: 0 0 15px rgba(139, 92, 246, 0.4);
}

@keyframes pulseOrb {
  0% {
    transform: scale(0.8);
    opacity: 0.7;
    box-shadow: 0 0 15px var(--primary);
  }

  100% {
    transform: scale(1.2);
    opacity: 1;
    box-shadow: 0 0 30px var(--primary), 0 0 50px var(--primary);
  }
}

@keyframes spin3D {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.result-circle {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 10px solid var(--bg-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px auto;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
}

.result-circle h1 {
  font-size: 40px;
  color: var(--primary);
  margin: 0;
  line-height: 1;
}

body.dark-mode .result-circle h1 {
  color: #818cf8;
}

.result-circle span {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 700;
  margin-top: 5px;
}

.ans-card {
  border-right: 6px solid;
}

.ans-correct {
  border-right-color: var(--secondary);
}

.ans-wrong {
  border-right-color: var(--danger);
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* === Teacher and Admin Dashboard styling === */
.dash-tab-btn {
  flex: 0 0 auto;
  min-width: max-content;
  padding: 12px 18px;
  border: none;
  background: var(--surface);
  color: var(--text-muted);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.3s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-soft);
  white-space: nowrap;
}

.dash-tab-btn.active {
  background: var(--primary-grad);
  color: white;
  box-shadow: 0 4px 10px rgba(67, 56, 202, 0.25);
}

.dash-tab-content {
  display: none;
  width: 100%;
}

.dash-tab-content.active {
  display: block;
  animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* === Modernized Tables === */
.table-responsive {
  overflow-x: auto;
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 20px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 14px;
}

table th,
table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  color: var(--text-main);
}

table th {
  background: var(--table-header);
  font-weight: 800;
  color: var(--text-main);
}

table tbody tr:hover {
  background-color: rgba(67, 56, 202, 0.02);
}

.badge-status {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-active {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.badge-used {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.badge-expired {
  background: rgba(244, 63, 94, 0.12);
  color: #be123c;
}

.btn-icon-small {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s;
}

.btn-icon-edit {
  background: rgba(67, 56, 202, 0.08);
  color: var(--primary);
}

body.dark-mode .btn-icon-edit {
  background: rgba(129, 140, 248, 0.15);
  color: #818cf8;
}

.btn-icon-edit:hover {
  background: var(--primary);
  color: white;
}

body.dark-mode .btn-icon-edit:hover {
  background: #4f46e5;
  color: white;
}

.btn-icon-delete {
  background: rgba(244, 63, 94, 0.08);
  color: var(--danger);
}

.btn-icon-delete:hover {
  background: var(--danger);
  color: white;
}

.btn-icon-copy {
  background: rgba(16, 185, 129, 0.08);
  color: #059669;
}

.btn-icon-copy:hover {
  background: #059669;
  color: white;
}

.btn-icon-share {
  background: rgba(79, 70, 229, 0.08);
  color: var(--primary);
}

.btn-icon-share:hover {
  background: var(--primary);
  color: white;
}

.btn-icon-verify {
  background: rgba(245, 158, 11, 0.08);
  color: #d97706;
}

.btn-icon-verify:hover {
  background: #d97706;
  color: white;
}

/* === Subscriptions Buttons in Profile === */
.sub-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: nowrap;
  align-items: center;
}

.sub-card-actions .btn-main {
  flex: 1;
  min-height: 36px;
  padding: 8px 12px;
  font-size: 12px;
  margin-bottom: 0;
  border-radius: 10px;
  white-space: nowrap;
  gap: 5px;
}

/* === Overlays and Modals === */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 3, 6, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
  box-sizing: border-box;
  animation: fadeInOverlay 0.3s ease-out forwards;
}

.modal-box {
  background: var(--surface);
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  border: 1px solid var(--border-color);
  animation: modalScale 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeInOverlay {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes modalScale {
  from {
    transform: scale(0.94) translateY(20px);
    opacity: 0;
  }

  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

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

.modal-header h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
}

.modal-body {
  padding: 20px 25px;
}

/* === Profile Subscriptions Banners === */
.sub-card-mini {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sub-card-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 800;
  font-size: 15px;
}

.sub-progress-container {
  width: 100%;
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 5px;
}

.sub-progress-bar {
  height: 100%;
  background: var(--primary-grad);
  border-radius: 4px;
  transition: 0.5s;
}

/* === Pre-Exam Subject Stats Card === */
.subject-stats-wrapper {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 20px 0;
}

.stat-box-mini {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  padding: 15px 10px;
  border-radius: var(--radius-md);
  text-align: center;
}

.stat-box-mini i {
  font-size: 20px;
  color: var(--primary);
  margin-bottom: 8px;
  display: block;
}

body.dark-mode .stat-box-mini i {
  color: #818cf8;
}

.stat-box-mini span {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
}

.stat-box-mini b {
  font-size: 14px;
  color: var(--text-main);
  font-weight: 800;
}

/* === Responsive Design for Stats Screen === */
.stats-grid-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 20px;
  width: 100%;
}

.stats-grid-subjects {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
  width: 100%;
}

/* Responsive settings grid for auth screen */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: 100%;
}

.grid-span-2 {
  grid-column: span 1;
}

@media (min-width: 768px) {
  .bottom-nav {
    bottom: 25px;
    /* Floats beautifully at the bottom like a premium desktop/tablet dock! */
    top: auto;
    width: 80%;
    max-width: 600px;
    padding: 12px 25px;
    gap: 20px;
    border-radius: 24px;
  }

  .nav-item {
    flex-direction: row;
    padding: 10px 20px;
    gap: 8px;
  }

  .nav-item span {
    display: inline-block;
    opacity: 1;
    height: auto;
    min-height: auto;
    margin: 0;
    overflow: visible;
  }

  /* Override base active span specificity to ensure active tab text displays beautifully on tablet and desktop */
  .nav-item.active span {
    display: inline-block;
    opacity: 1;
    height: auto;
    min-height: auto;
    margin: 0;
    overflow: visible;
  }

  .content-area {
    padding-top: 25px;
  }

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

  .free-exam-card {
    grid-column: span 3;
  }

  .settings-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-span-2 {
    grid-column: span 2;
  }

  /* Responsive screen sizing for Tablets */
  #home-screen,
  #auth-screen,
  #profile-screen,
  #results-history-screen,
  #stats-screen {
    max-width: 860px;
  }

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

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

  #dashboard-screen {
    max-width: 950px;
  }
}

@media (min-width: 1024px) {
  .bottom-nav {
    bottom: 15px;
    /* Expands into a spacious desktop dock floating dock at the bottom! */
    width: 100%;
    max-width: 800px;
    padding: 14px 30px;
    gap: 30px;
    font-size: 14px;
    border-radius: 28px;
  }

  .nav-item {
    padding: 12px 24px;
    gap: 10px;
  }

  /* Responsive screen sizing for Computers / Desktop */
  .grid-subjects {
    grid-template-columns: repeat(4, 1fr);
  }

  .free-exam-card {
    grid-column: span 4;
  }

  #home-screen,
  #auth-screen,
  #profile-screen,
  #results-history-screen,
  #stats-screen {
    max-width: 1100px;
  }

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

  #dashboard-screen {
    max-width: 1200px;
  }
}

/* Tiny helper for mobile phone buttons & dashboard responsive view */
@media (max-width: 767px) {
  .card {
    padding: 20px 15px;
  }

  .hero-icon {
    width: 65px;
    height: 65px;
    font-size: 28px;
  }

  .input-modern,
  select.input-modern {
    padding: 14px 40px 14px 14px;
  }

  /* Table cell optimizations for mobile view */
  table th,
  table td {
    padding: 10px 12px;
    font-size: 13px;
  }

  /* Stats boxes in mobile view */
  .subject-stats-wrapper {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .stat-box-mini {
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: right;
  }

  .stat-box-mini i {
    margin-bottom: 0;
  }
}

@media (max-width: 480px) {
  .btn-main {
    padding: 12px 16px;
    min-height: 48px;
  }

  .card button[style*="width: auto"],
  .card button[style*="width:auto"] {
    width: 100% !important;
    margin-top: 8px !important;
    box-sizing: border-box;
  }
}

/* === DB Loading Overlay === */
.db-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(11, 15, 25, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.3s ease;
}

.db-loading-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  padding: 40px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  text-align: center;
  max-width: 450px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  animation: scaleUp 0.3s ease forwards;
}

.db-loading-icon {
  font-size: 50px;
  color: #4f46e5;
  animation: bounce 1.5s infinite ease-in-out;
}

.db-loading-card h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
}

.db-loading-card p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  min-height: 21px;
}

.db-progress-bar-container {
  width: 100%;
  height: 12px;
  background: var(--border-color);
  border-radius: 50px;
  overflow: hidden;
  position: relative;
}

.db-progress-bar-fill {
  height: 100%;
  background: var(--primary-grad);
  width: 0%;
  border-radius: 50px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#db-loading-percentage {
  font-family: "Bruno Ace", monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

@keyframes scaleUp {
  from {
    transform: scale(0.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

/* === PWA Install Modal === */
.pwa-install-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(11, 15, 25, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.3s ease;
}

.pwa-install-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  padding: 30px 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  text-align: center;
  max-width: 400px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  animation: scaleUp 0.3s ease forwards;
}

.pwa-install-icon {
  font-size: 40px;
  color: #4f46e5;
  animation: pulse-slow 2s infinite ease-in-out;
}

.pwa-install-card h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
}

.pwa-install-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.pwa-install-actions {
  display: flex;
  width: 100%;
  gap: 12px;
  margin-top: 10px;
}

.btn-pwa-confirm {
  background: var(--primary-grad);
  color: white;
  border: none;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-pwa-confirm:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-pwa-cancel {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  flex: 1;
  transition: background-color 0.2s ease;
}

.btn-pwa-cancel:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-main);
}

body.dark-mode .btn-pwa-cancel:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* === Watermark for Exam Screen (Background Protection) === */
#exam-screen {
  position: relative !important;
  overflow: hidden !important;
}

#exam-screen::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300' viewBox='0 0 300 300'><text x='30' y='120' fill='%234338ca' font-size='24' font-family='sans-serif' font-weight='900' transform='rotate(-25 30 120)'>Q-AZMON</text><text x='30' y='150' fill='%2310b981' font-size='16' font-family='sans-serif' font-weight='800' transform='rotate(-25 30 150)'>Q - ئەزمون</text><text x='30' y='180' fill='%2364748b' font-size='12' font-family='sans-serif' font-weight='700' transform='rotate(-25 30 180)'>پلاتفۆرمێ تاقیکرنێن زیرەک</text></svg>");
  background-repeat: repeat;
}

body.dark-mode #exam-screen::before {
  opacity: 0.03;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300' viewBox='0 0 300 300'><text x='30' y='120' fill='%23818cf8' font-size='24' font-family='sans-serif' font-weight='900' transform='rotate(-25 30 120)'>Q-AZMON</text><text x='30' y='150' fill='%2334d399' font-size='16' font-family='sans-serif' font-weight='800' transform='rotate(-25 30 150)'>Q - ئەزمون</text><text x='30' y='180' fill='%2394a3b8' font-size='12' font-family='sans-serif' font-weight='700' transform='rotate(-25 30 180)'>پلاتفۆرمێ تاقیکرنێن زیرەک</text></svg>");
}

#exam-screen>* {
  position: relative;
  z-index: 1;
}

/* === Multi-select Custom Field === */
.multi-select-options-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  max-height: 220px;
  overflow-y: auto;
  margin-top: 5px;
  padding: 8px 0;
}

.multi-select-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 15px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-main);
  transition: background 0.2s ease;
  user-select: none;
  text-align: right;
  direction: rtl;
}

.multi-select-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

body.dark-mode .multi-select-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.multi-select-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
  margin: 0;
}

.multi-select-item span {
  font-weight: 500;
}

/* === Academic PDF Printing Layout === */
@media print {
  body {
    background: white !important;
    color: black !important;
    font-size: 12pt !important;
    overflow: visible !important;
  }

  .app-wrapper {
    height: auto !important;
    overflow: visible !important;
  }

  .content-area {
    overflow: visible !important;
    padding: 0 !important;
    padding-bottom: 0 !important;
  }

  .bottom-nav,
  .glass-header,
  .btn-main,
  .btn-icon-small,
  #theme-toggle,
  #back-button,
  .dash-tab-btn,
  .input-modern,
  #dash-results-search,
  #dash-results-subject-select {
    display: none !important;
  }

  .card {
    box-shadow: none !important;
    border: 1px solid #94a3b8 !important;
    page-break-inside: avoid !important;
    background: white !important;
    color: black !important;
  }

  .table-responsive {
    border: none !important;
    overflow: visible !important;
  }

  table {
    width: 100% !important;
    font-size: 11pt !important;
    background: white !important;
  }

  table th,
  table td {
    border: 1px solid #94a3b8 !important;
    padding: 10px !important;
    color: black !important;
    white-space: normal !important;
  }

  table th {
    background: #e2e8f0 !important;
  }

  /* Show grades report only when printing */
  .screen {
    display: none !important;
  }

  #dashboard-screen {
    display: block !important;
    opacity: 1 !important;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .dash-tab-content {
    display: none !important;
  }

  #dash-tab-results {
    display: block !important;
  }
}

/* ============================================
           === Supplementary Extra Styles ===
           ============================================ */

/* === Dark Mode for Input Fields === */
body.dark-mode .input-modern,
body.dark-mode select.input-modern {
  background: var(--surface);
  border-color: var(--border-color);
  color: var(--text-main);
}

body.dark-mode .input-modern:focus,
body.dark-mode select.input-modern:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2);
}

body.dark-mode .input-modern::placeholder {
  color: #52525b;
}

/* === Social Media Icons === */
.social-icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.social-icon-btn:hover {
  transform: scale(1.15) translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

/* === Leaderboard Card styling === */
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  transition: 0.3s;
  border-bottom: 1px solid var(--border-color);
}

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

.leaderboard-item:hover {
  background: rgba(67, 56, 202, 0.03);
}

body.dark-mode .leaderboard-item:hover {
  background: rgba(129, 140, 248, 0.05);
}

.leaderboard-rank {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  flex-shrink: 0;
  background: var(--bg-color);
  color: var(--text-muted);
  border: 2px solid var(--border-color);
}

.leaderboard-rank.gold {
  background: linear-gradient(135deg, #fde68a 0%, #f59e0b 100%);
  color: #78350f;
  border-color: #f59e0b;
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
}

.leaderboard-rank.silver {
  background: linear-gradient(135deg, #e2e8f0 0%, #94a3b8 100%);
  color: #1e293b;
  border-color: #94a3b8;
  box-shadow: 0 4px 10px rgba(148, 163, 184, 0.3);
}

.leaderboard-rank.bronze {
  background: linear-gradient(135deg, #fed7aa 0%, #f97316 100%);
  color: #7c2d12;
  border-color: #f97316;
  box-shadow: 0 4px 10px rgba(249, 115, 22, 0.3);
}

.leaderboard-info {
  flex: 1;
  text-align: right;
}

.leaderboard-name {
  font-weight: 800;
  font-size: 14px;
  color: var(--text-main);
  display: block;
  margin-bottom: 2px;
}

.leaderboard-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.leaderboard-score {
  font-weight: 900;
  font-size: 18px;
  color: var(--primary);
  flex-shrink: 0;
}

body.dark-mode .leaderboard-score {
  color: #818cf8;
}

/* === Bookmarks styling === */
.bookmark-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: 0.3s;
  border-right: 5px solid var(--primary);
}

body.dark-mode .bookmark-card {
  border-right-color: #818cf8;
}

.bookmark-card:hover {
  box-shadow: var(--shadow-float);
  transform: translateY(-3px);
}

.bookmark-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 10px;
}

.bookmark-card-subject {
  font-size: 11px;
  font-weight: 800;
  color: var(--primary);
  background: rgba(67, 56, 202, 0.08);
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-block;
}

body.dark-mode .bookmark-card-subject {
  color: #818cf8;
  background: rgba(129, 140, 248, 0.12);
}

.bookmark-card-question {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-main);
  margin-bottom: 12px;
}

.bookmark-card-answer {
  font-size: 13px;
  font-weight: 700;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-unbookmark {
  background: rgba(244, 63, 94, 0.08);
  color: var(--danger);
  border: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s;
  flex-shrink: 0;
}

.btn-unbookmark:hover {
  background: var(--danger);
  color: white;
}

/* === Exam Answers Review Cards === */
.review-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 15px;
  transition: 0.2s;
}

.review-question-title {
  font-weight: 800;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-main);
  margin-bottom: 15px;
}

.review-compare-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.review-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
}

.review-line.correct {
  background: rgba(16, 185, 129, 0.08);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.review-line.wrong {
  background: rgba(244, 63, 94, 0.08);
  color: #be123c;
  border: 1px solid rgba(244, 63, 94, 0.2);
}

.review-line.skipped {
  background: rgba(245, 158, 11, 0.08);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.review-line i {
  flex-shrink: 0;
  font-size: 14px;
}

/* === Toast Notifications === */
.toast-container {
  position: fixed;
  top: 90px;
  right: 20px;
  z-index: 99998;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  min-width: 260px;
  max-width: 350px;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toastIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  pointer-events: all;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.toast.hiding {
  animation: toastOut 0.3s ease forwards;
}

.toast-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.toast.toast-success .toast-icon {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.toast.toast-error .toast-icon {
  background: rgba(244, 63, 94, 0.12);
  color: #be123c;
}

.toast.toast-info .toast-icon {
  background: rgba(67, 56, 202, 0.1);
  color: var(--primary);
}

.toast.toast-warning .toast-icon {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(40px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(40px);
  }
}

/* === Teacher Bio Card === */
.teacher-profile-card {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: right;
}

.teacher-avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--surface);
  box-shadow: var(--shadow-soft);
  flex-shrink: 0;
}

.teacher-avatar-placeholder {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--primary-grad);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
  box-shadow: var(--shadow-soft);
}

.teacher-info {
  flex: 1;
}

.teacher-name {
  font-weight: 800;
  font-size: 15px;
  color: var(--text-main);
  display: block;
  margin-bottom: 4px;
}

.teacher-bio {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  line-height: 1.5;
}

/* === Question Cards in Dashboard === */
.dash-question-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  transition: 0.2s;
}

.dash-question-card:hover {
  border-color: rgba(67, 56, 202, 0.3);
  box-shadow: var(--shadow-soft);
}

.dash-question-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.dash-question-text {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-main);
  flex: 1;
}

.dash-question-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.dash-q-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(67, 56, 202, 0.08);
  color: var(--primary);
}

body.dark-mode .dash-q-tag {
  background: rgba(129, 140, 248, 0.12);
  color: #818cf8;
}

.dash-question-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* === Subject Stats Cards === */
.stats-subject-card {
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: 0.3s;
}

.stats-subject-card:hover {
  border-color: rgba(67, 56, 202, 0.3);
  box-shadow: var(--shadow-float);
  transform: translateY(-3px);
}

.stats-subject-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.stats-subject-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--primary-grad);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stats-subject-name {
  font-weight: 800;
  font-size: 16px;
  color: var(--text-main);
}

.stats-subject-count {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
}

.stats-mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stats-mini-item {
  text-align: center;
  padding: 10px 8px;
  background: var(--bg-color);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.stats-mini-item span {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 700;
  margin-bottom: 4px;
}

.stats-mini-item b {
  font-size: 16px;
  font-weight: 900;
  color: var(--text-main);
}

/* === Subject Progress Bar === */
.stats-subject-progress {
  margin-top: 14px;
}

.stats-subject-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stats-subject-progress-label span:first-child {
  color: var(--text-main);
}

/* === Dashboard Form Fields === */
.input-group-modern {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group-modern label {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-muted);
  text-align: right;
}

.input-group-modern .input-modern {
  direction: rtl;
  text-align: right;
}

.input-group-modern .input-modern[type="url"],
.input-group-modern .input-modern[dir="ltr"] {
  direction: ltr;
  text-align: left;
}

/* === Profile Subscriptions Cards === */
.sub-card-mini {
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: 0.3s;
}

.sub-card-mini:hover {
  border-color: rgba(67, 56, 202, 0.2);
}

.sub-card-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* === Internal Alert Banners === */
.alert-banner {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
  line-height: 1.5;
}

.alert-banner.alert-info {
  background: rgba(67, 56, 202, 0.06);
  border: 1px solid rgba(67, 56, 202, 0.15);
  color: var(--primary);
}

.alert-banner.alert-success {
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #059669;
}

.alert-banner.alert-warning {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #d97706;
}

.alert-banner.alert-danger {
  background: rgba(244, 63, 94, 0.06);
  border: 1px solid rgba(244, 63, 94, 0.15);
  color: #be123c;
}

body.dark-mode .alert-banner.alert-info {
  background: rgba(129, 140, 248, 0.08);
  border-color: rgba(129, 140, 248, 0.2);
  color: #818cf8;
}

/* === Post-Exam Results Screen === */
.result-header-card {
  background: var(--primary-grad);
  color: white;
  border-radius: var(--radius-lg);
  padding: 30px;
  text-align: center;
  margin-bottom: 20px;
  box-shadow: var(--shadow-float);
  border: none;
}

.result-circle-wrapper {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.result-score-label {
  font-size: 13px;
  font-weight: 700;
  opacity: 0.85;
  margin-top: 8px;
}

.result-metrics-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 20px;
}

.result-metric {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  text-align: center;
  backdrop-filter: blur(6px);
}

.result-metric i {
  font-size: 18px;
  margin-bottom: 6px;
  display: block;
  opacity: 0.9;
}

.result-metric span {
  display: block;
  font-size: 10px;
  opacity: 0.75;
  font-weight: 700;
  margin-bottom: 3px;
}

.result-metric b {
  font-size: 15px;
  font-weight: 900;
}

/* === Navigation Pagination Indicators === */
.screen-empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
}

.screen-empty-state i {
  font-size: 48px;
  margin-bottom: 15px;
  display: block;
  opacity: 0.5;
}

.screen-empty-state h3 {
  font-weight: 800;
  font-size: 17px;
  color: var(--text-main);
  margin-bottom: 8px;
}

.screen-empty-state p {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.6;
}

/* === Floating Action Button === */
.fab-btn {
  position: fixed;
  bottom: 100px;
  left: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--primary-grad);
  color: white;
  border: none;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-float);
  transition: 0.3s;
  z-index: 500;
}

.fab-btn:hover {
  transform: scale(1.1);
}

.fab-btn:active {
  transform: scale(0.95);
}

/* === Dashboard Details UI Improvements === */
.q-options-preview {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 10px;
}

.q-option-item {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 12px;
  background: var(--bg-color);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 6px;
}

.q-option-item.is-correct {
  color: #059669;
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.2);
  font-weight: 800;
}

.q-option-item.is-correct::before {
  content: "\f00c";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 10px;
}

/* === Dark Mode General Improvements === */
body.dark-mode .sub-card-mini {
  background: #1e293b;
  border-color: #334155;
}

body.dark-mode .teacher-profile-card {
  background: #1e293b;
  border-color: #334155;
}

body.dark-mode .stats-mini-item {
  background: #1e293b;
  border-color: #334155;
}

body.dark-mode .stats-subject-card {
  background: var(--surface);
}

body.dark-mode .dash-question-card {
  background: var(--surface);
}

body.dark-mode .review-card {
  background: var(--surface);
}

body.dark-mode .q-option-item {
  background: #1e293b;
  border-color: #334155;
}

body.dark-mode .leaderboard-rank {
  background: #1e293b;
  border-color: #334155;
}

body.dark-mode .bookmark-card {
  background: var(--surface);
}

/* === Scrollbar Improvements === */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.25);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.45);
}

body.dark-mode ::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.2);
}

/* === Action Buttons Improvements === */
.btn-outline {
  width: 100%;
  padding: 14px 24px;
  min-height: 52px;
  border: 2px solid var(--primary);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 800;
  font-family: inherit;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  transition: 0.3s;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
  box-sizing: border-box;
}

.btn-outline:hover {
  background: var(--primary);
  color: white;
  box-shadow: 0 8px 15px rgba(67, 56, 202, 0.2);
}

body.dark-mode .btn-outline {
  border-color: #818cf8;
  color: #818cf8;
}

body.dark-mode .btn-outline:hover {
  background: #4f46e5;
  color: white;
}

/* === Exam Progress Bar Improvements === */
.exam-progress-bar-wrapper {
  width: 100%;
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 10px;
}

.exam-progress-bar-fill {
  height: 100%;
  background: var(--primary-grad);
  border-radius: 2px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Responsive Leaderboard Layout === */
@media (max-width: 480px) {
  .leaderboard-item {
    padding: 10px 12px;
    gap: 10px;
  }

  .leaderboard-score {
    font-size: 16px;
  }

  .result-metrics-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .result-metric {
    padding: 10px 6px;
  }

  .result-metric b {
    font-size: 13px;
  }

  .stats-mini-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
  }

  .toast-container {
    right: 12px;
    left: 12px;
  }

  .toast {
    min-width: unset;
    max-width: 100%;
  }
}

/* === Responsive Profile Layout === */
@media (min-width: 768px) {
  .result-metrics-row {
    grid-template-columns: repeat(3, 1fr);
  }

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

  .toast-container {
    right: 30px;
  }
}

/* ============================================================
           === Scientific Review & Sponsor Section - New Design ===
           ============================================================ */

/* Outer container - animate entry */
#subject-teacher-box {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  border: none !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  margin-top: 24px;
}

#subject-teacher-box.teacher-box-visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Section Header --- */
.teacher-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding-right: 4px;
}

.teacher-section-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to left,
      rgba(79, 70, 229, 0.4),
      var(--border-color),
      transparent);
}

.teacher-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.teacher-section-title i {
  color: var(--primary);
  font-size: 14px;
  animation: pulseIcon 2s infinite;
}

@keyframes pulseIcon {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.15);
    opacity: 0.8;
  }
}

body.dark-mode .teacher-section-title i {
  color: #818cf8;
}

/* --- Premium Main Card --- */
.teacher-card-v2 {
  position: relative;
  background: linear-gradient(135deg,
      rgba(255, 255, 255, 0.75) 0%,
      rgba(255, 255, 255, 0.98) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(79, 70, 229, 0.12);
  box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.03),
    0 1px 8px rgba(79, 70, 229, 0.04);
  animation: tcv2In 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
  margin-bottom: 16px;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.teacher-card-v2:hover {
  box-shadow:
    0 20px 40px rgba(67, 56, 202, 0.12),
    0 0 15px rgba(67, 56, 202, 0.05);
  transform: translateY(-4px) scale(1.005);
  border-color: rgba(79, 70, 229, 0.3);
}

body.dark-mode .teacher-card-v2 {
  background: linear-gradient(135deg,
      rgba(21, 31, 50, 0.75) 0%,
      rgba(21, 31, 50, 0.98) 100%);
  border-color: rgba(129, 140, 248, 0.12);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

body.dark-mode .teacher-card-v2:hover {
  border-color: rgba(129, 140, 248, 0.35);
}

@keyframes tcv2In {
  from {
    opacity: 0;
    transform: translateY(15px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Animate upper background gradient bar */
.teacher-card-v2::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #4f46e5, #10b981, #3b82f6, #4f46e5);
  background-size: 300% 100%;
  animation: gradientShift 6s ease infinite;
  z-index: 2;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

/* --- Main info section --- */
.teacher-card-main {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 24px 20px 18px 20px;
  position: relative;
}

/* Background circular decoration */
.teacher-card-main::after {
  content: "";
  position: absolute;
  top: -30px;
  left: -30px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle,
      rgba(67, 56, 202, 0.04) 0%,
      transparent 70%);
  pointer-events: none;
}

/* Top section: image, name, and subject next to it */
.teacher-card-top {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
}

/* --- Teacher image --- */
.teacher-photo-wrap {
  position: relative;
  flex-shrink: 0;
}

.teacher-photo-ring {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  padding: 3px;
  background: linear-gradient(135deg, #4f46e5 0%, #10b981 100%);
  box-shadow: 0 4px 12px rgba(67, 56, 202, 0.15);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.teacher-photo-ring img {
  width: 100%;
  height: 100%;
  border-radius: 17px;
  object-fit: cover;
  display: block;
}

.teacher-card-v2:hover .teacher-photo-ring {
  transform: scale(1.03) rotate(1deg);
  box-shadow: 0 12px 28px rgba(67, 56, 202, 0.32);
}

/* Verification circular badge */
.teacher-verified-badge {
  position: absolute;
  bottom: -5px;
  left: -5px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2.5px solid var(--surface);
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.35);
  z-index: 2;
  animation: badgeFloat 2.5s infinite ease-in-out;
}

@keyframes badgeFloat {

  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-3px) scale(1.05);
  }
}

/* --- Teacher details --- */
.teacher-info-wrap {
  flex: 1;
  min-width: 0;
  text-align: right;
}

.teacher-name-v2 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  margin: 0 0 6px 0;
  line-height: 1.3;
  transition: color 0.25s;
}

.teacher-card-v2:hover .teacher-name-v2 {
  color: var(--primary);
}

body.dark-mode .teacher-card-v2:hover .teacher-name-v2 {
  color: #818cf8;
}

/* Subtitle role */
.teacher-role-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 700;
  display: block;
  margin-top: 2px;
}

/* Stats chips row */
.teacher-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
  width: 100%;
}

.teacher-stat-card {
  background: #f8fafc;
  border: 1px solid rgba(0, 0, 0, 0.02);
  border-radius: 14px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.teacher-stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.teacher-stat-label {
  font-size: 9.5px;
  color: var(--text-muted);
  font-weight: 700;
}

.teacher-stat-val {
  font-size: 13.5px;
  color: var(--text-main);
  font-weight: 800;
}

body.dark-mode .teacher-stat-card {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.02);
}

/* Communication buttons row */
.teacher-social-cluster {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tc-social-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--bg-color);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  cursor: pointer;
}

.tc-social-btn i {
  transition: transform 0.25s ease;
}

.tc-social-btn:hover {
  background: var(--social-color, var(--primary));
  color: #ffffff;
  border-color: var(--social-color, var(--primary));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

.tc-social-btn:hover i {
  transform: scale(1.15);
}

.tc-social-btn:active {
  transform: translateY(0) scale(0.95);
}

body.dark-mode .tc-social-btn {
  background: #1e293b;
  border-color: #334155;
}

.teacher-contact-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 800;
  font-family: inherit;
  background: var(--primary-grad);
  color: white;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(67, 56, 202, 0.15);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  min-height: 40px;
  white-space: nowrap;
}

.teacher-contact-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(67, 56, 202, 0.25);
  opacity: 0.95;
}

.teacher-contact-btn:active {
  transform: translateY(0) scale(0.97);
}

body.dark-mode .teacher-contact-btn {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Biography */
.teacher-bio-container {
  width: 100%;
  margin-top: 14px;
  text-align: right;
}

.teacher-bio-v2 {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.75;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

/* --- Fading separator --- */
.teacher-card-divider {
  height: 1px;
  background: linear-gradient(90deg,
      transparent,
      var(--border-color) 15%,
      var(--border-color) 85%,
      transparent);
  margin: 0 20px;
  opacity: 0.6;
}

/* --- Communication section --- */
.teacher-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 18px 20px;
  gap: 12px;
}

/* --- Expand biography section --- */
.teacher-bio-toggle {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 11.5px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.25s;
}

.teacher-bio-toggle:hover {
  opacity: 0.85;
  transform: translateX(-2px);
}

body.dark-mode .teacher-bio-toggle {
  color: #818cf8;
}

body.dark-mode .teacher-bio-toggle:hover {
  color: #a5b4fc;
}

body.dark-mode .teacher-subject-tag {
  box-shadow: none;
}

/* --- Responsive for very small screens --- */
@media (max-width: 360px) {
  .teacher-card-main {
    padding: 16px;
  }

  .teacher-card-top {
    gap: 12px;
  }

  .teacher-photo-ring {
    width: 80px;
    height: 80px;
    border-radius: 20px;
  }

  .teacher-photo-ring img {
    border-radius: 17px;
  }

  .teacher-name-v2 {
    font-size: 14px;
  }

  .teacher-card-footer {
    flex-wrap: wrap;
  }

  .teacher-contact-btn {
    width: 100%;
    justify-content: center;
  }
}

/* --- Testing Mode Switch & Control UI --- */
.testing-control-bar {
  background: linear-gradient(135deg,
      rgba(79, 70, 229, 0.08) 0%,
      rgba(139, 92, 246, 0.08) 100%);
  border: 1px dashed var(--primary);
  padding: 12px 18px;
  border-radius: 12px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  direction: rtl;
  box-shadow: var(--shadow-soft);
}

body.dark-mode .testing-control-bar {
  background: linear-gradient(135deg,
      rgba(79, 70, 229, 0.15) 0%,
      rgba(139, 92, 246, 0.15) 100%);
  border: 1px dashed var(--primary);
}

.switch-modern {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
}

.switch-modern input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider-modern {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 22px;
}

.slider-modern:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.switch-modern input:checked+.slider-modern {
  background: linear-gradient(135deg, var(--primary) 0%, #4338ca 100%);
}

.switch-modern input:checked+.slider-modern:before {
  transform: translateX(22px);
}

body.dark-mode .slider-modern {
  background-color: #475569;
}

body.eye-comfort-active::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(245, 158, 11, 0.07);
  pointer-events: none;
  z-index: 999999;
}

/* === Welcome Card & Emoji Selector === */
.welcome-card {
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%) !important;
  border: 1px solid var(--border-color) !important;
  padding: 24px 30px !important;
  position: relative;
  overflow: hidden;
}

.welcome-card::after {
  content: "";
  position: absolute;
  top: -50px;
  left: -50px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(104, 61, 204, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.welcome-card-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.welcome-text-side {
  flex: 1;
  text-align: right;
}

.welcome-text-side h2 {
  font-size: 22px;
  font-weight: 900;
  color: #ffffff;
  margin-bottom: 6px;
}

.welcome-text-side p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.5;
}

.welcome-avatar-side {
  width: 70px;
  height: 70px;
  border-radius: 20px;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
  cursor: default;
  position: relative;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: none;
  user-select: none;
}

.welcome-avatar-side:hover {
  transform: scale(1.08) rotate(-3deg);
}

.avatar-edit-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s;
}

.welcome-avatar-side:hover .avatar-edit-badge {
  transform: scale(1.1);
}

.avatar-emoji-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  justify-items: center;
}

.avatar-emoji-btn {
  font-size: 32px;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: transparent !important;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  box-shadow: none !important;
}

.avatar-emoji-btn:hover {
  transform: scale(1.2) translateY(-2px);
  border-color: var(--primary);
  background: transparent !important;
}

.avatar-emoji-btn.selected {
  border-color: var(--primary);
  background: transparent !important;
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.25) !important;
}