/* =========================================================
   RP Quiz — Frontend Styles
   Raiffeisen Parc brand: dark green + turquoise
   ========================================================= */

:root {
  --rp-green:       #1B3A2C;
  --rp-green-light: #244d3b;
  --rp-teal:        #3D9E8C;
  --rp-teal-dark:   #2e7d6e;
  --rp-teal-light:  #e8f7f5;
  --rp-white:       #ffffff;
  --rp-text:        #1a1a1a;
  --rp-text-light:  #5a6a62;
  --rp-border:      #d4e4de;
  --rp-error:       #e53e3e;
  --rp-shadow:      0 8px 32px rgba(27, 58, 44, 0.18);
  --rp-radius:      16px;
  --rp-radius-sm:   10px;
  --rp-transition:  0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Wrapper ─────────────────────────────────────────────── */
.rp-quiz-wrapper {
  background: var(--rp-green);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(61, 158, 140, 0.15) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(61, 158, 140, 0.1) 0%, transparent 50%);
  padding: 40px 20px 60px;
  min-height: 500px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  transition: opacity 0.4s ease;
}
.rp-quiz-wrapper.rp-ready {
  opacity: 1;
}
.rp-quiz-closed {
  background: var(--rp-green);
  color: var(--rp-white);
  text-align: center;
  padding: 40px;
  border-radius: var(--rp-radius);
  font-size: 1.1rem;
}

/* ── Progress bar ────────────────────────────────────────── */
.rp-progress {
  max-width: 640px;
  margin: 0 auto 32px;
}

.rp-progress__bar {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 100px;
  height: 6px;
  overflow: hidden;
}

.rp-progress__fill {
  height: 100%;
  background: var(--rp-teal);
  border-radius: 100px;
  transition: width var(--rp-transition);
  min-width: 4%;
}

/* ── Steps ───────────────────────────────────────────────── */
.rp-step {
  display: none;
}

.rp-step--active {
  display: block;
  animation: rpFadeIn 0.35s ease;
}

@keyframes rpFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Card ────────────────────────────────────────────────── */
.rp-card {
  background: var(--rp-white);
  border-radius: var(--rp-radius);
  box-shadow: var(--rp-shadow);
  max-width: 640px;
  margin: 0 auto;
  overflow: hidden;
}

.rp-card__image {
  width: 100%;
  max-height: 280px;
  overflow: hidden;
}

.rp-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rp-card__body {
  padding: 36px 40px;
}

/* ── Intro step ──────────────────────────────────────────── */
.rp-intro__title {
  font-size: 1.9rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--rp-green);
  letter-spacing: 0.02em;
  margin: 0 0 8px;
  line-height: 1.15;
}

.rp-intro__subtitle {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--rp-teal-dark);
  margin: 0 0 16px;
}

.rp-intro__desc {
  color: var(--rp-text-light);
  font-size: 0.95rem;
  line-height: 1.65;
  margin-bottom: 28px;
}

.rp-intro__desc p { margin: 0 0 10px; }

/* ── Question step ───────────────────────────────────────── */
.rp-question__counter {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--rp-teal);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0 0 8px;
}

.rp-question__label {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--rp-green);
  margin: 0 0 6px;
  line-height: 1.3;
}

.rp-question__desc {
  font-size: 0.9rem;
  color: var(--rp-text-light);
  margin: 0 0 20px;
}

.rp-required {
  color: var(--rp-teal);
  margin-left: 2px;
}

.rp-question__input {
  margin-bottom: 28px;
}

/* ── Options (radio / checkbox) ──────────────────────────── */
.rp-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rp-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid var(--rp-border);
  border-radius: var(--rp-radius-sm);
  cursor: pointer;
  transition: border-color var(--rp-transition), background var(--rp-transition), box-shadow var(--rp-transition);
  user-select: none;
}

.rp-option:hover {
  border-color: var(--rp-teal);
  background: var(--rp-teal-light);
}

.rp-option input[type="radio"],
.rp-option input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* Custom radio/checkbox indicator */
.rp-option__check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 2px solid var(--rp-border);
  border-radius: 50%;
  background: var(--rp-white);
  transition: border-color var(--rp-transition), background var(--rp-transition);
  position: relative;
}

.rp-options--checkbox .rp-option__check {
  border-radius: 6px;
}

.rp-option__check::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--rp-teal);
  transform: scale(0);
  transition: transform var(--rp-transition);
}

.rp-options--checkbox .rp-option__check::after {
  border-radius: 3px;
  inset: 0;
  background: none;
  border-bottom: 2px solid var(--rp-white);
  border-right: 2px solid var(--rp-white);
  width: 6px;
  height: 10px;
  margin: auto;
  transform: rotate(45deg) scale(0);
}

.rp-option:has(input:checked) {
  border-color: var(--rp-teal);
  background: var(--rp-teal-light);
  box-shadow: 0 0 0 1px var(--rp-teal);
}

.rp-option:has(input:checked) .rp-option__check {
  border-color: var(--rp-teal);
  background: var(--rp-teal);
}

.rp-option:has(input:checked) .rp-option__check::after {
  transform: scale(1);
}

.rp-options--checkbox .rp-option:has(input:checked) .rp-option__check::after {
  transform: rotate(45deg) scale(1);
}

.rp-option__img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
}

.rp-option__label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--rp-text);
}

.rp-option:has(input:checked) .rp-option__label {
  color: var(--rp-teal-dark);
  font-weight: 600;
}

/* Error state */
.rp-options.rp-option--error .rp-option {
  border-color: var(--rp-error);
}

/* ── Text / Email fields ─────────────────────────────────── */
.rp-field {
  margin-bottom: 16px;
}

.rp-field label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--rp-green);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.rp-field input[type="text"],
.rp-field input[type="email"] {
  width: 100%;
  padding: 13px 16px;
  border: 2px solid var(--rp-border);
  border-radius: var(--rp-radius-sm);
  font-size: 0.95rem;
  color: var(--rp-text);
  background: var(--rp-white);
  transition: border-color var(--rp-transition), box-shadow var(--rp-transition);
  box-sizing: border-box;
  outline: none;
}

.rp-field input:focus {
  border-color: var(--rp-teal);
  box-shadow: 0 0 0 3px rgba(61, 158, 140, 0.15);
}

.rp-field input.rp-field--error,
.rp-field--error input {
  border-color: var(--rp-error);
}

/* ── Contact step ────────────────────────────────────────── */
.rp-contact__title {
  font-size: 1.3rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--rp-green);
  margin: 0 0 6px;
}

.rp-contact__intro {
  font-size: 0.9rem;
  color: var(--rp-text-light);
  margin: 0 0 24px;
}

.rp-contact-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}

.rp-field--full {
  grid-column: 1 / -1;
}

/* ── Opt-in ──────────────────────────────────────────────── */
.rp-field--optin {
  margin-bottom: 0;
}

.rp-optin-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--rp-text-light);
  line-height: 1.5;
}

.rp-optin-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.rp-optin__check {
  flex-shrink: 0;
  margin-top: 2px;
  width: 20px;
  height: 20px;
  border: 2px solid var(--rp-border);
  border-radius: 5px;
  background: var(--rp-white);
  transition: border-color var(--rp-transition), background var(--rp-transition);
  position: relative;
}

.rp-optin__check::after {
  content: '';
  position: absolute;
  inset: 0;
  background: none;
  border-bottom: 2px solid var(--rp-white);
  border-right: 2px solid var(--rp-white);
  width: 5px;
  height: 9px;
  margin: auto;
  transform: rotate(45deg) scale(0);
  transition: transform var(--rp-transition);
  top: -2px;
}

.rp-optin-label:has(input:checked) .rp-optin__check {
  border-color: var(--rp-teal);
  background: var(--rp-teal);
}

.rp-optin-label:has(input:checked) .rp-optin__check::after {
  transform: rotate(45deg) scale(1);
}

/* ── Bonus inline (sur slide confirmation) ───────────────── */
.rp-bonus-inline {
  margin-top: 28px;
  text-align: center;
}

.rp-bonus-inline__divider {
  width: 48px;
  height: 2px;
  background: var(--rp-border);
  margin: 0 auto 24px;
  border-radius: 2px;
}

.rp-bonus-inline__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--rp-green);
  margin: 8px 0 6px;
}

.rp-bonus-inline__desc {
  font-size: 0.88rem;
  color: var(--rp-text-light);
  margin: 0 0 16px;
  line-height: 1.5;
}

.rp-bonus-inline .rp-btn {
  margin: 0 auto;
}

/* ── Bonus step (kept for admin compat) ──────────────────── */
.rp-bonus__badge {
  display: inline-block;
  background: var(--rp-teal);
  color: var(--rp-white);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 100px;
  margin-bottom: 16px;
}

.rp-bonus__title {
  font-size: 1.25rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--rp-green);
  margin: 0 0 10px;
}

.rp-bonus__desc {
  font-size: 0.95rem;
  color: var(--rp-text-light);
  margin: 0 0 24px;
  line-height: 1.6;
}

.rp-bonus__actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 28px;
}

.rp-bonus__already {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--rp-text-light);
}

.rp-bonus__already input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

/* ── Confirmation step ───────────────────────────────────── */
.rp-step--confirmation {
  display: none !important;
}

.rp-step--confirmation.rp-step--active {
  display: block !important;
}

.rp-card--confirmation .rp-card__body {
  text-align: center;
  padding: 56px 40px;
}

.rp-confirmation__icon {
  width: 72px;
  height: 72px;
  background: var(--rp-teal-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}

.rp-confirmation__icon svg {
  width: 36px;
  height: 36px;
  stroke: var(--rp-teal);
}

.rp-confirmation__content {
  color: var(--rp-text);
  font-size: 1rem;
  line-height: 1.7;
}

.rp-confirmation__content h2,
.rp-confirmation__content h3 {
  color: var(--rp-green);
  text-transform: uppercase;
  font-weight: 800;
  margin-bottom: 12px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.rp-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.rp-nav--right {
  justify-content: flex-end;
}

.rp-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 100px;
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--rp-transition);
  text-decoration: none;
  white-space: nowrap;
}

.rp-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.rp-btn--primary {
  background: var(--rp-teal);
  color: var(--rp-white);
  border-color: var(--rp-teal);
  margin-left: auto;
}

.rp-btn--primary:hover {
  background: var(--rp-teal-dark);
  border-color: var(--rp-teal-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(61, 158, 140, 0.35);
}

.rp-btn--primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.rp-btn--ghost {
  background: transparent;
  color: var(--rp-text-light);
  border-color: var(--rp-border);
}

.rp-btn--ghost:hover {
  border-color: var(--rp-green);
  color: var(--rp-green);
  background: rgba(27, 58, 44, 0.05);
}

.rp-btn--secondary {
  background: transparent;
  color: var(--rp-teal);
  border-color: var(--rp-teal);
}

.rp-btn--secondary:hover {
  background: var(--rp-teal-light);
}

/* ── Error messages ──────────────────────────────────────── */
.rp-error {
  color: var(--rp-error);
  font-size: 0.84rem;
  margin: 6px 0 0;
  font-weight: 500;
}

.rp-error--global {
  background: #fff5f5;
  border: 1px solid #fed7d7;
  border-radius: var(--rp-radius-sm);
  padding: 10px 14px;
  margin-bottom: 12px;
}

/* ── Loader ──────────────────────────────────────────────── */
.rp-btn--loading {
  pointer-events: none;
}

.rp-btn--loading::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: white;
  border-radius: 50%;
  animation: rpSpin 0.7s linear infinite;
}

@keyframes rpSpin {
  to { transform: rotate(360deg); }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .rp-quiz-wrapper {
    padding: 24px 12px 40px;
  }

  .rp-card__body {
    padding: 24px 20px;
  }

  .rp-contact-fields {
    grid-template-columns: 1fr;
  }

  .rp-intro__title {
    font-size: 1.5rem;
  }

  .rp-btn {
    padding: 12px 18px;
    font-size: 0.82rem;
  }
}
