/*
 * Busqueda global del menu (vista theme/quickadmin/busqueda_global.php, comportamiento
 * en assets/js/busqueda_global.js). Ventana sobre toda la pagina, por encima de la
 * barra (z-index 10000) y del megamenu (10010).
 */

.busqueda-global {
    position: fixed;
    inset: 0;
    z-index: 10050;
    font-family: inherit;
}

.busqueda-global[hidden] {
    display: none;
}

body.busqueda-global-abierta {
    overflow: hidden;
}

.busqueda-global-fondo {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, .45);
}

.busqueda-global-ventana {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 660px;
    max-width: calc(100% - 24px);
    max-height: 76vh;
    margin: 12vh auto 0;
    overflow: hidden;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .3);
    color: #1f2937;
    animation: busqueda-global-entrar .14s ease-out;
}

@keyframes busqueda-global-entrar {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(.99);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .busqueda-global-ventana {
        animation: none;
    }
}

.busqueda-global svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ===== Campo ===== */

.busqueda-global-campo {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 12px;
    padding: 14px 16px 14px 20px;
    border-bottom: 1px solid #e5ebf1;
}

.busqueda-global-campo > svg {
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    color: #5b6472;
}

.busqueda-global-campo input {
    flex: 1;
    min-width: 0;
    height: 32px;
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    box-shadow: none;
    color: #1f2937;
    font: inherit;
    font-size: 17px;
}

.busqueda-global-esc {
    flex: 0 0 auto;
    padding: 3px 8px;
    border: 1px solid #dbe3ec;
    border-radius: 6px;
    background: #fafbfc;
    color: #5b6472;
    font-size: 11px;
    cursor: pointer;
}

/* ===== Resultados ===== */

.busqueda-global-cuerpo {
    position: relative;
    flex: 1 1 auto;
    padding: 6px 8px 8px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.busqueda-global-seccion {
    padding: 8px 10px 4px;
    color: #5b6472;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
}

.busqueda-global-resultados {
    margin: 0;
    padding: 0;
    list-style: none;
}

.busqueda-global-opcion {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
}

.busqueda-global-opcion.busqueda-global-activa {
    background: rgba(var(--siag-brand-rgb, 72, 136, 190), .09);
}

.busqueda-global-icono {
    display: flex;
    flex: 0 0 32px;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #eef0f3;
    color: #374151;
    font-size: 12px;
    font-weight: 700;
}

.busqueda-global-icono-phva {
    background: var(--siag-brand-solido, #3d74a3);
    color: var(--siag-brand-contraste, #fff);
}

.busqueda-global-icono-tipo {
    background: rgba(var(--siag-brand-rgb, 72, 136, 190), .1);
    color: var(--siag-brand, #4888be);
}

.busqueda-global-icono svg {
    width: 16px;
    height: 16px;
}

.busqueda-global-textos {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
}

.busqueda-global-nombre {
    overflow: hidden;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.busqueda-global-activa .busqueda-global-nombre {
    color: var(--siag-brand-dark-3, #2f6492);
}

.busqueda-global-ruta {
    overflow: hidden;
    color: #5b6472;
    font-size: 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.busqueda-global-tambien {
    margin-left: 4px;
    padding: 1px 7px;
    border-radius: 10px;
    background: #f3f4f6;
    font-size: 11px;
}

.busqueda-global-enter {
    flex: 0 0 auto;
    visibility: hidden;
    color: #5b6472;
    font-size: 14px;
}

.busqueda-global-activa .busqueda-global-enter {
    visibility: visible;
}

.busqueda-global mark {
    padding: 0 1px;
    border-radius: 3px;
    background: rgba(var(--siag-brand-rgb, 72, 136, 190), .2);
    color: inherit;
}

.busqueda-global-vacio {
    padding: 28px 24px 32px;
    color: #5b6472;
    font-size: 13px;
    text-align: center;
}

/* ===== Pie con atajos ===== */

.busqueda-global-pie {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
    padding: 10px 20px;
    border-top: 1px solid #e5ebf1;
    background: #fafbfc;
    color: #5b6472;
    font-size: 12px;
}

.busqueda-global-pie kbd {
    display: inline-block;
    min-width: 18px;
    margin-right: 2px;
    padding: 1px 5px;
    border: 1px solid #dbe3ec;
    border-radius: 5px;
    background: #fff;
    box-shadow: none;
    color: #374151;
    font-family: inherit;
    font-size: 11px;
    text-align: center;
}

.busqueda-global-pie-total {
    margin-left: auto;
}

/* ===== Pantalla pequena: casi todo el alto, sin atajos de teclado ===== */

@media (max-width: 600px) {
    .busqueda-global-ventana {
        max-width: calc(100% - 16px);
        max-height: calc(100vh - 16px);
        margin-top: 8px;
    }

    .busqueda-global-pie > span:not(.busqueda-global-pie-total) {
        display: none;
    }

    .busqueda-global-pie-total {
        margin-left: 0;
    }
}

/* En pantalla tactil no hay Esc: el boton dice "Cerrar" */
.busqueda-global-esc-toque {
    display: none;
}

@media (hover: none) {
    .busqueda-global-esc-tecla {
        display: none;
    }

    .busqueda-global-esc-toque {
        display: inline;
    }

    .busqueda-global-esc {
        min-height: 36px;
        padding: 4px 12px;
        font-size: 13px;
    }
}
