/* ========================================================
   AWS CPC QUIZ TRAINER v6.0 — Unified + Dark Mode Edition
   Author: Geoffrey D. Metzger | Integrity Programming
   ======================================================== */

/* ========================================================
   ROOT COLORS
   ======================================================== */
:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --gray-bg: #f3f4f6;
  --gray-ink: #111827;
  --gray-text: #374151;
  --gray-light: #f9fafb;
  --gray-border: #e5e7eb;
  --green: #059669;
  --green-light: #bbf7d0;
  --red: #ef4444;
  --red-light: #fecaca;
  --amber: #f59e0b;
  --amber-dark: #d97706;
  --card-bg: #fff;
}

/* 🌙 Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    --blue: #3b82f6;
    --blue-dark: #2563eb;
    --gray-bg: #0f172a;
    --gray-ink: #f8fafc;
    --gray-text: #e2e8f0;
    --gray-light: #1e293b;
    --gray-border: #334155;
    --green: #10b981;
    --green-light: #064e3b;
    --red: #f87171;
    --red-light: #7f1d1d;
    --amber: #fbbf24;
    --amber-dark: #b45309;
    --card-bg: #1e293b;
  }
}

/* ========================================================
   BASE
   ======================================================== */
* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--gray-bg);
  color: var(--gray-ink);
  margin: 0;
  padding: 2rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}

.container {
  max-width: 640px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ========================================================
   CARD LAYOUT
   ======================================================== */
.card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 1.75rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
}

.card.hidden { opacity: 0; display: none !important; }

h1, h2, h3 { margin-top: 0; color: var(--gray-ink); }

/* ========================================================
   QUIZ STATUS BAR
   ======================================================== */
.quiz-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--gray-light);
  border: 1px solid var(--gray-border);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gray-text);
}

#question-number { color: var(--gray-ink); }
#timer { color: var(--blue-dark); font-weight: bold; }

/* ========================================================
   BUTTONS
   ======================================================== */
button, .primary-btn, .green-btn, .secondary-btn, .warning-btn {
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  text-decoration: none;
  display: inline-block;
  margin: 0.4rem;
  transition: background 0.2s ease, transform 0.1s ease;
}

button:hover { transform: translateY(-1px); }

.primary-btn { background: var(--blue); }
.primary-btn:hover { background: var(--blue-dark); }

.green-btn { background: var(--green); }
.green-btn:hover { background: #047857; }

.secondary-btn {
  background-color: #dbe4f3;
  color: #0b5ed7;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.secondary-btn:hover {
  background-color: #0b5ed7; /* hover background */
  color: #fff; /* white text when hovered */
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.warning-btn { background: var(--amber); }
.warning-btn:hover { background: var(--amber-dark); }

button:disabled { background: #94a3b8; cursor: not-allowed; }

/* ========================================================
   FORM ELEMENTS
   ======================================================== */
.form-group { margin-bottom: 1.25rem; text-align: center; }

.form-group h3 { margin-bottom: 0.75rem; color: #fff; }

/* ========================================================
   QUIZ QUESTION / OPTIONS
   ======================================================== */
#question-text {
  font-size: 1.15rem;
  margin-top: 0.75rem;
  color: var(--gray-ink);
  line-height: 1.45;
}

#options { padding: 0; margin: 1rem 0; }

#options li {
  list-style: none;
  background: var(--gray-light);
  margin: 0.5rem 0;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--gray-border);
  cursor: pointer;
  transition: all 0.2s ease;
}

#options li:hover { background: #eff6ff; transform: scale(1.02); }
#options li.correct { background: var(--green-light); border-color: #16a34a; }
#options li.incorrect { background: var(--red-light); border-color: var(--red); }

/* ========================================================
   RESULTS / REVIEW / PROGRESS
   ======================================================== */
#domain-stats {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.95rem;
}

#domain-stats th, #domain-stats td {
  padding: 0.5rem;
  border-bottom: 1px solid var(--gray-border);
}

#domain-stats th {
  background: #eff6ff;
  color: #1e3a8a;
  font-weight: 700;
}

.review-item {
  background: var(--gray-light);
  border: 1px solid var(--gray-border);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1rem;
  transition: transform 0.2s ease;
}

.review-item:hover { transform: scale(1.01); }

/* ========================================================
   STYLED RADIO BUTTONS (Question Count)
   ======================================================== */
.form-group label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background-color: rgba(255, 255, 255, 0.07);
  padding: 0.5rem 1rem;
  margin: 0.4rem;
  border-radius: 8px;
  cursor: pointer;
  color: #e5e7eb;
  font-weight: 500;
  transition: all 0.2s ease;
}

.form-group label:hover {
  background-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

/* Hide native radio */
.form-group input[type="radio"] {
  appearance: none;
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid #9ca3af;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* Checked glow */
.form-group input[type="radio"]:checked {
  border-color: #00ffcc;
  background: radial-gradient(circle at center, #00ffcc 45%, transparent 46%);
  box-shadow: 0 0 6px rgba(0, 255, 204, 0.4);
  animation: pop 0.15s ease-out;
}

/* ========================================================
   DOMAIN FILTER (Unified for Learn + Quiz)
   ======================================================== */
#domain-filter, .domain-filter {
  text-align: center;
  margin-bottom: 1.75rem;
}

#domain-filter .filter-title,
.domain-filter .filter-title {
  display: block;
  font-weight: 700;
  color: #fff;
  font-size: 1.1rem;
  text-align: center;
  margin-bottom: 0.85rem;
}

#domain-filter .filter-options,
.domain-filter .filter-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

/* Checkbox pills */
#domain-filter label,
.domain-filter label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background-color: rgba(255, 255, 255, 0.07);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #e5e7eb;
  font-weight: 500;
}

#domain-filter label:hover,
.domain-filter label:hover {
  background-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

/* Hide default checkbox */
#domain-filter input[type="checkbox"],
.domain-filter input[type="checkbox"] {
  appearance: none;
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid #9ca3af;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

/* Checked glow */
#domain-filter input[type="checkbox"]:checked,
.domain-filter input[type="checkbox"]:checked {
  border-color: #00ffcc;
  background: #00ffcc;
  box-shadow: 0 0 6px rgba(0, 255, 204, 0.4);
  animation: pop 0.15s ease-out;
}

#domain-filter input[type="checkbox"]:checked + label,
.domain-filter input[type="checkbox"]:checked + label {
  color: #00ffcc;
  font-weight: 600;
}

/* ========================================================
   UTILITIES
   ======================================================== */
.fw-bold { font-weight: 700; }
.lead { font-size: 1.1rem; color: var(--gray-text); }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-3 { margin-bottom: 1rem; }

/* ========================================================
   POP ANIMATION
   ======================================================== */
@keyframes pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ========================================================
   DARK MODE SHADOWS
   ======================================================== */
@media (prefers-color-scheme: dark) {
  .card, .cert-card {
    box-shadow: 0 2px 12px rgba(255, 255, 255, 0.05);
  }

  #options li:hover {
    background: rgba(59,130,246,0.15);
  }

  #domain-stats th {
    background: rgba(59,130,246,0.15);
    color: #93c5fd;
  }
  .secondary-btn {
    background-color: #1e293b;
    color: #60a5fa;
  }
  .secondary-btn:hover {
    background-color: #2563eb;
    color: #fff;
  }
}

/* ========================================================
   RESPONSIVE
   ======================================================== */
@media (max-width: 640px) {
  body { padding: 1rem; }
  .card { padding: 1.25rem; }
  .quiz-status-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    font-size: 0.9rem;
  }
  #options li { font-size: 0.95rem; }
  button { width: 100%; }
  #domain-filter .filter-options,
  .domain-filter .filter-options {
    gap: 0.6rem;
  }
  #domain-filter label,
  .domain-filter label {
    flex: 1 1 calc(45% - 0.5rem);
    justify-content: center;
  }
}

#clear-filters-btn {
  margin-top: 0.75rem;
  background: var(--amber);
}

#clear-filters-btn:hover {
  background: var(--amber-dark);
}

/* ========================================================
   MODULE NAVIGATION BUTTONS (Prev / Next)
   ======================================================== */
#modules-screen .btn-group,
#modules-screen .mt-4 {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

#modules-screen button {
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.7rem 1.6rem;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

/* 🔵 Next button — blue gradient */
#next-module {
  background: linear-gradient(90deg, var(--blue), var(--blue-dark));
  color: #fff;
  box-shadow: 0 2px 5px rgba(59, 130, 246, 0.3);
}
#next-module:hover {
  background: linear-gradient(90deg, #60a5fa, #2563eb);
  transform: translateY(-1px);
}

/* 🔙 Previous button — gray secondary */
#prev-module {
  background: #374151;
  color: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}
#prev-module:hover {
  background: #4b5563;
  transform: translateY(-1px);
}
/* ========================================================
   FIX: Next Question button visibility (override)
   ======================================================== */
#next-btn {
  background: var(--blue);
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  margin-top: 1rem;
  margin-bottom: 2rem;
  transition: background 0.25s ease, transform 0.1s ease;
}

#next-btn:hover:not(:disabled) {
  background: var(--blue-dark);
  transform: translateY(-2px);
}

/* ✅ Disabled state readable on both dark/light mode */
#next-btn:disabled {
  background: #d1d5db; /* light gray */
  color: #1e293b;      /* dark gray text */
  opacity: 0.9;
  cursor: not-allowed;
  transform: none;
}
