/* ══════════════════════════════════════════════
   Grand Quizz Widget — Front-end Styles
══════════════════════════════════════════════ */

:root {
  --gqw-p:   #5B4FCF;
  --gqw-p2:  #8B5CF6;
  --gqw-p3:  #C084FC;
  --gqw-gold:#f59e0b;
  --gqw-r:   12px;
}

/* ── WIDGET CONTAINER ── */
.gqw-widget {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 4px 24px rgba(91,79,207,.13), 0 1px 4px rgba(0,0,0,.06);
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  max-width: 680px;
  margin: 0 auto;
}

/* ── HEADER ── */
.gqw-widget-header {
  background: linear-gradient(135deg, #5B4FCF 0%, #8B5CF6 60%, #C084FC 100%);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.gqw-widget-icon { font-size: 36px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.25)); animation: gqw-float 3s ease-in-out infinite; }
.gqw-widget-title h3 { margin:0; color:#fff; font-size:22px; font-weight:800; letter-spacing:-.3px; }
.gqw-widget-title p  { margin:0; color:rgba(255,255,255,.75); font-size:13px; margin-top:2px; }

@keyframes gqw-float {
  0%,100% { transform:translateY(0); }
  50%      { transform:translateY(-5px); }
}

/* ── BODY ── */
.gqw-widget-body { padding: 28px; }

/* ── GENERATE AREA ── */
.gqw-generate-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 12px 0 8px;
}
.gqw-orb {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #5B4FCF, #C084FC);
  border-radius: 50%;
  margin-bottom: 8px;
  box-shadow: 0 0 30px rgba(91,79,207,.35), 0 0 60px rgba(192,132,252,.2);
  animation: gqw-pulse 2.5s ease-in-out infinite;
}
@keyframes gqw-pulse {
  0%,100% { box-shadow:0 0 20px rgba(91,79,207,.3), 0 0 50px rgba(192,132,252,.15); }
  50%      { box-shadow:0 0 40px rgba(91,79,207,.55), 0 0 80px rgba(192,132,252,.35); }
}

.gqw-generate-text { margin:0; font-size:20px; font-weight:800; color:#1e293b; }
.gqw-generate-sub  { margin:0; font-size:14px; color:#64748b; }
.gqw-generate-sub strong { color:var(--gqw-p); }

.gqw-generate-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 14px 32px;
  background: linear-gradient(135deg, #5B4FCF, #8B5CF6);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(91,79,207,.4);
  transition: all .25s;
  letter-spacing: -.2px;
}
.gqw-generate-btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 10px 28px rgba(91,79,207,.5);
}
.gqw-generate-btn:active { transform:scale(.97); }
.gqw-btn-icon { font-size: 18px; animation: gqw-spin-slow 4s linear infinite; }
@keyframes gqw-spin-slow { to { transform:rotate(360deg); } }

/* ── LOADING ── */
.gqw-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 40px 0;
  color: #64748b;
  font-size: 14px;
}
.gqw-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #e2e8f0;
  border-top-color: var(--gqw-p);
  border-radius: 50%;
  animation: gqw-spin .8s linear infinite;
}
@keyframes gqw-spin { to { transform:rotate(360deg); } }

/* ── QUESTIONS CONTAINER ── */
.gqw-questions-container { display:flex; flex-direction:column; gap:0; }

/* ── QUESTION CARD ── */
.gqw-q-card {
  background: #fafbff;
  border: 1.5px solid #e8e4ff;
  border-radius: 14px;
  margin-bottom: 14px;
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
  animation: gqw-slide-in .35s ease both;
}
.gqw-q-card:nth-child(1) { animation-delay:.04s }
.gqw-q-card:nth-child(2) { animation-delay:.1s }
.gqw-q-card:nth-child(3) { animation-delay:.16s }
.gqw-q-card:nth-child(4) { animation-delay:.22s }
.gqw-q-card:nth-child(5) { animation-delay:.28s }
.gqw-q-card:nth-child(6) { animation-delay:.34s }
.gqw-q-card:nth-child(7) { animation-delay:.40s }
.gqw-q-card:nth-child(8) { animation-delay:.46s }
.gqw-q-card:nth-child(9) { animation-delay:.52s }
.gqw-q-card:nth-child(10){ animation-delay:.58s }

@keyframes gqw-slide-in {
  from { opacity:0; transform:translateY(12px); }
  to   { opacity:1; transform:translateY(0); }
}

.gqw-q-card:hover { box-shadow:0 4px 20px rgba(91,79,207,.12); transform:translateY(-1px); }

/* ── QUESTION HEADER (clickable) ── */
.gqw-q-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  user-select: none;
}
.gqw-q-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gqw-p), var(--gqw-p2));
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.gqw-q-text {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.5;
  direction: auto;
}
.gqw-q-arrow {
  font-size: 12px;
  color: #94a3b8;
  transition: transform .3s;
  padding-top: 3px;
  flex-shrink: 0;
}
.gqw-q-card.open .gqw-q-arrow { transform:rotate(180deg); color:var(--gqw-p); }

/* ── ANSWER ── */
.gqw-q-answer {
  display: none;
  padding: 0 18px 16px 58px;
  animation: gqw-fade-in .25s ease;
}
@keyframes gqw-fade-in { from{opacity:0;transform:translateY(-6px)} to{opacity:1;transform:none} }

.gqw-answer-inner {
  background: linear-gradient(135deg, #f0edff, #faf5ff);
  border: 1.5px solid #c4b5fd;
  border-radius: 10px;
  padding: 14px 16px;
}
.gqw-answer-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gqw-p);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.gqw-answer-text {
  font-size: 14px;
  color: #374151;
  line-height: 1.55;
  font-weight: 500;
  direction: auto;
}
.gqw-answer-source {
  margin-top: 8px;
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── REVEAL ALL ── */
.gqw-reveal-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: transparent;
  border: 2px solid #c4b5fd;
  border-radius: 50px;
  color: var(--gqw-p);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  margin-bottom: 14px;
  width: 100%;
  justify-content: center;
}
.gqw-reveal-all-btn:hover { background:#f0edff; border-color:var(--gqw-p); transform:scale(1.01); }

/* ── BOTTOM STOP BUTTON ── */
.gqw-stop-bottom-btn {
  width: 100%;
  padding: 13px;
  background: transparent;
  color: #f87171;
  border: 2px solid #f87171;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all .25s;
  margin-bottom: 10px;
  letter-spacing: .2px;
}
.gqw-stop-bottom-btn:hover {
  background: #f87171;
  color: #fff;
  box-shadow: 0 4px 14px rgba(248,113,113,.4);
  transform: translateY(-1px);
}
.gqw-stop-bottom-btn:active { transform: scale(.98); }
.gqw-stop-bottom-btn.stopped {
  background: #dcfce7;
  border-color: #86efac;
  color: #166534;
  cursor: default;
}
.gqw-stop-bottom-btn.stopped:hover {
  transform: none;
  box-shadow: none;
}

/* ── REGENERATE ── */
.gqw-regenerate-btn {
  width: 100%;
  padding: 13px;
  background: linear-gradient(135deg, #5B4FCF, #8B5CF6);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(91,79,207,.3);
  transition: all .25s;
  margin-top: 4px;
}
.gqw-regenerate-btn:hover { transform:translateY(-2px); box-shadow:0 8px 22px rgba(91,79,207,.45); }

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
  .gqw-widget-body { padding: 18px; }
  .gqw-widget-header { padding: 18px 20px; }
  .gqw-generate-btn { padding:13px 24px; font-size:14px; }
}

/* ══════════════════════════════════════════════
   TIMER
══════════════════════════════════════════════ */
.gqw-timer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #1e1e3a, #2d2060); /* overridden by dynamic CSS */
  border-radius: 12px;
  padding: 12px 18px;
  margin-bottom: 18px;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  gap: 12px;
}

.gqw-timer-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gqw-timer-icon {
  font-size: 20px;
  animation: gqw-tick 1s steps(1) infinite;
}
.gqw-timer-icon.paused { animation: none; }

@keyframes gqw-tick {
  0%,100% { opacity:1; }
  50%      { opacity:.4; }
}

.gqw-timer-display {
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
  font-family: 'Courier New', 'Lucida Console', monospace;
  text-shadow: 0 0 20px rgba(167,139,250,.6);
  min-width: 80px;
}

.gqw-timer-display.warning { color: #fbbf24; text-shadow: 0 0 20px rgba(251,191,36,.6); }
.gqw-timer-display.danger  { color: #f87171; text-shadow: 0 0 20px rgba(248,113,113,.6); animation: gqw-blink .6s ease-in-out infinite; }

@keyframes gqw-blink {
  0%,100% { opacity:1; }
  50%      { opacity:.5; }
}

.gqw-timer-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,.45);
  display: block;
  margin-top: 1px;
}

.gqw-timer-controls {
  display: flex;
  gap: 8px;
}

.gqw-timer-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1.5px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.1);
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  backdrop-filter: blur(4px);
}
.gqw-timer-btn:hover { background: rgba(255,255,255,.2); transform: scale(1.1); }
.gqw-timer-btn:active { transform: scale(.95); }

.gqw-timer-pause.paused { background: rgba(251,191,36,.2); border-color:rgba(251,191,36,.4); }

/* Stopped state */
.gqw-timer-bar.stopped {
  background: linear-gradient(135deg, #1e2a1e, #1a3a1a);
}
.gqw-timer-bar.stopped .gqw-timer-display {
  color: #86efac;
  text-shadow: 0 0 20px rgba(134,239,172,.5);
}
.gqw-timer-bar.stopped .gqw-timer-icon { animation: none; }

