/* ============================================================
   Cookie Manager — Diniz Pneus
   LGPD Cookie Consent Banner & Modal
   ============================================================ */

/* ---- Banner ---- */
#cookie-banner {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99999;
    width: 360px;
    max-width: calc(100vw - 48px);
    background: #1a1a1a;
    color: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    padding: 22px 22px 18px;
    font-family: 'Open Sans', sans-serif;
    font-size: 13px;
    line-height: 1.55;
    animation: cookieBannerIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

#cookie-banner.cookie-hide {
    animation: cookieBannerOut 0.25s ease forwards;
}

@keyframes cookieBannerIn {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

@keyframes cookieBannerOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(20px); }
}

#cookie-banner .cookie-icon {
    font-size: 22px;
    margin-bottom: 8px;
    display: block;
}

#cookie-banner .cookie-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 8px;
    color: #fff;
}

#cookie-banner .cookie-text {
    color: #c9c9c9;
    margin-bottom: 12px;
}

#cookie-banner .cookie-links {
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

#cookie-banner .cookie-links a {
    color: #e30613;
    text-decoration: none;
    font-weight: 600;
    font-size: 12px;
    transition: color 0.2s;
}

#cookie-banner .cookie-links a:hover {
    color: #ff3344;
    text-decoration: underline;
}

#cookie-banner .cookie-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

#cookie-banner .cookie-btn {
    flex: 1;
    min-width: 80px;
    padding: 9px 10px;
    border: none;
    border-radius: 7px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 11.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    letter-spacing: 0.2px;
}

#cookie-banner .cookie-btn-customize {
    background: transparent;
    border: 1.5px solid #555;
    color: #ccc;
}

#cookie-banner .cookie-btn-customize:hover {
    border-color: #999;
    color: #fff;
}

#cookie-banner .cookie-btn-reject {
    background: transparent;
    border: 1.5px solid #555;
    color: #ccc;
}

#cookie-banner .cookie-btn-reject:hover {
    border-color: #999;
    color: #fff;
}

#cookie-banner .cookie-btn-accept {
    background: #e30613;
    color: #fff;
    border: 1.5px solid #e30613;
}

#cookie-banner .cookie-btn-accept:hover {
    background: #b8050f;
    border-color: #b8050f;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(227, 6, 19, 0.4);
}

/* ---- Modal ---- */
#cookie-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(3px);
    align-items: center;
    justify-content: center;
    padding: 16px;
}

#cookie-modal-overlay.active {
    display: flex;
    animation: overlayIn 0.2s ease;
}

@keyframes overlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

#cookie-modal {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
    from { transform: scale(0.93) translateY(20px); opacity: 0; }
    to   { transform: scale(1)    translateY(0);    opacity: 1; }
}

#cookie-modal .modal-header {
    padding: 22px 24px 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}

#cookie-modal .modal-header h3 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: #1a1a1a;
    margin: 0;
}

#cookie-modal .modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    font-size: 20px;
    line-height: 1;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s;
    flex-shrink: 0;
}

#cookie-modal .modal-close:hover {
    color: #333;
}

#cookie-modal .modal-body {
    padding: 20px 24px;
}

#cookie-modal .modal-intro {
    font-size: 13px;
    color: #555;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Category rows */
.cookie-category {
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}

.cookie-category:hover {
    border-color: #d0d0d0;
}

.cookie-category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.cookie-category-info {
    flex: 1;
}

.cookie-category-name {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 13.5px;
    color: #1a1a1a;
    margin-bottom: 2px;
}

.cookie-category-desc {
    font-size: 12px;
    color: #777;
    line-height: 1.5;
}

/* Toggle switch */
.cookie-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.cookie-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.cookie-toggle-slider {
    position: absolute;
    inset: 0;
    background: #ccc;
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.25s;
}

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

.cookie-toggle input:checked + .cookie-toggle-slider {
    background: #e30613;
}

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

.cookie-toggle input:disabled + .cookie-toggle-slider {
    background: #28a745;
    cursor: not-allowed;
    opacity: 0.85;
}

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

.cookie-required-badge {
    font-size: 10px;
    background: #e8f5e9;
    color: #2e7d32;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 20px;
    letter-spacing: 0.3px;
}

#cookie-modal .modal-footer {
    padding: 16px 24px 22px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

#cookie-modal .modal-footer .cookie-btn {
    flex: 1;
    min-width: 120px;
    padding: 11px 16px;
    border: none;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

#cookie-modal .modal-footer .cookie-btn-reject-all {
    background: #f5f5f5;
    color: #555;
    border: 1.5px solid #ddd;
}

#cookie-modal .modal-footer .cookie-btn-reject-all:hover {
    background: #ebebeb;
    border-color: #bbb;
}

#cookie-modal .modal-footer .cookie-btn-save {
    background: #e30613;
    color: #fff;
}

#cookie-modal .modal-footer .cookie-btn-save:hover {
    background: #b8050f;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(227, 6, 19, 0.35);
}

/* Mobile */
@media (max-width: 420px) {
    #cookie-banner {
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 14px 14px 0 0;
    }

    #cookie-banner .cookie-actions {
        flex-direction: column;
    }

    #cookie-banner .cookie-btn {
        width: 100%;
    }
}

/* ---- Cookie FAB (botão flutuante pós-consentimento) ---- */
#cookie-fab {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99998;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: rgba(26, 26, 26, 0.45);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.45;
    transition: opacity 0.25s, transform 0.25s, background 0.25s;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: cookieFabIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    line-height: 1;
    padding: 0;
}

#cookie-fab:hover {
    opacity: 0.9;
    transform: scale(1.1);
    background: rgba(26, 26, 26, 0.75);
}

@keyframes cookieFabIn {
    from { opacity: 0; transform: scale(0.5); }
    to   { opacity: 0.45; transform: scale(1); }
}

@media (max-width: 420px) {
    #cookie-fab {
        bottom: 16px;
        left: 16px;
        width: 42px;
        height: 42px;
        font-size: 20px;
    }
}
