/* =========================
   SCOPE: .acf-form-scope
   ========================= */

/* Vars локализуем на уровне обёртки, а не :root */
.acf-form-scope {
  --iwaf-font-size-base: 16px;
  --iwaf-color-bg: #ffffff;
  --iwaf-color-text: #333;
  --iwaf-color-primary: #0D464C;
  --iwaf-color-accent: #7cb7a5;
  --iwaf-color-muted: #e9ecef;
  --iwaf-color-soft: #f8f9fa;

  --iwaf-radius-sm: .25rem;
  --iwaf-radius-md: .375rem;
  --iwaf-radius-lg: .5rem;
  --iwaf-radius-xl: .75rem;

  --iwaf-space-1: .25rem;
  --iwaf-space-2: .5rem;
  --iwaf-space-3: .625rem;
  --iwaf-space-4: .75rem;
  --iwaf-space-5: 1rem;
  --iwaf-space-6: 1.25rem;
  --iwaf-space-7: 1.5rem;
  --iwaf-space-8: 2rem;

  --iwaf-fs-sm: .875rem;
  --iwaf-fs-md: 1rem;
  --iwaf-fs-lg: 1.125rem;
  --iwaf-fs-xl: 1.375rem;
  --iwaf-fs-2xl: 1.5rem;

  --iwaf-header-offset: 4.5rem;
}

/* Базовый размер шрифта только внутри сферы */
.acf-form-scope,
.acf-form-scope * { font-size: var(--iwaf-font-size-base); }

/* НИЧЕГО глобально не скрываем — только внутри .acf-form-scope */
.acf-form-scope div#header,
.acf-form-scope hr,
.acf-form-scope div#footer { display: none !important; }

/* Полноэкранный режим — только когда обёртка получает модификатор .is-fullscreen */
.acf-form-scope.is-fullscreen {
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  background: var(--iwaf-color-bg) !important;
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 10000;
}

/* Логотип */
.acf-form-scope .form-logo {
  position: fixed;
  top: 0; left: 0; right: 0;
  text-align: center;
  padding: var(--iwaf-space-6) 0;
  background: var(--iwaf-color-bg);
  z-index: 10010;
  pointer-events: none;
}
.acf-form-scope .form-logo img {
  width: 7.5rem; height: auto; max-height: 3.75rem;
}

/* Контейнер формы */
.acf-form-scope .survey-container {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 100%; max-width: 37.5rem;
  display: flex; flex-direction: column;
  z-index: 10005;
  padding-top: var(--iwaf-header-offset);
  opacity: 0; visibility: hidden; transition: opacity .25s ease;
}
.acf-form-scope .survey-container.iwaf-visible {
  opacity: 1 !important; visibility: visible !important;
}

/* Прелоадер */
.acf-form-scope .iwaf-preloader { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(255,255,255,0.0); z-index: 10050; }
.acf-form-scope .iwaf-preloader .iwaf-spinner { width: 2.25rem; height: 2.25rem; border: .25rem solid #cfe8e4; border-top-color: var(--iwaf-color-primary); border-radius: 50%; animation: iwaf-spin 0.9s linear infinite; }
@keyframes iwaf-spin { to { transform: rotate(360deg); } }

/* Thank you */
.acf-form-scope .iwaf-thankyou-overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: transparent; z-index: 10020; visibility: hidden; opacity: 0; transition: opacity .15s ease; }
.acf-form-scope .iwaf-thankyou-overlay.iwaf-show { visibility: visible; opacity: 1; }
.acf-form-scope .iwaf-thankyou-card { border-radius: var(--iwaf-radius-lg); width: min(32.5rem, 90vw); padding: 1.75rem 1.5rem; text-align: center; direction: rtl; }
.acf-form-scope .iwaf-thankyou-dot { width: .875rem; height: .875rem; margin: .25rem auto .75rem; background: #2ecc71; border-radius: 50%; }
.acf-form-scope .iwaf-thankyou-title { margin: 0 0 .5rem; font-size: var(--iwaf-fs-xl); color: var(--iwaf-color-primary); }
.acf-form-scope .iwaf-thankyou-sub { margin: 0; font-size: var(--iwaf-fs-sm); color: var(--iwaf-color-text); }

/* Заголовок формы */
.acf-form-scope .form-title { text-align: center; margin: var(--iwaf-space-6) 0 0; font-size: var(--iwaf-fs-2xl); font-weight: 600; color: var(--iwaf-color-text); }
.acf-form-scope .form-title h2 { margin: 0; padding: 0; }

/* Скрываем табы ACF */
.acf-form-scope .acf-tab-wrap,
.acf-form-scope .acf-tab-group,
.acf-form-scope .acf-tab-button { display: none !important; }

/* ACF container */
.acf-form-scope .acf-form { flex: 1; display: flex; flex-direction: column; }
.acf-form-scope .acf-fields { flex: 1; overflow-y: auto; overflow-x: hidden; max-height: calc(90vh - 12.5rem); padding-bottom: 10rem; }

/* Анимация появления полей */
@keyframes iwaf-fade-slide { from { opacity: 0; transform: translateY(.5rem); } to { opacity: 1; transform: translateY(0); } }
.acf-form-scope .acf-field.iwaf-anim-fade-in { animation: iwaf-fade-slide 260ms ease both; animation-delay: var(--iwaf-delay, 0ms); }

/* Поля */
.acf-form-scope .acf-field { margin-bottom: var(--iwaf-space-3); padding: var(--iwaf-space-3); background: var(--iwaf-color-bg); text-align: left; max-width: 100%; overflow: hidden; }
.acf-form-scope.rtl .acf-field { text-align: right; }

/* True/False центр */
.acf-form-scope .acf-field.acf-field-true-false { text-align: center !important; }

/* Radio как строки */
.acf-form-scope .acf-field-radio .acf-input { display: block; }
.acf-form-scope .acf-field-radio .acf-input input[type="radio"] { display: none !important; }
.acf-form-scope .acf-field-radio .acf-input label { display: block; padding: var(--iwaf-space-4) var(--iwaf-space-5); margin-bottom: .5rem; background: var(--iwaf-color-soft); border: .0625rem solid var(--iwaf-color-muted); border-radius: var(--iwaf-radius-md); cursor: pointer; transition: background-color .2s ease; font-size: var(--iwaf-fs-md); color: var(--iwaf-color-text); text-align: right; }
.acf-form-scope .acf-field-radio .acf-input label:hover { background: var(--iwaf-color-muted); border-color: var(--iwaf-color-accent); }
.acf-form-scope .acf-field-radio .acf-input input[type="radio"]:checked + label,
.acf-form-scope .acf-field-radio .acf-input label.selected,
.acf-form-scope .acf-radio-list li label.selected { background: var(--iwaf-color-accent); color: #fff; border-color: var(--iwaf-color-accent); }

.acf-form-scope .acf-field.acf-hidden { display: none !important; }
.acf-form-scope .acf-label label { font-weight: 600; color: var(--iwaf-color-text); margin-bottom: .5rem; display: block; }

/* Text / Textarea */
.acf-form-scope .acf-field-text .acf-input input { width: 100%; max-width: 100%; padding: 1rem 1.25rem; border: .125rem solid var(--iwaf-color-muted); border-radius: var(--iwaf-radius-xl); font-size: var(--iwaf-fs-md); font-weight: 400; color: var(--iwaf-color-text); background: var(--iwaf-color-bg); box-sizing: border-box; transition: all .3s ease; box-shadow: 0 .125rem .25rem rgba(0,0,0,.05); pointer-events: auto; user-select: text; }
.acf-form-scope .acf-field-textarea .acf-input textarea { width: 100%; max-width: 100%; padding: 1rem 1.25rem; border: .125rem solid var(--iwaf-color-muted); border-radius: var(--iwaf-radius-xl); font-size: var(--iwaf-fs-md); color: var(--iwaf-color-text); background: var(--iwaf-color-bg); box-sizing: border-box; transition: all .3s ease; }

.acf-form-scope .acf-field-text .acf-input input:focus { outline: none; border-color: var(--iwaf-color-primary); box-shadow: 0 .25rem .75rem rgba(13,70,76,.15); transform: translateY(-.0625rem); }
.acf-form-scope .acf-field-textarea .acf-input textarea:focus { outline: none; border-color: var(--iwaf-color-primary); box-shadow: 0 .25rem .75rem rgba(13,70,76,.15); }
.acf-form-scope .acf-field-text .acf-input input::placeholder,
.acf-form-scope .acf-field-textarea .acf-input textarea::placeholder { color: #999; font-weight: 400; }

/* Select (multi) */
.acf-form-scope .acf-input select { width: 100%; max-width: 100%; padding: var(--iwaf-space-4) var(--iwaf-space-5); border: .0625rem solid var(--iwaf-color-muted); font-size: var(--iwaf-fs-md); box-sizing: border-box; }
.acf-form-scope .acf-input select:focus { outline: none; border-color: var(--iwaf-color-text); }
.acf-form-scope .acf-field-select .acf-input { display: block !important; }
.acf-form-scope .acf-field-select .acf-input select,
.acf-form-scope .acf-field-select .acf-input .select2-container { display: none !important; }
.acf-form-scope .acf-field-select .acf-input .select-options-container { display: block; margin-top: var(--iwaf-space-3); }
.acf-form-scope .acf-field-select .acf-input .select-option { display: flex !important; align-items: center !important; justify-content: space-between !important; padding: var(--iwaf-space-4) var(--iwaf-space-5) !important; margin-bottom: .5rem !important; background: var(--iwaf-color-soft) !important; border: .0625rem solid var(--iwaf-color-muted) !important; border-radius: var(--iwaf-radius-md) !important; cursor: pointer !important; transition: all .2s ease !important; font-size: var(--iwaf-fs-md) !important; color: var(--iwaf-color-text) !important; text-align: left !important; }
.acf-form-scope.rtl .acf-field-select .acf-input .select-option { text-align: right !important; }
.acf-form-scope .acf-field-select .acf-input .select-option:hover { background: var(--iwaf-color-muted) !important; border-color: var(--iwaf-color-accent) !important; }
.acf-form-scope .acf-field-select .acf-input .select-option.selected { background: var(--iwaf-color-accent) !important; color: #fff !important; border-color: var(--iwaf-color-accent) !important; }
.acf-form-scope .acf-field-select .acf-input .select-option input[type="checkbox"] { width: 1.125rem !important; height: 1.125rem !important; accent-color: var(--iwaf-color-accent) !important; margin-left: .75rem !important; margin-right: 0 !important; }
.acf-form-scope.rtl .acf-field-select .acf-input .select-option input[type="checkbox"] { margin-left: 0 !important; margin-right: .75rem !important; }
.acf-form-scope .acf-field-select .acf-input .select-option.selected input[type="checkbox"] { accent-color: #fff !important; }

/* Скрытые поля */
.acf-form-scope .acf-field.acf-hidden { display: none !important; }

/* Значения (value display) */
.acf-form-scope .acf-field-value-display { background: var(--iwaf-color-bg); color: var(--iwaf-color-text); padding: 0; margin-bottom: var(--iwaf-space-3); text-align: center; border: none; }
.acf-form-scope .acf-field-value-display .acf-label label { display: none !important; }
.acf-form-scope .acf-field-value-display .field-value { color: var(--iwaf-color-text); line-height: 1.6; font-size: var(--iwaf-fs-lg); font-weight: 600; padding: 0; margin: 0; }
.acf-form-scope .acf-field-value-display img { max-width: 18.75rem !important; height: auto !important; display: block !important; margin: 0 auto !important; }

/* Навигация (fixed, но кликабельна) */
.acf-form-scope .survey-navigation {
  display: flex; justify-content: center; align-items: center;
  gap: var(--iwaf-space-4);
  position: fixed; left: 0; right: 0; bottom: 3.125rem;
  margin: 0; padding: 0; z-index: 10012;
  pointer-events: none;
}
.acf-form-scope .survey-prev-btn,
.acf-form-scope .survey-next-btn {
  padding: var(--iwaf-space-4) var(--iwaf-space-7);
  background: var(--iwaf-color-primary); color: #fff; border: none;
  font-weight: 600; cursor: pointer; font-size: var(--iwaf-fs-md);
  border-radius: var(--iwaf-radius-sm); transition: all .3s ease;
  margin: 0 var(--iwaf-space-3); pointer-events: auto;
}
.acf-form-scope .survey-next-btn { min-width: calc(6.25rem * 1.5); }
.acf-form-scope .survey-prev-btn { display: none; }
.acf-form-scope.iwaf-debug .survey-prev-btn { display: inline-block; }

.acf-form-scope .survey-submit-proxy {
  padding: var(--iwaf-space-4) var(--iwaf-space-7);
  background: var(--iwaf-color-primary); color: #fff; border: none;
  font-weight: 600; cursor: pointer; font-size: var(--iwaf-fs-md);
  border-radius: var(--iwaf-radius-sm); transition: all .3s ease;
  margin: 0 var(--iwaf-space-3); pointer-events: auto;
}
.acf-form-scope .survey-submit-proxy:hover { background: #0a3a3f; transform: translateY(-.0625rem); }
.acf-form-scope .survey-submit-proxy:disabled { background: #ccc; color: #999; cursor: not-allowed; transform: none; }

.acf-form-scope .survey-prev-btn:hover,
.acf-form-scope .survey-next-btn:hover { background: #0a3a3f; transform: translateY(-.0625rem); }
.acf-form-scope .survey-next-btn:disabled,
.acf-form-scope .survey-next-btn.disabled { background: #ccc; color: #999; cursor: not-allowed; transform: none; }

/* Submit */
.acf-form-scope .acf-form-submit { pointer-events: none; }
.acf-form-scope .acf-form-submit input[type="submit"] {
  pointer-events: auto;
  background: var(--iwaf-color-primary); color: #fff;
  padding: 1rem 2rem; border: none; font-size: var(--iwaf-fs-lg);
  font-weight: 600; cursor: pointer; border-radius: var(--iwaf-radius-sm);
  transition: all .3s ease;
}
.acf-form-scope .acf-form-submit input[type="submit"]:hover { background: #0a3a3f; transform: translateY(-.0625rem); }
.acf-form-scope .acf-form-submit input[type="submit"][disabled] { background: #ccc !important; color: #999 !important; cursor: not-allowed !important; }

/* Универсальное скрытие элементов — ТОЛЬКО ВНУТРИ СКОПА */
.acf-form-scope header,
.acf-form-scope footer,
.acf-form-scope .site-header,
.acf-form-scope .site-footer,
.acf-form-scope #wpadminbar,
.acf-form-scope .header,
.acf-form-scope .footer,
.acf-form-scope .main-header,
.acf-form-scope .main-footer,
.acf-form-scope .navbar,
.acf-form-scope .nav,
.acf-form-scope .menu,
.acf-form-scope .navigation,
.acf-form-scope .site-branding,
.acf-form-scope .site-title,
.acf-form-scope .site-description,
.acf-form-scope .entry-footer,
.acf-form-scope .entry-header,
.acf-form-scope .post-footer,
.acf-form-scope .post-header,
.acf-form-scope .page-header,
.acf-form-scope .page-footer,
.acf-form-scope .content-header,
.acf-form-scope .content-footer,
.acf-form-scope .site-info,
.acf-form-scope .powered-by,
.acf-form-scope [class*="powered"],
.acf-form-scope .main-navigation,
.acf-form-scope .widget-area,
.acf-form-scope .sidebar { display: none !important; }
