/* ============================================================
   Survey Candidates – Public Form Styles
   Mobile-first · Accessible · No external dependencies
   ============================================================ */

/* ── Custom Properties ─────────────────────────────────────── */
:root {
  --survey-primary:      #1F2D4D;
  --survey-primary-dk:   #141e35;
  --survey-accent:       #c0392b;
  --survey-success:      #27ae60;
  --survey-warning:      #e67e22;
  --survey-border:       #30363d;
  --survey-bg:           #FFFFFF;
  --survey-card-bg:      #FDF3E1;
  --survey-text:         #1F2D4D;
  --survey-text-muted:   #6A7A96;
  --survey-radius:       8px;
  --survey-radius-sm:    4px;
  --survey-shadow:       0 1px 4px rgba(31, 45, 77, .10);
  --survey-shadow-focus: 0 0 0 3px rgba(31, 45, 77, .22);
  --survey-font:         -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --survey-transition:   0.18s ease;
}

/* ── Wrapper ────────────────────────────────────────────────── */
.survey-wrap {
  font-family: var(--survey-font);
  color: var(--survey-text);
  max-width: 860px;
  margin: 0 auto;
  padding: 0 16px 48px;
  box-sizing: border-box;
}

/* ── Alert ──────────────────────────────────────────────────── */
.survey-alert {
  border-radius: var(--survey-radius);
  padding: 14px 18px;
  margin-bottom: 24px;
  font-size: .95rem;
  border-left: 4px solid transparent;
}
.survey-alert--error {
  background: #fdf3f2;
  border-color: var(--survey-accent);
  color: #7b2018;
}
.survey-alert ul {
  margin: 6px 0 0 18px;
  padding: 0;
}
.survey-alert li { margin-bottom: 4px; }

/* ── Section / Card ─────────────────────────────────────────── */
.survey-section {
  background: var(--survey-bg);
  border: 1px solid var(--survey-border);
  border-radius: var(--survey-radius);
  box-shadow: var(--survey-shadow);
  padding: 24px 28px;
  margin-bottom: 24px;
}

.survey-section__title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--survey-primary);
  line-height: 1.3;
}
.survey-section__desc {
  font-size: .88rem;
  color: var(--survey-text-muted);
  margin: 0 0 20px;
}

/* Criterion section header */
.survey-section--criterion .survey-section__title {
  border-bottom: 2px solid var(--survey-primary);
  padding-bottom: 10px;
  margin-bottom: 20px;
}

/* ── Form Fields ────────────────────────────────────────────── */
.survey-field {
  margin-bottom: 20px;
}
.survey-field:last-child { margin-bottom: 0; }

.survey-label {
  display: block;
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: 6px;
  color: var(--survey-text);
}
.survey-label--required::after,
.survey-legend--required::after {
  content: " *";
  color: var(--survey-accent);
  font-weight: 700;
  aria-hidden: true;
}

.survey-input,
.survey-select {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1.5px solid var(--survey-border);
  border-radius: var(--survey-radius-sm);
  font-size: .95rem;
  font-family: inherit;
  color: var(--survey-text);
  background: #fff;
  transition: border-color var(--survey-transition), box-shadow var(--survey-transition);
  -webkit-appearance: none;
  appearance: none;
}
.survey-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2357606a' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
.survey-input:focus,
.survey-select:focus {
  outline: none;
  border-color: var(--survey-primary);
  box-shadow: var(--survey-shadow-focus);
}
.survey-input::placeholder { color: #a0aab4; }

/* ── Fieldset / Legend ──────────────────────────────────────── */
.survey-fieldset {
  border: none;
  padding: 0;
  margin: 0 0 24px;
}
.survey-fieldset:last-child { margin-bottom: 0; }

.survey-legend {
  display: block;
  font-weight: 600;
  font-size: .9rem;
  color: var(--survey-text);
  margin-bottom: 10px;
  padding: 0;
}

/* ── Radio Group ────────────────────────────────────────────── */
.survey-radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.survey-radio-group--vertical {
  flex-direction: column;
  gap: 8px;
}

.survey-radio-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid var(--survey-border);
  border-radius: var(--survey-radius-sm);
  cursor: pointer;
  background: #fff;
  transition: border-color var(--survey-transition), background var(--survey-transition);
  font-size: .9rem;
  line-height: 1.4;
}
.survey-radio-label:hover {
  border-color: var(--survey-primary);
  background: var(--survey-bg);
}
.survey-radio-label input[type="radio"] {
  margin: 0;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--survey-primary);
  cursor: pointer;
}
.survey-radio-label:has(input:checked) {
  border-color: #04946C;
  background: #04946C;
  color: #fff;
}
.survey-radio-label input:focus-visible {
  outline: 3px solid var(--survey-primary);
  outline-offset: 2px;
}
.survey-radio-text {
  flex: 1;
}

/* ── Question ───────────────────────────────────────────────── */
.survey-question {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--survey-border);
}
.survey-question:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.survey-question__text {
  display: block;
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--survey-card-bg);
  border-radius: var(--survey-radius-sm);
  color: var(--survey-text);
}
.survey-question__num {
  display: inline-block;
  background: var(--survey-primary);
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: .78rem;
  font-weight: 700;
  text-align: center;
  line-height: 24px;
  margin-right: 8px;
  flex-shrink: 0;
}
.survey-question__note {
  font-size: .82rem;
  color: var(--survey-text-muted);
  font-style: italic;
  margin: -8px 0 10px;
}

/* ── Submit Area ────────────────────────────────────────────── */
.survey-submit-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
}
.survey-submit-notice {
  font-size: .85rem;
  color: var(--survey-text-muted);
  margin: 0;
}
.survey-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 36px;
  border: none;
  border-radius: var(--survey-radius);
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--survey-transition), transform .1s ease;
  text-decoration: none;
}
.survey-btn--primary {
  background: var(--survey-primary);
  color: #fff;
  min-width: 220px;
}
.survey-btn--primary:hover {
  background: var(--survey-primary-dk);
}
.survey-btn--primary:active {
  transform: translateY(1px);
}
.survey-btn--primary:focus-visible {
  outline: 3px solid var(--survey-primary);
  outline-offset: 3px;
}
.survey-btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* ── Progress bar (injected by JS) ─────────────────────────── */
.survey-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--survey-border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 28px;
}
.survey-progress-bar__fill {
  height: 100%;
  background: var(--survey-primary);
  border-radius: 99px;
  transition: width .3s ease;
}

/* ── Validation feedback (JS-enhanced) ──────────────────────── */
.survey-question.has-error .survey-question__text,
.survey-fieldset.has-error .survey-legend {
  color: var(--survey-accent);
}
.survey-question.has-error .survey-radio-group::before,
.survey-fieldset.has-error .survey-radio-group::before {
  content: "Моля, изберете отговор.";
  display: block;
  color: var(--survey-accent);
  font-size: .85rem;
  margin-bottom: 6px;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (min-width: 640px) {
  .survey-wrap { padding: 0 24px 60px; }
  .survey-section { padding: 28px 36px; }
  .survey-submit-wrap { flex-direction: row; justify-content: center; }
}

@media (max-width: 480px) {
  .survey-section { padding: 18px 16px; }
  .survey-radio-label { padding: 10px 12px; }
  .survey-btn--primary { width: 100%; }
}

/* ── Thank You message ──────────────────────────────────────── */
.survey-thankyou {
  background: #f0faf4;
  border: 2px solid var(--survey-success);
  border-radius: var(--survey-radius);
  padding: 32px 36px;
  color: var(--survey-text);
  line-height: 1.7;
}

.survey-thankyou p {
  margin: 0 0 1.1em;
}

.survey-thankyou p:last-child {
  margin-bottom: 0;
}

/* ── High contrast / accessibility ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
