/* ============================================
   Quiz Lector — Frontend Styles
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=DM+Sans:wght@400;500;600&display=swap');

:root {
  --ql-font-display: 'Playfair Display', Georgia, serif;
  --ql-font-body:    'DM Sans', system-ui, sans-serif;

  /* Light theme */
  --ql-bg:           #FAFAF8;
  --ql-surface:      #FFFFFF;
  --ql-border:       #E8E4DC;
  --ql-text:         #1A1714;
  --ql-text-muted:   #7A7369;
  --ql-accent:       #C4522A;
  --ql-accent-light: #FDF0EB;
  --ql-correct:      #1E6B45;
  --ql-correct-bg:   #EAF5EF;
  --ql-wrong:        #9B2626;
  --ql-wrong-bg:     #FEF0F0;
  --ql-gold:         #B8892A;
  --ql-shadow:       0 4px 24px rgba(26,23,20,0.08);
  --ql-radius:       16px;
}

.ql-theme-dark {
  --ql-bg:           #111109;
  --ql-surface:      #1C1B18;
  --ql-border:       #2E2C27;
  --ql-text:         #F0EDE7;
  --ql-text-muted:   #7A7369;
  --ql-accent:       #E07050;
  --ql-accent-light: #2A1F1A;
  --ql-correct:      #3DB870;
  --ql-correct-bg:   #0F2A1C;
  --ql-wrong:        #E05555;
  --ql-wrong-bg:     #2A1010;
  --ql-shadow:       0 4px 24px rgba(0,0,0,0.4);
}

/* ---- Base ---- */
.ql-wrap {
  font-family: var(--ql-font-body);
  background: var(--ql-bg);
  border: 1px solid var(--ql-border);
  border-radius: var(--ql-radius);
  overflow: hidden;
  max-width: 680px;
  margin: 2rem auto;
  box-shadow: var(--ql-shadow);
  position: relative;
}

.ql-screen {
  padding: 3rem 2.5rem;
}

@media (max-width: 600px) {
  .ql-screen { padding: 2rem 1.5rem; }
}

/* ---- Loading ---- */
.ql-screen--loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  text-align: center;
}

.ql-loading-inner { color: var(--ql-text-muted); }

.ql-loading-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ql-text);
  margin: 1.5rem 0 0.3rem;
}

.ql-loading-sub {
  font-size: 0.9rem;
  color: var(--ql-text-muted);
  margin: 0;
}

/* Spinner */
.ql-spinner {
  position: relative;
  width: 64px;
  height: 64px;
  margin: 0 auto;
}

.ql-spinner__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--ql-accent);
  animation: ql-spin 1.2s linear infinite;
}
.ql-spinner__ring--2 {
  inset: 10px;
  border-top-color: var(--ql-gold);
  animation-delay: -0.4s;
}
.ql-spinner__ring--3 {
  inset: 20px;
  border-top-color: var(--ql-text-muted);
  animation-delay: -0.8s;
}

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

/* ---- Error ---- */
.ql-screen--error {
  text-align: center;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ql-error-inner { max-width: 360px; margin: 0 auto; }
.ql-error-icon  { font-size: 3rem; display: block; margin-bottom: 1rem; }
.ql-error-inner h3 {
  font-family: var(--ql-font-display);
  font-size: 1.4rem;
  color: var(--ql-text);
  margin: 0 0 0.5rem;
}
.ql-error-inner p { color: var(--ql-text-muted); margin: 0 0 1.5rem; }

/* ---- Intro ---- */
.ql-screen--intro { text-align: center; }
.ql-intro-inner   { max-width: 440px; margin: 0 auto; }

.ql-intro-badge {
  font-size: 4rem;
  display: block;
  margin-bottom: 1rem;
  animation: ql-float 3s ease-in-out infinite;
}
@keyframes ql-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.ql-title {
  font-family: var(--ql-font-display);
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--ql-text);
  margin: 0 0 0.5rem;
  line-height: 1.1;
}
.ql-subtitle {
  color: var(--ql-text-muted);
  font-size: 1rem;
  margin: 0 0 2rem;
}

.ql-intro-stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2.5rem;
}
.ql-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}
.ql-stat__num {
  font-family: var(--ql-font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--ql-accent);
}
.ql-stat__label {
  font-size: 0.8rem;
  color: var(--ql-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---- Buttons ---- */
.ql-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--ql-font-body);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  padding: 0.8rem 1.8rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.ql-btn--start {
  background: var(--ql-accent);
  color: #fff;
  font-size: 1.1rem;
  padding: 1rem 2.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(196,82,42,0.3);
}
.ql-btn--start:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(196,82,42,0.4);
}

.ql-btn--primary {
  background: var(--ql-accent);
  color: #fff;
}
.ql-btn--primary:hover { opacity: 0.9; transform: translateY(-1px); }

.ql-btn--secondary {
  background: var(--ql-surface);
  color: var(--ql-text);
  border: 1.5px solid var(--ql-border);
}
.ql-btn--secondary:hover { background: var(--ql-accent-light); }

.ql-btn--next {
  background: var(--ql-accent);
  color: #fff;
  padding: 0.8rem 2rem;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(196,82,42,0.2);
}
.ql-btn--next:hover { opacity: 0.9; transform: translateY(-1px); }

/* ---- Question ---- */
.ql-question-header {
  margin-bottom: 2rem;
}

.ql-progress-bar {
  height: 6px;
  background: var(--ql-border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}
.ql-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ql-accent), var(--ql-gold));
  border-radius: 3px;
  transition: width 0.5s cubic-bezier(0.4,0,0.2,1);
  width: 0%;
}

.ql-question-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--ql-text-muted);
  font-weight: 500;
}

.ql-source-badge {
  display: inline-block;
  font-size: 0.78rem;
  background: var(--ql-accent-light);
  color: var(--ql-accent);
  border-radius: 6px;
  padding: 0.2rem 0.7rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ql-question-text {
  font-family: var(--ql-font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ql-text);
  margin: 0 0 1.5rem;
  line-height: 1.35;
}

.ql-options {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.ql-option {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: var(--ql-surface);
  border: 1.5px solid var(--ql-border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--ql-text);
  transition: all 0.15s ease;
  text-align: left;
  width: 100%;
  font-family: var(--ql-font-body);
}
.ql-option:hover:not(:disabled) {
  border-color: var(--ql-accent);
  background: var(--ql-accent-light);
}

.ql-option__letter {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--ql-border);
  color: var(--ql-text-muted);
  font-weight: 700;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.ql-option:hover:not(:disabled) .ql-option__letter {
  background: var(--ql-accent);
  color: #fff;
}

/* Correct/incorrect states */
.ql-option--correct {
  background: var(--ql-correct-bg) !important;
  border-color: var(--ql-correct) !important;
  color: var(--ql-correct) !important;
}
.ql-option--correct .ql-option__letter {
  background: var(--ql-correct) !important;
  color: #fff !important;
}

.ql-option--wrong {
  background: var(--ql-wrong-bg) !important;
  border-color: var(--ql-wrong) !important;
  color: var(--ql-wrong) !important;
}
.ql-option--wrong .ql-option__letter {
  background: var(--ql-wrong) !important;
  color: #fff !important;
}

.ql-option:disabled { cursor: default; opacity: 0.7; }
.ql-option--correct:disabled,
.ql-option--wrong:disabled   { opacity: 1; }

/* Feedback */
.ql-feedback {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  border-radius: 10px;
  padding: 1rem;
  margin-top: 1rem;
  background: var(--ql-correct-bg);
  border: 1.5px solid var(--ql-correct);
  animation: ql-fadeIn 0.3s ease;
}
.ql-feedback--wrong {
  background: var(--ql-wrong-bg);
  border-color: var(--ql-wrong);
}

.ql-feedback__icon { font-size: 1.4rem; line-height: 1; }
.ql-feedback__label {
  font-weight: 700;
  margin: 0 0 0.2rem;
  font-size: 0.95rem;
  color: var(--ql-correct);
}
.ql-feedback--wrong .ql-feedback__label { color: var(--ql-wrong); }
.ql-feedback__explanation { margin: 0; font-size: 0.9rem; color: var(--ql-text-muted); }

.ql-question-footer {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
}

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

/* ---- Results ---- */
.ql-screen--results { text-align: center; }
.ql-results-inner { max-width: 480px; margin: 0 auto; }

.ql-prize-emoji {
  font-size: 5rem;
  display: block;
  margin-bottom: 0.5rem;
  animation: ql-pop 0.5s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes ql-pop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.ql-score-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.2rem;
  margin-bottom: 0.5rem;
}
.ql-score-num {
  font-family: var(--ql-font-display);
  font-size: 5rem;
  font-weight: 900;
  color: var(--ql-accent);
  line-height: 1;
}
.ql-score-slash, .ql-score-total {
  font-family: var(--ql-font-display);
  font-size: 2rem;
  color: var(--ql-text-muted);
}

.ql-prize-title {
  font-family: var(--ql-font-display);
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--ql-text);
  margin: 0 0 0.5rem;
}
.ql-prize-desc {
  color: var(--ql-text-muted);
  margin: 0 0 2rem;
}

/* Results breakdown */
.ql-results-breakdown {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 0.3rem;
  margin-bottom: 2rem;
}
.ql-result-dot {
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ql-result-dot--correct { background: var(--ql-correct-bg); }
.ql-result-dot--wrong   { background: var(--ql-wrong-bg); }

.ql-results-actions {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================
   Admin Styles
   ============================================ */
.ql-admin { max-width: 1100px; }
.ql-admin h1 {
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
}
.ql-admin-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) {
  .ql-admin-grid { grid-template-columns: 1fr; }
}
.ql-card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.ql-card h2 { font-size: 1.1rem; margin-top: 0; }
.ql-shortcode {
  display: block;
  background: #f6f7f7;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 0.5rem 0.8rem;
  font-size: 0.95rem;
  margin: 0.5rem 0;
}
.ql-param-list { font-size: 0.9rem; color: #555; padding-left: 1.2rem; }
.ql-status-list { list-style: none; padding: 0; margin: 0; }
.ql-status-list li { padding: 0.4rem 0; font-size: 0.9rem; }
