/* =========================================================
   BUSCADOR (lupa en la cabecera)
   ========================================================= */

.busca-btn {
    display: none;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 40px;
    height: 40px;
    margin-left: auto;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: #12304a;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* Móvil: la lupa va fuera del menú, junto a las tres rayas */
@media (max-width: 600px) {
    .busca-btn {
        display: inline-flex;
    }
}

/* Ordenador y tableta: la lupa va dentro del menú, al final */
.busca-btn-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 38px;
    height: 38px;
    margin: 0 0 0 2px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: #12304a;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.2s ease;
}

.busca-btn-menu:hover {
    transform: scale(1.08);
}

.busca-btn-menu:focus-visible {
    outline: 2px solid #168bb0;
    outline-offset: 2px;
}

.busca-btn-menu svg {
    width: 21px;
    height: 21px;
}

@media (max-width: 600px) {
    .busca-btn-menu {
        display: none;
    }
}

.busca-btn svg {
    width: 24px;
    height: 24px;
}

.busca-btn:focus-visible {
    outline: 2px solid #168bb0;
    outline-offset: 2px;
}

/* velo oscuro detrás del buscador */
.busca-velo {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(18, 48, 74, 0.38);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.busca-velo.abierto {
    opacity: 1;
    visibility: visible;
}

.busca-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2001;
    box-sizing: border-box;
    max-height: 100vh;
    max-height: 100dvh;
    overflow-y: auto;
    padding: 14px 16px 20px;
    border-radius: 0 0 22px 22px;
    background: #ffffff;
    box-shadow: 0 18px 40px -12px rgba(18, 48, 74, 0.4);
    transform: translateY(-105%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0.25s ease;
}

.busca-panel.abierto {
    transform: translateY(0);
    visibility: visible;
}

.busca-fila {
    display: flex;
    align-items: center;
    gap: 10px;
}

.busca-campo {
    position: relative;
    flex: 1;
}

.busca-campo svg {
    position: absolute;
    left: 14px;
    top: 50%;
    width: 20px;
    height: 20px;
    transform: translateY(-50%);
    color: #206e95;
    pointer-events: none;
}

.busca-campo input {
    width: 100%;
    box-sizing: border-box;
    height: 48px;
    padding: 0 16px 0 42px;
    border: 1px solid #cfe3ee;
    border-radius: 999px;
    background: #eef6fa;
    color: #12304a;
    font: inherit;
    font-size: 16px;     /* 16px evita que el iPhone amplíe la pantalla */
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.busca-campo input:focus {
    border-color: #206e95;
    background: #ffffff;
}

.busca-cerrar {
    flex: none;
    padding: 10px 4px;
    border: 0;
    background: none;
    color: #206e95;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.busca-titulo {
    margin: 18px 4px 8px;
    color: #5b7487;
    font-size: 13px;
    font-weight: 600;
}

.busca-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 4px;
    padding: 0;
    list-style: none;
}

.busca-chips button {
    padding: 9px 14px;
    border: 1px solid #cfe3ee;
    border-radius: 999px;
    background: #e8f2f9;
    color: #206e95;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.busca-lista {
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
}

.busca-lista a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    border-bottom: 1px solid #e2edf1;
    color: #12304a;
    text-decoration: none;
}

.busca-lista li:last-child a {
    border-bottom: 0;
}

.busca-texto {
    flex: 1;
    min-width: 0;
}

.busca-texto strong {
    display: block;
    font-size: 16px;
    font-weight: 700;
}

.busca-texto span {
    display: block;
    margin-top: 2px;
    color: #5b7487;
    font-size: 13px;
    line-height: 1.35;
}

.busca-tipo {
    flex: none;
    padding: 3px 9px;
    border-radius: 999px;
    background: #e8f2f9;
    color: #206e95;
    font-size: 12px;
    font-weight: 600;
}

.busca-flecha {
    flex: none;
    color: #206e95;
    font-size: 18px;
}

.busca-nada {
    margin: 18px 4px 4px;
    color: #5b7487;
    font-size: 15px;
    line-height: 1.5;
}

.busca-nada a {
    color: #206e95;
    font-weight: 700;
}

/* Ordenador y tableta: el panel es una tarjeta centrada, no una barra de lado a lado */
@media (min-width: 601px) {
    .busca-panel {
        top: 84px;
        left: 50%;
        right: auto;
        width: min(580px, calc(100vw - 40px));
        max-height: calc(100vh - 120px);
        max-height: calc(100dvh - 120px);
        border-radius: 22px;
        opacity: 0;
        transform: translate(-50%, -16px);
        transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s ease;
    }

    .busca-panel.abierto {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .busca-velo, .busca-panel { transition: none; }
}


/* Ordenador: la lupa es una burbuja azul clarito, aparte de la cápsula del menú */
@media (min-width: 901px) {
    .busca-btn-menu {
        position: fixed;
        top: 27px;
        right: max(7%, calc((100% - 1280px) / 2));
        z-index: 1000;
        width: 48px;
        height: 48px;
        margin: 0;
        border: 1px solid rgba(32, 110, 149, 0.14);
        background-color: #e8f2f9;
        color: #206e95;
        box-shadow: 0 8px 26px -10px rgba(18, 48, 74, 0.22);
        transition: transform 0.2s ease;
    }

    .busca-btn-menu:hover {
        transform: scale(1.08);
    }

    .busca-btn-menu svg {
        width: 22px;
        height: 22px;
    }

    /* la cápsula se aparta para dejar sitio a la burbuja */
    :is(.hero, .site-header) .menu {
        right: calc(max(7%, (100% - 1280px) / 2) + 58px);
    }
}


/* Pantallas medianas (de 901 a 1100 px): el menú se hace un poco más compacto
   para que quepan la cápsula, la burbuja y el botón "Volver" sin pisarse */
@media (min-width: 901px) and (max-width: 1100px) {
    .busca-btn-menu {
        right: max(4%, calc((100% - 1280px) / 2));
    }

    :is(.hero, .site-header) .menu {
        right: calc(max(4%, (100% - 1280px) / 2) + 56px);
        padding: 6px 6px 6px 6px;
    }

    :is(.hero, .site-header) .menu > a,
    :is(.hero, .site-header) .menu .dropdown-toggle {
        padding: 9px 9px;
        font-size: 13.5px;
    }

    :is(.hero, .site-header) .menu > a::after,
    :is(.hero, .site-header) .menu .dropdown-toggle::after {
        left: 9px;
    }

    :is(.hero, .site-header) .menu > a:hover::after,
    :is(.hero, .site-header) .menu .dropdown:hover .dropdown-toggle::after,
    :is(.hero, .site-header) .menu a.is-active::after {
        width: calc(100% - 18px);
    }

    :is(.hero, .site-header) .menu a.menu-cta {
        margin-left: 4px;
        padding: 10px 16px;
        font-size: 13.5px;
    }
}

/* Todavía más compacto justo por encima de los 900 px */
@media (min-width: 901px) and (max-width: 960px) {
    :is(.hero, .site-header) .menu {
        padding-left: 4px;
    }

    :is(.hero, .site-header) .menu > a,
    :is(.hero, .site-header) .menu .dropdown-toggle {
        padding: 9px 6px;
        font-size: 13px;
    }

    :is(.hero, .site-header) .menu > a::after,
    :is(.hero, .site-header) .menu .dropdown-toggle::after {
        left: 6px;
    }

    :is(.hero, .site-header) .menu > a:hover::after,
    :is(.hero, .site-header) .menu .dropdown:hover .dropdown-toggle::after,
    :is(.hero, .site-header) .menu a.is-active::after {
        width: calc(100% - 12px);
    }

    :is(.hero, .site-header) .menu a.menu-cta {
        margin-left: 2px;
        padding: 9px 13px;
        font-size: 13px;
    }
}
