/* ==========================================================================
   06-FORMS-UI.CSS
   Estilos para formularios, inputs y validaciones visuales
   ========================================================================== */

.form-container {
  background:
    linear-gradient(180deg, var(--color-surface) 0%, var(--color-bg-cream) 100%);
  padding: 2rem;
  border-radius: 6px;
  box-shadow: 0 18px 42px rgba(6, 26, 49, 0.11);
  border: 1px solid rgba(10, 110, 156, 0.28);
  border-top: 4px solid var(--color-brand-gold);
}

.form-group {
  margin-bottom: 0.9rem;
  position: relative;
}

.form-label {
  display: block;
  font-weight: 600;
  color: var(--color-primary-dark);
  margin-bottom: 0.25rem;
}

.form-control {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  scroll-margin-top: calc(var(--header-height) + 1rem);
  scroll-margin-bottom: 1rem;
  padding: 0.58rem 0.85rem;
  font-family: var(--font-family-main);
  font-size: 1rem;
  color: var(--color-text-main);
  background-color: #EEF1EE;
  border: 1px solid rgba(18, 58, 99, 0.22);
  border-radius: 6px;
  transition: all 0.3s ease;
}

.form-control::placeholder {
  color: #596169;
  opacity: 1;
}

.form-control:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(22, 59, 115, 0.1);
  background-color: #E8ECE9;
}

/* Clases de validación visual */
.form-control.is-invalid {
  border-color: #EF4444; /* Rojo error */
  background-color: #FEF2F2;
}

.form-control.is-valid {
  border-color: #10B981; /* Verde éxito */
  background-color: #F0FDF4;
}

.error-message {
  color: #B91C1C;
  font-size: 0.82rem;
  margin-top: 3px;
  display: none;
}

.is-invalid ~ .error-message {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

.form-submit {
  width: 100%;
  min-width: 0;
  white-space: normal;
  padding: 0.75rem;
  font-size: 1rem;
  margin-top: 0.35rem;
}

/* Alertas globales del formulario */
.form-alert {
  padding: 0.85rem 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-weight: 500;
}

@media (max-width: 768px) {
  .form-container {
    padding: 1.25rem;
  }
}

.form-alert.success {
  display: block;
  background-color: #D1FAE5;
  color: #065F46;
  border: 1px solid #10B981;
}

.form-alert.error {
  display: block;
  background-color: #FEE2E2;
  color: #991B1B;
  border: 1px solid #EF4444;
}

/* La región de estado permanece disponible para tecnologías de asistencia. */
.form-alert:empty {
  padding: 0;
  margin: 0;
  border: 0;
}

.form-help {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.field-help {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin: 0.35rem 0 0;
}

.form-submit:disabled {
  cursor: wait;
  opacity: 0.75;
}
/* Distribución de la página de contacto: mismo orden visual y de lectura en móvil. */
.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  grid-template-areas: "intro form" "channels form";
  grid-template-rows: auto 1fr;
  gap: 1.5rem 2rem;
  align-items: start;
  margin-top: calc(var(--header-height) + 1rem);
  margin-bottom: 2rem;
  padding: 2rem;
}
.contact-intro { grid-area: intro; min-width: 0; }
.contact-form-wrapper { grid-area: form; min-width: 0; }
.contact-channels { grid-area: channels; min-width: 0; }
.contact-intro h1 {
  font-size: clamp(1.75rem, 2.1vw, 1.95rem);
  margin: .75rem 0;
}
.contact-intro > p {
  color: var(--color-text-muted);
  font-size: 1rem;
  line-height: 1.65;
  margin: 0;
}
.contact-form-wrapper h2 { margin-bottom: .75rem; }
.contact-channels h2 { font-size: 1rem; margin-bottom: .85rem; }
.contact-whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  min-height: 48px;
  padding: .75rem 1rem;
  font-size: .95rem;
  box-shadow: none;
}
.contact-channel-list { list-style: none; padding: 0; margin: .65rem 0 0; }
.contact-channel-list li + li { border-top: 1px solid var(--color-border); }
.contact-channel-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-height: 44px;
  padding-block: .6rem;
  font-size: .9rem;
  font-weight: 500;
}
.contact-channel-list a > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.contact-channel-list a > span:last-child { flex-shrink: 0; }
.contact-channel-list a:hover { text-decoration: underline; text-underline-offset: .2em; }
.contact-page .form-container {
  background: #fff;
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-brand-gold);
  border-radius: 10px;
  box-shadow: none;
}
.contact-next-step, .contact-ruc {
  font-size: .9rem;
  color: var(--color-text-muted);
  margin: .9rem 0 0;
}
.contact-next-step strong { color: var(--color-primary-dark); }
.contact-next-step { line-height: 1.65; }
.contact-ruc { font-size: .8rem; }
.contact-optional-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 1rem;
}
.contact-page .form-control { min-height: 44px; background: #f8fafc; }
.contact-page textarea.form-control { min-height: 112px; resize: vertical; }
.contact-page select.form-control { appearance: none; padding-right: 2.2rem; background-image: linear-gradient(45deg, transparent 50%, var(--color-primary) 50%), linear-gradient(135deg, var(--color-primary) 50%, transparent 50%); background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.quote-details { margin: 1rem 0; padding: .85rem 1rem; border: 1px solid var(--color-border); border-radius: 6px; }
.quote-details summary { font-size: 1rem; color: var(--color-primary-dark); font-weight: 600; cursor: pointer; min-height: 44px; align-content: center; }
.quote-details[open] summary { margin-bottom: .75rem; }
.quote-details .form-group { margin-top: .85rem; }
.quote-details input[type=date] { min-width: 0; width: 100%; }
.quote-standards { min-width: 0; margin: 1rem 0; padding: .75rem 1rem 1rem; border: 1px solid var(--color-border); border-radius: 6px; }
.quote-standards[hidden] { display: none; }
.quote-standards legend { font-size: .95rem; font-weight: 600; color: var(--color-primary-dark); padding-inline: .2rem; }
.quote-checkboxes { display: flex; flex-wrap: wrap; gap: .5rem 1rem; }
.quote-checkboxes label { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; font-size: 1rem; cursor: pointer; }
.quote-checkboxes input { width: 1.15rem; height: 1.15rem; accent-color: var(--color-primary); }
.badge-hablemos {
  display: inline-block;
  background: rgba(22, 59, 115, .1);
  color: var(--color-primary);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: .875rem;
}
@media (max-width: 768px) {
  .contact-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "intro" "channels" "form";
    grid-template-rows: auto;
    gap: 1.25rem;
    padding: 0;
    margin-bottom: 1.5rem;
  }
  .contact-intro h1 { font-size: 1.75rem; margin: .5rem 0; }
  .contact-page .form-container { padding: 1.25rem; }
  .contact-form-wrapper { padding-top: .25rem; }
}
@media (max-width: 600px) {
  .contact-optional-fields { grid-template-columns: minmax(0, 1fr); }
}
