/* Household Financing Behaviors Survey — custom styles (beyond Bootstrap 4) */

:root {
  --ink: #1c2a24;
  --ink-soft: #3d4f46;
  --paper: #f3efe6;
  --paper-deep: #e7e0d2;
  --panel: #fffcf7;
  --accent: #0f6b5c;
  --accent-dark: #0a4f44;
  --accent-soft: #d7ebe5;
  --border: #c9bda8;
  --danger: #9b3b2e;
  --shadow: 0 10px 28px rgba(28, 42, 36, 0.08);
  --radius: 10px;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Source Sans 3", "Noto Sans Khmer", sans-serif;
  --font-kh: "Noto Sans Khmer", "Source Sans 3", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
  background:
    radial-gradient(ellipse at top left, rgba(15, 107, 92, 0.08), transparent 42%),
    linear-gradient(180deg, #ebe4d6 0%, var(--paper) 35%, #efe9dc 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(28, 42, 36, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28, 42, 36, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  z-index: -1;
}

/* ---- Language display (single-language UI; both stay in markup) ---- */
body.lang-en .lang-kh,
body.lang-en .q-kh,
body.lang-en .opt-kh,
body.lang-en .intro-kh,
body.lang-en .privacy-kh,
body.lang-en .success-kh,
body.lang-en .th-kh,
body.lang-en .brand-title-kh {
  display: none !important;
}

body.lang-kh .lang-en,
body.lang-kh .q-en,
body.lang-kh .opt-en,
body.lang-kh .intro-en,
body.lang-kh .privacy-en,
body.lang-kh .success-en {
  display: none !important;
}

body.lang-kh {
  font-family: var(--font-kh);
}

body.lang-kh .brand-title,
body.lang-kh .section-title {
  font-family: var(--font-kh);
}

.header-top {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}

.lang-switcher {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.6rem;
  padding: 0.35rem 0.5rem;
  background: rgba(255, 252, 247, 0.85);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.lang-switcher-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-right: 0.15rem;
}

.lang-switcher-form {
  display: inline-flex;
  gap: 0.25rem;
}

.lang-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink-soft);
  font-weight: 600;
  min-width: 4.5rem;
}

.lang-btn.is-active,
.lang-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.lang-btn:focus {
  box-shadow: 0 0 0 0.15rem rgba(15, 107, 92, 0.28);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  z-index: 1000;
}

.skip-link:focus {
  left: 0.75rem;
  top: 0.75rem;
}

.survey-header {
  padding: 2.25rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(135deg, rgba(15, 107, 92, 0.12), transparent 55%),
    linear-gradient(180deg, rgba(255, 252, 247, 0.9), rgba(243, 239, 230, 0.55));
}

.brand-block {
  max-width: 46rem;
  animation: rise-in 0.55s ease both;
}

.brand-eyebrow {
  margin: 0 0 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-dark);
}

.brand-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.85rem, 4vw, 2.75rem);
  line-height: 1.15;
  color: var(--ink);
}

.brand-title-kh {
  margin: 0.35rem 0 0.65rem;
  font-family: var(--font-kh);
  font-size: 1.05rem;
  color: var(--ink-soft);
}

.brand-sub {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.survey-main {
  padding: 1.75rem 0 3.5rem;
}

.survey-form {
  max-width: 920px;
  margin: 0 auto;
}

.progress-wrap {
  margin-bottom: 1.25rem;
  animation: rise-in 0.55s ease 0.08s both;
}

.progress {
  height: 0.55rem;
  background: var(--paper-deep);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  background: linear-gradient(90deg, var(--accent), #1f8f7a);
  transition: width 0.35s ease;
}

.progress-label {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.survey-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.25rem 1.1rem;
  margin-bottom: 1.25rem;
  animation: rise-in 0.55s ease both;
}

.survey-section:nth-of-type(2) { animation-delay: 0.05s; }
.survey-section:nth-of-type(3) { animation-delay: 0.1s; }
.survey-section:nth-of-type(4) { animation-delay: 0.15s; }

.section-title {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.55rem;
  color: var(--accent-dark);
}

.section-lead {
  margin: 0 0 1rem;
  color: var(--ink-soft);
  font-family: var(--font-kh);
  font-size: 0.95rem;
}

.intro-card {
  background: linear-gradient(180deg, #f8f5ee, #f1ebe0);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
}

.intro-en,
.privacy-en {
  margin-bottom: 0.55rem;
}

.intro-kh,
.privacy-kh,
.success-kh {
  font-family: var(--font-kh);
  color: var(--ink-soft);
}

.intro-rule {
  border-top: 1px solid var(--border);
  margin: 0.9rem 0;
}

.question-block {
  padding: 1rem 0;
  border-top: 1px solid rgba(201, 189, 168, 0.55);
}

.question-block:first-of-type {
  border-top: 0;
  padding-top: 0.25rem;
}

.question-label {
  display: block;
  margin-bottom: 0.75rem;
}

.q-en {
  display: block;
  font-weight: 600;
  color: var(--ink);
}

.q-kh {
  display: block;
  margin-top: 0.25rem;
  font-family: var(--font-kh);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink-soft);
}

.hint-text {
  font-size: 0.88rem;
  color: var(--ink-soft);
  margin: -0.25rem 0 0.75rem;
}

.option-group {
  margin: 0;
  padding: 0;
  border: 0;
}

.option-item {
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.4rem;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(243, 239, 230, 0.45);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.option-item:hover,
.option-item:focus-within {
  background: var(--accent-soft);
  border-color: rgba(15, 107, 92, 0.28);
}

.custom-control-label {
  width: 100%;
  cursor: pointer;
  padding-left: 0.25rem;
}

.opt-num {
  font-weight: 700;
  color: var(--accent-dark);
  margin-right: 0.2rem;
}

.opt-en {
  display: inline;
}

.opt-kh {
  display: block;
  margin-top: 0.15rem;
  font-family: var(--font-kh);
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.number-row .form-control {
  width: 7rem;
  border-color: var(--border);
  background: #fff;
}

.number-suffix {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.choice-table-wrap {
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
}

.choice-table {
  margin: 0;
  font-size: 0.92rem;
}

.choice-table thead th {
  background: var(--accent-soft);
  border-color: var(--border);
  vertical-align: middle;
  font-weight: 600;
  color: var(--accent-dark);
}

.choice-table td,
.choice-table th {
  vertical-align: middle;
  border-color: var(--border);
}

.th-kh {
  display: block;
  font-family: var(--font-kh);
  font-weight: 500;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.ab-toggle .btn {
  min-width: 3.25rem;
  border-color: var(--accent);
  color: var(--accent-dark);
}

.ab-toggle .btn.active,
.ab-toggle .btn:active,
.ab-toggle .btn:focus {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: none;
}

.btn-outline-primary {
  color: var(--accent-dark);
  border-color: var(--accent);
}

.btn-outline-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.payment-table .custom-control {
  padding-left: 1.4rem;
}

.submit-bar {
  text-align: center;
  padding: 1.5rem 1rem 0.5rem;
}

.submit-note {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.btn-submit {
  background: linear-gradient(180deg, #148172, var(--accent-dark));
  border: 0;
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.7rem 1.8rem;
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(15, 107, 92, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-submit:hover,
.btn-submit:focus {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15, 107, 92, 0.34);
}

.survey-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 2rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  background: rgba(255, 252, 247, 0.65);
}

.footer-meta {
  margin-bottom: 0;
  opacity: 0.85;
}

.success-panel {
  max-width: 640px;
  margin: 1rem auto 2rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 1.5rem;
  text-align: center;
  animation: rise-in 0.5s ease both;
}

.response-ref {
  margin: 1rem 0 1.5rem;
  color: var(--ink-soft);
}

.invalid-feedback {
  color: var(--danger);
}

.option-group.is-invalid,
.form-control.is-invalid {
  outline: 1px solid rgba(155, 59, 46, 0.35);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Wizard navigation */
.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0 0.5rem;
  max-width: 920px;
}

.btn-nav {
  min-width: 9rem;
  padding: 0.65rem 1.1rem;
  font-weight: 600;
}

.brand-id {
  margin: 0.45rem 0 0;
  font-size: 0.95rem;
  color: var(--accent-dark);
  font-weight: 500;
}

.brand-id strong {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.wizard-step .section-title {
  font-size: 1.35rem;
}

.wizard-form .form-control-lg {
  max-width: 28rem;
  border-color: var(--border);
}

.wizard-form select.custom-select {
  max-width: 36rem;
  border-color: var(--border);
  background-color: #fff;
  height: calc(1.5em + 1rem + 2px);
}

@media (max-width: 767.98px) {
  .header-top {
    justify-content: stretch;
  }

  .lang-switcher {
    width: 100%;
    justify-content: space-between;
  }

  .lang-btn {
    flex: 1;
  }

  .wizard-nav {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .btn-nav {
    width: 100%;
  }

  .survey-header {
    padding: 1.5rem 0 1.1rem;
  }

  .survey-section {
    padding: 1.1rem 0.9rem 0.85rem;
  }

  .choice-table {
    font-size: 0.82rem;
  }

  .ab-toggle .btn {
    min-width: 2.6rem;
    padding: 0.25rem 0.45rem;
  }

  .opt-en {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
