.cuestionario-page {
  min-height: 100vh;
  background: var(--bg-main);
  padding-bottom: 4rem;
}

/* Progress */
.progress-bar-area {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: var(--nav-height);
  z-index: 90;
}

.progress-steps {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.progress-step {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.progress-step__dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  transition: background 300ms, border-color 300ms, color 300ms;
}
.progress-step.done .progress-step__dot  { background: var(--orange); border-color: var(--orange); color: #fff; }
.progress-step.active .progress-step__dot { background: var(--orange); border-color: var(--orange); color: #fff; }
.progress-step.active { color: var(--text-primary); }

.progress-connector {
  flex: 1;
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  transition: background 300ms;
}
.progress-connector.done { background: var(--orange); }

.progress-bar-track {
  height: 5px;
  background: var(--border);
  border-radius: 100px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--orange);
  border-radius: 100px;
  transition: width 400ms ease;
}

/* Wrap */
.cuestionario-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 0;
}

/* Steps */
.cuestionario-step {
  display: none;
}
.cuestionario-step.active {
  display: block;
  animation: stepIn 380ms ease forwards;
}

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

.step-header { margin-bottom: 2rem; }
.step-header h2 { color: var(--text-primary); margin-bottom: 0.5rem; }
.step-header p  { color: var(--text-body); font-size: 16px; }

/* Form */
.form-group { margin-bottom: 1.5rem; }

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}
.form-label .req { color: var(--orange); }

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 16px;
  color: var(--text-primary);
  background: var(--bg-secondary);
  transition: border-color 200ms, box-shadow 200ms;
  outline: none;
}
.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); }
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255,107,0,0.14);
}
.form-input.field-error,
.form-select.field-error,
.form-textarea.field-error { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,0.12); }

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

/* Char counter */
.textarea-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.4rem;
}
.char-count { font-size: 12px; color: var(--text-muted); }

.quality-bar-track { height: 4px; background: var(--border); border-radius: 100px; overflow: hidden; margin-top: 0.4rem; }
.quality-bar-fill  { height: 100%; border-radius: 100px; width: 0%; transition: width 200ms, background 200ms; }
.quality-label     { font-size: 12px; color: #16a34a; font-weight: 600; margin-top: 0.3rem; display: none; }
.quality-label.show{ display: block; }

/* AI button */
.btn-ai {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 8px 14px;
  background: var(--blue-tint);
  border: 1px solid var(--blue-soft);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  cursor: pointer;
  transition: background 150ms;
  margin-top: 0.5rem;
  font-family: inherit;
}
.btn-ai:hover { background: var(--blue-soft); }
.btn-ai:disabled { opacity: 0.6; cursor: not-allowed; }

/* Conditional */
.conditional-field        { display: none; }
.conditional-field.visible{ display: block; animation: stepIn 250ms ease forwards; }

/* Tone radio grid */
.tone-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.tone-option input[type="radio"] { display: none; }
.tone-option__label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-secondary);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 200ms, background 200ms, color 200ms;
}
.tone-option__label .emo { font-size: 22px; }
.tone-option input:checked + .tone-option__label {
  border-color: var(--orange);
  background: rgba(255,107,0,0.06);
  color: var(--orange-dark);
}

/* Phone row */
.phone-row { display: flex; gap: 0.75rem; }
.phone-row .form-select { max-width: 130px; flex-shrink: 0; }
.phone-row .form-input  { flex: 1; }

/* Step nav */
.step-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.step-nav-right { display: flex; align-items: center; gap: 1rem; }
.step-indicator { font-size: 13px; color: var(--text-muted); }


/* ===== TEST CHAT ===== */
.test-chat-wrap {
  display: none;
  max-width: 640px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
}
.test-chat-wrap.active { display: block; animation: stepIn 380ms ease forwards; }

.test-chat-header { text-align: center; margin-bottom: 2rem; }
.test-chat-header h2 { color: var(--text-primary); margin-bottom: 0.5rem; }
.test-chat-header p  { color: var(--text-body); }

.chat-window {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(44,18,0,0.1);
}

.chat-header {
  background: var(--orange);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.chat-header__avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,232,208,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.chat-header__info { flex: 1; min-width: 0; }
.chat-header__name   { font-weight: 700; color: var(--bg-main); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-header__status { font-size: 12px; color: rgba(255,232,208,0.75); }
.chat-header__counter {
  font-size: 12px; font-weight: 600; color: var(--bg-main);
  background: rgba(0,0,0,0.2); padding: 3px 10px; border-radius: 100px; flex-shrink: 0;
}

.chat-messages {
  padding: 1.25rem;
  min-height: 280px;
  max-height: 380px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #e5ddd5;
}

.chat-bubble {
  max-width: 80%;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.chat-bubble--received {
  background: #fff;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  color: #1c1c1c;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.chat-bubble--sent {
  background: var(--bg-main);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

/* Typing */
.typing-dots { display: flex; gap: 4px; padding: 4px 0; }
.typing-dots span {
  width: 8px; height: 8px; border-radius: 50%; background: #999;
  animation: typingAnim 1.1s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingAnim {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.85); }
  30%           { opacity: 1; transform: scale(1); }
}

.chat-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}
.chat-input {
  flex: 1;
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background: var(--bg-main);
  color: var(--text-primary);
  transition: border-color 200ms;
}
.chat-input:focus { border-color: var(--orange); }
.chat-input:disabled { opacity: 0.5; cursor: not-allowed; }

.chat-send {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--orange); border: none; color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0; transition: background 150ms;
}
.chat-send:hover    { background: var(--orange-hover); }
.chat-send:disabled { background: var(--text-muted); cursor: not-allowed; }

.test-chat-cta {
  text-align: center;
  margin-top: 2rem;
}
.test-chat-cta .btn { width: 100%; justify-content: center; font-size: 17px; padding: 16px; }

.test-chat-edit {
  display: block;
  text-align: center;
  margin-top: 1rem;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 150ms;
}
.test-chat-edit:hover { color: var(--orange); }

@media (max-width: 480px) {
  .tone-grid { grid-template-columns: 1fr; }
  .phone-row { flex-direction: column; }
  .phone-row .form-select { max-width: 100%; }
}
