/* =========================================================
   MUSICALWORLD — INDEX
   Arquivo: pesquisa.css

   Responsabilidade:
   Painel de pesquisa criado pelo painel-pesquisa.js,
   incluindo resultados e estados da busca.
   ========================================================= */

/*
O painel é criado diretamente no BODY pelo
painel-pesquisa.js.

Não usamos position:absolute aqui porque o
.app-container possui overflow:hidden.
*/

/* =========================================================
   PAINEL DE BUSCA
   ========================================================= */

.search-overlay {
    position: fixed;

    inset: 0;

    width: 100%;
    height: 100%;

    background-color: #ffffff;

    z-index: 9999;

    display: flex;

    flex-direction: column;

    opacity: 0;

    visibility: hidden;

    pointer-events: none;

    transform: translateY(8px);

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease,
        transform 0.2s ease;
}

.search-overlay.ativo {
    opacity: 1;

    visibility: visible;

    pointer-events: auto;

    transform: translateY(0);
}

/* =========================================================
   CABEÇALHO DA BUSCA
   ========================================================= */

.search-overlay-header {
    width: 100%;

    display: flex;

    align-items: center;

    gap: 10px;

    padding: 10px 14px;

    background-color: #ffffff;

    border-bottom: 1px solid #eeeeee;

    flex-shrink: 0;
}

/* =========================================================
   WRAPPER DO INPUT
   ========================================================= */

.search-overlay-input-wrapper {
    position: relative;

    flex: 1;

    min-width: 0;

    display: flex;

    align-items: center;

    background: transparent;

    border: 0;

    border-radius: 0;

    padding: 0;

    box-shadow: none;
}

/* =========================================================
   ÍCONE DA BUSCA
   ========================================================= */

.search-overlay-icon {
    position: absolute;

    left: 12px;

    width: 16px;
    height: 16px;

    color: #999eaa;

    pointer-events: none;

    flex-shrink: 0;
}

/* =========================================================
   INPUT DA BUSCA
   ========================================================= */

.search-overlay-input {
    width: 100%;

    height: 38px;

    padding: 0 12px 0 36px;

    border: 1px solid #e5e5e8;

    border-radius: 9px;

    outline: none;

    background-color: #ffffff;

    color: #20222b;

    font-family: inherit;

    font-size: 13px;

    font-weight: 500;

    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

.search-overlay-input::placeholder {
    color: #a0a4ae;
}

.search-overlay-input:hover {
    border-color: #dddddf;
}

.search-overlay-input:focus {
    border-color: #d5d0e8;

    box-shadow:
        0 0 0 2px rgba(109, 74, 255, 0.05);
}

/* =========================================================
   BOTÃO CANCELAR
   ========================================================= */

.search-overlay-cancelar {
    flex: 0 0 auto;

    height: 38px;

    padding: 0 2px;

    border: 0;

    background: transparent;

    color: #6d4aff;

    font-family: inherit;

    font-size: 12px;

    font-weight: 700;

    cursor: pointer;

    white-space: nowrap;

    transition:
        opacity 0.18s ease;
}

.search-overlay-cancelar:hover {
    opacity: 0.7;
}

.search-overlay-cancelar:active {
    opacity: 0.5;
}

/* =========================================================
   RESULTADOS
   ========================================================= */

.search-results {
    flex: 1;

    width: 100%;

    overflow-y: auto;

    overflow-x: hidden;

    padding: 0;

    background-color: #ffffff;

    -webkit-overflow-scrolling: touch;
}

/* =========================================================
   ITEM DO RESULTADO
   ========================================================= */

.search-result-item {
    display: flex;

    align-items: center;

    width: 100%;

    min-height: 68px;

    padding: 9px 16px;

    gap: 12px;

    border-bottom: 1px solid #eeeeee;

    background-color: #ffffff;

    color: inherit;

    text-decoration: none;

    cursor: pointer;

    transition:
        background-color 0.15s ease;
}

.search-result-item:hover {
    background-color: #fafafa;
}

.search-result-item:active {
    background-color: #f5f5f7;
}

/* =========================================================
   AVATAR DO RESULTADO
   ========================================================= */

.search-result-avatar-wrapper {
    width: 46px;
    height: 46px;

    min-width: 46px;
    min-height: 46px;

    flex: 0 0 46px;

    overflow: hidden;

    border-radius: 50%;

    background-color: #f0edff;
}

.search-result-avatar {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: cover;
}

.search-result-avatar-fallback {
    width: 100%;
    height: 100%;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background-color: #f0edff;

    color: #6d4aff;

    font-size: 13px;

    font-weight: 800;
}

/* =========================================================
   INFORMAÇÕES DO RESULTADO
   ========================================================= */

.search-result-info {
    flex: 1;

    min-width: 0;

    overflow: hidden;
}

.search-result-name {
    margin: 0 0 4px 0;

    color: #20222b;

    font-size: 13px;

    font-weight: 800;

    line-height: 1.2;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;
}

.search-result-location,
.search-result-genre {
    display: flex;

    align-items: center;

    min-width: 0;

    width: 100%;

    gap: 5px;

    color: #858a96;

    font-size: 10px;

    font-weight: 500;

    line-height: 1.35;

    overflow: hidden;
}

.search-result-location {
    margin-bottom: 2px;
}

.search-result-location svg,
.search-result-genre svg {
    width: 12px;
    height: 12px;

    min-width: 12px;

    flex: 0 0 12px;

    color: #999da7;
}

.search-result-location span,
.search-result-genre span {
    display: block;

    min-width: 0;

    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;
}

/* =========================================================
   SETA DO RESULTADO
   ========================================================= */

.search-result-arrow {
    width: 16px;
    height: 16px;

    min-width: 16px;

    flex: 0 0 16px;

    color: #a5a9b4;

    transition:
        transform 0.15s ease,
        color 0.15s ease;
}

.search-result-item:hover .search-result-arrow {
    color: #6d4aff;

    transform: translateX(2px);
}

/* =========================================================
   ESTADO VAZIO
   ========================================================= */

.search-estado-vazio {
    width: 100%;

    margin: 0;

    padding: 38px 24px;

    color: #9296a3;

    font-size: 12px;

    font-weight: 500;

    line-height: 1.5;

    text-align: center;
}

/* =========================================================
   SEM RESULTADOS
   ========================================================= */

.search-estado-sem-resultados {
    width: 100%;

    min-height: 180px;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    padding: 30px 24px;

    text-align: center;
}

.search-estado-sem-resultados svg {
    width: 28px;
    height: 28px;

    margin-bottom: 10px;

    color: #b1b4be;
}

.search-estado-sem-resultados p {
    margin: 0;

    color: #8b909c;

    font-size: 12px;

    font-weight: 600;
}

/* =========================================================
   CARREGANDO
   ========================================================= */

.search-estado-carregando {
    width: 100%;

    min-height: 180px;

    display: flex;

    flex-direction: column;

    align-items: center;

    justify-content: center;

    padding: 30px 24px;

    text-align: center;
}

.search-estado-carregando p {
    margin: 11px 0 0;

    color: #8b909c;

    font-size: 11px;

    font-weight: 600;
}

.search-loading-spinner {
    width: 23px;
    height: 23px;

    border: 2px solid #e6e4ef;

    border-top-color: #6d4aff;

    border-radius: 50%;

    animation:
        search-spinner 0.7s linear infinite;
}

@keyframes search-spinner {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* =========================================================
   ERRO
   ========================================================= */

.search-estado-erro {
    width: 100%;

    min-height: 180px;

    display: flex;

    align-items: center;

    justify-content: center;

    padding: 30px 24px;

    text-align: center;
}

.search-estado-erro p {
    margin: 0;

    color: #8b909c;

    font-size: 12px;

    font-weight: 600;
}

/* =========================================================
   ACESSIBILIDADE DA PESQUISA
   ========================================================= */

.search-result-item:focus-visible,
.search-overlay-cancelar:focus-visible {
    outline: 2px solid #6d4aff;

    outline-offset: -2px;
}

.search-overlay-input:focus-visible {
    outline: none;
}