/*
 * Hoja de estilos del simulador de beneficios.
 * Orden: base, estructura, componentes y adaptaciones responsive.
 */

/* ==========================================================================
   01. VARIABLES Y ESTILOS BASE
   ========================================================================== */
:root {
    --naranja: #FE6106;
    --gris-oscuro: #4a4a4a;
    --gris-texto: #333333;
    --azul: #0012A9;
    --borde-input: #c9c9c9;
    --azul-oscuro: #16375c;

    --form-grid-gap: 20px;

}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    background-color: #ffffff;
}


/* ==========================================================================
   02. ESTRUCTURA GENERAL DE LA PÁGINA
   ========================================================================== */
.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.content-wrapper.form-content-wrapper {
    padding-top: 0;
}

.form-header {
    margin-top: 20px;
}

.form-subtitle {
    padding-left: 3%;
    margin-top: 0;
    color: var(--gris-oscuro);
    font-size: 17px !important;
}

.form-subtitle-central {
    font-size: 16px !important;
    color: var(--gris-oscuro);
    margin-top: 0;
}

.input-uppercase {
    text-transform: uppercase;
}

.titulo-admision{
    margin-bottom: 1% !important;
    color: var(--azul) !important;
    font-size: 50px !important;
    font-weight: bold !important;
}

.formulario-principal {
    padding-left: 7%;
    padding-right: 7%;
    margin-bottom: 5%;
}

/* ==========================================================================
   03. BANNER Y AVISO DE ADMISIÓN
   ========================================================================== */
/* 03.1 Banner */
.banner-container {
    width: 100%;
    max-width: 100%;
    margin-bottom: 24px;
    padding: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.img-banner {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* 03.2 Aviso de admisión */
.aviso-admision {
    display: grid;
    grid-template-rows: 1fr;

    width: calc(100% - 40px);
    max-width: 1160px;
    margin: 0 auto 48px;
    overflow: hidden;
    box-sizing: border-box;

    background-color: #ffffff;
    border: 1px solid var(--borde-input);
    border-left: 5px solid var(--azul);
    border-radius: 12px;
    box-shadow: 0 5px 18px rgba(20, 34, 72, 0.08);
    color: var(--gris-texto);
    opacity: 1;

    transition:
            grid-template-rows 0.5s cubic-bezier(0.4, 0, 0.2, 1),
            opacity 0.3s ease,
            margin-bottom 0.5s cubic-bezier(0.4, 0, 0.2, 1),
            border-width 0.4s ease,
            box-shadow 0.3s ease;
}

.aviso-admision__interior {
    min-height: 0;
    overflow: hidden;
}

.aviso-admision--oculto {
    grid-template-rows: 0fr;
    margin-bottom: 0 !important;
    border-width: 0;
    opacity: 0;
    box-shadow: none;
    pointer-events: none;
}

.aviso-admision__encabezado {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px 0;
}

.aviso-admision__icono {
    display: inline-grid;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    place-items: center;
    border-radius: 50%;
    background-color: var(--azul);
    color: #ffffff;
    font-weight: 600;
    line-height: 1;
}

.aviso-admision__titulo {
    margin: 0;
    color: var(--azul);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
}

.aviso-admision__contenido {
    padding: 16px 20px 20px 62px;
    font-size: 16px;
    line-height: 1.55;
}

.aviso-admision__contenido p {
    margin: 0 0 12px;
}

.aviso-admision__contenido ul {
    margin: 0 0 16px;
    padding-left: 22px;
}

.aviso-admision__contenido li {
    margin-bottom: 5px;
}

.aviso-admision__contenido a {
    color: var(--azul);
    overflow-wrap: anywhere;
    text-decoration: none;
}

.aviso-admision__contenido a:hover,
.aviso-admision__contenido a:focus {
    text-decoration: underline;
}

.aviso-admision__contacto {
    margin-bottom: 20px !important;
}

.aviso-admision__boton {
    width: min(260px, 100%);
    min-height: 44px;
    padding: 10px 28px;
    cursor: pointer;
    background-color: var(--naranja);
    border: 1px solid var(--naranja);
    border-radius: 6px;
    color: #ffffff;
    font: inherit;
    font-weight: 600;
    transition:
            background-color 0.2s ease,
            border-color 0.2s ease,
            box-shadow 0.2s ease;
}

.aviso-admision__boton:hover {
    background-color: #d94d00;
    border-color: #d94d00;
}

.aviso-admision__boton:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(254, 97, 6, 0.3);
}

/* ==========================================================================
   04. STEPPER Y TARJETAS
   ========================================================================== */
/* 04.1 Títulos y contenido del paso */
.step-title {
    font-size: 25px !important;
    font-weight: 700;
    color: var(--azul) !important;
    margin: 0;
    padding-left: 3% !important;
}

.step-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.step-body {
    padding-left: 0;
}


/* 04.2 Tarjetas */
.itp-card {
    width: 100%;
    max-width: 980px;
    overflow: hidden;
    box-sizing: border-box;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}

.itp-card.disabled-card {
    opacity: 0.5;
    pointer-events: none;
    filter: grayscale(60%);
}


/* 04.3 Stepper vertical */
.stepper-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.step-row {
    display: flex;
    align-items: stretch;
}

.step-track {
    flex: 0 0 auto;
    width: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-right: 24px;
    padding-top: 20px;
}

.step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--naranja, #f5820d);
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    z-index: 1;
}

.step-connector {
    width: 2px;
    flex: 1 1 auto;
    min-height: 60px;
    margin-top: 4px;
    background-color: #8f8fd9;
}

.step-row.step-last .step-track {
    padding-bottom: 0;
}

.step-row > .step-content {
    flex: 1 1 0;
    width: 0;
    min-width: 0;
    max-width: 100%;
    padding-bottom: 20px;
}

/* ==========================================================================
   05. ESTRUCTURA DEL FORMULARIO
   ========================================================================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--form-grid-gap);
    width: 100%;
    margin-top: 20px;
}

.form-grid--academic-scores {
    grid-template-columns:
        calc((100% - var(--form-grid-gap)) / 2)
        repeat(2, minmax(0, 1fr));
}

.form-grid--paes {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: start;
}

.form-field {
    width: 100%;
    min-width: 0;
    text-align: left;
}

/* ==========================================================================
   06. LABELS, AYUDAS Y VALIDACIÓN
   ========================================================================== */
/* 06.1 Labels */
.field-label {
    display: block;
    font-size: 14px;
    color: var(--azul-oscuro);
    margin-bottom: 8px;
    font-weight: 400;
}

.field-label-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
}

.field-label-row .field-label {
    margin-bottom: 0;
}


/* 06.2 Íconos de información y tooltips */
.field-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--azul-oscuro, #3255f9);
    border-radius: 50%;
    color: var(--azul-oscuro, #3255f9);
    font-size: 10px;
    font-weight: 700;
    font-style: italic;
    font-family: Georgia, serif;
    cursor: help;
    margin-left: 4px;
    vertical-align: middle;
    line-height: 1;
    flex-shrink: 0;
}
.ui-tooltip .ui-tooltip-text {
    background-color: #16375c !important;
    color: #ffffff !important;
    font-size: 12px !important;
    border-radius: 6px !important;
    padding: 6px 10px !important;
}


/* 06.3 Indicadores y mensajes */
.required-mark {
    margin-left: 2px;
    color: orangered;
}

.mensaje-beca-seccion {
    width: 100%;
    box-sizing: border-box;
}

.mensaje-beca-seccion .ui-message-error {
    display: block !important;
    width: 100%;
    box-sizing: border-box;
    margin-top: 12px !important;
}

/* ==========================================================================
   07. INPUTS Y COMPONENTES PRIMEFACES
   ========================================================================== */
/* 07.1 Inputs y selectores */
.step-body .ui-inputtext,
.step-body .ui-inputmask,
.step-body .ui-selectonemenu {
    width: 100% !important;
    max-width: 100%;
    border: 1px solid var(--borde-input) !important;
    border-radius: 6px !important;
    padding: 10px 12px !important;
    font-size: 14px !important;
    color: var(--gris-texto) !important;
    box-shadow: none !important;
}

.step-body .ui-selectonemenu .ui-selectonemenu-label {
    display: block !important;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    padding: 0 44px 0 0 !important;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* 07.2 Campo de teléfono */
.step-body .telefono-input-group {
    width: 100%;
}

.step-body .telefono-input-group .ui-inputgroup-addon {
    padding: 10px 12px !important;
    border: 1px solid var(--borde-input) !important;
    border-right: 0 !important;
    border-radius: 6px 0 0 6px !important;
    background-color: #ffffff !important;
    color: var(--gris-texto) !important;
    font-size: 14px !important;
}

.step-body .telefono-input-group .ui-inputtext {
    flex: 1 1 auto;
    min-width: 0;
    border-radius: 0 6px 6px 0 !important;
}

/* ==========================================================================
   08. CONTROLES SOCIOECONÓMICOS
   ========================================================================== */
.toggle-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.toggle-fields-row {
    display: flex;
    flex-wrap: wrap;
    gap: 24%;
    margin: 20px 0;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #16375c;
    font-size: 13px;
}

.toggle-info-icon {
    display: inline-flex;
    color: #9ca3af;
    font-size: 12px;
    cursor: help;
}

.toggle-info-icon .pi {
    font-size: 13px;
}

.toggle-pill.ui-selectonebutton {
    display: inline-flex !important;
    padding: 3px;
    border: none !important;
}

.toggle-pill .ui-button {
    padding: 6px 22px !important;
    border: solid;
    border-style: solid !important;
    border-radius: 4px !important;
    background: transparent !important;
    color: #6b7280 !important;
    box-shadow: none !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    transition: background-color 0.15s, color 0.15s;
}

.toggle-pill .ui-button:not(.ui-state-active):hover {
    background: #e5e7eb !important;
    color: #374151 !important;
}

.toggle-pill .ui-button.ui-state-active {
    background-color: #f5820d !important;
    color: #ffffff !important;
}

.toggle-pill .ui-button .ui-button-text {
    padding: 0 !important;
}

/* ==========================================================================
   09. AUTORIZACIÓN Y TÉRMINOS Y CONDICIONES
   ========================================================================== */
.consent-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    gap: 20px;
    margin-top: 20px;
    padding-left: 15px;
    text-align: center;
}

.consent-field,
.consent-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.consent-copy {
    max-width: 100%;
    text-align: left;
}

.consent-choice {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    column-gap: 8px;
}

body .terminos-checkbox {
    margin-top: 1px;
}

.consent-label {
    display: block;
    margin: 0;
    font-size: small;
    line-height: 1.25;
    text-align: left;
}

body .privacy-link {
    color: #2983FE !important;
    font-weight: 600;
    text-decoration: underline;
}

/* PrimeFaces calcula el ticket usando content-box. */
body .terminos-checkbox .ui-chkbox-box .ui-chkbox-icon::before {
    box-sizing: content-box;
}

.button-simular{
    width: 200px;
    height: 50px;
    background-color: var(--naranja) !important;
}

/* ==========================================================================
   10. DIÁLOGO DE POLÍTICA DE PRIVACIDAD
   ========================================================================== */
body .ui-dialog.privacy-dialog {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%) !important;
    margin: 0 !important;

    width: min(720px, calc(100vw - 32px)) !important;
    max-width: calc(100vw - 32px) !important;
    border-radius: 8px;
}

/*
 * PrimeFaces conserva el encabezado del diálogo.
 * Nuestro layout administra el texto y las acciones.
 */
body .ui-dialog.privacy-dialog .ui-dialog-content {
    padding: 0 !important;
    overflow: hidden !important;
}

.privacy-dialog__layout {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: #ffffff;
}

/* Única área que puede desplazarse */
.privacy-dialog__scroll {
    min-width: 0;
    min-height: 0;
    max-height: 60vh;
    max-height: 60dvh;
    overflow-y: auto;
    overscroll-behavior: contain;

    scrollbar-width: auto;
    scrollbar-color: #8f8fd9 #eef1f7;
}

.privacy-dialog__content {
    padding: 20px;
    color: #000000;
    line-height: 1.6;
    text-align: left;
}

.privacy-dialog__heading {
    margin: 0 0 15px;
    color: #0026fa;
    line-height: 1.35;
}

.privacy-dialog__content p {
    text-align: left;
}

/* Acciones fuera del área desplazable */
.privacy-dialog__actions {
    flex: 0 0 auto;
    display: flex;
    justify-content: flex-end;
    padding: 12px 16px;
    border-top: 1px solid #d1d5db;
    background: #ffffff;
}

body .privacy-dialog__button.ui-button {
    margin: 0;
    border: none;
    border-radius: 6px;
    background: #0026fa;
    color: #ffffff;
}

/* Scrollbar de Chrome y Edge */
.privacy-dialog__scroll::-webkit-scrollbar {
    width: 10px;
}

.privacy-dialog__scroll::-webkit-scrollbar-track {
    background: #eef1f7;
}

.privacy-dialog__scroll::-webkit-scrollbar-thumb {
    border: 2px solid #eef1f7;
    border-radius: 10px;
    background: #8f8fd9;
}

/* ==========================================================================
   11. ADAPTACIONES RESPONSIVE
   ========================================================================== */
/* 11.1 Escritorio desde 768px */
@media (min-width: 768px) {
    .step-body {
        padding-left: 15px !important;
    }
}

/* 11.2 Escritorio desde 993px */
@media (min-width: 993px) {
    .toggle-fields-row {
        display: grid;
        grid-template-columns:
                minmax(0, 1fr)
                minmax(0, 2fr)
                minmax(0, 1fr);
        gap: 24px;
        align-items: start;
    }

    .toggle-fields-row > .toggle-field {
        min-width: 0;
    }

    .toggle-control--stacked {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        width: 240px;
        max-width: 100%;
        min-width: 0;
    }

    .toggle-control--stacked > .ui-selectonemenu {
        width: 100% !important;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .toggle-control--stacked > .ui-selectonemenu > .ui-selectonemenu-label {
        display: block !important;
        width: 100%;
        min-width: 0;
        box-sizing: border-box;
        padding-right: 44px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

}

/* 11.3 Tablet y pantallas medianas hasta 1025px */
@media (max-width: 1025px) {

    .consent-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .consent-field,
    .consent-actions {
        width: 100%;
    }

    .form-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .button-simular {
        width: 200px;
        height: 50px;
        background-color: var(--naranja) !important;
    }

    .formulario-principal {
        padding-left: 8px;
        padding-right: 8px;
        margin-top: 24px;
        margin-bottom: 24px;
        text-align: center;
    }

    .titulo-admision {
        margin-bottom: 1% !important;
        color: var(--azul) !important;
        font-size: 50px !important;
        font-weight: bold !important;
    }

    .form-subtitle-central {
        margin: 0 !important;
        line-height: 1.45;
        text-align: center;
    }

    .toggle-pill.ui-selectonebutton {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* 11.4 Controles socioeconómicos hasta 992px */
@media (max-width: 992px) {
    .toggle-fields-row {
        flex-direction: column;
        width: 100%;
        gap: 14px;
    }

    .toggle-field {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        gap: 12px;
    }

    .toggle-label {
        flex: 1 1 auto;
        white-space: normal;
    }

    .toggle-control {
        flex: 0 0 55%;
        width: 55%;
        max-width: 55%;
        min-width: 0;
        box-sizing: border-box;
    }

    .toggle-pill.ui-selectonebutton {
        overflow: hidden;
        padding: 0 !important;
        border: 1px solid var(--borde-input) !important;
        border-radius: 6px !important;
    }

    .toggle-control--stacked {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .toggle-control--stacked > .toggle-pill.ui-selectonebutton {
        flex: 0 0 auto;
        width: 100% !important;
        max-width: 100% !important;
    }

    .toggle-control--stacked > .ui-selectonemenu {
        width: 100% !important;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .toggle-pill .ui-button {
        flex: 1 1 50% !important;
        width: 50% !important;
        border: none !important;
        border-radius: 0 !important;
        background: #ffffff !important;
        color: var(--gris-texto, #333333) !important;
    }

    .toggle-pill .ui-button:first-child {
        border-right: 1px solid var(--borde-input) !important;
    }

    .toggle-pill .ui-button.ui-state-active {
        background-color: #f5820d !important;
        color: #ffffff !important;
    }
}

.form-subtitle-nem {
    padding-top: 10px;
    font-size: 13.5px !important;
    color: var(--gris-oscuro);
    margin-top: 0;
    margin-bottom: 0 !important;
}

/* 11.5 Móvil hasta 650px */
@media (max-width: 650px) {
    .stepper-wrapper {
        padding-right: 8px;
        padding-left: 8px;
    }

    .step-track {
        width: 28px;
        margin-right: 8px;
    }

    .step-circle {
        width: 28px;
        height: 28px;
        font-size: 13px;
    }

    .itp-card > .form-header {
        margin-top: 16px;
        padding-right: 16px;
        padding-left: 16px;
    }

    .step-title {
        padding-left: 0 !important;
        font-size: 20px !important;
        line-height: 1.25;
    }

    .form-subtitle {
        margin: 4px 0 0;
        padding-left: 0;
        font-size: 14px !important;
        line-height: 1.4;
    }

    .content-wrapper {
        padding: 12px !important;
    }

    .form-grid {
        --form-grid-gap: 16px;
        margin-top: 0;
    }

    .form-grid + .form-grid {
        margin-top: 16px;
    }

    .aviso-admision {
        width: calc(100% - 24px);
        margin-bottom: 32px;
        border-radius: 10px;
    }

    .aviso-admision__encabezado {
        align-items: flex-start;
        padding: 16px 16px 0;
    }

    .aviso-admision__titulo {
        font-size: 17px;
    }

    .aviso-admision__contenido {
        padding: 14px 16px 18px;
    }

    .aviso-admision__boton {
        width: 100%;
    }

    .field-label {
        font-size: 15px;
    }

    .step-body .ui-inputtext,
    .step-body .ui-inputmask {
        min-height: 44px !important;
        font-size: 16px !important;
    }

    /* Contenedor principal de los selects de PrimeFaces */
    .step-body .ui-selectonemenu {
        min-height: 44px !important;
        padding: 0 !important;
        font-size: 16px !important;
    }

    /* Texto seleccionado */
    .step-body .ui-selectonemenu .ui-selectonemenu-label {
        min-height: 42px;
        padding: 0 44px 0 12px !important;
        font-size: 16px !important;
        line-height: 42px;
    }

    /* Área táctil de la flecha */
    .step-body .ui-selectonemenu .ui-selectonemenu-trigger {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
    }

    /* Prefijo +56 del teléfono */
    .step-body .telefono-input-group {
        min-height: 44px;
    }

    .step-body .telefono-input-group .ui-inputgroup-addon {
        display: flex;
        align-items: center;
        min-height: 44px;
        font-size: 16px !important;
    }

    /* Separación superior de la tarjeta de aceptación */
    .content-wrapper.terminos-content-wrapper {
        padding-top: 20px !important;
    }

    .consent-layout {
        gap: 16px;
        margin-top: 0;
        padding-left: 0;
    }

    body .ui-dialog.privacy-dialog {
        width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
    }

    .privacy-dialog__content {
        padding: 16px;
    }

    .privacy-dialog__actions {
        padding: 10px 12px;
    }
}

/* ==========================================================================
   12. ACCESIBILIDAD
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .aviso-admision {
        transition: none;
    }
}
