/* ==========================================================================
   Markad Publicidad Estudio — Selector personalizado reutilizable
   Archivo: assets/css/components/custom-select.css
   ========================================================================== */


/* ==========================================================================
   1. CONTENEDOR
   ========================================================================== */

.mk-custom-select {
    position: relative;
    width: 100%;
    min-width: 0;
    margin: 0;

    color: var(--mk-indigo-950);
    font-family: var(--mk-font-body);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;

    isolation: isolate;
}


/* ==========================================================================
   2. ETIQUETA
   ========================================================================== */

.mk-custom-select > .mk-custom-select__label {
    display: block;
    margin: 0 0 0.65rem;

    color: var(--mk-indigo-950);
    font-family: var(--mk-font-body);
    font-size: 0.875rem;
    font-weight: 800;
    line-height: 1.35;
}


/* ==========================================================================
   3. CONTROL
   ========================================================================== */

.mk-custom-select > .mk-custom-select__control {
    position: relative;
    width: 100%;
    min-width: 0;
}


/* ==========================================================================
   4. SELECT NATIVO
   ========================================================================== */

/*
| Antes de que JavaScript active el componente, el selector nativo permanece
| completamente funcional.
*/

.mk-custom-select .mk-custom-select__native {
    display: block;
    width: 100%;
    min-height: 3.5rem;
    margin: 0;
    padding: 0.875rem 3.25rem 0.875rem 1.15rem;

    border: 1px solid rgba(11, 22, 66, 0.16);
    border-radius: var(--mk-border-radius-md);
    outline: 0;

    color: var(--mk-indigo-950);
    background-color: var(--mk-white);

    font-family: var(--mk-font-body);
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.25;

    cursor: pointer;
    appearance: auto;

    transition:
        border-color var(--mk-transition-base),
        box-shadow var(--mk-transition-base),
        background-color var(--mk-transition-base);
}

.mk-custom-select .mk-custom-select__native:hover {
    border-color: rgba(198, 57, 221, 0.48);
}

.mk-custom-select .mk-custom-select__native:focus-visible {
    border-color: var(--mk-magenta-500);
    box-shadow:
        0 0 0 4px rgba(198, 57, 221, 0.14),
        0 8px 24px rgba(11, 22, 66, 0.08);
}


/*
| El selector se oculta visualmente únicamente después de que JavaScript
| agregue la clase is-enhanced.
*/

.mk-custom-select.is-enhanced .mk-custom-select__native {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;

    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);

    border: 0;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
}


/* ==========================================================================
   5. BOTÓN PRINCIPAL
   ========================================================================== */

.mk-custom-select .mk-custom-select__trigger {
    position: relative;
    z-index: 2;

    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;

    width: 100%;
    min-height: 3.5rem;
    margin: 0;
    padding: 0.875rem 0.85rem 0.875rem 1.15rem;

    border: 1px solid rgba(11, 22, 66, 0.16);
    border-radius: var(--mk-border-radius-md);
    outline: 0;

    color: var(--mk-indigo-950);
    background-color: var(--mk-white);

    font-family: var(--mk-font-body);
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.25;
    text-align: left;

    cursor: pointer;
    appearance: none;

    box-shadow:
        0 1px 2px rgba(11, 22, 66, 0.02),
        0 8px 22px rgba(11, 22, 66, 0.04);

    transition:
        color var(--mk-transition-base),
        border-color var(--mk-transition-base),
        background-color var(--mk-transition-base),
        box-shadow var(--mk-transition-base),
        transform var(--mk-transition-base);
}

.mk-custom-select.is-enhanced .mk-custom-select__trigger {
    display: flex;
}

.mk-custom-select .mk-custom-select__trigger:hover {
    border-color: rgba(198, 57, 221, 0.48);
    background-color: rgba(198, 57, 221, 0.025);

    box-shadow:
        0 1px 2px rgba(11, 22, 66, 0.03),
        0 12px 30px rgba(11, 22, 66, 0.08);
}

.mk-custom-select .mk-custom-select__trigger:focus-visible {
    border-color: var(--mk-magenta-500);

    box-shadow:
        0 0 0 4px rgba(198, 57, 221, 0.14),
        0 12px 30px rgba(11, 22, 66, 0.08);
}

.mk-custom-select.is-open .mk-custom-select__trigger {
    border-color: var(--mk-magenta-500);
    border-bottom-right-radius: calc(
        var(--mk-border-radius-md) * 0.7
    );
    border-bottom-left-radius: calc(
        var(--mk-border-radius-md) * 0.7
    );

    box-shadow:
        0 0 0 4px rgba(198, 57, 221, 0.1),
        0 14px 34px rgba(11, 22, 66, 0.1);
}


/* ==========================================================================
   6. TEXTO DEL VALOR
   ========================================================================== */

.mk-custom-select .mk-custom-select__trigger > span {
    display: block;
    min-width: 0;
    overflow: hidden;

    color: inherit;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ==========================================================================
   7. ICONO PRINCIPAL
   ========================================================================== */

.mk-custom-select .mk-custom-select__icon {
    display: block;
    flex: 0 0 auto;

    width: 2rem;
    height: 2rem;
    padding: 0.38rem;

    border: 1px solid rgba(198, 57, 221, 0.18);
    border-radius: var(--mk-border-radius-pill);

    color: var(--mk-magenta-500);
    background-color: rgba(198, 57, 221, 0.08);

    transform: rotate(0deg);

    transition:
        color var(--mk-transition-base),
        border-color var(--mk-transition-base),
        background-color var(--mk-transition-base),
        transform var(--mk-transition-base);
}

.mk-custom-select.is-open .mk-custom-select__icon {
    color: var(--mk-white);
    border-color: var(--mk-magenta-500);
    background-color: var(--mk-magenta-500);
    transform: rotate(180deg);
}


/* ==========================================================================
   8. MENÚ DESPLEGABLE
   ========================================================================== */

.mk-custom-select .mk-custom-select__dropdown {
    position: absolute;
    top: calc(100% + 0.55rem);
    right: 0;
    left: 0;
    z-index: 20;

    width: 100%;
    max-height: 18rem;
    margin: 0;
    padding: 0.45rem;

    overflow-x: hidden;
    overflow-y: auto;

    border: 1px solid rgba(11, 22, 66, 0.12);
    border-radius: var(--mk-border-radius-md);

    background-color: var(--mk-white);

    box-shadow:
        0 18px 50px rgba(11, 22, 66, 0.15),
        0 4px 14px rgba(11, 22, 66, 0.06);

    opacity: 0;
    visibility: hidden;
    transform: translateY(-0.45rem) scale(0.985);
    transform-origin: top center;
    pointer-events: none;

    transition:
        opacity var(--mk-transition-base),
        visibility var(--mk-transition-base),
        transform var(--mk-transition-base);
}

.mk-custom-select .mk-custom-select__dropdown[hidden] {
    display: none;
}

.mk-custom-select.is-open .mk-custom-select__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}


/* ==========================================================================
   9. OPCIONES
   ========================================================================== */

.mk-custom-select .mk-custom-select__option {
    position: relative;

    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;

    width: 100%;
    min-height: 3rem;
    margin: 0;
    padding: 0.75rem 0.9rem;

    border: 0;
    border-radius: calc(
        var(--mk-border-radius-md) * 0.7
    );
    outline: 0;

    color: var(--mk-indigo-950);
    background-color: transparent;

    font-family: var(--mk-font-body);
    font-size: 0.925rem;
    font-weight: 700;
    line-height: 1.35;
    text-align: left;

    cursor: pointer;
    appearance: none;

    transition:
        color var(--mk-transition-base),
        background-color var(--mk-transition-base),
        transform var(--mk-transition-base);
}

.mk-custom-select .mk-custom-select__option + .mk-custom-select__option {
    margin-top: 0.18rem;
}

.mk-custom-select .mk-custom-select__option:hover,
.mk-custom-select .mk-custom-select__option.is-highlighted {
    color: var(--mk-magenta-700);
    background-color: rgba(198, 57, 221, 0.075);
}

.mk-custom-select .mk-custom-select__option:focus-visible {
    color: var(--mk-magenta-700);
    background-color: rgba(198, 57, 221, 0.09);

    box-shadow: inset 0 0 0 2px rgba(198, 57, 221, 0.28);
}

.mk-custom-select .mk-custom-select__option.is-selected {
    color: var(--mk-white);
    background-color: var(--mk-indigo-950);

    box-shadow: 0 7px 18px rgba(11, 22, 66, 0.16);
}

.mk-custom-select .mk-custom-select__option.is-selected:hover,
.mk-custom-select .mk-custom-select__option.is-selected:focus-visible,
.mk-custom-select .mk-custom-select__option.is-selected.is-highlighted {
    color: var(--mk-white);
    background-color: var(--mk-indigo-950);
}

.mk-custom-select .mk-custom-select__option > span {
    display: block;
    min-width: 0;
}

.mk-custom-select .mk-custom-select__option > svg {
    display: block;
    flex: 0 0 auto;

    width: 1.05rem;
    height: 1.05rem;

    color: var(--mk-magenta-400);
}


/* ==========================================================================
   10. TEXTO DE AYUDA
   ========================================================================== */

.mk-custom-select > .mk-custom-select__help {
    margin: 0.7rem 0 0;

    color: rgba(11, 22, 66, 0.64);
    font-family: var(--mk-font-body);
    font-size: 0.8rem;
    font-weight: 400;
    line-height: 1.55;
}


/* ==========================================================================
   11. ESTADOS
   ========================================================================== */

.mk-custom-select.is-disabled {
    opacity: 0.58;
}

.mk-custom-select.is-disabled .mk-custom-select__trigger,
.mk-custom-select.is-disabled .mk-custom-select__native {
    cursor: not-allowed;
}

.mk-custom-select.has-error .mk-custom-select__native,
.mk-custom-select.has-error .mk-custom-select__trigger {
    border-color: #c93b52;
}

.mk-custom-select.has-error .mk-custom-select__help {
    color: #a9263d;
}


/* ==========================================================================
   12. INTEGRACIÓN CON EL SIMULADOR
   ========================================================================== */

.mk-growth-simulator .mk-custom-select {
    width: 100%;
}

.mk-growth-simulator
.mk-custom-select
.mk-custom-select__trigger {
    background-color: var(--mk-white);
}

.mk-growth-simulator
.mk-custom-select.is-open
.mk-custom-select__dropdown {
    z-index: 40;
}


/*
| Evita que la tarjeta corte el menú cuando se encuentra abierto.
*/

.mk-growth-simulator
.mk-custom-select:has(.mk-custom-select__trigger[aria-expanded="true"]) {
    z-index: 30;
}


/* ==========================================================================
   13. TABLETS
   ========================================================================== */

@media (max-width: 56.25rem) {

    .mk-custom-select .mk-custom-select__trigger,
    .mk-custom-select .mk-custom-select__native {
        min-height: 3.4rem;
    }

    .mk-custom-select .mk-custom-select__dropdown {
        max-height: 16rem;
    }

}


/* ==========================================================================
   14. MÓVILES
   ========================================================================== */

@media (max-width: 37.5rem) {

    .mk-custom-select > .mk-custom-select__label {
        margin-bottom: 0.55rem;
        font-size: 0.84rem;
    }

    .mk-custom-select .mk-custom-select__trigger,
    .mk-custom-select .mk-custom-select__native {
        min-height: 3.35rem;
        padding-top: 0.8rem;
        padding-bottom: 0.8rem;

        font-size: 0.925rem;
    }

    .mk-custom-select .mk-custom-select__trigger {
        padding-right: 0.7rem;
        padding-left: 1rem;
    }

    .mk-custom-select .mk-custom-select__icon {
        width: 1.9rem;
        height: 1.9rem;
    }

    .mk-custom-select .mk-custom-select__dropdown {
        top: calc(100% + 0.4rem);
        max-height: min(17rem, 48vh);
        padding: 0.4rem;
    }

    .mk-custom-select .mk-custom-select__option {
        min-height: 3.1rem;
        padding: 0.78rem 0.85rem;
        font-size: 0.9rem;
    }

    .mk-custom-select > .mk-custom-select__help {
        margin-top: 0.6rem;
        font-size: 0.775rem;
    }

}


/* ==========================================================================
   15. MOVIMIENTO REDUCIDO
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {

    .mk-custom-select .mk-custom-select__native,
    .mk-custom-select .mk-custom-select__trigger,
    .mk-custom-select .mk-custom-select__icon,
    .mk-custom-select .mk-custom-select__dropdown,
    .mk-custom-select .mk-custom-select__option {
        transition-duration: 0.01ms;
        transition-delay: 0ms;
    }

}