/* ===========================
   CompraSinSorpresas – styles.css
   Aesthetic: Editorial / Refined Minimal
   Palette: Deep navy + warm sand + terracotta accent
=========================== */

:root {
  --navy: #1a2340;
  --navy-light: #253056;
  --sand: #f5f0e8;
  --sand-dark: #e8e0d0;
  --terracotta: #c0603a;
  --terracotta-light: #d97e5a;
  --white: #ffffff;
  --text-main: #1a2340;
  --text-muted: #6b7280;
  --border: #d6cfc3;
  --success: #2d7a4f;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(26, 35, 64, 0.10);
  --shadow-lg: 0 8px 40px rgba(26, 35, 64, 0.16);
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--sand);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 16px;
  line-height: 1.6;
}

/* ===========================
   HEADER
=========================== */

.header {
  background: var(--navy);
  color: var(--white);
  padding: 0;
  position: relative;
  overflow: hidden;
}

.header-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 48px 24px 36px;
  position: relative;
  z-index: 1;
}

.header-decoration {
  position: absolute;
  right: -80px;
  top: -60px;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(192, 96, 58, 0.18) 0%, transparent 70%);
  pointer-events: none;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.logo-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.logo-text {
  font-family: var(--font-body);
  font-size: 1.25rem;
  font-weight: 300;
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.85);
}

.logo-text strong {
  font-weight: 600;
  color: var(--white);
}

.tagline {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 400;
  line-height: 1.3;
  color: var(--sand);
  max-width: 540px;
}

/* ===========================
   MAIN & CONTAINER
=========================== */

.main {
  flex: 1;
  padding: 40px 16px 32px;
}

.container {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ===========================
   CARDS
=========================== */

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 36px;
  border: 1px solid var(--border);
}

@media (max-width: 520px) {
  .card {
    padding: 24px 20px;
  }
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 28px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--sand-dark);
}

/* ===========================
   FORM FIELDS
=========================== */

.field-group {
  margin-bottom: 24px;
}

.field-group:last-of-type {
  margin-bottom: 0;
}

.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.input-wrapper {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input-wrapper:focus-within {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26, 35, 64, 0.08);
}

.input-prefix {
  background: var(--sand);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0 14px;
  display: flex;
  align-items: center;
  border-right: 1.5px solid var(--border);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.input {
  width: 100%;
  padding: 13px 16px;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-main);
  background: transparent;
}

.input::placeholder {
  color: #b5b0a8;
}

/* Remove number spinners — prefijos webkit sin alternativa estándar (advertencia esperada en validadores W3C) */
.input::-webkit-outer-spin-button,
.input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}
.input[type=number] { -moz-appearance: textfield; appearance: textfield; }

.select {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--text-main);
  background: var(--white);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
  transition: border-color var(--transition);
}

.select:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26, 35, 64, 0.08);
}

/* ===========================
   TOGGLE BUTTONS
=========================== */

.toggle-group {
  display: flex;
  gap: 8px;
}

.toggle-btn {
  flex: 1;
  padding: 10px 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.toggle-btn:hover {
  border-color: var(--navy-light);
  color: var(--navy);
}

.toggle-btn.active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}

/* ===========================
   RADIO GROUP
=========================== */

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.radio-option:hover {
  border-color: var(--navy-light);
  background: var(--sand);
}

.radio-option input[type="radio"] {
  accent-color: var(--navy);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  cursor: pointer;
}

/* :has() soportado en Chrome 105+, Firefox 121+, Safari 15.4+.
   La clase .radio-option--selected sirve como fallback aplicada vía JS
   en navegadores que no soporten :has(). */
.radio-option:has(input:checked),
.radio-option--selected {
  border-color: var(--navy);
  background: rgba(26, 35, 64, 0.04);
}

.radio-label {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-main);
}

/* ===========================
   SUB-FIELDS (banco)
=========================== */

.sub-fields {
  margin-top: -16px;
  margin-bottom: 24px;
  padding: 20px;
  background: var(--sand);
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 0;
  animation: fadeSlideIn 0.25s ease;
}

.sub-fields .field-group {
  margin-bottom: 18px;
}

.sub-fields .field-group:last-child {
  margin-bottom: 0;
}

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

/* ===========================
   CALCULATE BUTTON
=========================== */

.btn-calcular {
  display: block;
  width: 100%;
  margin-top: 32px;
  padding: 16px 24px;
  background: var(--terracotta);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 14px rgba(192, 96, 58, 0.28);
}

.btn-calcular:hover {
  background: var(--terracotta-light);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(192, 96, 58, 0.36);
}

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

/* ===========================
   RESULTS CARD
=========================== */

.results-card {
  animation: fadeSlideIn 0.35s ease;
}

.results-title {
  color: var(--navy);
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 24px;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--sand-dark);
  gap: 16px;
}

.result-item:last-child {
  border-bottom: none;
}

.result-label {
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.4;
}

.result-note {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.result-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy);
  white-space: nowrap;
  text-align: right;
}

.result-value.na {
  color: var(--text-muted);
  font-weight: 400;
  font-style: italic;
}

/* ===========================
   TOTALS
=========================== */

.total-box {
  background: var(--sand);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border: 1.5px solid var(--sand-dark);
}

.total-box--final {
  background: var(--navy);
  border-color: var(--navy);
  margin-bottom: 24px;
}

.total-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.total-box--final .total-label {
  color: rgba(245, 240, 232, 0.75);
}

.total-amount {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--navy);
}

.total-amount--final {
  color: var(--sand);
  font-size: 1.5rem;
}

.nota-banco {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--sand);
  border-left: 3px solid var(--terracotta);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 10px 14px;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* ===========================
   SUMMARY GRID (dinero propio)
=========================== */

.summary-grid {
  border: 1.5px solid var(--sand-dark);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 20px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 18px;
  border-bottom: 1px solid var(--sand-dark);
  gap: 16px;
}

.summary-row:last-child {
  border-bottom: none;
}

.summary-row--highlight {
  background: rgba(192, 96, 58, 0.06);
}

.summary-row--total {
  background: var(--navy);
}

.summary-row--total .summary-label {
  color: rgba(245, 240, 232, 0.8);
  font-weight: 500;
}

.summary-row--total .summary-value {
  color: var(--sand);
  font-size: 1.1rem;
}

.summary-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.summary-value {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
  text-align: right;
}

/* ===========================
   EXTRA PCT & NOTA ITP
=========================== */

.extra-pct-line {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--terracotta);
  margin: -8px 0 20px;
  letter-spacing: 0.01em;
}

.nota-itp {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(26, 35, 64, 0.04);
  border-left: 3px solid var(--navy);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 16px;
  margin-bottom: 24px;
}

.nota-icon {
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.nota-itp p {
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.nota-itp strong {
  color: var(--navy);
  font-weight: 600;
}

.nota-itp em {
  color: var(--terracotta);
  font-style: normal;
  font-weight: 500;
}

/* ===========================
   RESET BUTTON
=========================== */

.btn-reset {
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-reset:hover {
  border-color: var(--navy);
  color: var(--navy);
  background: var(--sand);
}

/* ===========================
   FOOTER
=========================== */

.footer {
  background: var(--navy-light);
  color: rgba(245, 240, 232, 0.7);
  padding: 28px 24px 20px;
  margin-top: auto;
}

.aviso-legal {
  max-width: 680px;
  margin: 0 auto 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  border: 1px solid rgba(255,255,255,0.08);
}

.aviso-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.aviso-legal p {
  font-size: 0.8rem;
  line-height: 1.6;
  color: rgba(245, 240, 232, 0.65);
}

.aviso-legal strong {
  color: rgba(245, 240, 232, 0.9);
  font-weight: 600;
}

.aviso-legal em {
  color: var(--terracotta-light);
  font-style: normal;
  font-weight: 500;
}

.footer-copy {
  text-align: center;
  font-size: 0.75rem;
  color: rgba(245, 240, 232, 0.35);
  max-width: 680px;
  margin: 0 auto;
}

/* ===========================
   RESPONSIVE
=========================== */

@media (max-width: 480px) {
  .header-inner {
    padding: 32px 20px 28px;
  }

  .total-box {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .total-amount {
    font-size: 1.2rem;
  }

  .total-amount--final {
    font-size: 1.35rem;
  }

  .result-item {
    flex-direction: column;
    gap: 4px;
  }

  .result-value {
    text-align: left;
  }
}

/* ===========================
   AHORRO NECESARIO
=========================== */

.ahorro-bloque {
  margin-bottom: 20px;
}

.ahorro-pct-line {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
  background: rgba(26, 35, 64, 0.05);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 10px;
  line-height: 1.5;
}

.ahorro-edu {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0 4px;
  line-height: 1.5;
}

/* ===========================
   COMPARADOR ALQUILER
=========================== */

.comparador-bloque {
  border-top: 2px solid var(--sand-dark);
  padding-top: 24px;
  margin-bottom: 24px;
}

.comparador-titulo {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 16px;
}

.comparador-input-row {
  margin-bottom: 14px;
}

.input-wrapper--inline {
  display: flex;
  align-items: stretch;
}

.btn-calcular-alquiler {
  padding: 0 18px;
  background: var(--navy);
  color: var(--white);
  border: none;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  transition: background var(--transition);
}

.btn-calcular-alquiler:hover {
  background: var(--navy-light);
}

.comparador-resultado {
  font-size: 0.875rem;
  color: var(--text-main);
  background: var(--sand);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  line-height: 1.6;
  margin-bottom: 20px;
}

/* ===========================
   LEADS BLOQUE
=========================== */

.leads-bloque {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  border-radius: var(--radius-sm);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.leads-texto {
  font-size: 0.85rem;
  color: rgba(245, 240, 232, 0.8);
  line-height: 1.5;
}

.btn-leads {
  padding: 10px 20px;
  background: var(--terracotta);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  box-shadow: 0 3px 10px rgba(192, 96, 58, 0.35);
}

.btn-leads:hover {
  background: var(--terracotta-light);
  transform: translateY(-1px);
}

.leads-aviso {
  font-size: 0.82rem;
  color: rgba(245, 240, 232, 0.75);
  font-style: italic;
}

/* ===========================
   PRÉSTAMO: AUTO vs MANUAL
=========================== */

.radio-sublabel {
  display: block;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}

.prestamo-estimado-bloque {
  background: var(--sand);
  border: 1.5px solid var(--sand-dark);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 4px;
}

.prestamo-estimado-valor {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 4px;
}

.prestamo-estimado-nota {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.input-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.4;
}