/* ── Questionnaire Layout — Step-by-step ──────────────────────────────────── */

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#form-screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.q-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.q-logo {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.logo-title {
  font-family: var(--display);
  font-size: 2rem;
  color: var(--green);
  letter-spacing: 0.04em;
  line-height: 1;
}

.logo-sub {
  font-size: 0.85rem;
  color: var(--text2);
  font-weight: 400;
}

/* ── Main content ────────────────────────────────────────────────────────── */

.q-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 24px 48px;
  overflow: hidden;
}

#questionnaire-form {
  width: 100%;
  max-width: 520px;
  position: relative;
  min-height: 320px;
}

/* ── Step cards ──────────────────────────────────────────────────────────── */

.q-step {
  display: none;
  flex-direction: column;
  gap: 16px;
  padding: 32px 28px;
  background: var(--bg2);
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--border);
  transition: border-color 0.15s ease;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  opacity: 0;
}

.q-step.active {
  display: flex;
  position: relative;
  opacity: 1;
  animation: fadeIn 0.35s ease both;
}

.q-step:focus-within {
  border-color: var(--green-border);
}

/* ── Step transitions ────────────────────────────────────────────────────── */

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

.q-step.enter-right {
  animation: slideInRight 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.q-step.enter-left {
  animation: slideInLeft 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

.q-step.exit-left {
  animation: slideOutLeft 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  position: absolute;
}

.q-step.exit-right {
  animation: slideOutRight 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
  position: absolute;
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(60px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-60px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideOutLeft {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-60px); }
}

@keyframes slideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(60px); }
}

/* ── Question elements ───────────────────────────────────────────────────── */

.q-question-number {
  font-size: 0.72rem;
  font-family: var(--mono);
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.8;
}

.q-question-text {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.q-step input[type="text"] {
  background: var(--bg3);
  border: 1.5px solid transparent;
  padding: 14px 16px;
  font-size: 1.05rem;
  border-radius: var(--radius);
  color: var(--text);
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}

.q-step input[type="text"]:focus {
  border-color: var(--green);
  background: var(--bg3);
}

.q-question-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.q-hint {
  font-size: 0.78rem;
  color: var(--text2);
  opacity: 0.65;
  font-style: italic;
}

.q-word-count {
  font-size: 0.75rem;
  font-family: var(--mono);
  color: var(--text2);
  transition: color 0.15s;
}

.q-word-count.over {
  color: var(--danger);
  font-weight: 600;
}

/* ── Step navigation ─────────────────────────────────────────────────────── */

.q-step-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.btn-back,
.btn-next {
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-back {
  background: transparent;
  color: var(--text2);
  padding: 10px 14px;
}

.btn-back:hover {
  color: var(--text);
  background: var(--bg3);
}

.btn-next {
  background: var(--green);
  color: var(--bg);
  margin-left: auto;
}

.btn-next:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-next:active {
  transform: translateY(0);
}

/* ── Progress bar ────────────────────────────────────────────────────────── */

.q-progress {
  flex: 1;
  height: 3px;
  background: var(--bg3);
  border-radius: 2px;
  overflow: hidden;
}

.q-progress-bar {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  transition: width 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ── Send button (last step) ─────────────────────────────────────────────── */

.btn-send {
  background: var(--green);
  color: var(--bg);
  font-size: 0.95rem;
  padding: 12px 24px;
}

.btn-send:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

/* ── Success screen ──────────────────────────────────────────────────────── */

#success-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.success-content {
  text-align: center;
  animation: success-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes success-in {
  from { opacity: 0; transform: scale(0.8) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.success-emoji {
  font-size: 5rem;
  margin-bottom: 20px;
  line-height: 1;
  filter: drop-shadow(0 0 20px rgba(57, 231, 95, 0.4));
}

.success-title {
  font-size: 3rem;
  color: var(--green);
  margin-bottom: 12px;
}

.success-sub {
  font-size: 1.1rem;
  color: var(--text2);
  line-height: 1.6;
}

/* ── Mobile tweaks ───────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .q-main {
    padding: 20px 16px 40px;
    align-items: flex-start;
    padding-top: 40px;
  }
  .logo-title {
    font-size: 1.6rem;
  }
  .q-step {
    padding: 24px 20px;
  }
  .q-question-text {
    font-size: 1.05rem;
  }
}
