/* ==========================================================================
   [0] TOKEN DI DESIGN GLOBALI E STILI DI BASE
   ========================================================================== */
:root {
    /* --- COLORI PRINCIPALI AGGIORNATI PER MAGGIORE CONTRASTO --- */
    --bg-color: #f4f7fa; 
    --panel-bg: #ffffff; 
    --wheel-bg: #ffffff; 
    
    --text-primary: #1a202c; 
    --text-secondary: #4a5568; 
    
    --line-base: #cbd5e0; 
    --line-week: #718096; /* Più scuro per leggibilità */
    --line-month: #2d3748; 
    --line-year: #1a202c; 
    
    /* Colori spicchi mesi (Disco esterno) - Alternanza più visibile */
    --accent-color-1: #e2e8f0; /* Grigio/Azzurro chiaro */
    --accent-color-2: #ffffff; /* Bianco */
    
    /* Indicatori */
    --arrow-um: #0056b3; /* Blu intenso per U.M. */
    --arrow-dpp: #dd6b20; /* Arancione per D.P.P. */
    
    --toggle-bg: #e2e8f0; 
    --tooltip-bg: #1a202c; 
    --tooltip-text: #ffffff;
    
    --dp-background: #FFFFFF; --dp-text-primary: #111111; --dp-text-secondary: #A0A0A0; --dp-accent-background: #007BFF; --dp-accent-text: #FFFFFF; --dp-today-border: #007BFF; --dp-hover-background: #F0F5FA; --dp-shadow: 0 4px 12px rgba(0,0,0,0.1);
    --sidebar-bg: #2C3E50; --sidebar-text: #ECF0F1; --sidebar-accent: #1ABC9C; --sidebar-secondary-bg: #34495E; --sidebar-border: #4a6179;
    
    /* Icone (codificate base64) */
    --icon-reset: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3e%3cpath d='M12 4c-4.418 0-8 3.582-8 8s3.582 8 8 8 8-3.582 8-8-3.582-8-8-8zm0 14c-3.313 0-6-2.687-6-6s2.687-6 6-6 6 2.687 6 6-2.687 6-6 6zm-1-8v4h2v-4h-2z'/%3e%3c/svg%3e");
    --icon-reset-wheel-new: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3e%3cpath d='M12 6.5A5.5 5.5 0 1 0 17.5 12a.75.75 0 0 1 1.5 0A7 7 0 1 1 12 5a.75.75 0 0 1 0 1.5Z'/%3e%3cpath d='M12 8a.75.75 0 0 1 .75-.75h4.5a.75.75 0 0 1 0 1.5H13V12a.75.75 0 0 1-1.5 0V8a.75.75 0 0 1 .75-.75Z'/%3e%3c/svg%3e");
    --icon-tutorial: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3e%3cpath d='M12 2C6.486 2 2 6.486 2 12s4.486 10 10 10 10-4.486 10-10S17.514 2 12 2zm0 18c-4.411 0-8-3.589-8-8s3.589-8 8-8 8 3.589 8 8-3.589 8-8 8zm-1-13h2v2h-2v-2zm0 4h2v6h-2v-6z'/%3e%3c/svg%3e");
    --icon-theme-light: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3e%3cpath d='M12 3a1 1 0 0 1 1 1v2a1 1 0 1 1-2 0V4a1 1 0 0 1 1-1zM5.636 5.636a1 1 0 0 1 1.414 0l1.414 1.414a1 1 0 0 1-1.414 1.414L5.636 7.05A1 1 0 0 1 5.636 5.636zM3 12a1 1 0 0 1 1-1h2a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1zM5.636 18.364a1 1 0 0 1 0-1.414l1.414-1.414a1 1 0 0 1 1.414 1.414l-1.414 1.414a1 1 0 0 1-1.414 0zM12 19a1 1 0 0 1-1 1v2a1 1 0 1 1-2 0v-2a1 1 0 0 1-1-1zM18.364 18.364a1 1 0 0 1-1.414 0l-1.414-1.414a1 1 0 1 1 1.414-1.414l1.414 1.414a1 1 0 0 1 0 1.414zM21 12a1 1 0 0 1-1 1h-2a1 1 0 1 1 0 2h2a1 1 0 0 1 1 1zM18.364 5.636a1 1 0 0 1 0 1.414l-1.414 1.414a1 1 0 1 1-1.414-1.414L16.95 5.636a1 1 0 0 1 1.414 0zM12 7a5 5 0 1 0 0 10 5 5 0 0 0 0-10z'/%3e%3c/svg%3e");
    --icon-theme-dark: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3e%3cpath fill-rule='evenodd' d='M9.528 1.718a.75.75 0 0 1 .162.819A8.97 8.97 0 0 0 9 6a9 9 0 0 0 9 9 8.97 8.97 0 0 0 4.463-.949a.75.75 0 0 1 .819.162l.805.806a.75.75 0 0 1-.162.819A10.5 10.5 0 1 1 9.528 1.718l.806.805z' clip-rule='evenodd'/%3e%3c/svg%3e");
    --icon-lock-open: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3e%3cpath d='M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zM9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9V6zm9 14H6V10h12v10zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z'/%3e%3c/svg%3e");
    --icon-lock-closed: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3e%3cpath d='M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2 2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1v2z'/%3e%3c/svg%3e");
    --icon-zoom: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3e%3cpath d='M10 4a6 6 0 1 0 0 12 6 6 0 0 0 0-12zm-8 6a8 8 0 1 1 14.32 4.906l3.387 3.387a1 1 0 0 1-1.414 1.414l-3.387-3.387A8 8 0 0 1 2 10z'/%3e%3c/svg%3e");
    --icon-pin: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3e%3cpath d='M16 12V4H17V2H7V4H8V12L6 14V16H11.0312V22H12.9688V16H18V14L16 12Z'/%3e%3c/svg%3e");
    --icon-pin-off: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3e%3cpath fill-rule='evenodd' d='M3.707 4.707a1 1 0 0 0 0 1.414l14.586 14.586a1 1 0 0 0 1.414-1.414L5.121 4.707a1 1 0 0 0-1.414 0Z' clip-rule='evenodd'/%3e%3cpath d='M16 12V4H17V2H7V4H7.28L16 12.72V12ZM11.031 16H6V14L8 12V12.72L9.28 14H11.031V16ZM12.969 22V16H18V14L16 12V11.28L18.72 14H18V16H12.969V22Z'/%3e%3c/svg%3e");
    --magnifier-bg: rgba(255, 255, 255, 0.85);
    --magnifier-border: #a0aec0;
    --magnifier-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* TEMA SCURO */
[data-theme="dark"] {
    --bg-color: #1a202c; --panel-bg: #2d3748; --wheel-bg: #2d3748; --text-primary: #f7fafc; --text-secondary: #a0aec0; --line-base: #4a5568; --line-week: #718096; --line-month: #b07eb0; --line-year: #f7fafc; --accent-color-1: #374151; --accent-color-2: #4a5568; 
    --arrow-um: #63b3ed; /* Blu chiaro brillante per il dark mode */
    --arrow-dpp: #f97316;
    --toggle-bg: #4a5568; --tooltip-bg: #f7fafc; --tooltip-text: #1a202c;
    --dp-background: #1E1E1E; --dp-text-primary: #F0F0F0; --dp-text-secondary: #6B6B6B; --dp-accent-background: #339DFF; --dp-accent-text: #111111; --dp-today-border: #339DFF; --dp-hover-background: #2C2C2C; --dp-shadow: 0 4px 12px rgba(0,0,0,0.4);
    --magnifier-bg: rgba(45, 55, 72, 0.85);
    --magnifier-border: #718096;
    --magnifier-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    --sidebar-bg: #2d3748; --sidebar-text: #f7fafc; --sidebar-accent: #14b8a6; --sidebar-secondary-bg: #1a202c; --sidebar-border: #4a5568;
}

body, html { height: 100%; margin: 0; padding: 0; font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background-color: var(--bg-color); transition: background-color 0.3s ease; overflow: hidden; }

/* ==========================================================================
   [1] LAYOUT PRINCIPALE E RESPONSIVE
   ========================================================================== */
#app-container { display: flex; align-items: center; justify-content: center; gap: 2vw; width: 100%; height: 100%; padding: 2vw; box-sizing: border-box; }
.wheel-container { position: relative; width: 92vmin; height: 92vmin; max-width: 800px; max-height: 800px; flex-shrink: 0; transition: transform 600ms ease-in-out, filter 300ms; }
#info-panel { width: 480px; flex-shrink: 0; transition: transform 600ms ease-in-out 150ms, opacity 600ms ease-in-out 150ms, width 600ms ease-in-out 150ms, filter 300ms; }

/* Stati del Layout */
.focus-mode .wheel-container { transform: scale(1.1); }
.focus-mode #info-panel { opacity: 0; transform: translateX(100%); width: 0; }
.focus-mode #exam-tooltip { opacity: 0; visibility: hidden; transition: opacity 300ms, visibility 300ms; }
body:not(.tutorial-active) .focus-mode #call-to-action.hidden { opacity: 0; }
.dashboard-visible .wheel-container { transform: scale(1); }
.dashboard-visible #info-panel { opacity: 1; transform: translateX(0); width: 480px; }
.dashboard-visible #call-to-action { display: none; }

#call-to-action { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; z-index: 10; pointer-events: none; transition: opacity 0.3s ease-in-out; }
.frosted-glass-cta { width: 250px; height: 250px; background-color: rgba(255, 255, 255, 0.15); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 50%; display: flex; justify-content: center; align-items: center; text-align: center; padding: 20px; box-sizing: border-box; }
.frosted-glass-cta p {
    margin: 0;
    color: var(--text-primary); 
    font-size: 1.2em;
    font-weight: 500;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Media Queries */
@media (max-width: 1100px) {
    #app-container { 
        flex-direction: column; 
        justify-content: flex-start; 
        padding: 80px 10px 40px; 
        gap: 20px;
        height: auto;
        overflow-y: auto;
    }
    .focus-mode #app-container { 
        justify-content: center; 
        padding: 2vw; 
        height: 100%; 
        overflow-y: hidden;
    }
    .focus-mode #info-panel { transform: translateY(100%); width: 95%; }
    .dashboard-visible #info-panel { transform: translateY(0); width: 95%; max-width: 450px; max-height: none; overflow-y: visible; }
    .wheel-container { width: 80vw; height: 80vw; max-width: 400px; max-height: 400px; flex-shrink: 0; }
}

@media (max-width: 768px) {
    #utility-sidebar.open { width: 85%; box-shadow: 5px 0 20px rgba(0,0,0,0.5); }
    #sidebar-handle.open { left: 85%; }
    .modal-header h1 { font-size: 1.8em; }
    #info-panel { padding: 20px 15px; }
    .hybrid-date-picker input { font-size: 20px; }
    .button-group { flex-direction: column; }
    #app-container {
        padding-top: 60px; 
    }
}

/* STILI PER LOGIN FOOTER */
.login-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid var(--line-base);
    font-size: 0.8em;
}
.login-footer a {
    color: var(--text-secondary);
    font-weight: 600;
    text-decoration: none;
    margin: 0 5px;
}
.login-footer a:hover {
    color: var(--arrow-um);
}

#login-copyright {
    position: fixed;
    bottom: 10px;
    left: 0;
    width: 100%;
    text-align: center;
    font-size: 0.8em;
    color: var(--text-secondary);
    z-index: 1;
}

#login-theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background-color: var(--toggle-bg);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 110; 
    transition: transform 0.2s, background-color 0.3s;
}
#login-theme-toggle:hover {
    transform: scale(1.1);
}
#login-theme-toggle::before {
    content: '';
    display: block;
    width: 24px;
    height: 24px;
    background-color: var(--text-primary);
    -webkit-mask-size: contain;
    mask-size: contain;
    mask-image: var(--icon-theme-light);
    -webkit-mask-image: var(--icon-theme-light);
}
[data-theme="dark"] #login-theme-toggle::before {
    mask-image: var(--icon-theme-dark);
    -webkit-mask-image: var(--icon-theme-dark);
}

/* STILE AVVISO FLUTTUANTE (Toast Notification) */
#global-announcement-banner {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 90%;
    max-width: 400px;
    background-color: var(--panel-bg); /* Usa il colore del pannello del tema */
    color: var(--text-primary);
    border-left: 5px solid var(--arrow-um); /* Barra laterale colorata */
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    padding: 20px;
    z-index: 10000;
    display: none; /* Nascosto di default */
    opacity: 0;
    transform: translateX(50px);
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: left;
    font-size: 0.95em;
    line-height: 1.5;
    box-sizing: border-box;
}

#global-announcement-banner.show-banner {
    display: block;
    opacity: 1;
    transform: translateX(0);
}

#global-announcement-banner h4 {
    margin: 0 0 10px 0;
    color: var(--arrow-um);
    font-size: 1.1em;
    padding-right: 20px;
}

#global-announcement-banner .banner-content ul {
    margin: 5px 0;
    padding-left: 20px;
    list-style-type: disc;
}

.banner-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 5px;
}

.banner-close-btn:hover {
    color: var(--arrow-um);
}

/* Mobile: in alto al centro */
@media (max-width: 480px) {
    #global-announcement-banner {
        top: 10px;
        right: 5%;
        left: 5%;
        width: 90%;
    }
}
    body {
        height: auto;
        min-height: 100vh;
        padding-top: 0;
    }


#global-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.3s ease, visibility 0.3s;
    color: var(--text-primary);
    visibility: visible;
    opacity: 1;
}

#global-loader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--line-base);
    border-top-color: var(--arrow-um);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    body, html {
        height: auto !important;
        overflow-y: auto !important; 
        overflow-x: hidden;
    }

    #app-container {
        display: block; 
        height: auto;
        padding: 10px;
        overflow: visible;
    }

    .wheel-container {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        opacity: 0;
        pointer-events: none;
        z-index: -100;
        left: 0;
        top: 0;
    }

    #info-panel {
        width: 100% !important;
        max-width: 100% !important;
        opacity: 1 !important;
        transform: none !important;
        margin: 0 auto;
        padding: 0;
        height: auto !important;
        max-height: none !important;
        display: block !important;
    }

    #call-to-action,
    #hand-guide-animation,
    .pulse-shape-inner,
    .pulse-shape-outer {
        display: none !important;
    }
}
/* Stile per il cursore e il testo quando fuori validità */
.forecast-arrow.invalid {
    fill: #e74c3c !important; /* Rosso errore */
    stroke: #c0392b !important;
}

text.forecast-day-number.invalid {
    fill: #e74c3c !important;
    font-weight: bold;
}