/* ==========================================================================
   Stili per il Calcolatore di Fatica (Compatibile con Tailwind Dark/Light)
   ========================================================================== */

/* --- LEGEND COLORS (Barre interne) --- */
.legend-low {
    background-color: #22c55e; /* green-500 */
    color: white !important;
}
.legend-medium {
    background-color: #f59e0b; /* amber-500 */
    color: white !important;
}
.legend-high {
    background-color: #ef4444; /* red-500 */
    color: white !important;
}
.legend-critical {
    background-color: #8b5cf6; /* violet-500 */
    color: white !important;
}

/* --- FIX CONTRASTO TEMA CHIARO (Default quando .dark NON è presente) --- */
/* Forza il testo scuro nel calcolatore quando siamo in modalità luce */
#fatigue-form label,
#fatigue-form h3,
#fatigue-form h4,
#fatigue-form .text-sm,
.factor-label,
#recommendations,
#recommendations h4,
#recommendation-list li {
    color: #1e293b; /* slate-800 (nero/blu scuro) */
}

/* --- FIX INPUT & SELECT IN TEMA CHIARO --- */
/* Evita che ereditino il bianco del body */
#fatigue-form input,
#fatigue-form select,
#fatigue-form textarea {
    color: #111827 !important; /* gray-900 */
    background-color: #ffffff !important;
    border-color: #d1d5db !important;
}

/* --- RIPRISTINO TEMA SCURO (.dark presente) --- */
.dark #fatigue-form label,
.dark #fatigue-form h3,
.dark #fatigue-form h4,
.dark .factor-label,
.dark #recommendations,
.dark #recommendation-list li {
    color: #f1f5f9 !important; /* slate-100 (bianco) */
}

.dark #fatigue-form input,
.dark #fatigue-form select,
.dark #fatigue-form textarea {
    color: #f3f4f6 !important;
    background-color: #1f2937 !important; /* gray-800 */
    border-color: #4b5563 !important;
}

/* --- RISULTATI & INDICATORI --- */
.risk-indicator {
    text-align: center;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    color: white !important; /* Qui il bianco va bene perché lo sfondo è colorato */
    transition: all 0.3s ease;
}

.risk-low { background-color: #22c55e; }
.risk-medium { background-color: #f59e0b; }
.risk-high { background-color: #ef4444; }
.risk-critical { background-color: #8b5cf6; }

/* --- BARRE DEI FATTORI --- */
.factor-bar {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.factor-label {
    width: 33%;
    font-weight: 600;
    font-size: 0.875rem;
    padding-right: 12px;
    text-align: right;
}

.bar-container {
    flex-grow: 1;
    background-color: #e5e7eb; /* Grigio chiaro per Light Mode */
    border-radius: 9999px;
    height: 16px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
}

.dark .bar-container {
    background-color: #374151; /* Grigio scuro per Dark Mode */
}

.bar-fill {
    height: 100%;
    transition: width 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 8px;
}

.bar-score {
    font-size: 10px;
    font-weight: 900;
    /* Colore gestito via JS o con fallback qui */
}

/* --- RECOMMENDATIONS BOX --- */
#recommendations {
    margin-top: 24px;
    padding: 16px;
    border-radius: 12px;
    background-color: #f8fafc; /* Fondo chiarissimo per Light Mode */
    border-left: 4px solid #3b82f6;
}

.dark #recommendations {
    background-color: rgba(31, 41, 55, 0.5); /* Sfondo scuro trasparente */
    border-color: #60a5fa;
}

