/* css/presupuesto.css — formulario de presupuesto.
   Hereda estética de las fichas de modelo: cards visuales por color,
   tipografía mono para eyebrows/labels-utilitarios, generous whitespace.
*/

/* ============================================================
   PAGE LAYOUT
   ============================================================ */

main.presupuesto-page {
  background: var(--bg-primary);
  color: var(--fg-primary);
}

/* === HERO compacto === */

.presupuesto-hero {
  padding: clamp(56px, 9vw, 96px) 0 clamp(40px, 7vw, 64px);
  /* Sin fondo sólido (hereda transparente de main) para que los polígonos
     de .page-polygons sean visibles a través del hero. */
  background: transparent;
}

.presupuesto-hero-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--brand-magenta);
  margin-bottom: var(--space-4);
}

.presupuesto-hero-title {
  font-family: var(--font-display);
  font-size: clamp(40px, 5.5vw, 72px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-4);
  color: var(--fg-primary);
  max-width: 18ch;
}

.presupuesto-hero-subtitle {
  font-family: var(--font-sans);
  font-size: clamp(16px, 1.5vw, 19px);
  line-height: 1.55;
  color: var(--fg-muted);
  max-width: 60ch;
  margin: 0;
}

/* ============================================================
   LAYOUT 60/40
   ============================================================ */

.presupuesto-body {
  padding: clamp(40px, 6vw, 80px) 0 clamp(64px, 9vw, 120px);
}

.presupuesto-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(40px, 6vw, 64px);
}

@media (min-width: 1024px) {
  .presupuesto-grid {
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: clamp(48px, 5vw, 80px);
  }
}

/* ============================================================
   FORMULARIO (col izquierda)
   ============================================================ */

.presupuesto-form {
  display: flex;
  flex-direction: column;
  gap: clamp(40px, 5vw, 56px);
  /* Card opaca para que los polígonos flotantes de fondo NO atraviesen
     el formulario (legibilidad de inputs y labels). El aside derecho
     SÍ deja ver los polígonos. */
  background: var(--bg-primary);
  padding: clamp(24px, 3.5vw, 44px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 18px 48px -24px rgba(10, 10, 10, 0.10);
}

.presupuesto-fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.presupuesto-fieldset-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
}

.presupuesto-fieldset-title {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
  color: var(--fg-primary);
}

.presupuesto-fieldset-subtitle {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  margin: 0;
  color: var(--fg-muted);
}

/* === Campos === */

.presupuesto-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 600px) {
  .presupuesto-row.is-2col {
    grid-template-columns: 1fr 1fr;
  }
  .presupuesto-row.is-3col {
    grid-template-columns: repeat(3, 1fr);
  }
}

.presupuesto-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.presupuesto-label {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-primary);
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}

.presupuesto-label .req {
  color: var(--brand-magenta);
}

.presupuesto-help {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--fg-muted);
  margin-top: -2px;
  line-height: 1.45;
}

.presupuesto-input,
.presupuesto-select,
.presupuesto-textarea {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 16px;
  background: var(--bg-primary);
  color: var(--fg-primary);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast),
    background var(--transition-fast);
}

.presupuesto-input::placeholder,
.presupuesto-textarea::placeholder {
  color: var(--fg-subtle);
}

.presupuesto-input:hover,
.presupuesto-select:hover,
.presupuesto-textarea:hover {
  border-color: var(--fg-subtle);
}

.presupuesto-input:focus,
.presupuesto-select:focus,
.presupuesto-textarea:focus {
  outline: none;
  border-color: var(--brand-magenta);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-magenta) 18%, transparent);
}

.presupuesto-textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.55;
}

/* Estado de error */
.presupuesto-field.has-error .presupuesto-input,
.presupuesto-field.has-error .presupuesto-select,
.presupuesto-field.has-error .presupuesto-textarea {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 14%, transparent);
}

.presupuesto-field-error {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--danger);
  margin: 0;
  display: none;
}

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

/* ============================================================
   MODELO PICKER — cards visuales
   ============================================================ */

.modelo-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}

@media (min-width: 720px) {
  .modelo-picker {
    grid-template-columns: repeat(4, 1fr);
  }
  .modelo-picker .modelo-pick-unsure {
    grid-column: 1 / -1;
  }
}

.modelo-pick {
  position: relative;
  cursor: pointer;
  display: block;
}

.modelo-pick input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.modelo-pick-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  padding: var(--space-4) var(--space-4);
  border-radius: 12px;
  background: var(--bg-soft);
  border: 2px solid transparent;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    transform var(--transition-fast);
  min-height: 100px;
}

.modelo-pick-card .code {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-muted);
}

.modelo-pick-card .name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--fg-primary);
}

.modelo-pick-card .desc {
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.4;
  color: var(--fg-muted);
  margin-top: var(--space-1);
}

.modelo-pick:hover .modelo-pick-card {
  background: #FFFFFF;
  border-color: var(--border);
}

/* Selected — pintamos con el color del modelo */
.modelo-pick input[type="radio"]:checked + .modelo-pick-card {
  background: var(--pick-color, var(--brand-magenta));
  border-color: var(--pick-color-strong, var(--brand-magenta));
  color: #FFFFFF;
}

.modelo-pick input[type="radio"]:checked + .modelo-pick-card .code,
.modelo-pick input[type="radio"]:checked + .modelo-pick-card .name,
.modelo-pick input[type="radio"]:checked + .modelo-pick-card .desc {
  color: #FFFFFF;
}

/* A6 (yellow) → texto oscuro al estar seleccionado */
.modelo-pick.is-a6 input[type="radio"]:checked + .modelo-pick-card,
.modelo-pick.is-a6 input[type="radio"]:checked + .modelo-pick-card .code,
.modelo-pick.is-a6 input[type="radio"]:checked + .modelo-pick-card .name,
.modelo-pick.is-a6 input[type="radio"]:checked + .modelo-pick-card .desc {
  color: var(--fg-primary);
}

/* Focus visible */
.modelo-pick input[type="radio"]:focus-visible + .modelo-pick-card {
  outline: 2px solid var(--fg-primary);
  outline-offset: 2px;
}

/* Asignación de color a cada card */
.modelo-pick.is-a3 { --pick-color: var(--model-a3); --pick-color-strong: var(--model-a3-strong); }
.modelo-pick.is-a5 { --pick-color: var(--model-a5); --pick-color-strong: var(--model-a5-strong); }
.modelo-pick.is-a6 { --pick-color: var(--model-a6); --pick-color-strong: var(--model-a6-strong); }
.modelo-pick.is-a8 { --pick-color: var(--model-a8); --pick-color-strong: var(--model-a8-strong); }

.modelo-pick.modelo-pick-unsure .modelo-pick-card {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--fg-muted);
  font-family: var(--font-sans);
  font-size: 14px;
  min-height: auto;
  padding: var(--space-4) var(--space-5);
  flex-direction: row;
  align-items: center;
  justify-content: center;
}

.modelo-pick.modelo-pick-unsure input[type="radio"]:checked + .modelo-pick-card {
  background: var(--fg-primary);
  border: 2px solid var(--fg-primary);
  border-style: solid;
  color: var(--bg-primary);
  font-weight: 600;
  box-shadow: 0 8px 22px rgba(10,10,10,0.22);
}

/* ============================================================
   DIMENSIONES — split largo + ancho con unidad cm
   ============================================================ */

.presupuesto-dim-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: var(--space-4);
  margin-top: var(--space-3);
}
@media (max-width: 520px) {
  .presupuesto-dim-row {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
  .presupuesto-dim-sep { display: none; }
}
.presupuesto-dim-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.presupuesto-dim-sublabel {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-subtle);
  font-weight: 600;
}
.presupuesto-dim-input {
  position: relative;
  display: flex;
  align-items: center;
}
.presupuesto-dim-input .presupuesto-input {
  padding-right: 44px;
  width: 100%;
  font-feature-settings: 'tnum' on;
}
.presupuesto-dim-unit {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--fg-subtle);
  font-weight: 600;
  pointer-events: none;
}
.presupuesto-dim-range {
  font-size: 11px;
  color: var(--fg-subtle);
  margin: 0;
  font-feature-settings: 'tnum' on;
}
.presupuesto-dim-sep {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  color: var(--fg-subtle);
  align-self: center;
  padding-bottom: 10px;
  user-select: none;
}

/* ============================================================
   FILE UPLOAD — drop zone
   ============================================================ */

.presupuesto-dropzone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: clamp(24px, 4vw, 36px);
  text-align: center;
  background: var(--bg-soft);
  transition:
    border-color var(--transition-fast),
    background var(--transition-fast);
}

.presupuesto-dropzone.is-dragover {
  border-color: var(--brand-magenta);
  background: color-mix(in srgb, var(--brand-magenta) 6%, var(--bg-soft));
}

.presupuesto-dropzone-icon {
  width: 32px;
  height: 32px;
  color: var(--fg-subtle);
  margin: 0 auto var(--space-3);
  display: block;
}

.presupuesto-dropzone-text {
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--fg-muted);
  margin: 0 0 var(--space-1);
}

.presupuesto-dropzone-btn {
  background: none;
  border: 0;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  color: var(--brand-magenta);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.presupuesto-dropzone-btn:hover {
  color: #c81857;
}

.presupuesto-dropzone-formats {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-subtle);
  margin: var(--space-3) 0 0;
}

.presupuesto-dropzone input[type="file"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  inset: 0;
}

/* File preview cuando hay archivo */
.presupuesto-file-preview {
  display: none;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.presupuesto-file-preview.is-shown {
  display: flex;
}

.presupuesto-file-preview-icon {
  width: 28px;
  height: 28px;
  color: var(--brand-magenta);
  flex-shrink: 0;
}

.presupuesto-file-preview-info {
  flex: 1;
  min-width: 0;
}

.presupuesto-file-preview-name {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-primary);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.presupuesto-file-preview-size {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-muted);
  margin: 2px 0 0;
}

.presupuesto-file-preview-remove {
  background: none;
  border: 0;
  padding: var(--space-2);
  cursor: pointer;
  color: var(--fg-muted);
  border-radius: 6px;
  transition: background var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
}

.presupuesto-file-preview-remove:hover {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

/* Cuando está mostrado el preview, ocultamos el dropzone */
.presupuesto-dropzone-wrapper.has-file .presupuesto-dropzone {
  display: none;
}

/* ============================================================
   TEXTAREA + COUNTER
   ============================================================ */

.presupuesto-counter {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg-subtle);
  align-self: flex-end;
}

.presupuesto-counter.is-warning {
  color: var(--warning);
}

.presupuesto-counter.is-danger {
  color: var(--danger);
}

/* ============================================================
   RGPD + SUBMIT
   ============================================================ */

.presupuesto-rgpd {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) 0;
}

.presupuesto-rgpd input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--brand-magenta);
  margin-top: 2px;
  cursor: pointer;
  flex-shrink: 0;
}

.presupuesto-rgpd-label {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg-muted);
  cursor: pointer;
}

.presupuesto-rgpd-label a {
  color: var(--fg-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.presupuesto-rgpd.has-error .presupuesto-rgpd-label {
  color: var(--danger);
}

.presupuesto-submit-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: flex-start;
}

.presupuesto-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 16px 32px;
  border-radius: 999px;
  border: 0;
  background: var(--brand-magenta);
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(233, 30, 99, 0.32);
  transition:
    transform var(--transition-base),
    background var(--transition-base),
    box-shadow var(--transition-base);
}

.presupuesto-submit:hover {
  background: #c81857;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(233, 30, 99, 0.42);
}

.presupuesto-submit:disabled,
.presupuesto-submit.is-loading {
  background: var(--fg-subtle);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.presupuesto-submit-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
}

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

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

@media (prefers-reduced-motion: reduce) {
  .presupuesto-submit-spinner {
    animation: none;
  }
  .presupuesto-submit:hover {
    transform: none;
  }
}

/* ============================================================
   ESTADOS — SUCCESS / ERROR
   ============================================================ */

.presupuesto-state {
  display: none;
  padding: clamp(32px, 4vw, 48px);
  border-radius: 16px;
  background: var(--bg-soft);
  border: 1px solid var(--border-subtle);
}

.presupuesto-state.is-shown {
  display: block;
}

.presupuesto-state.is-success {
  background: color-mix(in srgb, var(--success) 8%, var(--bg-soft));
  border-color: color-mix(in srgb, var(--success) 30%, var(--border-subtle));
}

.presupuesto-state.is-error {
  background: color-mix(in srgb, var(--danger) 6%, var(--bg-soft));
  border-color: color-mix(in srgb, var(--danger) 30%, var(--border-subtle));
}

.presupuesto-state-icon {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-4);
}

.presupuesto-state.is-success .presupuesto-state-icon { color: var(--success); }
.presupuesto-state.is-error   .presupuesto-state-icon { color: var(--danger); }

.presupuesto-state-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 2.6vw, 32px);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 var(--space-3);
  color: var(--fg-primary);
}

.presupuesto-state-msg {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--fg-muted);
  margin: 0 0 var(--space-5);
  max-width: 50ch;
}

.presupuesto-state-ref {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-primary);
  background: #FFFFFF;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin-bottom: var(--space-5);
}

.presupuesto-state-actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* ============================================================
   SIDEBAR (col derecha)
   ============================================================ */

.presupuesto-sidebar {
  display: flex;
  flex-direction: column;
  gap: clamp(24px, 3vw, 32px);
}

/* La aside no es sticky: scroll natural con el resto de la página. */

.presupuesto-sidebar-card {
  background: var(--bg-soft);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: clamp(20px, 2.5vw, 28px);
}

.presupuesto-sidebar-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 var(--space-4);
  color: var(--fg-primary);
}

/* === Proceso steps === */

.proceso-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.proceso-step {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}

.proceso-step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand-magenta);
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
}

.proceso-step-content { min-width: 0; }

.proceso-step-title {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 2px;
  color: var(--fg-primary);
}

.proceso-step-desc {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg-muted);
  margin: 0;
}

/* === Why list === */

.why-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.why-list li {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg-muted);
}

.why-list svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: var(--brand-magenta);
  margin-top: 2px;
}

/* === Contact === */

.sidebar-contact-intro {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg-muted);
  margin: 0 0 var(--space-4);
}

.sidebar-contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-contact-item { display: block; }

.sidebar-contact-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--fg-primary);
  background: var(--bg-soft);
  border: 1px solid var(--border-subtle);
  transition: background var(--transition-fast),
              border-color var(--transition-fast),
              transform var(--transition-fast);
}
.sidebar-contact-link:hover,
.sidebar-contact-link:focus-visible {
  outline: none;
  background: color-mix(in srgb, var(--brand-magenta) 6%, var(--bg-soft));
  border-color: color-mix(in srgb, var(--brand-magenta) 28%, transparent);
  transform: translateX(2px);
}

.sidebar-contact-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  color: var(--brand-magenta);
  border: 1px solid var(--border-subtle);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.sidebar-contact-link:hover .sidebar-contact-icon {
  background: var(--brand-magenta);
  color: #FFFFFF;
  border-color: var(--brand-magenta);
}
.sidebar-contact-icon svg { width: 18px; height: 18px; }

.sidebar-contact-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.sidebar-contact-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-subtle);
}

.sidebar-contact-value {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-primary);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-contact-langs {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-subtle);
  margin: var(--space-4) 0 0;
}
