/**
 * Minimalist Modern Quiz Design
 * Clean, spacious, elegant
 */

/* Uses global theme palette vars from style.css */

/* Hide WordPress post content when quiz is active */
body.quiz-active .entry-header,
body.quiz-active .entry-title,
body.quiz-active .ast-single-post-header,
body.quiz-active .post-thumbnail,
body.quiz-active .ast-blog-featured-section,
body.quiz-active header.entry-header,
body.quiz-active .entry-content > *:not([data-match-me-quiz]),
body.quiz-active article .entry-content > *:not([data-match-me-quiz]) {
  display: none !important;
}

.mmq {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
  padding: var(--spacing-lg);
  background: var(--color-bg);
}

.mmq-fullheight {
  /* Fill the viewport under the sticky header */
  /* max-height: calc(100svh - var(--header-height) - 16px); */
  display: flex;
  flex-direction: column;
}

.mmq-screen {
  display: flex;
  flex-direction: column;
}

.mmq-fullheight .mmq-screen {
  flex: 1;
}

.mmq-loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Intro / gated start */
.mmq-intro {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.mmq-intro-title {
  font-size: 1.75rem;
  font-weight: 400;
  color: var(--color-primary);
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.2;
  text-align: left;
}

.mmq-intro-content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  align-items: center;
}

.mm-empty p {
    margin: 0;
}



a.mm-quiz-card-button {
    font-weight: bold;
}

.mmq-intro-image {
  width: 100%;
  max-width: 400px;
}

.mmq-intro-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
}

.mmq-intro-text {
  width: 100%;
  max-width: 600px;
  text-align: center;
}

.mmq-intro-text p {
  margin: 0;
  color: var(--color-text-light);
  line-height: 1.6;
}

.mmq-intro-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

.mmq-start {
  width: 100%;
  max-width: 300px;
  min-height: 56px;
  padding: var(--spacing-md) var(--spacing-xl);
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  border: none;
  background: linear-gradient(135deg, #1E2A44 0%, #2B3A5E 100%);
  color: #ffffff;
  letter-spacing: 0.01em;
  box-shadow: 0 4px 12px rgba(30, 42, 68, 0.20);
}

.mmq-start:hover {
  background: linear-gradient(135deg, #243554 0%, #354668 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(30, 42, 68, 0.30);
}

.mmq-view-results {
  width: 100%;
  max-width: 300px;
  min-height: 48px;
  padding: var(--spacing-sm) var(--spacing-lg);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  border: 1.5px solid rgba(30, 42, 68, 0.18);
  background: rgba(255, 255, 255, 0.90);
  color: var(--color-primary);
  letter-spacing: 0.01em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.mmq-view-results:hover {
  background: rgba(30, 42, 68, 0.04);
  border-color: rgba(30, 42, 68, 0.28);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(30, 42, 68, 0.12);
}

/* Header */
.mmq-header {
  margin-bottom: var(--spacing-xl);
  text-align: center;
}

.mmq-title {
  font-size: 1.75rem;
  font-weight: 400;
  color: var(--color-primary);
  margin: 0 0 var(--spacing-xs) 0;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.mmq-progress {
  margin-top: var(--spacing-sm);
}

.mmq-progress-bar {
  height: 6px;
  background: rgba(30, 42, 68, 0.10);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: var(--spacing-xs);
}

.mmq-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #1E2A44, #3A4A72);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.mmq-progress-text {
  font-size: 0.875rem;
  color: var(--color-text-lighter);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: center;
}

/* Question */
.mmq-question {
  margin-bottom: var(--spacing-lg);
}

.mmq-fullheight .mmq-question {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.mmq-question-text {
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--color-text);
  margin-bottom: var(--spacing-md);
  line-height: 1.5;
  letter-spacing: -0.01em;
}

/* Options */
.mmq-options {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
}

.mmq-fullheight .mmq-options {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
  margin-bottom: 0;
}

.mmq-option {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  cursor: pointer;
  transition: var(--transition);
  min-height: auto;
}

.mmq-option:hover {
  border-color: var(--color-text-light);
  background: var(--color-bg-subtle);
}

.mmq-option input[type="radio"] {
  margin: 0;
  margin-top: 2px;
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--color-accent);
  flex-shrink: 0;
}


/* Apply border/background when radio is checked */
.mmq-option input[type="radio"]:checked ~ span,
.mmq-option:has(input[type="radio"]:checked) {
  border-color: var(--color-primary);
  background: var(--color-bg-subtle);
}

/* Fallback for browsers without :has() support */
.mmq-option.selected {
  border-color: var(--color-primary);
  background: var(--color-bg-subtle);
}

.mmq-option span {
  flex: 1;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--color-text);
  font-weight: 400;
}

/* Actions */
.mmq-actions {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-lg);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--color-border);
}

.mmq-fullheight .mmq-actions {
  margin-top: auto;
}

.mmq-back,
.mmq-next {
  flex: 1;
  min-height: 52px;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  letter-spacing: 0.01em;
}

.mmq-back {
  background: transparent;
  color: var(--color-text-light);
  border: 1px solid var(--color-border);
}

.mmq-back:hover:not(:disabled) {
  background: var(--color-bg-subtle);
  border-color: var(--color-text-light);
  color: var(--color-text);
}

.mmq-back:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.mmq-next {
  background: var(--color-primary);
  color: var(--color-bg);
  border: 1px solid var(--color-primary);
}

.mmq-next:hover:not(:disabled) {
  background: #243454;
  border-color: #243454;
}

.mmq-next:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Error */
.mmq-error {
  margin-bottom: var(--spacing-md);
  padding: var(--spacing-md);
  border-radius: var(--radius-sm);
  background: #fff5f5;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Results Container */
.mmq-results {
  padding: 0;
}

/* Responsive */
@media (max-width: 640px) {
  .mmq {
    padding: 12px;
  }

  .mmq-title {
    font-size: 1.25rem;
  }

  .mmq-question-text {
    font-size: 1.05rem;
    margin-bottom: 10px;
    line-height: 1.35;
  }

  .mmq-header {
    margin-bottom: 10px;
  }

  .mmq-progress {
    margin-top: 6px;
  }

  .mmq-progress-bar {
    height: 5px;
    margin-bottom: 6px;
  }

  .mmq-progress-text {
    font-size: 0.8125rem;
  }

  .mmq-question {
    margin-bottom: 10px;
  }

  .mmq-options {
    gap: 8px;
    margin-bottom: 12px;
  }

  .mmq-option {
    padding: 10px 12px;
  }

  .mmq-option span {
    font-size: 0.9rem;
    line-height: 1.35;
  }

  /* Keep actions always in the same place on mobile */
  .mmq-fullheight .mmq-screen {
    /* Account for mobile browser UI + safe areas so the last CTA never gets clipped */
    max-height: calc(100svh - var(--header-height) - 24px - env(safe-area-inset-bottom, 0px));
  }

  .mmq-fullheight .mmq-actions {
    position: sticky;
    bottom: 0;
    margin-top: auto;
    padding-top: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(246, 245, 242, 0.96);
    backdrop-filter: blur(8px);
  }

  .mmq-back,
  .mmq-next {
    min-height: 46px;
    padding: 12px 16px;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: visible;
  }

  .mmq-intro {
    gap: var(--spacing-md);
  }
  
  .mmq-intro-title {
    font-size: 1.5rem;
  }

  .mmq-start {
    min-height: 46px;
    padding: 10px 12px;
    font-size: 0.9rem;
  }
}
