:root {
    --azul: #2b6cb0;
    --azul-escuro: #1f4f82;
    --verde: #276749;
    --verde-claro: #f0fff4;
    --texto: #374151;
    --texto-secundario: #5f6b7a;
    --borda: #d7dee8;
    --fundo-suave: #f7fafc;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

[hidden] {
    display: none !important;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    background: #ffffff;
    color: var(--texto);
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.5;
}

body.sem-conexao {
    overflow: hidden;
}

button,
input,
select {
    min-height: 44px;
    font: inherit;
}

button,
a,
select {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.site-header {
    padding: calc(1.6rem + env(safe-area-inset-top)) calc(1rem + env(safe-area-inset-right)) 1.6rem calc(1rem + env(safe-area-inset-left));
    background: var(--azul);
    color: #ffffff;
}

.header-content {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.site-header h1 {
    font-size: 2rem;
    line-height: 1.15;
    letter-spacing: -0.04em;
}

.site-header p {
    margin-top: 0.3rem;
    opacity: 0.94;
}

.botao-compartilhar {
    flex: 0 0 auto;
    padding: 0.65rem 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.75);
    border-radius: 10px;
    background: #ffffff;
    color: var(--azul-escuro);
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
}

.botao-compartilhar:hover {
    background: #edf6ff;
}

.botao-compartilhar:active,
.botao-buscar:active,
.botao-recarregar:active {
    transform: translateY(1px);
}

main {
    flex: 1;
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 2.4rem calc(1.25rem + env(safe-area-inset-right)) 3rem calc(1.25rem + env(safe-area-inset-left));
}

.introducao {
    margin-bottom: 1.4rem;
}

.introducao h2 {
    color: #263244;
    font-size: clamp(1.35rem, 4vw, 1.7rem);
    line-height: 1.25;
}

.busca-container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px auto;
    gap: 0.7rem;
    align-items: stretch;
}

#campoBusca,
#filtroBairro {
    min-width: 0;
    width: 100%;
    padding: 0.85rem 1rem;
    border: 2px solid var(--borda);
    border-radius: 11px;
    background: #ffffff;
    color: var(--texto);
    font-size: 16px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#campoBusca::placeholder {
    color: #66758a;
}

#filtroBairro,
.ordenacao-resultados {
    cursor: pointer;
}

#campoBusca:focus,
#filtroBairro:focus,
.ordenacao-resultados:focus {
    outline: none;
    border-color: var(--verde);
    box-shadow: 0 0 0 3px rgba(39, 103, 73, 0.16);
}

.botao-buscar,
.botao-recarregar {
    padding: 0.85rem 1.25rem;
    border: 0;
    border-radius: 11px;
    background: var(--verde);
    color: #ffffff;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.botao-buscar:hover,
.botao-recarregar:hover {
    background: #22543d;
}

.botao-buscar:disabled {
    cursor: wait;
    opacity: 0.72;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible {
    outline: 3px solid #f6c344;
    outline-offset: 3px;
}

.status-compartilhamento {
    min-height: 1.5rem;
    margin-top: 0.45rem;
    color: var(--verde);
    font-size: 0.9rem;
    text-align: right;
}

.secao-resultados {
    margin-top: 1.15rem;
}

.controles-resultados {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

.ordenacao-resultados {
    max-width: 100%;
    padding: 0.6rem 2.2rem 0.6rem 0.8rem;
    border: 1px solid var(--borda);
    border-radius: 10px;
    background-color: var(--fundo-suave);
    color: var(--texto);
    font-size: 0.9rem;
    font-weight: 650;
}

.resultados-container {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.card {
    padding: 1.15rem;
    border: 1px solid var(--borda);
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(22, 34, 51, 0.04);
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.card:hover {
    border-color: #b8c4d2;
    box-shadow: 0 4px 14px rgba(22, 34, 51, 0.07);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.8rem;
    margin-bottom: 0.7rem;
}

.produto {
    color: #263244;
    font-size: 1.04rem;
    font-weight: 700;
    line-height: 1.35;
}

.preco {
    flex: 0 0 auto;
    padding: 0.27rem 0.68rem;
    border-radius: 8px;
    background: var(--verde-claro);
    color: var(--verde);
    font-size: 1.2rem;
    font-weight: 800;
    white-space: nowrap;
}

.card-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.18rem;
}

.loja {
    color: var(--texto);
    font-weight: 650;
}

.endereco,
.telefone {
    color: var(--azul-escuro);
    font-size: 0.91rem;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

.endereco:hover,
.telefone:hover {
    text-decoration-thickness: 2px;
}

.preco-unidade {
    margin-top: 0.16rem;
    color: var(--verde);
    font-size: 0.88rem;
    font-weight: 650;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    margin-top: 0.7rem;
    padding-top: 0.65rem;
    border-top: 1px solid #e8edf3;
    color: var(--texto-secundario);
    font-size: 0.8rem;
}

.categoria {
    flex: 0 0 auto;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: #ebf8ff;
    color: var(--azul-escuro);
    font-size: 0.75rem;
    font-weight: 650;
}

.mensagem {
    min-height: 1.5rem;
    margin-top: 1.5rem;
    color: var(--texto-secundario);
    text-align: center;
}

.campo-copia {
    position: fixed;
    top: 0;
    left: -9999px;
    opacity: 0;
}

footer {
    padding: 1.8rem calc(1rem + env(safe-area-inset-right)) calc(1.8rem + env(safe-area-inset-bottom)) calc(1rem + env(safe-area-inset-left));
    background: var(--fundo-suave);
    color: var(--texto-secundario);
    font-size: 0.84rem;
    text-align: center;
}

.tela-offline {
    position: fixed;
    z-index: 9999;
    inset: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: calc(1.5rem + env(safe-area-inset-top)) calc(1.5rem + env(safe-area-inset-right)) calc(1.5rem + env(safe-area-inset-bottom)) calc(1.5rem + env(safe-area-inset-left));
    background: #ffffff;
    text-align: center;
}

.offline-conteudo {
    width: min(100%, 340px);
}

.offline-icone {
    margin-bottom: 0.6rem;
    font-size: 3rem;
    line-height: 1;
}

.offline-conteudo h2 {
    color: #263244;
    font-size: 1.7rem;
}

.offline-conteudo > p {
    margin: 0.45rem 0 1.25rem;
    color: var(--texto-secundario);
}

.botao-recarregar {
    width: 100%;
}

.status-conexao {
    min-height: 1.5rem;
    margin-top: 0.7rem !important;
    color: var(--texto-secundario);
    font-size: 0.9rem;
}

@media (max-width: 640px) {
    .site-header {
        padding-top: calc(1.3rem + env(safe-area-inset-top));
        padding-bottom: 1.3rem;
    }

    .site-header h1 {
        font-size: 1.65rem;
    }

    .site-header p {
        font-size: 0.9rem;
    }

    .botao-compartilhar {
        padding: 0.58rem 0.75rem;
        font-size: 0.9rem;
    }

    main {
        padding-top: 1.7rem;
        padding-right: calc(1rem + env(safe-area-inset-right));
        padding-bottom: 2.5rem;
        padding-left: calc(1rem + env(safe-area-inset-left));
    }

    .busca-container {
        grid-template-columns: 1fr;
    }

    .status-compartilhamento {
        text-align: left;
    }

    .card-header {
        flex-wrap: wrap;
    }

    .card-footer {
        align-items: flex-start;
    }
}

@media (max-width: 380px) {
    .header-content {
        align-items: flex-start;
        flex-direction: column;
    }

    .botao-compartilhar {
        width: 100%;
    }

    .ordenacao-resultados {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
