/**
 * Select nativo — appearance: base-select (mejora progresiva)
 * Chrome 135+. Sin flecha desplegable (picker-icon oculto).
 */

/* —— Fallback: select clásico (sin flecha SVG) —— */
.ae-admin-shell select.form-select,
.ae-admin-shell select.ae-native-select {
    box-sizing: border-box;
    height: 2.5rem;
    min-height: 2.5rem;
    padding: 0 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 2.5rem;
    color: var(--color-on-surface);
    border-radius: var(--radius-lg);
    border: none;
    background-color: #fff;
    background-image: none;
    box-shadow: inset 0 0 0 1px rgba(136, 115, 99, 0.16), var(--shadow-xs);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    max-width: 100%;
    transition: box-shadow 0.2s ease;
}

.ae-admin-shell select.form-select:hover,
.ae-admin-shell select.ae-native-select:hover {
    box-shadow: inset 0 0 0 1.5px rgba(239, 135, 25, 0.45), 0 4px 14px rgba(239, 135, 25, 0.08);
}

.ae-admin-shell select.form-select:focus,
.ae-admin-shell select.ae-native-select:focus {
    outline: 0;
    box-shadow: inset 0 0 0 2px var(--ae-color-primary), 0 0 0 4px var(--ae-color-focus);
}

.ae-admin-shell select.form-select:disabled,
.ae-admin-shell select.ae-native-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--color-surface-container-low);
}

.ae-admin-shell select.form-select:has(option[value=""]:checked),
.ae-admin-shell select.form-select.ae-select-empty {
    color: rgba(85, 67, 53, 0.5);
    font-weight: 400;
}

/* —— base-select —— */
@supports (appearance: base-select) {
    .ae-admin-shell select.form-select,
    .ae-admin-shell select.ae-native-select {
        appearance: base-select;
        -webkit-appearance: base-select;

        box-sizing: border-box;
        height: 2.5rem;
        min-height: 2.5rem;
        max-height: 2.5rem;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        padding: 0 1rem;
        font-size: 0.875rem;
        font-weight: 500;
        line-height: 1.25;
        color: var(--color-on-surface);
        background-color: #fff;
        background-image: none;
        border: none;
        border-radius: var(--radius-lg);
        box-shadow: inset 0 0 0 1px rgba(136, 115, 99, 0.16), var(--shadow-xs);
        cursor: pointer;
        max-width: 100%;
        width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        transition: box-shadow 0.2s ease;
    }

    .ae-admin-shell select.form-select:hover,
    .ae-admin-shell select.ae-native-select:hover {
        box-shadow: inset 0 0 0 1.5px rgba(239, 135, 25, 0.45), 0 4px 14px rgba(239, 135, 25, 0.08);
    }

    .ae-admin-shell select.form-select:focus,
    .ae-admin-shell select.ae-native-select:focus,
    .ae-admin-shell select.form-select:open,
    .ae-admin-shell select.ae-native-select:open {
        outline: 0;
        box-shadow: inset 0 0 0 2px var(--ae-color-primary), 0 0 0 4px var(--ae-color-focus);
    }

    .ae-admin-shell select.form-select:disabled,
    .ae-admin-shell select.ae-native-select:disabled {
        opacity: 0.6;
        cursor: not-allowed;
        background-color: var(--color-surface-container-low);
    }

    .ae-admin-shell select.form-select:has(option[value=""]:checked),
    .ae-admin-shell select.form-select.ae-select-empty {
        color: rgba(85, 67, 53, 0.5);
        font-weight: 400;
    }

    /* Sin flecha desplegable (sin reservar espacio en el flex) */
    .ae-admin-shell select.form-select::picker-icon,
    .ae-admin-shell select.ae-native-select::picker-icon {
        display: none;
        width: 0;
        height: 0;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }

    /* Panel desplegable */
    .ae-admin-shell select.form-select::picker(select),
    .ae-admin-shell select.ae-native-select::picker(select) {
        appearance: base-select;
        -webkit-appearance: base-select;

        top: calc(anchor(bottom) + 0.35rem);
        left: anchor(left);
        right: anchor(right);
        width: anchor-size(width);
        min-width: anchor-size(width);
        max-width: min(anchor-size(width), 100vw);
        margin: 0;
        position-try-fallbacks: flip-block;
        padding: 0.35rem;
        background-color: var(--color-surface-container-lowest);
        border: none;
        border-radius: var(--radius-xl);
        box-shadow: var(--shadow-lg);
        max-block-size: min(16rem, 50vh);
        overflow-y: auto;
    }

    .ae-admin-shell select.form-select option,
    .ae-admin-shell select.ae-native-select option {
        padding: 0.5rem 0.75rem;
        margin-block: 0.1rem;
        border-radius: var(--radius-default);
        font-size: 0.875rem;
        font-weight: 500;
        line-height: 1.35;
        color: var(--color-on-surface);
        background-color: transparent;
        white-space: normal;
    }

    .ae-admin-shell select.form-select option[value=""],
    .ae-admin-shell select.ae-native-select option[value=""] {
        color: rgba(85, 67, 53, 0.55);
        font-weight: 400;
    }

    .ae-admin-shell select.form-select option:hover,
    .ae-admin-shell select.ae-native-select option:hover {
        background-color: var(--color-primary-fixed);
    }

    .ae-admin-shell select.form-select option:checked,
    .ae-admin-shell select.ae-native-select option:checked {
        background-color: rgba(255, 220, 195, 0.55);
        color: var(--color-on-primary-container);
    }

    .ae-admin-shell select.form-select option::checkmark,
    .ae-admin-shell select.ae-native-select option::checkmark {
        color: var(--ae-color-primary);
        font-size: 0.875rem;
        margin-inline-end: 0.35rem;
    }

    .ae-admin-shell select.ae-select-thematic option {
        line-height: 1.4;
    }
}
