/* style.css - Premium Glassmorphic Tax Quiz Stylesheet */

:root {
  --bg-primary: #0b1528;
  --bg-secondary: #11203b;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --active-blue: #1d6fe9;
  --active-blue-glow: rgba(29, 111, 233, 0.4);
  --mint-strong: #00e676;
  --mint-glow: rgba(0, 230, 118, 0.3);
  --saffron-strong: #ff9100;
  --red-strong: #ff3d00;
  --glass-bg: rgba(17, 32, 59, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-glow: rgba(29, 111, 233, 0.2);
}

[data-theme="light"] {
  --bg-primary: #f0f4f9;
  --bg-secondary: #ffffff;
  --text-main: #1f2937;
  --text-muted: #4b5563;
  --active-blue: #1d6fe9;
  --active-blue-glow: rgba(29, 111, 233, 0.15);
  --mint-strong: #00c853;
  --mint-glow: rgba(0, 200, 83, 0.2);
  --saffron-strong: #ff6d00;
  --red-strong: #d50000;
  --glass-bg: rgba(255, 255, 255, 0.8);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-border-glow: rgba(29, 111, 233, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Manrope', 'DM Sans', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* Background Gradients */
.bg-orbs {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(140px);
  opacity: 0.18;
}

.orb-1 {
  top: -10%;
  right: -10%;
  width: 40vw;
  height: 40vw;
  background: var(--active-blue);
}

.orb-2 {
  bottom: -10%;
  left: -10%;
  width: 35vw;
  height: 35vw;
  background: var(--mint-strong);
}

/* Header */
.main-header {
  border-bottom: 1px solid var(--glass-border);
  background-color: rgba(11, 21, 40, 0.4);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  zIndex: 100;
}

body.quiz-embedded .main-header {
  display: none;
}

body.quiz-embedded .quiz-hub-main {
  min-height: 100vh;
  padding-top: 2rem;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-logo-image {
  width: 62px;
  height: 44px;
  flex: 0 0 auto;
  object-fit: contain;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.logo-main {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.logo-sub {
  margin-top: 0.28rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: var(--active-blue);
}

.theme-toggle-btn {
  background: none;
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 0.5rem;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  border-color: var(--active-blue);
  background: var(--glass-bg);
}

.sun-icon { display: none; width: 20px; height: 20px; }
.moon-icon { display: block; width: 20px; height: 20px; }

[data-theme="light"] .sun-icon { display: block; }
[data-theme="light"] .moon-icon { display: none; }

/* Main Workspace */
.quiz-hub-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
}

.quiz-container {
  width: 100%;
  max-width: 750px;
}

/* Glass Card */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 2.5rem;
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Screen Transitions */
.screen {
  display: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.screen.active {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* Start Screen */
.badge-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: var(--active-blue);
  border-radius: 50%;
}

.quiz-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(29, 111, 233, 0.1);
  border: 1px solid rgba(29, 111, 233, 0.2);
  color: var(--active-blue);
  padding: 0.35rem 0.75rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.quiz-title {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.quiz-title em {
  font-style: normal;
  color: var(--active-blue);
}

.quiz-lead {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 2rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.text-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 1rem 1.25rem;
  border-radius: 12px;
  font-size: 1rem;
  outline: none;
  transition: all 0.2s ease;
}

.text-input:focus {
  border-color: var(--active-blue);
  box-shadow: 0 0 0 4px var(--active-blue-glow);
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.level-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.5rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.level-card:hover {
  border-color: var(--active-blue);
  background: rgba(29, 111, 233, 0.05);
  transform: translateY(-4px);
}

.level-card.selected {
  border-color: var(--active-blue);
  background: rgba(29, 111, 233, 0.15);
  box-shadow: 0 8px 24px var(--active-blue-glow);
}

.level-card h3 {
  font-size: 1rem;
  font-weight: 800;
}

.level-card p {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.action-btn {
  width: 100%;
  background: var(--active-blue);
  border: none;
  color: white;
  padding: 1.1rem;
  border-radius: 14px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(29, 111, 233, 0.3);
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(29, 111, 233, 0.45);
}

.action-btn:active {
  transform: translateY(0);
}

/* Quiz Interface */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.quiz-progress-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.timer-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--saffron-strong);
  background: rgba(255, 145, 0, 0.1);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 145, 0, 0.2);
}

.timer-box svg {
  width: 16px;
  height: 16px;
  animation: pulse 1s infinite alternate;
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 100px;
  margin-bottom: 2rem;
  overflow: hidden;
}

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

.question-topic-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--active-blue);
  background: rgba(29, 111, 233, 0.1);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.question-text {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 2rem;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 2rem;
}

.option-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 1.1rem 1.4rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.option-item:hover {
  border-color: var(--active-blue);
  background: rgba(29, 111, 233, 0.04);
}

.option-item.selected {
  border-color: var(--active-blue);
  background: rgba(29, 111, 233, 0.12);
  box-shadow: 0 0 0 1px var(--active-blue);
}

.option-indicator {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.option-item.selected .option-indicator {
  border-color: var(--active-blue);
  background-color: var(--active-blue);
}

.option-item.selected .option-indicator::after {
  content: '';
  width: 8px;
  height: 8px;
  background-color: white;
  border-radius: 50%;
}

.navigation-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.secondary-btn {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 1rem;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.secondary-btn:hover {
  border-color: var(--active-blue);
  background: var(--glass-bg);
}

/* Results Screen */
.result-score-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 8px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 2rem;
  transition: all 0.3s ease;
}

.result-score-circle.pass {
  border-color: var(--mint-strong);
  box-shadow: 0 0 24px var(--mint-glow);
}

.result-score-circle.fail {
  border-color: var(--red-strong);
  box-shadow: 0 0 24px rgba(255, 61, 0, 0.2);
}

.score-num {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1;
}

.score-label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.result-status-title {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 1rem;
  text-align: center;
}

.result-status-title.pass { color: var(--mint-strong); }
.result-status-title.fail { color: var(--red-strong); }

.result-lead-text {
  text-align: center;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 2rem;
}

.metrics-summary-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.metric-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
}

.metric-card h5 {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.metric-card p {
  font-size: 1.15rem;
  font-weight: 800;
}

/* Certificate Preview Frame */
.cert-card-container {
  width: 100%;
  max-width: 700px;
  height: 495px; /* A4 aspect ratio helper */
  position: relative;
  background-color: #fcfcfc;
  padding: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  margin: 0 auto 2.5rem;
  overflow: hidden;
  border-radius: 8px;
  color: #333;
}

.cert-inner-border {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  bottom: 12px;
  border: 2px solid #d4af37;
  display: flex;
  flex-direction: column;
}

/* Header V-shape polygon layering */
.cert-header-gold-trim {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 160px;
  background-color: #d4af37;
  clip-path: polygon(0 0, 100% 0, 100% 80%, 50% 100%, 0 80%);
  z-index: 1;
}

.cert-header-blue-block {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 153px;
  background: linear-gradient(180deg, #0c2b5c 0%, #061938 100%);
  clip-path: polygon(0 0, 100% 0, 100% 79%, 50% 100%, 0 79%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: 20px;
}

.cert-title-primary {
  font-family: 'Cinzel', serif;
  font-size: 2.1rem;
  color: #ffffff;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1;
}

.cert-title-secondary {
  font-family: 'Manrope', sans-serif;
  font-size: 0.75rem;
  color: #d4af37;
  font-weight: 800;
  letter-spacing: 0.35em;
  margin-top: 0.5rem;
  text-transform: uppercase;
}

/* Center Seal Badge */
.cert-seal-container {
  position: absolute;
  top: 114px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
}

.cert-gold-seal {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle, #fbf2c2 0%, #d4af37 100%);
  padding: 3px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cert-seal-svg {
  width: 100%;
  height: 100%;
}

/* Content Body */
.cert-body-content {
  padding: 215px 2.5rem 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

.cert-presented-to {
  font-family: 'Manrope', sans-serif;
  font-size: 0.75rem;
  font-weight: 800;
  color: #777;
  letter-spacing: 0.18em;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}

.cert-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.2rem;
  font-weight: 800;
  color: #0b233f;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding-bottom: 0.25rem;
  margin-bottom: 1rem;
  width: 80%;
  max-width: 450px;
  letter-spacing: -0.01em;
  text-align: center;
}

.cert-description {
  font-family: 'Manrope', sans-serif;
  font-size: 0.85rem;
  color: #555;
  line-height: 1.6;
  max-width: 540px;
  margin-bottom: 1.5rem;
}

.cert-description strong {
  color: #0b233f;
  font-weight: 700;
}

/* Footer elements */
.cert-footer-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 1rem;
  margin-top: auto;
}

.cert-meta-col {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.cert-meta-label {
  font-size: 0.65rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.cert-meta-val {
  font-size: 0.8rem;
  font-weight: 700;
  color: #333;
}

.cert-signature-col {
  text-align: center;
}

.cert-sig-line {
  width: 130px;
  height: 1px;
  background-color: rgba(0, 0, 0, 0.15);
  margin-bottom: 0.4rem;
}

.cert-sig-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: #222;
}

.cert-sig-sub {
  font-size: 0.65rem;
  color: #777;
}

/* Confetti Canvas */
#confettiCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1000;
}

/* Answer Review */
.review-header-title {
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 0.75rem;
}

.review-item {
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.01);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.review-q-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.review-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.review-badge.correct {
  background: rgba(0, 230, 118, 0.15);
  color: var(--mint-strong);
}

.review-badge.incorrect {
  background: rgba(255, 61, 0, 0.15);
  color: var(--red-strong);
}

.review-question-text {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
}

.review-a-detail {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  padding-left: 1rem;
  border-left: 2px solid var(--active-blue);
}

/* Footer Disclaimer */
.footer-disclaimer {
  max-width: 600px;
  margin: 3rem auto 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Keyframes */
@keyframes pulse {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* Print Layout rules */
@media print {
  body {
    background: white !important;
    color: black !important;
  }
  
  .main-header,
  .bg-orbs,
  .quiz-title,
  .quiz-lead,
  .metrics-summary-row,
  .navigation-row,
  .review-section,
  .footer-disclaimer,
  .theme-toggle-btn {
    display: none !important;
  }
  
  .quiz-hub-main {
    padding: 0 !important;
  }
  
  .quiz-container {
    max-width: 100% !important;
  }
  
  .glass-card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }
  
  .cert-card-container {
    background-color: #fcfcfc !important;
    border: none !important;
    box-shadow: none !important;
    color: #333 !important;
    width: 100% !important;
    max-width: 100% !important;
    page-break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  
  .cert-name {
    color: #0b233f !important;
  }
  
  .cert-description {
    color: #555 !important;
  }
}

/* Responsive grid */
@media (max-width: 600px) {
  body.quiz-embedded .quiz-hub-main {
    align-items: flex-start;
    padding: 1rem 0.75rem !important;
  }

  body.quiz-embedded .quiz-container {
    max-width: 100% !important;
  }

  body.quiz-embedded .glass-card {
    border-radius: 18px;
    padding: 1.2rem;
  }

  body.quiz-embedded .quiz-title {
    font-size: 1.75rem;
    line-height: 1.18;
    letter-spacing: -0.02em;
  }

  body.quiz-embedded .quiz-lead {
    font-size: 0.92rem;
    margin-bottom: 1.4rem;
  }

  body.quiz-embedded .form-group {
    margin-bottom: 1.35rem;
  }

  body.quiz-embedded .text-input {
    max-width: 100%;
    min-width: 0;
    padding: 0.85rem 0.95rem;
    font-size: 0.95rem;
  }

  body.quiz-embedded .embedded-two-col {
    grid-template-columns: 1fr !important;
    gap: 0.85rem !important;
  }

  body.quiz-embedded .captcha-verify-row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    align-items: stretch !important;
    gap: 0.85rem !important;
    padding: 0.9rem !important;
    overflow: hidden;
  }

  body.quiz-embedded .captcha-visual-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 0.65rem !important;
    width: 100%;
    min-width: 0;
  }

  body.quiz-embedded #captchaCanvas {
    width: 100% !important;
    max-width: 150px;
    height: 42px !important;
  }

  body.quiz-embedded #refreshCaptchaBtn {
    white-space: nowrap;
  }

  body.quiz-embedded .captcha-input-wrap {
    width: 100% !important;
    max-width: none !important;
    min-width: 0;
  }

  body.quiz-embedded #verifyCaptchaInput {
    width: 100% !important;
  }

  body.quiz-embedded .level-card {
    padding: 1rem;
  }

  .level-grid {
    grid-template-columns: 1fr;
  }
  
  .metrics-summary-row {
    grid-template-columns: 1fr;
  }
  
  .cert-footer-row {
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
  }
}
