/* =============================================
   COOKIE CONSENT BANNER — ProntoQR
   ============================================= */

/* BANNER */
#cookie-banner {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    width: calc(100% - 3rem);
    max-width: 700px;
    background: var(--brand-darkblue);
    color: #e2e8f0;
    border-radius: 16px;
    padding: 1.4rem 1.6rem;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    z-index: 999999;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.4);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#cookie-banner.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.cookie-banner-text {
    flex: 1;
    min-width: 200px;
}

.cookie-banner-text p {
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
    color: #94a3b8;
}

.cookie-banner-text a {
    color: #a5b4fc;
    text-decoration: underline;
}

.cookie-banner-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.cookie-btn-primary {
    padding: 0.6rem 1.2rem;
    background: var(--brand-green);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s ease;
    white-space: nowrap;
}

.cookie-btn-primary:hover { background: var(--brand-green-hover); }

.cookie-btn-secondary {
    padding: 0.6rem 1.2rem;
    background: transparent;
    color: #94a3b8;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cookie-btn-secondary:hover {
    border-color: rgba(255,255,255,0.3);
    color: #e2e8f0;
}

@media (max-width: 600px) {
    #cookie-banner {
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-width: 100%;
        transform: translateY(20px);
        border-radius: 16px 16px 0 0;
    }
    #cookie-banner.visible {
        transform: translateY(0);
    }
    .cookie-banner-actions { width: 100%; }
    .cookie-btn-primary, .cookie-btn-secondary { flex: 1; text-align: center; }
}

/* MODAL PREFERENZE */
#cookie-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9999999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#cookie-modal.visible { opacity: 1; }

.cookie-modal-box {
    background: #ffffff;
    border-radius: 20px;
    padding: 2rem;
    max-width: 480px;
    width: 100%;
    box-shadow: 0 25px 50px rgba(15, 23, 42, 0.2);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.cookie-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
}

.cookie-modal-header h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--brand-darkblue);
    margin: 0;
}

.cookie-modal-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.2rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: color 0.2s ease;
}

.cookie-modal-close-btn:hover { color: var(--brand-darkblue); }

.cookie-category {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.cookie-category:last-of-type { border-bottom: none; }

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

.cookie-category-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--brand-darkblue);
}

.cookie-category-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

.cookie-always-on {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--brand-green);
    background: rgba(16, 185, 129, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 99px;
}

/* Toggle per categorie */
.cookie-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

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

.cookie-toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #e2e8f0;
    border-radius: 99px;
    transition: background 0.2s ease;
}

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

.cookie-toggle input:checked + .cookie-toggle-slider { background: var(--brand-purple); }
.cookie-toggle input:checked + .cookie-toggle-slider::before { transform: translateX(18px); }

.cookie-modal-footer {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.6rem;
}

.cookie-modal-save-btn {
    flex: 1;
    padding: 0.75rem;
    background: var(--brand-green);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s ease;
}

.cookie-modal-save-btn:hover { background: var(--brand-green-hover); }
