/* =========================================================
   1. UI DEL WIDGET
   ========================================================= */
#wpa11y-widget-container { position: fixed; z-index: 999999; font-family: Arial, sans-serif; }
#wpa11y-toggle-btn { cursor: pointer; transition: transform 0.3s ease; }
#wpa11y-toggle-btn:hover { transform: scale(1.05); }
#wpa11y-panel {
    position: absolute; bottom: calc(100% + 15px); width: 320px;
    background: #ffffff; border-radius: 12px; box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    overflow: hidden; transition: opacity 0.3s ease, visibility 0.3s ease;
}
#wpa11y-panel.wpa11y-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.wpa11y-panel-header { background: #f4f4f4; padding: 15px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #ddd; }
.wpa11y-panel-header h3 { margin: 0; font-size: 16px; color: #333; }
#wpa11y-close-btn { background: none; border: none; font-size: 24px; cursor: pointer; color: #666; }
.wpa11y-panel-body { padding: 15px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-height: 60vh; overflow-y: auto; }
.wpa11y-action-btn { background: #f8f9fa; border: 1px solid #ddd; border-radius: 8px; padding: 8px; cursor: pointer; font-size: 12px; text-align: center; color: #333; transition: background 0.2s; }
.wpa11y-action-btn.active { background: #cce5ff; border-color: #0056b3; font-weight: bold; }
#wpa11y-reset-btn { background: #dc3545; color: white; border: none; padding: 10px; border-radius: 8px; cursor: pointer; margin-top: 5px; }
.wpa11y-panel-footer { padding: 10px; text-align: center; font-size: 12px; background: #f4f4f4; }
.wpa11y-panel-footer a { color: #0056b3; text-decoration: underline; }

/* =========================================================
   2. REGOLE DI ACCESSIBILITÀ (Fix Menù e Layout)
   ========================================================= */

/* Alto Contrasto */
html.wpa11y-high-contrast { filter: invert(1) hue-rotate(180deg) !important; background-color: #000 !important; }
html.wpa11y-high-contrast img, html.wpa11y-high-contrast video, html.wpa11y-high-contrast iframe { filter: invert(1) hue-rotate(180deg) !important; }

/* Scala di grigi */
html.wpa11y-grayscale { filter: grayscale(100%) !important; }

/* Evidenzia Link (Usa Outline, senza toccare gli sfondi) */
body.wpa11y-highlight-links a, body.wpa11y-highlight-links .elementor-widget a { 
    outline: 3px solid #ffcc00 !important; 
    outline-offset: 2px !important; 
    text-decoration: underline !important; 
}

/* Evidenzia Titoli */
body.wpa11y-highlight-headings h1, body.wpa11y-highlight-headings h2, body.wpa11y-highlight-headings h3, 
body.wpa11y-highlight-headings h4, body.wpa11y-highlight-headings h5, body.wpa11y-highlight-headings h6,
body.wpa11y-highlight-headings .elementor-heading-title {
    outline: 3px dashed #ff9800 !important; outline-offset: 4px !important;
}

/* Font Dislessia */
@import url('https://fonts.cdnfonts.com/css/opendyslexic');
body.wpa11y-dyslexia-font *:not(i):not(svg):not(.elementor-icon) {
    font-family: 'OpenDyslexic', sans-serif !important;
    letter-spacing: 0.1em !important; word-spacing: 0.2em !important;
}

/* Pausa Animazioni */
body.wpa11y-pause-animations *, body.wpa11y-pause-animations *::before, body.wpa11y-pause-animations *::after {
    animation: none !important; transition: none !important; scroll-behavior: auto !important;
}

/* Cursori SVG Base64 */
body.wpa11y-cursor-black * { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="black" stroke="white" stroke-width="2" d="M5.5 3.21V20.8c0 .45.54.67.85.35l4.86-4.86a.5.5 0 0 1 .35-.15h6.87c.45 0 .67-.54.35-.85L6.35 2.86c-.31-.31-.85-.09-.85.35z"/></svg>'), auto !important; }
body.wpa11y-cursor-white * { cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><path fill="white" stroke="black" stroke-width="2" d="M5.5 3.21V20.8c0 .45.54.67.85.35l4.86-4.86a.5.5 0 0 1 .35-.15h6.87c.45 0 .67-.54.35-.85L6.35 2.86c-.31-.31-.85-.09-.85.35z"/></svg>'), auto !important; }

/* Lente sui Testi (ESCLUDE A PRIORI l'header e il widget, zero conflitti con Elementor) */
body.wpa11y-magnifier-active p:not(header *):not(nav *):not(.elementor-nav-menu *):not(#wpa11y-widget-container *):hover, 
body.wpa11y-magnifier-active h1:not(header *):not(nav *):not(.elementor-nav-menu *):not(#wpa11y-widget-container *):hover, 
body.wpa11y-magnifier-active h2:not(header *):not(nav *):not(.elementor-nav-menu *):not(#wpa11y-widget-container *):hover, 
body.wpa11y-magnifier-active h3:not(header *):not(nav *):not(.elementor-nav-menu *):not(#wpa11y-widget-container *):hover, 
body.wpa11y-magnifier-active span:not(header *):not(nav *):not(.elementor-nav-menu *):not(#wpa11y-widget-container *):hover,
body.wpa11y-magnifier-active .elementor-widget-text-editor *:not(header *):not(nav *):not(.elementor-nav-menu *):not(#wpa11y-widget-container *):hover {
    transform: scale(1.15) !important;
    transform-origin: center !important;
    background-color: #ffffcc !important; 
    color: #000 !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2) !important;
    z-index: 999998 !important; position: relative !important; border-radius: 4px !important; padding: 2px !important;
}

/* Maschera di Lettura */
#wpa11y-reading-mask {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    pointer-events: none; z-index: 999997; display: none;
}

/* =========================================================
   3. INGRANDIMENTO TESTO
   ========================================================= */
body.wpa11y-zoom-110 *:not(i):not(svg):not(#wpa11y-widget-container):not(#wpa11y-widget-container *) { font-size: 110% !important; line-height: 1.5 !important; }
body.wpa11y-zoom-120 *:not(i):not(svg):not(#wpa11y-widget-container):not(#wpa11y-widget-container *) { font-size: 120% !important; line-height: 1.5 !important; }
body.wpa11y-zoom-130 *:not(i):not(svg):not(#wpa11y-widget-container):not(#wpa11y-widget-container *) { font-size: 130% !important; line-height: 1.6 !important; }
body.wpa11y-zoom-140 *:not(i):not(svg):not(#wpa11y-widget-container):not(#wpa11y-widget-container *) { font-size: 140% !important; line-height: 1.6 !important; }
body.wpa11y-zoom-150 *:not(i):not(svg):not(#wpa11y-widget-container):not(#wpa11y-widget-container *) { font-size: 150% !important; line-height: 1.6 !important; }