/* ============================================================================
   AVISO DE COOKIES (LGPD) + CENTRAL DE PREFERÊNCIAS
   Markup: includes/aviso-cookies.php · JS: assets/js/tools/aviso-cookies.buscaorganica.js
   Card claro no canto inferior esquerdo (o WhatsApp ocupa o direito).
   ============================================================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.box-cookies.hide,
.cookie-manager.hide {
    display: none;
}

.box-cookies {
    position: fixed;
    text-align: left;
    left: 24px;
    bottom: 24px;
    z-index: 9999;
    width: 400px;
    max-width: calc(100% - 48px);
    padding: 22px 22px 18px;
    background: #fff;
    color: #333;
    border: 1px solid #e6e6ee;
    border-top: 4px solid var(--main);
    border-radius: 14px;
    box-shadow: 0 18px 50px rgba(6, 64, 31, .18);
    animation: cookies-in .35s ease-out;
}

.box-cookies .cookies-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.box-cookies .cookies-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: #f4f5fb;
    color: var(--main);
}

.box-cookies .cookies-title {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.3;
    color: var(--main);
}

.box-cookies .msg-cookies {
    margin: 0 0 16px;
    font-size: 14px;
    line-height: 1.6;
    color: #555;
}

.box-cookies .msg-cookies a {
    color: var(--main);
    font-weight: 600;
    text-decoration: underline;
}

.box-cookies .cookies-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.box-cookies .btn-cookies-link {
    grid-column: 1 / -1;
    justify-self: center;
}

/* Botões (banner e central) */
.btn-cookies {
    padding: 11px 16px;
    border: 2px solid var(--main);
    border-radius: 30px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background .2s, color .2s, transform .2s;
}

.btn-cookies-accept {
    background: var(--main);
    color: #fff;
}

.btn-cookies-accept:hover {
    background: var(--main-strong);
    border-color: var(--main-strong);
}

.btn-cookies-reject {
    background: #fff;
    color: var(--main);
}

.btn-cookies-reject:hover {
    background: #f4f5fb;
}

.btn-cookies:focus-visible,
.btn-cookies-link:focus-visible,
.cookie-manager-close:focus-visible {
    outline: 3px solid var(--secondary);
    outline-offset: 2px;
}

.btn-cookies-link {
    padding: 6px 4px;
    background: none;
    border: 0;
    font: inherit;
    font-size: 13px;
    color: #666;
    text-decoration: underline;
    cursor: pointer;
}

.btn-cookies-link:hover {
    color: var(--main);
}

/* Central de preferências (modal) */
.cookie-manager {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(6, 40, 20, .6);
}

body.cookie-manager-open {
    overflow: hidden;
}

.cookie-manager-inner {
    position: relative;
    text-align: left;
    width: 100%;
    max-width: 540px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    padding: 32px;
    background: #fff;
    color: #333;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .35);
    animation: cookies-in .25s ease-out;
}

.cookie-manager-inner h2 {
    margin: 0 0 8px;
    padding-right: 32px;
    font-size: 1.35rem;
    color: var(--main);
}

.cookie-manager-inner > p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
    color: #555;
}

.cookie-manager-close {
    position: absolute;
    top: 16px;
    right: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: #f4f5fb;
    border: 0;
    border-radius: 50%;
    color: #333;
    cursor: pointer;
}

.cookie-manager-close:hover {
    background: #e6e6ee;
}

.cookie-categories {
    margin: 20px 0;
    padding: 0;
    list-style: none;
}

.cookie-categories li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid #eee;
}

.cookie-categories li:last-child {
    border-bottom: 0;
}

.cookie-category-text strong {
    display: block;
    margin-bottom: 2px;
    font-size: 15px;
    color: #222;
}

.cookie-category-text span {
    font-size: 13px;
    line-height: 1.5;
    color: #666;
}

/* Switch */
.cookie-switch {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
    width: 46px;
    height: 26px;
    cursor: pointer;
}

.cookie-switch input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.cookie-switch-slider {
    position: absolute;
    inset: 0;
    background: #cfd1dc;
    border-radius: 26px;
    transition: background .2s;
    pointer-events: none;
}

.cookie-switch-slider::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
    transition: transform .2s;
}

.cookie-switch input:checked + .cookie-switch-slider {
    background: var(--main);
}

.cookie-switch input:checked + .cookie-switch-slider::before {
    transform: translateX(20px);
}

.cookie-switch input:disabled,
.cookie-switch input:disabled + .cookie-switch-slider {
    cursor: not-allowed;
    opacity: .6;
}

.cookie-switch input:focus-visible + .cookie-switch-slider {
    outline: 3px solid var(--secondary);
    outline-offset: 2px;
}

.cookie-manager-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

@keyframes cookies-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .box-cookies,
    .cookie-manager-inner {
        animation: none;
    }
}

/* Mobile: largura total, acima do menu fixo inferior (49px) */
@media (max-width: 640px) {
    .box-cookies {
        left: 12px;
        right: 12px;
        bottom: 61px;
        width: auto;
        max-width: none;
        padding: 18px 16px 14px;
    }

    .box-cookies .msg-cookies {
        font-size: 13px;
        margin-bottom: 12px;
    }

    .cookie-manager-inner {
        padding: 24px 20px;
    }

    .cookie-manager-actions .btn-cookies {
        flex: 1;
    }
}

/* Link "Preferências de cookies" no rodapé (reabre a central): visual de link da lista */
.footer-cookies-btn {
    /* <button> é sempre inline-block: limitar a largura deixa o botão ao lado
       da seta e o texto quebra dentro dele, como os links da lista */
    max-width: calc(100% - 1.2em);
    vertical-align: top;
    padding: 0;
    background: none;
    border: 0;
    font: inherit;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.footer-cookies-btn:hover {
    color: #ccc; /* mesmo hover dos links do rodapé */
}
