/**
 * IntrestThink Quiz Engine - Frontend Styles (v6.0)
 * Zero Cumulative Layout Shift (CLS 0.0), Mobile-First, Responsive Grid.
 */

:root {
  --itq-primary: #4F46E5;
  --itq-primary-hover: #4338CA;
  --itq-primary-light: rgba(79, 70, 229, 0.08);
  --itq-bg: #F8FAFC;
  --itq-surface: #FFFFFF;
  --itq-border: #E2E8F0;
  --itq-text: #0F172A;
  --itq-muted: #64748B;
  --itq-radius: 16px;
  --itq-shadow: 0 10px 30px -4px rgba(15, 23, 42, 0.08);
  --itq-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

.itq-quiz-wrapper {
  font-family: var(--itq-font);
  color: var(--itq-text);
  max-width: 760px;
  margin: 1.5rem auto;
  box-sizing: border-box;
}

.itq-quiz-card {
  background: var(--itq-surface);
  border: 1px solid var(--itq-border);
  border-radius: var(--itq-radius);
  box-shadow: var(--itq-shadow);
  padding: 2rem;
  position: relative;
}

/* Category Bubbly Rail Header */
.itq-category-rail {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 1.25rem;
  overflow-x: auto;
  padding-bottom: 4px;
}

.itq-category-node {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f1f5f9;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--itq-muted);
  white-space: nowrap;
}

.itq-category-node.is-active {
  background: var(--itq-primary);
  color: #fff;
}

/* 3 Progress Bar Styles */
.itq-progress-classic {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.itq-progress-classic-fill {
  height: 100%;
  background: var(--itq-primary);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.itq-progress-segmented {
  display: flex;
  gap: 4px;
  width: 100%;
  margin-bottom: 1.5rem;
}

.itq-segment {
  flex: 1;
  height: 7px;
  background: #e2e8f0;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.itq-segment.is-active,
.itq-segment.is-completed {
  background: var(--itq-primary);
}

/* Stem and Option SVGs */
.itq-question-stem {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--itq-border);
  border-radius: 12px;
  padding: 1rem;
  margin: 1rem 0;
  min-height: 90px;
}

/* Responsive Image Placeholder & Shimmer */
.itq-image-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  max-height: 240px;
  background: #f1f5f9;
  border: 1px solid var(--itq-border);
  border-radius: 12px;
  overflow: hidden;
  margin: 1rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.itq-shimmer-placeholder {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: itqShimmer 1.8s infinite;
}

@keyframes itqShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Variable Options Grid: 2x2 for 4 options, 1 col for text/2 options */
.itq-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.itq-options-grid.has-4-options {
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 540px) {
  .itq-options-grid.has-4-options {
    grid-template-columns: 1fr;
  }
}

.itq-option-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.15rem;
  background: #ffffff;
  border: 2px solid var(--itq-border);
  border-radius: 12px;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.itq-option-btn:hover {
  border-color: var(--itq-primary);
  background: var(--itq-primary-light);
}

.itq-option-btn.is-selected {
  border-color: var(--itq-primary);
  background: var(--itq-primary-light);
  box-shadow: 0 0 0 1px var(--itq-primary);
}

.itq-letter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.itq-option-btn.is-selected .itq-letter-badge {
  background: var(--itq-primary);
  color: #fff;
}
