/* ==========================================================
   VARIABLES
   ========================================================== */
:root {
  /* Encabezado (mismas reglas de la pantalla de verificación) */
  --white: #ffffff;
  --header-max: 784px;      /* encabezado: 752px del formulario + 16px de margen a cada lado */

  /* Formulario */
  --blue: #0b5fff;
  --blue-dark: #0850dd;
  --navy: #12295c;
  --text: #1a1a1a;
  --placeholder: #5b677d;
  --field-border: #a3adc1;
  --field-border-hover: #7f8ba3;
  --form-max: 752px;        /* ancho máximo del formulario */

  /* Lista desplegable del select (mismos colores del select de la banca) */
  --menu-bg: #0a47a8;
  --menu-scroll-track: #0a3a8c;
  --menu-scroll-thumb: #9db9ee;

  --font: "Roboto", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
}

/* ==========================================================
   RESET
   ========================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 14px;
  line-height: 20px;
  color: var(--text);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* ==========================================================
   ENCABEZADO
   ========================================================== */
.header {
  flex: 0 0 auto;
  background: linear-gradient(180deg, #0071d3 0%, #0057bf 50%, #003fa5 100%);
}

.header__inner {
  position: relative;
  max-width: var(--header-max);
  min-height: 116px;
  margin: 0 auto;
  padding: 56px 16px 28px;
}

.header__back {
  position: absolute;
  top: 8px;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transition: background-color 0.2s ease;
}

.header__back img {
  width: 24px;
  height: 24px;
}

.header__back:hover {
  background: rgba(255, 255, 255, 0.16);
}

.header__back:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: 2px;
}

.header__title {
  font-size: 20px;
  font-weight: 500;
  line-height: 28px;
  color: var(--white);
  text-wrap: balance;
}

/* ==========================================================
   CONTENIDO
   ========================================================== */
.main {
  flex: 1 1 auto;
  width: 100%;
  padding: 24px 16px 40px;
  /* Fondo con líneas (placeholder): cambia la ruta por la tuya */
  background: var(--white) url("img/fondo-lineas.png") center top / cover no-repeat;
}

.form {
  width: 100%;
  max-width: var(--form-max);
  margin: 0 auto;
}

/* ---------- Título ---------- */
.form__title {
  margin-bottom: 40px;
  font-size: 34px;
  font-weight: 700;
  line-height: 41px;
  text-align: center;
  color: var(--navy);
}

/* ---------- Cuadrícula de campos ---------- */
.form__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 20px;
  row-gap: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.field--full {
  grid-column: 1 / -1;
  margin-bottom: 4px;
}

.field__label {
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
  color: var(--text);
}

/* ---------- Inputs y select ---------- */
.field__control {
  display: block;
  width: 100%;
  height: 56px;
  padding: 0 20px;
  font-size: 16px;
  font-weight: 400;
  line-height: 24px;
  color: var(--text);
  background-color: var(--white);
  border: 1px solid var(--field-border);
  border-radius: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field__control:not(select) {
  -webkit-appearance: none;
  appearance: none;
}

.field__control:hover {
  border-color: var(--field-border-hover);
}

.field__control:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
}

.field__control::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

/* Select: mismo estilo del select de la banca (flecha propia + lista azul) */
.field__control--select {
  padding-right: 40px;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("img/icon-chevron-down.svg");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 20px 20px;
}

.field__control--select:required:invalid {
  color: var(--placeholder);
}

/* Lista nativa (navegadores que permiten colorear las opciones) */
.field__control--select option {
  color: var(--white);
  background: var(--menu-bg);
}

/* Lista desplegable personalizada, solo CSS: se activa donde el navegador
   soporta "appearance: base-select"; en los demás queda la lista nativa */
@supports (appearance: base-select) {
  .field__control--select,
  .field__control--select::picker(select) {
    appearance: base-select;
  }

  .field__control--select {
    display: flex;
    align-items: center;
    padding: 0 16px 0 20px;
    background-image: none;
  }

  .field__control--select::picker-icon {
    content: "";
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin-left: auto;
    background: url("img/icon-chevron-down.svg") center / 20px 20px no-repeat;
    transition: rotate 0.2s ease;
  }

  .field__control--select:open::picker-icon {
    rotate: 180deg;
  }

  .field__control--select:open {
    border-color: var(--blue);
    box-shadow: 0 0 0 1px var(--blue);
  }

  .field__control--select::picker(select) {
    max-height: 188px;
    margin-top: 4px;
    padding: 0;
    background: var(--menu-bg);
    border: 0;
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(10, 30, 80, 0.25);
    scrollbar-width: thin;
    scrollbar-color: var(--menu-scroll-thumb) var(--menu-scroll-track);
  }

  .field__control--select option {
    display: flex;
    align-items: center;
    height: 40px;
    padding: 0 16px;
    font-size: 15px;
    font-weight: 400;
    line-height: 20px;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease;
  }

  .field__control--select option[hidden] {
    display: none;
  }

  .field__control--select option:hover,
  .field__control--select option:focus {
    background: rgba(255, 255, 255, 0.16);
  }

  .field__control--select option:checked {
    font-weight: 500;
  }

  .field__control--select option::checkmark {
    display: none;
  }
}

/* ---------- Botón ---------- */
.form__actions {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 160px;
  height: 56px;
  padding: 0 16px;
  font-size: 16px;
  font-weight: 700;
  line-height: 24px;
  color: var(--white);
  background: var(--blue);
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn:hover {
  background: var(--blue-dark);
}

.btn:active {
  transform: scale(0.98);
}

.btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

/* ==========================================================
   TABLET Y MÓVIL: una sola columna
   ========================================================== */
@media (max-width: 599px) {
  .main {
    padding: 32px 16px 32px;
  }

  .form__title {
    margin-bottom: 32px;
    font-size: 28px;
    line-height: 36px;
  }

  .form__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .field--full {
    margin-bottom: 0;
  }
}

/* ==========================================================
   PANTALLAS PEQUEÑAS
   ========================================================== */
@media (max-width: 340px) {
  .header__title {
    font-size: 18px;
    line-height: 26px;
  }

  .form__title {
    font-size: 24px;
    line-height: 32px;
  }

  .field__control {
    padding: 0 16px;
  }
}

/* ==========================================================
   ESCRITORIO
   ========================================================== */
@media (min-width: 600px) {
  .header__inner {
    padding: 56px 16px 32px;
  }

  .header__title {
    font-size: 24px;
    line-height: 32px;
  }

  .main {
    padding-top: 48px;
    padding-bottom: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}