/* =========================================================
   FORMULARIO - "Completar formulario #MujeresConPoder"
   (Se apoya en las variables y clases base de styles.css)
   ========================================================= */

.btn-submit {
    border: none;
    cursor: pointer;
}

.form-subtitle {
    font-size: clamp(19px, 4vw, 22px);
    font-weight: 800;
    text-align: center;
    margin-top: 2px;
}

.form-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 22px 0;
    flex-grow: 1;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-input {
    width: 100%;
    padding: 16px 18px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-bg-white);
    font-size: 15px;
    font-weight: 500;
    color: var(--color-text-body);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input::placeholder {
    color: var(--color-text-faint);
}

.form-input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
}

select.form-input {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    color: var(--color-text-faint);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 42px;
}

select.form-input:valid:not([value=""]) {
    color: var(--color-text-body);
}

@media (max-width: 380px) {
    .form-row {
        gap: 10px;
    }

    .form-input {
        padding: 14px 16px;
    }
}

/* ==========================================
VALIDACIÓN DEL FORMULARIO
========================================== */

.form-field {
    width: 100%;
    position: relative;
}

/* Los mensajes están ocultos inicialmente */

.field-error {
    display: none;
    margin-top: 5px;
    padding-left: 4px;
    font-size: 12px;
    line-height: 1.3;
    color: #d9534f;
}

/* Mostrar SOLO el mensaje del campo con error */

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

/* Borde rojo solamente en el campo con error */

.form-field.has-error .form-input {
    border-color: #d9534f;
}

/* Select de países */

.country-select {
    cursor: pointer;
}

/* ==========================================
   SELECTOR DE PAÍS
   ========================================== */

.form-row {
    position: relative;
    z-index: 10;
}

.country-select-wrapper {
    position: relative;
    width: 100%;
    z-index: 100;
}

/* Botón que muestra el país seleccionado */

.country-select-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;

    text-align: left;
    background-image: none;

    color: var(--color-text-faint);

    cursor: pointer;

    position: relative;
    z-index: 101;
}

.country-select-trigger.has-value {
    color: var(--color-text-body);
}

/* País seleccionado */

.country-select-value {
    display: inline-flex;
    align-items: center;
    gap: 8px;

    min-width: 0;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Flecha */

.country-select-chevron {
    flex-shrink: 0;
    color: #9ca3af;

    transition: transform 0.2s ease;
}

.country-select-trigger[aria-expanded="true"] .country-select-chevron {
    transform: rotate(180deg);
}


/* ==========================================
   MENÚ DESPLEGABLE
   ========================================== */

.country-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    width: 100%;
    background: var(--color-bg-white);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 9999;

    display: flex;
    flex-direction: column;
    max-height: 260px;
    overflow: hidden;
}

.country-dropdown[hidden] {
    display: none !important;
}


/* ==========================================
   BUSCADOR
   ========================================== */

.country-search-wrap {
    padding: 10px;

    background: var(--color-bg-white);

    border-bottom: 1px solid var(--color-border);

    position: relative;
    z-index: 2;
}

.country-search {
    display: block;

    width: 100%;

    box-sizing: border-box;

    padding: 10px 12px;

    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);

    background: var(--color-bg-white);

    font-family: inherit;
    font-size: 14px;

    color: var(--color-text-body);

    outline: none;
}

.country-search::placeholder {
    color: var(--color-text-faint);
}

.country-search:focus {
    border-color: var(--color-primary);

    box-shadow:
        0 0 0 3px rgba(139, 92, 246, 0.12);
}


/* ==========================================
   LISTA DE PAÍSES
   ========================================== */

.country-list {
    display: flex !important;
    flex-direction: column;
    flex: 1 1 auto;

    list-style: none !important;
    margin: 0 !important;
    padding: 6px !important;
    width: 100%;

    height: 180px !important;
    max-height: 180px !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;

    touch-action: pan-y !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;

    box-sizing: border-box;
    background: var(--color-bg-white);
}


.country-list::-webkit-scrollbar {
    width: 7px;
}

.country-list::-webkit-scrollbar-track {
    background: transparent;
}

.country-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.country-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}


.country-option {
    display: flex !important;

    align-items: center;

    gap: 10px;

    width: 100%;

    box-sizing: border-box;

    padding: 9px 10px;

    margin: 0 !important;

    border-radius: 8px;

    list-style: none !important;

    cursor: pointer;

    font-size: 14px;
    font-weight: 500;

    color: var(--color-text-body);

    background: transparent;

    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}

.country-option:hover {
    background-color: rgba(139, 92, 246, 0.08);
}

.country-option.is-active {
    background-color: rgba(139, 92, 246, 0.08);
}

.country-option.is-selected {
    background-color: rgba(139, 92, 246, 0.12);

    font-weight: 700;
}


/* Banderas */

.country-option .fi,
.country-select-trigger .fi {
    display: inline-block;

    width: 20px;

    flex-shrink: 0;

    border-radius: 2px;
}

.country-option .fi {
    font-size: 18px;
}

.country-select-trigger .fi {
    font-size: 18px;
}

.country-empty {
    display: block;

    padding: 14px 12px;

    margin: 0;

    text-align: center;

    list-style: none !important;

    font-size: 13px;

    color: var(--color-text-faint);
}

.form-field:has(.country-select-wrapper) {
    position: relative;
    z-index: 100;
}

.country-select-wrapper {
    position: relative;
    z-index: 100;
}


/*
   Evita que el dropdown sea recortado
   por el contenedor del formulario.
*/

.form-fields,
.form-row,
.form-field {
    overflow: visible;
}

/* ==========================================
   PREFIJO TELEFÓNICO SEGÚN PAÍS
   ========================================== */

.phone-input-wrap {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-bg-white);
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.phone-input-wrap:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
}

.phone-code {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-faint);
    background-color: rgba(0, 0, 0, 0.02);
    border-right: 1px solid var(--color-border);
    white-space: nowrap;
    flex-shrink: 0;
}

.phone-code.has-value {
    color: var(--color-text-body);
}

.phone-code .fi {
    border-radius: 2px;
    font-size: 16px;
}

.phone-input-wrap .phone-input {
    border: none;
    border-radius: 0;
    box-shadow: none !important;
}

/* Ajustar el borde de error para que caiga en el wrapper */
.form-field.has-error .phone-input-wrap {
    border-color: #d9534f;
}

/* Banderas dentro de las opciones del país (reemplaza .flag por .fi) */
.country-option .fi,
.country-select-trigger .fi {
    border-radius: 2px;
    flex-shrink: 0;
}

.country-select-trigger {
    gap: 10px;
}

.country-select-value {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}


/* =========================================================
   Antes vivía como <style> inline dentro de formulario.html.
   Se movió aquí para no tener el CSS de esta página repartido
   entre dos archivos distintos. Al quedar al final del
   archivo, sigue ganando en la cascada exactamente igual que
   antes (por eso conserva los !important que ya tenía).
   ========================================================= */
 para que no pise los estilos) -->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/select2@4.0.13/dist/css/select2.min.css">

    <style>
        /* ==========================================
   ESTILOS Y FIXES DEL FORMULARIO
   ========================================== */
        .main-card {
            height: auto !important;
            min-height: auto;
            max-height: none !important;
            overflow: visible !important;
            padding-bottom: 24px;
        }

        body.page-container,
        .page-container {
            height: auto !important;
            min-height: 100vh;
            overflow-y: auto !important;
        }

        .form-fields {
            flex-grow: 0 !important;
        }

        .page-container,
        .main-card,
        .form-fields,
        .form-field {
            overflow: visible !important;
        }

        /* Ajustes para intl-tel-input */
        .iti {
            width: 100%;
        }

        .iti__country-list {
            z-index: 9999 !important;
            border-radius: 12px;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
        }

        /* Mensajes de error */
        .form-field.has-error input,
        .form-field.has-error select,
        .form-field.has-error .iti {
            border-color: #e53e3e !important;
            background-color: #fff5f5;
        }

        .form-field .field-error {
            color: #e53e3e;
            font-size: 12px;
            margin-top: 4px;
            display: block;
            font-weight: 500;
        }

        /* ==========================================
   SELECT2 ADAPTADO AL FORMULARIO
   ========================================== */
        .select2-container {
            width: 100% !important;
        }

        .select2-container--default .select2-selection--single {
            height: 52px;
            border: 1px solid #d9d9d9;
            border-radius: 12px;
            display: flex;
            align-items: center;
            padding: 0 8px;
            background: #fff;
        }

        .select2-container--default .select2-selection--single .select2-selection__rendered {
            flex: 1;
            line-height: normal;
            padding-left: 8px;
            padding-right: 28px;
            color: inherit;
            font: inherit;
        }

        .select2-container--default .select2-selection--single .select2-selection__placeholder {
            color: #9aa0a6;
        }

        .select2-container--default .select2-selection--single .select2-selection__arrow {
            height: 100%;
            right: 10px;
        }

        .select2-dropdown {
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 10px 25px rgba(0, 0, 0, .15);
        }

        .select2-search--dropdown .select2-search__field {
            border-radius: 8px;
            padding: 8px;
        }

        /* Deshabilitado (mientras carga o si no aplica) */
        .select2-container--default.select2-container--disabled .select2-selection--single {
            opacity: .6;
            cursor: not-allowed;
        }

        /* Estado de error */
        .form-field.has-error .select2-container--default .select2-selection--single {
            border-color: #e53e3e !important;
            background-color: #fff5f5;
        }

        /* ==========================================
   AJUSTES RESPONSIVE MÓVIL (Ancho total + Sin Scroll)
   ========================================== */
        @media (max-width: 520px) {

            html,
            body {
                width: 100% !important;
                overflow-x: hidden;
            }

            body.page-container,
            .page-container {
                width: 100% !important;
                min-height: 100dvh !important;
                height: auto !important;

                padding: 12px !important;
                margin: 0 !important;

                display: flex !important;
                flex-direction: column !important;

                /* Centra la tarjeta cuando hay espacio */
                justify-content: center !important;
                align-items: center !important;

                box-sizing: border-box !important;
            }

            .main-card {
                width: 100% !important;
                max-width: 100% !important;

                padding: 16px 14px 20px !important;
                margin: 0 !important;

                box-sizing: border-box !important;

                box-shadow: none !important;
            }

            /* ==========================================
       BOTÓN VOLVER
       ========================================== */

            .back-navigation-button {
                display: flex !important;
                align-items: center !important;
                justify-content: center !important;

                margin-top: 2px !important;
                margin-bottom: 8px !important;

                width: 36px !important;
                height: 36px !important;
            }

            /* ==========================================
       ENCABEZADO
       ========================================== */

            .form-header {
                width: 100% !important;
                margin-bottom: 6px !important;
                text-align: center !important;
            }

            .form-header h1 {
                font-size: 20px !important;
                line-height: 1.1 !important;
                margin: 0 !important;
            }

            .form-header h1 br {
                display: none;
            }

            .form-subtitle {
                margin: 4px 0 8px !important;
                font-size: 13px !important;
            }

            /* ==========================================
       TEXTO DE AYUDA
       ========================================== */

            .helper-text {
                width: 100% !important;

                font-size: 11px !important;
                line-height: 1.3 !important;

                margin: 0 0 10px !important;

                text-align: center !important;
            }

            /* ==========================================
       FORMULARIO
       ========================================== */

            .form-fields {
                width: 100% !important;
                max-width: 100% !important;

                display: flex !important;
                flex-direction: column !important;

                gap: 6px !important;

                flex-grow: 0 !important;
            }

            .form-field {
                width: 100% !important;
                max-width: 100% !important;

                margin: 0 !important;
            }

            .form-input,
            .iti,
            .select2-container {
                width: 100% !important;
                max-width: 100% !important;

                box-sizing: border-box !important;
            }

            .form-input,
            .select2-container--default .select2-selection--single {
                height: 40px !important;
            }

            .select2-container--default .select2-selection--single .select2-selection__rendered {
                line-height: 40px !important;
            }

            /* ==========================================
       FOOTER / BOTÓN
       ========================================== */

            .form-footer {
                width: 100% !important;

                margin-top: 10px !important;
                margin-bottom: 0 !important;
            }

            .btn-submit {
                width: 100% !important;

                padding: 10px !important;
                font-size: 13px !important;
            }
        }
    