/* =================================================================
   COOKIE BANNER GDPR - Conforme alle Linee Guida del Garante Privacy
   ================================================================= */

/* Overlay che blocca la navigazione */
#cookieBannerOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 99998;
    display: none;
    animation: fadeIn 0.3s ease-out;
}

#cookieBannerOverlay.show {
    display: block;
}

/* Banner principale */
#cookieBanner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 99999;
    display: none;
    animation: slideIn 0.4s ease-out;
    max-height: 90vh;
    overflow-y: auto;
}

#cookieBanner.show {
    display: block;
}

/* Header del banner */
.cookie-banner-header {
    background: #5BBF7B;
    color: white;
    padding: 1.5rem;
    border-radius: 12px 12px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cookie-banner-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.cookie-banner-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.cookie-banner-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Body del banner */
.cookie-banner-body {
    padding: 1.5rem;
}

.cookie-banner-text {
    color: #333;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

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

/* Pulsanti principali - TUTTI EQUIVALENTI */
.cookie-banner-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.cookie-btn {
    flex: 1;
    min-width: 140px;
    padding: 0.875rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.cookie-btn-accept {
    background: #1A6AFF;
    color: white;
}

.cookie-btn-accept:hover {
    background: #0D4FB8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 106, 255, 0.3);
}

.cookie-btn-reject {
    background: #1A6AFF;
    color: white;
}

.cookie-btn-reject:hover {
    background: #0D4FB8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(26, 106, 255, 0.3);
}

.cookie-btn-customize {
    background: #6C757D;
    color: white;
}

.cookie-btn-customize:hover {
    background: #5A6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

/* Pannello personalizzazione */
#cookieCustomize {
    display: none;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid #E9ECEF;
}

#cookieCustomize.show {
    display: block;
}

.cookie-category {
    background: #F8F9FA;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.cookie-category-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

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

.cookie-category-title {
    font-size: 1rem;
    font-weight: 600;
    color: #212529;
    margin: 0 0 0.5rem 0;
}

.cookie-category-description {
    font-size: 0.875rem;
    color: #6C757D;
    line-height: 1.5;
    margin: 0;
}

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

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

.cookie-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #CED4DA;
    transition: 0.3s;
    border-radius: 26px;
}

.cookie-toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.cookie-toggle input:checked + .cookie-toggle-slider {
    background-color: #1A6AFF;
}

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

.cookie-toggle input:disabled + .cookie-toggle-slider {
    background-color: #6C757D;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Pulsanti personalizzazione */
.cookie-customize-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.cookie-customize-buttons .cookie-btn {
    flex: 1;
}

/* Footer link per modificare preferenze */
.cookie-preferences-link {
    cursor: pointer;
    transition: color 0.3s;
}

.cookie-preferences-link:hover {
    color: #1A6AFF !important;
}

/* Animazioni */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Responsive */
@media (max-width: 576px) {
    #cookieBanner {
        width: 95%;
        max-width: none;
        top: 50%;
        transform: translate(-50%, -50%);
    }

    .cookie-banner-header {
        padding: 1.25rem;
    }

    .cookie-banner-title {
        font-size: 1.1rem;
    }

    .cookie-banner-body {
        padding: 1.25rem;
    }

    .cookie-banner-buttons {
        flex-direction: column;
    }

    .cookie-btn {
        width: 100%;
        min-width: 100%;
    }

    .cookie-customize-buttons {
        flex-direction: column;
    }

    .cookie-category-header {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }

    .cookie-toggle {
        align-self: flex-end;
    }
}

/* Accessibilità */
.cookie-btn:focus,
.cookie-toggle input:focus + .cookie-toggle-slider,
.cookie-banner-close:focus {
    outline: 3px solid #1A6AFF;
    outline-offset: 2px;
}

/* Badge "Sempre attivi" */
.cookie-badge-required {
    display: inline-block;
    background: #6C757D;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

/* =================================================================
   FLOATING COOKIE BUTTON - Sempre visibile in basso a destra
   ================================================================= */

#cookieFloatingButton {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    background: #1A6AFF;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 9997;
    display: none; /* Nascosto inizialmente */
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: bounceIn 0.6s ease-out;
}

#cookieFloatingButton.show {
    display: flex;
}

#cookieFloatingButton:hover {
    background: #0D4FB8;
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 6px 20px rgba(26, 106, 255, 0.4);
}

#cookieFloatingButton:active {
    transform: scale(0.95);
}

#cookieFloatingButton i {
    color: white;
    font-size: 24px;
}

/* Tooltip */
#cookieFloatingButton::before {
    content: 'Preferenze Cookie';
    position: absolute;
    right: 70px;
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

#cookieFloatingButton::after {
    content: '';
    position: absolute;
    right: 62px;
    border: 6px solid transparent;
    border-left-color: #333;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

#cookieFloatingButton:hover::before,
#cookieFloatingButton:hover::after {
    opacity: 1;
}

/* Animazione ingresso */
@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3) translateY(20px);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
    }
}

/* Pulse animation per attirare l'attenzione */
@keyframes pulse {
    0% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(26, 106, 255, 0.6);
    }
    100% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
}

#cookieFloatingButton.pulse {
    animation: pulse 2s infinite;
}

/* Responsive */
@media (max-width: 576px) {
    #cookieFloatingButton {
        width: 50px;
        height: 50px;
        bottom: 15px;
        right: 15px;
    }

    #cookieFloatingButton i {
        font-size: 20px;
    }

    /* Nasconde tooltip su mobile */
    #cookieFloatingButton::before,
    #cookieFloatingButton::after {
        display: none;
    }
}

/* ================================================================= */
/*   WHATSAPP FLOATING BUTTON                                       */
/* ================================================================= */

#whatsappFloatingButton {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    background: #25D366;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 9997;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: bounceIn 0.6s ease-out;
    text-decoration: none;
}

#whatsappFloatingButton:hover {
    background: #20BA5A;
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

#whatsappFloatingButton:active {
    transform: scale(0.95);
}

#whatsappFloatingButton i {
    color: white;
    font-size: 32px;
}

/* Tooltip WhatsApp */
#whatsappFloatingButton::before {
    content: 'Contattaci su WhatsApp';
    position: absolute;
    left: 75px;
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    font-family: 'Poppins', sans-serif;
}

#whatsappFloatingButton::after {
    content: '';
    position: absolute;
    left: 67px;
    border: 6px solid transparent;
    border-right-color: #333;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

#whatsappFloatingButton:hover::before,
#whatsappFloatingButton:hover::after {
    opacity: 1;
}

/* Animazione pulse per attirare attenzione */
@keyframes whatsappPulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow: 0 4px 20px rgba(37, 211, 102, 0.6), 0 0 0 0 rgba(37, 211, 102, 0.4);
    }
}

#whatsappFloatingButton {
    animation: bounceIn 0.6s ease-out, whatsappPulse 2s infinite 1s;
}

/* Responsive WhatsApp */
@media (max-width: 576px) {
    #whatsappFloatingButton {
        width: 55px;
        height: 55px;
        bottom: 15px;
        left: 15px;
    }

    #whatsappFloatingButton i {
        font-size: 28px;
    }

    /* Nasconde tooltip su mobile */
    #whatsappFloatingButton::before,
    #whatsappFloatingButton::after {
        display: none;
    }
}
