/* ============================================================
   COOKIE BANNER (GDPR e Garante Privacy Compliant)
   ============================================================ */

/* Banner fisso in basso */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    z-index: 9999;
    background: rgba(250, 246, 238, 0.95); /* var(--carta) */
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--linea, rgba(22,48,79,0.12));
    border-radius: var(--radius-lg, 14px);
    box-shadow: 0 20px 40px rgba(7, 29, 41, 0.15); /* var(--ink-deep) */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.cookie-banner-content {
    max-width: 1200px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@media (min-width: 992px) {
    .cookie-banner-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.cookie-text {
    flex: 1;
}

.cookie-text h3 {
    margin-bottom: 8px;
    font-size: 1.2rem;
    color: var(--ink, #0e3a52);
    font-family: var(--font-display);
}

.cookie-text p {
    font-size: 0.85rem;
    color: var(--testo-soft, #4a4338);
    line-height: 1.5;
    margin: 0;
}

.cookie-text a {
    color: var(--terra, #c89a5a);
    text-decoration: underline;
    font-weight: 500;
}

.cookie-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.btn-cookie {
    padding: 12px 20px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-pill, 999px);
    cursor: pointer;
    transition: all 0.3s var(--ease);
    border: 1px solid transparent;
}

.btn-cookie.btn-primary {
    background: var(--ink, #0e3a52);
    color: var(--carta, #faf6ee);
}

.btn-cookie.btn-primary:hover {
    background: var(--terra, #c89a5a);
}

.btn-cookie.btn-secondary {
    background: transparent;
    color: var(--ink, #0e3a52);
    border-color: var(--linea, rgba(22,48,79,0.12));
}

.btn-cookie.btn-secondary:hover {
    background: var(--crema, #f5efe1);
    border-color: var(--ink, #0e3a52);
}

.btn-cookie.btn-outline {
    background: transparent;
    color: var(--testo-soft, #4a4338);
    text-decoration: underline;
    padding: 12px 10px;
}

.btn-cookie.btn-outline:hover {
    color: var(--terra, #c89a5a);
}

/* Modal per le preferenze */
.cookie-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10000;
    background: rgba(7, 29, 41, 0.6); /* var(--ink-deep) */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.cookie-modal-content {
    background: var(--carta, #faf6ee);
    border-radius: var(--radius-lg, 14px);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 60px rgba(0,0,0,0.2);
    overflow: hidden;
}

.cookie-modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--linea, rgba(22,48,79,0.12));
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cookie-modal-header h3 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--ink, #0e3a52);
}

.btn-close-modal {
    font-size: 1.5rem;
    line-height: 1;
    color: var(--testo-mute, #8a8170);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.3s;
}

.btn-close-modal:hover {
    color: var(--ink, #0e3a52);
}

.cookie-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.cookie-category {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--linea-soft, rgba(22,48,79,0.06));
}

.cookie-category:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

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

.cookie-category-header h4 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--ink, #0e3a52);
}

.cookie-category p {
    font-size: 0.85rem;
    color: var(--testo-soft, #4a4338);
    margin: 0;
}

.cookie-modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--linea, rgba(22,48,79,0.12));
    background: var(--crema-soft, #f8f3e7);
    display: flex;
    justify-content: flex-end;
}

/* Toggle Switch CSS */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--terra, #c89a5a);
}

input:disabled + .slider {
    background-color: var(--mare-light, #77a2bd);
    cursor: not-allowed;
}

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

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Bottone fluttuante per riaprire le preferenze */
.cookie-settings-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9998;
    width: 48px;
    height: 48px;
    background: var(--carta, #faf6ee);
    border: 1px solid var(--linea, rgba(22,48,79,0.12));
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    color: var(--ink, #0e3a52);
    transition: all 0.3s var(--ease);
}

.cookie-settings-btn:hover {
    transform: scale(1.1);
    color: var(--terra, #c89a5a);
    border-color: var(--terra, #c89a5a);
}

@media (max-width: 576px) {
    .cookie-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-cookie {
        width: 100%;
        text-align: center;
    }
}
