/* ============================================================================
   Pre-Inscripción — estilos del modal y del form.
   El modal se renderiza vía componente App\Components\Form en mode=modal.
   Estilos siguen la paleta y tipografía existente (Oswald uppercase para
   botones y headings, base #1a1a1a/#fff).
   ============================================================================ */

/* Honeypot: invisible para humanos, accesible para bots. */
.form-honeypot {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---- Dialog ---- */
.form-modal {
    border: none;
    border-radius: 8px;
    padding: 0;
    width: min(680px, calc(100vw - 32px));
    max-height: calc(100vh - 64px);
    background: #fff;
    color: #222;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}
.form-modal::backdrop {
    background: rgba(0, 0, 0, 0.65);
}
.form-modal[open] {
    animation: form-modal-in 180ms ease-out;
}
@keyframes form-modal-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Mismo issue que con .form-submit: styles.min.css global mete
   `button:hover { border: 1px solid grey; background-color: #FFF }`.
   Sobrescribimos explícitamente border/background en hover para que el
   X cierre quede limpio sin caja gris. `button.form-modal__close` sube
   la especificidad por encima de cualquier `button[type]` legacy. */
button.form-modal__close,
.form-modal__close {
    position: absolute;
    top: 8px;
    right: 12px;
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    color: #888;
    cursor: pointer;
    border-radius: 4px;
    max-width: none;
    -webkit-appearance: none;
    appearance: none;
    transition: color 120ms ease;
}
button.form-modal__close:hover,
.form-modal__close:hover {
    color: #000;
    background: transparent;
    border: none;
}
.form-modal__close:focus { outline: none; }
.form-modal__close:focus-visible {
    outline: 2px solid #1a1a1a;
    outline-offset: 2px;
}

/* ---- Form region (envuelve form + success state) ---- */
.form-region {
    padding: 28px 32px;
    overflow-y: auto;
    max-height: inherit;
}
/* En modo inline (ej. /contacto) el form no está dentro de un <dialog>,
   no hay max-height; agregamos respiro abajo para que el siguiente
   bloque de la página no quede pegado al botón. */
.form-region--inline {
    padding-bottom: 16px;
    margin-bottom: 56px;
}

.cinefilia-form__header h2 {
    margin: 0 0 20px;
    font-family: 'Oswald', sans-serif;
    font-size: 1.15em;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #1a1a1a;
}
.cinefilia-form__lede {
    margin: 0 0 20px;
    color: #555;
    font-size: 0.92em;
    line-height: 1.5;
}

/* ---- Grid de campos ---- */
.cinefilia-form__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
}
.cinefilia-form__field--full { grid-column: 1 / -1; }
.cinefilia-form__field--half { grid-column: span 1; }

.cinefilia-form__field {
    display: flex;
    flex-direction: column;
}
.cinefilia-form__field > span {
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
}
.cinefilia-form__field > span em {
    color: #c0392b;
    font-style: normal;
}

.cinefilia-form__field input[type="text"],
.cinefilia-form__field input[type="email"],
.cinefilia-form__field input[type="tel"],
.cinefilia-form__field select,
.cinefilia-form__field textarea {
    width: 100%;
    height: auto;
    margin: 0;
    padding: 9px 12px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.95em;
    line-height: 1.4;
    font-family: inherit;
    background: #fff;
    color: #222;
    box-sizing: border-box;
}
.cinefilia-form__field textarea {
    resize: vertical;
    min-height: 84px;
}
.cinefilia-form__field input:focus,
.cinefilia-form__field select:focus,
.cinefilia-form__field textarea:focus {
    outline: none;
    border-color: #1a1a1a;
    box-shadow: 0 0 0 2px rgba(26, 26, 26, 0.12);
}

/* ---- Submit + errores ---- */
.form-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}
/* Las reglas globales `button:hover` del styles.min.css legacy mutan
   color y border en hover, lo que cambia el texto y reduce 2px el
   ancho del botón. Sobrescribimos color y border explícitamente para
   neutralizarlas (selector con `button.` sube la especificidad sobre
   `button[type=submit]` también, por si el modal queda dentro de un
   contenedor que lo apunta). */
button.form-submit,
.form-submit {
    position: relative;
    min-width: 120px;
    font-family: 'Oswald', sans-serif;
    font-size: 0.9em;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    background: #1a1a1a;
    color: #fff;
    border: 2px solid #1a1a1a;
    border-radius: 6px;
    padding: 11px 28px;
    max-width: none;
    cursor: pointer;
    transition: background-color 120ms ease;
}
button.form-submit:hover,
.form-submit:hover {
    background-color: #333;
    color: #fff;
    border: 2px solid #1a1a1a;
}
.form-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Estado loading del botón — la etiqueta se vuelve invisible (pero ocupa
   espacio para que el botón no encoja) y el spinner overlay aparece en
   el centro. El alto del botón se mantiene estable entre estados. */
.form-submit__label {
    display: inline-block;
    transition: opacity 120ms ease;
}
.form-submit__spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease;
}
.form-submit--loading .form-submit__label { opacity: 0; }
.form-submit--loading .form-submit__spinner {
    opacity: 1;
    animation: form-submit-spin 0.7s linear infinite;
}
@keyframes form-submit-spin {
    to { transform: rotate(360deg); }
}

.form-errors {
    margin-top: 12px;
    color: #c0392b;
    font-size: 0.88em;
    display: none;
}
.form-errors:not(:empty) { display: block; }

/* ---- Read-only field (campo de solo lectura, p. ej. curso preset) ---- */
.cinefilia-form__readonly {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    padding: 12px 14px;
    margin-bottom: 10px;
}
.cinefilia-form__readonly > span {
    display: block;
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #777;
    margin-bottom: 2px;
}
.cinefilia-form__readonly > strong {
    display: block;
    font-size: 0.98em;
    color: #1a1a1a;
    line-height: 1.4;
}

/* ---- Success state ----
   El min-height aquí mantiene el alto del modal/container constante al
   pasar de form a success — sin esto el modal "colapsa" cuando el form
   se reemplaza por el mensaje corto. Los valores aproximan la altura
   natural del form correspondiente (preregistration ~480px, contact con
   textarea grande ~560px). Mobile reduce a anchos cómodos.
   Flexbox dentro de .form-success centra el contenido verticalmente
   en ese alto reservado, así el ícono y el mensaje quedan al medio
   en vez de pegados arriba. */
.form-success {
    min-height: 480px;
    padding: 32px 16px;
    text-align: center;
    color: #222;
    font-size: 1.02em;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
/* Inline (contacto): el form vive en la página, no dentro de un modal,
   así que centrar verticalmente deja el mensaje muy "perdido" en el
   medio. Lo subimos a tercio superior con flex-start + padding extra. */
.form-region--inline .form-success {
    min-height: 560px;
    justify-content: flex-start;
    padding-top: 80px;
}
.form-success__icon {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}
.form-success__message {
    margin: 0 auto;
    max-width: 440px;
}
.form-success__message strong {
    color: #1a1a1a;
    font-weight: 700;
}

@media (max-width: 600px) {
    .form-success { min-height: 380px; }
    .form-region--inline .form-success { min-height: 460px; }
}

/* ---- Mobile ---- */
@media (max-width: 600px) {
    .form-region { padding: 20px 18px; }
    .cinefilia-form__grid { grid-template-columns: 1fr; }
    .cinefilia-form__field--half { grid-column: 1 / -1; }
}

/* ---- Botón Preinscribirse en estado cerrado ---- */
.btn-preregister--closed,
.btn-preregister--closed:link,
.btn-preregister--closed:visited {
    cursor: not-allowed;
    opacity: 0.55;
    text-decoration: none;
}
.btn-preregister--closed:hover {
    background: inherit !important;
    border-color: inherit !important;
    color: inherit !important;
}
