/*
   ================================================================
   BUSCA GLOBAL — MODAL
   ================================================================
*/

body:has(.busca-global-modal) {
    overflow: hidden;
}

.busca-global-modal,
.busca-global-modal * {
    box-sizing: border-box;
}

.busca-global-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    place-items: start center;
    overflow-y: auto;
    padding: clamp(26px, 7vh, 74px) 20px 32px;
    background: rgba(10, 24, 48, .58);
    backdrop-filter: blur(9px);
    -webkit-backdrop-filter: blur(9px);
    animation:
        busca-global-fundo-entrada
        260ms ease both;
}

.busca-global-modal__painel {
    width: min(880px, 100%);
    max-height: calc(100dvh - 90px);
    overflow: hidden;
    border: 1px solid rgba(217, 227, 245, .92);
    border-radius: 22px;
    background: #ffffff;
    color: #172033;
    animation:
        busca-global-painel-entrada
        420ms cubic-bezier(.16, 1, .3, 1) both;
}

.busca-global-modal__cabecalho {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: start;
    padding: 30px 32px 22px;
    border-bottom: 1px solid #edf1f7;
    background:
        linear-gradient(
            135deg,
            #f7faff 0%,
            #ffffff 72%);
}

.busca-global-modal__cabecalho > div {
    min-width: 0;
}

.busca-global-modal__kicker {
    display: inline-flex;
    margin-bottom: 8px;
    color: #1761e8;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.busca-global-modal__cabecalho h2 {
    margin: 0;
    color: #151d2f;
    font-size: clamp(24px, 3vw, 34px);
    font-weight: 900;
    letter-spacing: -.035em;
    line-height: 1.08;
}

.busca-global-modal__cabecalho p {
    max-width: 620px;
    margin: 10px 0 0;
    color: #758198;
    font-size: 13px;
    line-height: 1.5;
}

.busca-global-modal__fechar {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    padding: 0;
    border: 1px solid #e2e8f2;
    border-radius: 50%;
    background: #ffffff;
    color: #5c6880;
    font-family: inherit;
    cursor: pointer;
    transition:
        background-color .2s ease,
        color .2s ease,
        transform .2s ease;
}

.busca-global-modal__fechar:hover {
    background: #1761e8;
    color: #ffffff;
    transform: rotate(4deg) scale(1.04);
}

.busca-global-modal__fechar span {
    margin-top: -2px;
    font-size: 28px;
    font-weight: 300;
    line-height: 1;
}

.busca-global-modal__campo {
    position: relative;
    display: flex;
    min-height: 68px;
    align-items: center;
    gap: 12px;
    margin: 24px 32px 0;
    padding: 8px 10px 8px 18px;
    border: 2px solid #dce6f8;
    border-radius: 15px;
    background: #f8faff;
    transition:
        border-color .2s ease,
        background-color .2s ease;
}

.busca-global-modal__campo:focus-within {
    border-color: #1761e8;
    background: #ffffff;
}

.busca-global-modal__icone {
    display: grid;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    place-items: center;
    color: #1761e8;
}

.busca-global-modal__icone svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
}

.busca-global-modal__campo input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: #172033;
    font-family: inherit;
    font-size: 16px;
    font-weight: 650;
}

.busca-global-modal__campo input::placeholder {
    color: #9ba6b8;
    font-weight: 500;
}

.busca-global-modal__campo input::-webkit-search-cancel-button {
    display: none;
}

.busca-global-modal__limpar {
    min-height: 38px;
    padding: 0 13px;
    border: 0;
    border-radius: 9px;
    background: #eaf1ff;
    color: #1761e8;
    font-family: inherit;
    font-size: 11px;
    font-weight: 850;
    cursor: pointer;
}

.busca-global-modal__corpo {
    min-height: 210px;
    max-height: min(500px, calc(100dvh - 330px));
    overflow-y: auto;
    padding: 22px 32px 26px;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #c9d6ec transparent;
}

.busca-global-modal__inicial,
.busca-global-modal__vazio {
    display: flex;
    min-height: 210px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
}

.busca-global-modal__inicial-icone {
    display: grid;
    width: 62px;
    height: 62px;
    place-items: center;
    margin-bottom: 15px;
    border-radius: 18px;
    background: #edf3ff;
    color: #1761e8;
}

.busca-global-modal__inicial-icone svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.busca-global-modal__inicial strong,
.busca-global-modal__vazio strong {
    color: #1b2435;
    font-size: 15px;
    font-weight: 900;
}

.busca-global-modal__inicial p,
.busca-global-modal__vazio p {
    margin: 7px 0 0;
    color: #8893a6;
    font-size: 12px;
}

.busca-global-modal__carregando {
    display: flex;
    min-height: 210px;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 28px;
}

.busca-global-modal__spinner {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border: 3px solid #dce7fa;
    border-top-color: #1761e8;
    border-radius: 50%;
    animation:
        busca-global-spinner
        .75s linear infinite;
}

.busca-global-modal__carregando > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.busca-global-modal__carregando strong {
    color: #172033;
    font-size: 13px;
}

.busca-global-modal__carregando span:not(.busca-global-modal__spinner) {
    color: #8c97a9;
    font-size: 11px;
}

.busca-global-modal__resultado-topo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}

.busca-global-modal__resultado-topo > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.busca-global-modal__resultado-topo strong {
    color: #20293b;
    font-size: 13px;
    font-weight: 900;
}

.busca-global-modal__resultado-topo span {
    overflow: hidden;
    color: #8a95a8;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.busca-global-modal__quantidade {
    display: grid !important;
    min-width: 34px;
    height: 28px;
    place-items: center;
    padding: 0 8px;
    border-radius: 999px;
    background: #eaf1ff;
    color: #1761e8 !important;
    font-size: 10px !important;
    font-weight: 900;
}

.busca-global-modal__lista {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.busca-global-modal__item {
    display: grid;
    min-width: 0;
    grid-template-columns:
        68px
        minmax(0, 1fr)
        34px;
    gap: 14px;
    align-items: center;
    min-height: 82px;
    padding: 10px 12px;
    border: 1px solid #edf0f5;
    border-radius: 13px;
    background: #ffffff;
    color: #172033;
    text-decoration: none;
    transition:
        border-color .2s ease,
        background-color .2s ease,
        transform .2s ease;
}

.busca-global-modal__item:hover,
.busca-global-modal__item:focus-visible {
    border-color: #cfdcf4;
    background: #f8faff;
    color: #172033;
    transform: translateY(-1px);
}

.busca-global-modal__thumb {
    display: grid;
    width: 68px;
    height: 58px;
    place-items: center;
    overflow: hidden;
    border-radius: 10px;
    background: #eef3fb;
}

.busca-global-modal__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.busca-global-modal__thumb--fallback {
    color: #1761e8;
}

.busca-global-modal__thumb--fallback svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
}

.busca-global-modal__item-conteudo {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
}

.busca-global-modal__item-conteudo small {
    color: #1761e8;
    font-size: 8px;
    font-weight: 900;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.busca-global-modal__item-conteudo strong {
    overflow: hidden;
    color: #20293b;
    font-size: 13px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.busca-global-modal__item-conteudo > span {
    display: -webkit-box;
    overflow: hidden;
    color: #7d889b;
    font-size: 10px;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.busca-global-modal__item-abrir {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 50%;
    background: #edf3ff;
    color: #1761e8;
    font-size: 24px;
    font-weight: 300;
    line-height: 1;
    transition:
        background-color .2s ease,
        color .2s ease,
        transform .2s ease;
}

.busca-global-modal__item:hover
.busca-global-modal__item-abrir {
    background: #1761e8;
    color: #ffffff;
    transform: translateX(2px);
}

.busca-global-modal__rodape {
    display: flex;
    justify-content: flex-end;
    padding: 16px 32px 22px;
    border-top: 1px solid #edf1f7;
    background: #fbfcff;
}

.busca-global-modal__todos {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 0 19px;
    border-radius: 10px;
    background: #1761e8;
    color: #ffffff;
    font-size: 11px;
    font-weight: 850;
    text-decoration: none;
    transition:
        background-color .2s ease,
        transform .2s ease;
}

.busca-global-modal__todos:hover {
    background: #0f54cb;
    color: #ffffff;
    transform: translateY(-1px);
}

@keyframes busca-global-fundo-entrada {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes busca-global-painel-entrada {
    from {
        opacity: 0;
        transform:
            translate3d(0, -18px, 0)
            scale(.985);
    }

    to {
        opacity: 1;
        transform:
            translate3d(0, 0, 0)
            scale(1);
    }
}

@keyframes busca-global-spinner {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 700px) {
    .busca-global-modal {
        place-items: start center;
        padding:
            max(14px, env(safe-area-inset-top))
            12px
            max(14px, env(safe-area-inset-bottom));
        background: rgba(10, 24, 48, .68);
    }

    .busca-global-modal__painel {
        width: 100%;
        max-height:
            calc(
                100dvh -
                max(28px, env(safe-area-inset-top)) -
                max(28px, env(safe-area-inset-bottom)));
        border-radius: 17px;
    }

    .busca-global-modal__cabecalho {
        gap: 14px;
        padding: 22px 18px 17px;
    }

    .busca-global-modal__cabecalho h2 {
        font-size: 23px;
    }

    .busca-global-modal__cabecalho p {
        margin-top: 7px;
        font-size: 11px;
    }

    .busca-global-modal__fechar {
        width: 38px;
        height: 38px;
    }

    .busca-global-modal__campo {
        min-height: 60px;
        margin: 17px 16px 0;
        padding-left: 14px;
        border-radius: 12px;
    }

    .busca-global-modal__campo input {
        font-size: 14px;
    }

    .busca-global-modal__corpo {
        max-height:
            calc(100dvh - 285px);
        padding: 18px 16px 20px;
    }

    .busca-global-modal__item {
        grid-template-columns:
            54px
            minmax(0, 1fr)
            28px;
        gap: 10px;
        min-height: 72px;
        padding: 9px;
        border-radius: 11px;
    }

    .busca-global-modal__thumb {
        width: 54px;
        height: 50px;
        border-radius: 8px;
    }

    .busca-global-modal__item-conteudo strong {
        font-size: 11px;
    }

    .busca-global-modal__item-conteudo > span {
        font-size: 9px;
        -webkit-line-clamp: 1;
    }

    .busca-global-modal__item-abrir {
        width: 28px;
        height: 28px;
        font-size: 20px;
    }

    .busca-global-modal__rodape {
        padding: 13px 16px 16px;
    }

    .busca-global-modal__todos {
        width: 100%;
        min-height: 43px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .busca-global-modal,
    .busca-global-modal__painel,
    .busca-global-modal__spinner,
    .busca-global-modal__fechar,
    .busca-global-modal__campo,
    .busca-global-modal__item,
    .busca-global-modal__item-abrir,
    .busca-global-modal__todos {
        animation: none !important;
        transition: none !important;
    }
}
