@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

body {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 18px;
  transition: 0.3s;
}

/* THEMES */
body.dark {
  background: linear-gradient(135deg, #0b1220, #121c2f);
  color: #fff;
}

body.light {
  background: linear-gradient(135deg, #e2e8f0, #f8fafc);
  color: #0b1220;
}

.app-container {
  width: 100%;
  max-width: 540px;
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 18px 45px rgba(0,0,0,0.4);
  backdrop-filter: blur(15px);
  animation: fadeIn 0.7s ease;
  transition: 0.3s;
}

body.dark .app-container {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

body.light .app-container {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

@keyframes fadeIn {
  from {opacity: 0; transform: translateY(15px);}
  to {opacity: 1; transform: translateY(0);}
}

.header {
  text-align: center;
  margin-bottom: 18px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 2rem;
  font-weight: 700;
}

.header p {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-top: 4px;
}

.toggle-btn {
  width: 45px;
  height: 45px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  transition: 0.25s;
}

body.dark .toggle-btn {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

body.light .toggle-btn {
  background: rgba(0,0,0,0.08);
  color: #0b1220;
}

.controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 12px;
}

.dropdown-box {
  display: flex;
  flex-direction: column;
}

.dropdown-box label {
  font-size: 0.85rem;
  margin-bottom: 6px;
  opacity: 0.75;
}

/* ============================= */
/* UPDATED DROPDOWN FIX */
/* ============================= */

select {
  padding: 12px;
  border-radius: 14px;
  outline: none;
  font-size: 1rem;
  width: 100%;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  transition: 0.3s;
}

/* Closed Select Styling */
body.dark select {
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

body.light select {
  border: 1px solid rgba(0,0,0,0.15);
  background: rgba(0, 0, 0, 0.04);
  color: #0b1220;
}

/* Dropdown List Styling (Fix White Text Issue) */
select option {
  color: #000000;        /* Always black text */
  background: #ffffff;   /* Always white background */
}

/* ============================= */

button {
  padding: 13px;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 650;
  cursor: pointer;
  transition: 0.25s;
}

body.dark button {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  color: #0b1220;
}

body.light button {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
}

button:hover {
  transform: scale(1.03);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.quiz-area {
  margin-top: 20px;
}

.quiz-top {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.stats {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.stat-card {
  flex: 1;
  border-radius: 16px;
  padding: 12px;
  text-align: center;
}

body.dark .stat-card {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
}

body.light .stat-card {
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.1);
}

.stat-label {
  font-size: 0.75rem;
  opacity: 0.7;
  display: block;
}

.stat-value {
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 3px;
  display: block;
}

.progress {
  width: 100%;
  height: 10px;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #22c55e, #4ade80);
  transition: 0.4s ease;
}

.question-card {
  border-radius: 20px;
  padding: 18px;
  animation: fadeIn 0.4s ease;
}

body.dark .question-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
}

body.light .question-card {
  background: rgba(0,0,0,0.03);
  border: 1px solid rgba(0,0,0,0.1);
}

.question-number {
  font-size: 0.8rem;
  opacity: 0.75;
  margin-bottom: 10px;
}

.question-card h3 {
  font-size: 1.05rem;
  margin-bottom: 16px;
  line-height: 1.6;
}

.options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.option-btn {
  padding: 13px;
  border-radius: 16px;
  cursor: pointer;
  transition: 0.25s;
  font-size: 0.95rem;
}

body.dark .option-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
}

body.light .option-btn {
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.1);
}

.option-btn:hover {
  transform: scale(1.02);
}

.option-btn.correct {
  background: rgba(34,197,94,0.25) !important;
  border: 1px solid rgba(34,197,94,0.7) !important;
}

.option-btn.wrong {
  background: rgba(239,68,68,0.25) !important;
  border: 1px solid rgba(239,68,68,0.7) !important;
}

.quiz-actions {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.quiz-actions button {
  flex: 1;
}

.result-area, .review-area {
  text-align: center;
  margin-top: 20px;
}

.result-msg {
  opacity: 0.85;
  font-size: 0.95rem;
  margin-bottom: 18px;
}

.result-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.result-buttons button {
  flex: 1;
}

.review-area div {
  text-align: left;
  margin-top: 15px;
  max-height: 350px;
  overflow-y: auto;
  padding-right: 5px;
}

.review-item {
  padding: 12px;
  border-radius: 14px;
  margin-bottom: 10px;
}

body.dark .review-item {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
}

body.light .review-item {
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.1);
}

.review-item p {
  font-size: 0.9rem;
  margin-bottom: 6px;
}

.hidden {
  display: none;
}