/* =====================================================================
   BLUESTAY — Sistema de Diseño UI/UX
   Estilo Minimalista, Cálido, Sobrio y Mobile-First para Hospitalidad
   ===================================================================== */

:root {
  --color-primary: #0f233a;
  --color-primary-hover: #162e4c;
  --color-primary-light: #1e3a5f;
  
  --color-accent: #0284c7;
  --color-accent-hover: #0369a1;
  --color-accent-soft: #f0f9ff;
  --color-accent-border: #bae6fd;
  
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-surface-subtle: #f1f5f9;
  
  --color-text-main: #0f172a;
  --color-text-muted: #475569;
  --color-text-subtle: #94a3b8;
  
  --color-border: #e2e8f0;
  --color-border-hover: #cbd5e1;
  --color-border-focus: #0284c7;
  
  --color-danger: #e11d48;
  --color-danger-soft: #fff1f2;
  --color-danger-border: #fecdd3;
  
  --color-success: #059669;
  --color-success-soft: #ecfdf5;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
}

/* Reset y caja */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text-main);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Envoltura principal */
.app-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

@media (min-width: 640px) {
  .app-wrapper {
    padding: 28px 24px 60px;
  }
}

/* Cabecera de la Marca */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px 20px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 24px;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--color-primary);
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.brand-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #38bdf8;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-primary);
}

.brand-badge {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  background: var(--color-surface-subtle);
  color: var(--color-text-muted);
  border-radius: 20px;
  border: 1px solid var(--color-border);
}

/* Barra de Progreso Discreta */
.progress-container {
  margin-bottom: 24px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.8125rem;
  margin-bottom: 8px;
}

.progress-step-name {
  font-weight: 600;
  color: var(--color-text-main);
}

.progress-counter {
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.progress-bar-bg {
  width: 100%;
  height: 6px;
  background-color: var(--color-border);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), #38bdf8);
  width: 0%;
  border-radius: 4px;
  transition: width var(--transition-normal);
}

/* Contenedor de Tarjeta Principal */
.survey-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast);
}

@media (min-width: 640px) {
  .survey-card {
    padding: 36px 32px;
    box-shadow: var(--shadow-md);
  }
}

/* Pantalla de Bienvenida */
.welcome-hero {
  text-align: left;
}

.welcome-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background-color: var(--color-accent-soft);
  color: var(--color-accent);
  border: 1px solid var(--color-accent-border);
  border-radius: 30px;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.welcome-title {
  font-size: 1.625rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

@media (min-width: 640px) {
  .welcome-title {
    font-size: 1.875rem;
  }
}

.welcome-subtitle {
  font-size: 1.0625rem;
  color: var(--color-accent);
  font-weight: 600;
  margin-bottom: 20px;
}

.welcome-description {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  line-height: 1.65;
  margin-bottom: 24px;
}

.welcome-description p {
  margin-bottom: 12px;
}

/* 3 Datos Breves */
.facts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 24px 0;
  padding: 16px;
  background: var(--color-surface-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

@media (min-width: 520px) {
  .facts-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

.fact-item {
  display: flex;
  flex-direction: column;
}

.fact-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--color-text-subtle);
  margin-bottom: 4px;
}

.fact-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-main);
  line-height: 1.35;
}

/* Caja de Privacidad en Bienvenida */
.privacy-box {
  margin-top: 24px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: #ffffff;
}

.privacy-notice-text {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.privacy-link {
  color: var(--color-accent);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.privacy-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--color-text-main);
  line-height: 1.45;
  user-select: none;
}

.privacy-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--color-accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* Encabezados de Sección */
.section-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
}

.section-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-accent);
  margin-bottom: 4px;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: -0.015em;
}

@media (min-width: 640px) {
  .section-title {
    font-size: 1.375rem;
  }
}

/* Bloques de Preguntas */
.question-group {
  margin-bottom: 32px;
}

.question-group:last-child {
  margin-bottom: 8px;
}

.question-legend,
.question-label {
  display: block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-main);
  line-height: 1.4;
  margin-bottom: 12px;
}

.question-number {
  color: var(--color-accent);
  font-weight: 700;
  margin-right: 4px;
}

.question-hint {
  display: block;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--color-text-muted);
  margin-top: 4px;
  margin-bottom: 10px;
}

/* Campos de Texto e Inputs */
.input-field {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--color-text-main);
  background-color: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-field:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.input-field[aria-invalid="true"] {
  border-color: var(--color-danger);
  background-color: var(--color-danger-soft);
}

.input-field::placeholder {
  color: var(--color-text-subtle);
}

textarea.input-field {
  resize: vertical;
  min-height: 80px;
}

.field-subgroup {
  margin-bottom: 14px;
}

.field-subgroup:last-child {
  margin-bottom: 0;
}

.field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.optional-tag {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--color-text-subtle);
  margin-left: 4px;
}

/* Opciones de Selección (Radios y Checkboxes estilizados como tarjetas táctiles) */
.options-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background-color: #ffffff;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  min-height: 48px;
}

.option-card:hover {
  border-color: var(--color-border-hover);
  background-color: var(--color-surface-subtle);
}

.option-card:has(input:checked) {
  border-color: var(--color-accent);
  background-color: var(--color-accent-soft);
}

.option-card:has(input:focus-visible) {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Ocultar input nativo visualmente preservando accesibilidad */
.option-input {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border-hover);
  border-radius: 50%;
  margin-top: 3px;
  flex-shrink: 0;
  display: grid;
  place-content: center;
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
  background-color: #ffffff;
}

.option-input[type="checkbox"] {
  border-radius: var(--radius-sm);
}

.option-input::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transform: scale(0);
  transition: transform var(--transition-fast);
  background-color: #ffffff;
}

.option-input[type="checkbox"]::before {
  border-radius: 2px;
  width: 9px;
  height: 9px;
  background-color: #ffffff;
}

.option-input:checked {
  border-color: var(--color-accent);
  background-color: var(--color-accent);
}

.option-input:checked::before {
  transform: scale(1);
}

.option-text {
  font-size: 0.9375rem;
  color: var(--color-text-main);
  line-height: 1.4;
  margin-top: 2px;
  flex: 1;
}

.option-card:has(input:checked) .option-text {
  color: var(--color-primary);
  font-weight: 500;
}

/* Campos Condicionales Desplegables */
.conditional-field {
  margin-top: 12px;
  padding: 14px 16px;
  background-color: var(--color-surface-subtle);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  animation: fadeIn 200ms ease;
}

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

/* Mensajes de Error */
.field-error-msg {
  display: none;
  font-size: 0.8125rem;
  color: var(--color-danger);
  margin-top: 6px;
  font-weight: 500;
}

.has-error .field-error-msg {
  display: block;
}

.has-error .option-card {
  border-color: var(--color-danger-border);
}

.form-alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-alert-danger {
  background-color: var(--color-danger-soft);
  color: var(--color-danger);
  border: 1px solid var(--color-danger-border);
}

/* Botones de Navegación */
.survey-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-fast);
  min-height: 48px;
  touch-action: manipulation;
}

.btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-primary {
  background-color: var(--color-primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--color-primary-hover);
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--color-text-main);
  border-color: var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
  background-color: var(--color-surface-subtle);
  border-color: var(--color-border-hover);
}

.btn-accent {
  background-color: var(--color-accent);
  color: #ffffff;
}

.btn-accent:hover:not(:disabled) {
  background-color: var(--color-accent-hover);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-full {
  width: 100%;
}

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.8s linear infinite;
  display: none;
}

.is-loading .btn-spinner {
  display: inline-block;
}

.is-loading .btn-text {
  opacity: 0.8;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Pantalla de Confirmación */
.confirmation-screen {
  text-align: center;
  padding: 32px 16px;
}

@media (min-width: 640px) {
  .confirmation-screen {
    padding: 48px 24px;
  }
}

.confirmation-badge {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--color-success-soft);
  border: 2px solid #a7f3d0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-success);
  margin-bottom: 20px;
}

.confirmation-badge svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.confirmation-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 12px;
  letter-spacing: -0.015em;
}

.confirmation-text {
  font-size: 1rem;
  color: var(--color-text-muted);
  line-height: 1.6;
  max-width: 520px;
  margin: 0 auto 28px;
}

.confirmation-meta {
  font-size: 0.8125rem;
  color: var(--color-text-subtle);
  background: var(--color-surface-subtle);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-bottom: 24px;
}

/* Modal de Políticas de Privacidad */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-backdrop.is-active {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-lg);
  max-width: 620px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: transform var(--transition-normal);
}

.modal-backdrop.is-active .modal-dialog {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--color-border);
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
}

.modal-close:hover {
  color: var(--color-text-main);
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  line-height: 1.6;
}

.modal-body h4 {
  color: var(--color-primary);
  font-size: 0.9375rem;
  margin: 16px 0 6px;
}

.modal-body h4:first-child {
  margin-top: 0;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
  text-align: right;
  background-color: var(--color-surface-subtle);
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

/* Pie de página */
.site-footer {
  text-align: center;
  padding-top: 24px;
  font-size: 0.8125rem;
  color: var(--color-text-subtle);
}

.site-footer a {
  color: var(--color-accent);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

/* Ocultar campo honeypot */
.sr-only-hp {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
