.iff-wrapper {
  direction: rtl;
  font-family: inherit;
}

.iff-preview {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2.4rem 1rem;
  background: #0f172a;
  position: relative;
  overflow: hidden;
}

/* ── Background image — full cover, always centered ────────────────────────── */
.iff-preview--has-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--iff-bg-url);
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  opacity: var(--iff-bg-opacity, 0.55);
  pointer-events: none;
  z-index: 0;
}

/* ── Subtle dark gradient overlay for readability ─────────────────────────── */
.iff-preview--has-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(10, 15, 30, 0.30) 0%,
    rgba(10, 15, 30, 0.15) 45%,
    rgba(10, 15, 30, 0.40) 100%
  );
  pointer-events: none;
  z-index: 0;
}

.iff-preview--has-bg .iff-preview__inner {
  position: relative;
  z-index: 1;
}

/* ── Glass card (when background image is set) ────────────────────────────── */
.iff-preview__inner {
  width: min(780px, 100%);
  border-radius: 28px;
  padding: 2.4rem 2.2rem;
  text-align: center;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 30px 60px -45px rgba(15, 23, 42, 0.55);
}

.iff-preview--has-bg .iff-preview__inner {
  background: rgba(255, 255, 255, 0.13);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.26);
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.20);
}

/* ── Badge ──────────────────────────────────────────────────────────────────── */
.iff-preview__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.32rem 0.85rem;
  letter-spacing: 0.02em;
}
.iff-preview--has-bg .iff-preview__badge {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.32);
  color: rgba(255, 255, 255, 0.92);
}

/* ── Title ──────────────────────────────────────────────────────────────────── */
.iff-preview__title {
  margin: 0.72rem 0 0.2rem;
  color: #0f172a;
  font-size: clamp(1.26rem, 2.6vw, 1.9rem);
  font-weight: 800;
}
.iff-preview--has-bg .iff-preview__title {
  color: #ffffff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.35);
}

/* ── Subtitle ───────────────────────────────────────────────────────────────── */
.iff-preview__subtitle {
  margin: 0;
  color: #64748b;
  line-height: 1.9;
  font-size: 0.95rem;
}
.iff-preview--has-bg .iff-preview__subtitle {
  color: rgba(255, 255, 255, 0.78);
}

.iff-launcher {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
}

.iff-launcher-button {
  border: 0;
  border-radius: 14px;
  min-height: 54px;
  min-width: min(420px, 100%);
  padding: 0.8rem 2rem;
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  color: #0f172a;
  font-family: Vazirmatn, IRANSans, "Segoe UI", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.5;
  cursor: pointer;
  box-shadow: 0 18px 32px -20px rgba(245, 158, 11, 0.7);
  transition: transform 0.16s ease, box-shadow 0.2s ease;
}

.iff-launcher-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 24px 38px -23px rgba(245, 158, 11, 0.78);
}

.iff-launcher-button:active {
  transform: translateY(1px);
}

.iff-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  z-index: 3100;
}

.iff-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.98);
  width: min(860px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  border-radius: 20px;
  border: 1px solid #dbe3ef;
  background: #ffffff;
  box-shadow: 0 25px 55px -38px rgba(15, 23, 42, 0.75);
  padding: 1.1rem 1.1rem 1.2rem;
  z-index: 3110;
  opacity: 0;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.iff-modal.iff-is-open {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.iff-close {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid #d3dceb;
  background: #ffffff;
  color: #334155;
  font-size: 1.2rem;
  cursor: pointer;
}

.iff-title {
  margin: 0;
  color: #0f172a;
  font-size: 1.12rem;
  font-weight: 800;
  padding-left: 2.4rem;
}

.iff-subtitle {
  margin: 0.35rem 0 0.95rem;
  color: #64748b;
  font-size: 0.92rem;
  line-height: 1.7;
}

.iff-progress {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #e9eff8;
  overflow: hidden;
  margin-bottom: 0.35rem;
}

.iff-progress__bar {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #0f172a, #1e3a8a);
  transition: width 0.24s ease;
}

.iff-progress__text {
  margin: 0 0 0.75rem;
  color: #475569;
  font-size: 0.8rem;
}

.iff-stage {
  min-height: 430px;
}

.iff-card {
  position: relative;
  overflow: hidden;
  border: 1px solid #dbe3ef;
  border-radius: 16px;
  padding: 1.2rem;
  background: #fcfdff;
  animation: iffFadeIn 0.2s ease;
}

.iff-card__content {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 0.75rem;
}

.iff-card--question {
  min-height: 460px;
}

.iff-card--question.iff-card--has-image {
  border-color: rgba(203, 213, 225, 0.9);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.iff-card--question.iff-card--has-image .iff-card__title,
.iff-card--question.iff-card--has-image .iff-card__description,
.iff-card--question.iff-card--has-image .iff-field__label,
.iff-card--question.iff-card--has-image .iff-option__text {
  color: #000000;
}

.iff-card--question.iff-card--has-image .iff-card__content {
  color: #000000;
}

.iff-card--question.iff-card--has-image .iff-option {
  border: 0;
  background: transparent;
  padding: 0.2rem 0;
}

.iff-card--question.iff-card--has-image .iff-option:hover {
  border: 0;
  background: transparent;
}

.iff-card--question.iff-card--has-image .iff-input,
.iff-card--question.iff-card--has-image .iff-textarea {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(148, 163, 184, 0.6);
  color: #0f172a;
}

.iff-card--question.iff-card--has-image .iff-input::placeholder,
.iff-card--question.iff-card--has-image .iff-textarea::placeholder {
  color: rgba(71, 85, 105, 0.82);
}

.iff-card--question.iff-card--has-image .iff-input:focus,
.iff-card--question.iff-card--has-image .iff-textarea:focus {
  border-color: rgba(15, 23, 42, 0.75);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.18);
}

.iff-card__title {
  margin: 0;
  color: #000000;
  font-weight: 800;
  font-size: 1rem;
}

.iff-card__description {
  margin: 0.35rem 0 0.85rem;
  color: #000000;
  line-height: 1.8;
  font-size: 0.87rem;
}

.iff-field {
  display: grid;
  gap: 0.34rem;
}

.iff-field__label {
  color: #000000;
  font-size: 0.86rem;
  font-weight: 700;
}

.iff-field__hint {
  margin: 0;
  color: #475569;
  font-size: 0.76rem;
  line-height: 1.55;
}

.iff-input,
.iff-textarea {
  width: 100%;
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid #d1dceb;
  background: #ffffff;
  color: #0f172a;
  font-family: inherit;
  font-size: 0.92rem;
  padding: 0.62rem 0.72rem;
  outline: none;
}

.iff-textarea {
  min-height: 120px;
  resize: vertical;
}

.iff-input:focus,
.iff-textarea:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16);
}

.iff-input--uppercase {
  text-transform: uppercase;
}

.iff-option-grid {
  display: grid;
  gap: 0.45rem;
}

.iff-option {
  display: flex;
  align-items: center;
  gap: 0.48rem;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #ffffff;
  padding: 0.52rem 0.62rem;
  cursor: pointer;
}

.iff-option:hover {
  border-color: #c7d3e6;
  background: #f8fafc;
}

.iff-option input {
  width: 17px;
  height: 17px;
  accent-color: #f59e0b;
}

.iff-option__text {
  color: #000000;
  font-size: 0.9rem;
}

.iff-stage-error,
.iff-field-error {
  margin: 0.62rem 0 0;
  border-radius: 10px;
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #991b1b;
  font-size: 0.82rem;
  padding: 0.5rem 0.65rem;
}

.iff-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.iff-button {
  border: 0;
  border-radius: 12px;
  min-height: 44px;
  padding: 0.6rem 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

.iff-button:active {
  transform: translateY(1px);
}

.iff-button[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.iff-button--primary {
  width: 100%;
  background: #f59e0b;
  color: #0f172a;
}

.iff-button--primary:hover {
  background: #fbbf24;
}

.iff-button--muted {
  background: #eef2f7;
  color: #334155;
  min-width: 108px;
}

.iff-button--muted:hover {
  background: #e2e8f0;
}

.iff-contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.58rem;
}

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

.iff-required-star {
  color: #ef4444;
  font-weight: 800;
}

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

@media (max-width: 900px) {
  .iff-preview__inner {
    border-radius: 18px;
    padding: 1.05rem 0.9rem;
  }

  .iff-launcher-button {
    min-height: 48px;
    font-size: 0.95rem;
  }

  .iff-modal {
    width: calc(100vw - 1rem);
    padding: 0.95rem;
    border-radius: 16px;
  }

  .iff-stage {
    min-height: 320px;
  }

  .iff-card--question {
    min-height: 340px;
  }

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