/* =====================
   COOKIE BANNER STYLES
   ===================== */

/* Overlay sfondo */
#cookie-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: none;
}

#cookie-overlay.visible {
    display: block;
}

/* Banner principale */
#cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    padding: 30px 40px;
    z-index: 9999;
    display: none;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.1);
}

#cookie-banner.visible {
    display: block;
}

.cookie-banner-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}

.cookie-banner-text h3 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
}

.cookie-banner-text p {
    font-size: 13px;
    color: #555;
    line-height: 1.6;
    max-width: 700px;
}

.cookie-banner-text a {
    color: #000;
    font-weight: 500;
    text-decoration: underline;
}

.cookie-banner-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.btn-cookie {
    padding: 11px 24px;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.5px;
    cursor: pointer;
    border: 1px solid #000;
    font-family: inherit;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-cookie-accept-all {
    background: #000;
    color: #fff;
}

.btn-cookie-accept-all:hover {
    background: #333;
}

.btn-cookie-reject {
    background: #fff;
    color: #000;
}

.btn-cookie-reject:hover {
    background: #f5f5f5;
}

.btn-cookie-settings {
    background: #fff;
    color: #000;
    border-color: #ccc;
}

.btn-cookie-settings:hover {
    border-color: #000;
}

/* Modal impostazioni */
#cookie-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#cookie-modal.visible {
    display: flex;
}

.cookie-modal-box {
    background: #fff;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.cookie-modal-header {
    padding: 30px 30px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 20px;
    margin-bottom: 0;
}

.cookie-modal-header h2 {
    font-size: 22px;
    font-weight: 400;
}

.cookie-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    line-height: 1;
    padding: 0;
}

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

.cookie-modal-body {
    padding: 25px 30px;
}

.cookie-modal-body > p {
    font-size: 13px;
    color: #555;
    line-height: 1.7;
    margin-bottom: 25px;
}

/* Categoria cookie */
.cookie-category {
    border: 1px solid #e0e0e0;
    margin-bottom: 15px;
}

.cookie-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    cursor: pointer;
    user-select: none;
}

.cookie-category-header:hover {
    background: #f9f9f9;
}

.cookie-category-info h4 {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 3px;
}

.cookie-category-info span {
    font-size: 12px;
    color: #888;
}

/* Toggle switch */
.cookie-toggle {
    position: relative;
    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;
    transition: 0.3s;
    cursor: pointer;
}

.cookie-toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    left: 3px;
    top: 3px;
    transition: 0.3s;
}

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

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

.cookie-toggle input:disabled + .cookie-toggle-slider {
    background: #000;
    opacity: 0.5;
    cursor: not-allowed;
}

/* Dettaglio categoria */
.cookie-category-body {
    display: none;
    padding: 0 20px 18px;
    border-top: 1px solid #f0f0f0;
}

.cookie-category-body.open {
    display: block;
}

.cookie-category-body p {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    margin-top: 12px;
}

.cookie-expand-arrow {
    display: inline-block;
    margin-left: 8px;
    transition: transform 0.2s;
    font-size: 12px;
    color: #888;
}

.cookie-expand-arrow.open {
    transform: rotate(180deg);
}

/* Footer modal */
.cookie-modal-footer {
    padding: 20px 30px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Pulsante riapertura banner (icona in basso a sinistra) */
#cookie-reopen-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 8px 14px;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    z-index: 9997;
    color: #555;
    display: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.2s;
}

#cookie-reopen-btn:hover {
    border-color: #000;
    color: #000;
}

#cookie-reopen-btn.visible {
    display: block;
}

/* ==================
   RESPONSIVE MOBILE
   ================== */
@media (max-width: 768px) {
    #cookie-banner {
        padding: 20px;
    }

    .cookie-banner-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .cookie-banner-actions {
        flex-wrap: wrap;
        width: 100%;
    }

    .btn-cookie {
        flex: 1;
        text-align: center;
        padding: 12px 16px;
    }

    .cookie-modal-box {
        max-height: 95vh;
    }

    .cookie-modal-footer {
        flex-direction: column;
    }

    .cookie-modal-footer .btn-cookie {
        width: 100%;
        text-align: center;
    }
}
