/* ============================================================
   Cookie Consent Banner + Modal (LGPD) — CBIC Portal
   ============================================================ */

.cookie-consent-banner {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    background: #ffffff;
    border-top: 1px solid var(--portal-border, #dfe7f1);
    box-shadow: 0 -12px 32px rgba(15, 23, 42, .12);
    padding: 1rem 1.25rem;
    transform: translateY(120%);
    opacity: 0;
    transition: transform .35s cubic-bezier(.4,0,.2,1), opacity .35s ease;
}

.cookie-consent-banner.is-visible {
    transform: translateY(0);
    opacity: 1;
}

.cookie-consent-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.cookie-consent-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cbic-red, #ee404a), var(--cbic-blue, #0c4da2));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
}

.cookie-consent-text {
    flex: 1 1 420px;
    font-size: .875rem;
    line-height: 1.5;
    color: var(--portal-text, #0f172a);
}

.cookie-consent-text a {
    color: var(--cbic-blue, #0c4da2);
    font-weight: 600;
    text-decoration: underline;
}

.cookie-consent-actions {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.cookie-btn {
    border-radius: 999px;
    padding: .55rem 1.15rem;
    font-size: .84rem;
    font-weight: 700;
    border: 1.5px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
    font-family: 'Montserrat', sans-serif;
}

.cookie-btn:active { transform: scale(.97); }

.cookie-btn-primary {
    background: linear-gradient(90deg, var(--cbic-red, #ee404a), var(--cbic-blue, #0c4da2));
    color: #fff;
}

.cookie-btn-primary:hover { box-shadow: 0 6px 18px rgba(238,64,74,.35); }

.cookie-btn-outline {
    background: transparent;
    border-color: var(--portal-border, #dfe7f1);
    color: var(--portal-text, #0f172a);
}

.cookie-btn-outline:hover { background: #f4f7fb; }

body.dark .cookie-consent-banner {
    background: #0b1220;
    border-top-color: #1e293b;
    box-shadow: 0 -12px 32px rgba(0,0,0,.5);
}

body.dark .cookie-btn-outline {
    border-color: #263248;
    color: #e2e8f0;
}

body.dark .cookie-btn-outline:hover { background: #16233d; }

/* ── Modal de personalização ── */

.cookie-consent-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8, 15, 30, .55);
    z-index: 2100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.cookie-consent-modal-backdrop.is-visible {
    display: flex;
}

.cookie-consent-modal {
    width: 100%;
    max-width: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0,0,0,.25);
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

body.dark .cookie-consent-modal { background: #0f172a; color: #e2e8f0; }

.cookie-consent-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--portal-border, #dfe7f1);
}

body.dark .cookie-consent-modal-header { border-bottom-color: #1e293b; }

.cookie-consent-modal-header h5 {
    margin: 0;
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--portal-text, #0f172a);
}

body.dark .cookie-consent-modal-header h5 { color: #f1f5f9; }

.cookie-consent-modal-close {
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 1rem;
    cursor: pointer;
    line-height: 1;
    padding: .35rem;
}

.cookie-consent-modal-body {
    padding: 1.2rem 1.4rem;
    overflow-y: auto;
}

.cookie-category { padding: .85rem 0; border-bottom: 1px solid var(--portal-border, #dfe7f1); }
.cookie-category:last-child { border-bottom: 0; }
body.dark .cookie-category { border-bottom-color: #1e293b; }

.cookie-category-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .35rem;
}

.cookie-category-title { font-weight: 700; font-size: .92rem; color: var(--portal-text, #0f172a); }
body.dark .cookie-category-title { color: #f1f5f9; }

.cookie-category-desc { margin: 0; font-size: .8rem; color: var(--portal-muted, #52657f); line-height: 1.45; }
body.dark .cookie-category-desc { color: #94a3b8; }

.cookie-toggle-locked {
    font-size: .72rem;
    font-weight: 700;
    color: #16a34a;
    background: rgba(22,163,74,.12);
    padding: .25rem .65rem;
    border-radius: 999px;
}

.cookie-switch {
    position: relative;
    display: inline-block;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.cookie-switch input { opacity: 0; width: 0; height: 0; }

.cookie-switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #cbd5e1;
    border-radius: 999px;
    transition: background-color .2s ease;
}

.cookie-switch-slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s ease;
}

.cookie-switch input:checked + .cookie-switch-slider { background: var(--cbic-blue, #0c4da2); }
.cookie-switch input:checked + .cookie-switch-slider::before { transform: translateX(18px); }

.cookie-consent-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
    padding: 1rem 1.4rem;
    border-top: 1px solid var(--portal-border, #dfe7f1);
}

body.dark .cookie-consent-modal-footer { border-top-color: #1e293b; }

@media (max-width: 768px) {
    .cookie-consent-banner { padding: .85rem 1rem; }
    .cookie-consent-inner { gap: .6rem; }
    .cookie-consent-icon { width: 34px; height: 34px; font-size: .95rem; }
    .cookie-consent-text { flex-basis: 100%; font-size: .78rem; line-height: 1.45; }
    .cookie-consent-actions { width: 100%; gap: .5rem; }
    .cookie-btn { flex: 1 1 auto; padding: .5rem .8rem; font-size: .78rem; }
}

@media (max-width: 576px) {
    .cookie-consent-banner { padding: .75rem .85rem; }
    .cookie-consent-icon { display: none; }
    .cookie-consent-text { font-size: .74rem; line-height: 1.4; }
    .cookie-consent-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: .4rem;
    }
    .cookie-btn { padding: .5rem .6rem; font-size: .72rem; white-space: normal; }
    .cookie-btn-primary { grid-column: 1 / -1; }
}
