/* ═══════════════════════════════════════════════════════════════
   IUBENDA OVERLAY - CSS OTTIMIZZATO v2.0
   Stili per popup privacy/cookie con animazioni e responsive
   ═══════════════════════════════════════════════════════════════ */

/* Overlay base - ID dinamici generati da JS */
[id^="ppol-"] {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 999999;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: iubFadeIn 0.3s ease-out;
}

@keyframes iubFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes iubSlideUp {
    from { 
        opacity: 0;
        transform: translateY(50px) scale(0.95);
    }
    to { 
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Box contenitore */
[id^="ppol-"] > div {
    position: relative;
    width: 90%;
    max-width: 800px;
    height: 85%;
    max-height: 90vh;
    margin: 5vh auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5),
                0 0 1px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: iubSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Toolbar header */
[id^="ppol-"] > div > div:first-child {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: linear-gradient(to bottom, #f8f9fa, #f0f1f2);
    border-bottom: 1px solid #e0e0e0;
    min-height: 50px;
}

[id^="ppol-"] > div > div:first-child::before {
    content: 'Privacy & Cookie Policy';
    font-size: 16px;
    font-weight: 600;
    color: #333;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Bottone chiusura */
[id^="ppol-"] button {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    padding: 4px 10px;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 300;
    min-width: 36px;
    min-height: 36px;
}

[id^="ppol-"] button:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #000;
    transform: scale(1.1);
}

[id^="ppol-"] button:active {
    transform: scale(0.95);
}

/* Iframe contenuto */
[id^="ppfr-"] {
    flex: 1;
    width: 100%;
    border: none;
    background: #fff;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

/* Tablet */
@media (max-width: 768px) {
    [id^="ppol-"] > div {
        width: 95%;
        height: 90%;
        margin: 3vh auto;
    }
    
    [id^="ppol-"] > div > div:first-child {
        padding: 12px 16px;
    }
    
    [id^="ppol-"] > div > div:first-child::before {
        font-size: 14px;
    }
}

/* Mobile */
@media (max-width: 480px) {
    [id^="ppol-"] > div {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    [id^="ppol-"] > div > div:first-child {
        padding: 10px 14px;
    }
    
    [id^="ppol-"] > div > div:first-child::before {
        font-size: 13px;
    }
    
    [id^="ppol-"] button {
        font-size: 24px;
        padding: 4px 8px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   ACCESSIBILITY
   ═══════════════════════════════════════════════════════════════ */

[id^="ppol-"] button:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    [id^="ppol-"],
    [id^="ppol-"] > div {
        animation: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   DARK MODE SUPPORT (opzionale)
   ═══════════════════════════════════════════════════════════════ */

@media (prefers-color-scheme: dark) {
    [id^="ppol-"] {
        background: rgba(0, 0, 0, 0.85);
    }
    
    [id^="ppol-"] > div {
        background: #1e1e1e;
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    }
    
    [id^="ppol-"] > div > div:first-child {
        background: linear-gradient(to bottom, #2a2a2a, #242424);
        border-bottom-color: #333;
    }
    
    [id^="ppol-"] > div > div:first-child::before {
        color: #e0e0e0;
    }
    
    [id^="ppol-"] button {
        color: #bbb;
    }
    
    [id^="ppol-"] button:hover {
        background: rgba(255, 255, 255, 0.1);
        color: #fff;
    }
}