/* ==========================================================
   MODUL WHAT-IF (SCENARII) - DESIGN PREMIUM
   ========================================================== */

.whatif-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: rgba(15, 23, 42, 0.75); /* Culoare de bază semi-transparentă */
    background-image: radial-gradient(rgba(255, 255, 255, 0.09) 1px, transparent 0); /* Micro-textura sablată */
    background-size: 1px 1px; /* Dimensiunea texturii */
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    animation: softFade 0.2s ease-out forwards;
    will-change: opacity;
}

.whatif-container {
    background: var(--bg);
    width: 100%;
    max-width: 950px;
    max-height: 90vh;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: softSlide 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    will-change: transform, opacity;
}

.whatif-header {
    padding: 25px 30px;
    border-bottom: 2px solid var(--border);
    background: var(--card-bg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.whatif-header h2 {
    margin: 0;
    border: none;
    padding: 0;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.whatif-close-btn {
    background: var(--danger-bg);
    color: var(--danger);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.whatif-close-btn:hover {
    background: var(--danger);
    color: white;
    transform: scale(1.05);
}

.whatif-body {
    padding: 30px;
    overflow-y: auto;
    background: var(--bg);
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch; /* Scroll cu inerție pe ecranele tactile */
    transform: translateZ(0);          /* Trimite randarea direct pe placa video */
    will-change: scroll-position;
}

.whatif-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    position: relative;
}

.whatif-col-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: 0.2s ease;
    transform: translate3d(0, 0, 0); 
    backface-visibility: hidden;
}

.whatif-col-card.referinta { border-top: 4px solid #64748b; }
.whatif-col-card.propus { border-top: 4px solid var(--accent); }

.whatif-col-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.whatif-cost-curent-box {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid #10b981;
    padding: 15px;
    border-radius: 16px;
    margin-top: 25px;
    text-align: center;
}

.whatif-rezultat-final {
    margin-top: 30px;
    background: linear-gradient(145deg, var(--card-bg), var(--bg));
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 30px;
    box-shadow: var(--shadow-md);
    text-align: center;
    animation: softFade 0.3s ease-out forwards;
}

/* Flex Row pentru input-uri */
.whatif-input-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}
.whatif-input-row > div {
    flex: 1;
}

/* Containerul de rezultate - Stil Premium */
.wi-result-details {
    margin-top: 15px;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: #f8fafc; /* Fundal deschis pentru Light Mode */
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Stil pentru coloanele din interiorul detaliilor */
.wi-result-col {
    padding: 5px;
}

.wi-result-col b {
    color: var(--text); /* Textul va fi negru pe light, alb pe dark */
}

/* ========================================================== */
/* STILURI WHAT-IF - 100% CSP COMPLIANT (FĂRĂ STILURI INLINE)  */
/* ========================================================== */
.whatif-overlay {
    display: none;
}
.whatif-overlay.whatif-show {
    display: flex;
}
.overflow-hidden {
    overflow: hidden !important;
}
.whatif-hidden {
    display: none !important;
}
.whatif-cost-label {
    font-size: 0.85rem;
    font-weight: bold;
    color: #10b981;
    text-transform: uppercase;
}
.whatif-cost-value {
    font-size: 1.8rem;
    font-weight: 900;
    color: #10b981;
}
.whatif-accent-title {
    color: var(--accent);
}
.whatif-section-divider {
    border-top: 1px dashed var(--border);
    padding-top: 20px;
    margin-bottom: 25px;
}
.whatif-input-margin-lg {
    margin-bottom: 15px;
}
.whatif-input-margin-sm {
    margin-bottom: 5px;
}
.whatif-btn-full {
    width: 100%;
    font-size: 1rem;
}
.whatif-rezultat-title {
    margin-top: 0;
    color: var(--text-muted);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.whatif-rezultat-cost {
    font-size: 3rem;
    font-weight: 900;
    color: var(--primary);
    margin: 10px 0;
    line-height: 1;
}
.whatif-margin-20 {
    margin: 20px 0;
}
.whatif-badge-instante {
    font-size: 0.7rem;
    background: rgba(99, 102, 241, 0.15);
    color: #6366f1;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 700;
}
.whatif-col-heading {
    font-weight: 700;
    font-size: 0.85rem;
    margin: 12px 0 6px;
}
.whatif-col-heading-main {
    font-weight: 700;
    font-size: 0.85rem;
    margin: 12px 0 6px;
    color: var(--text-main);
}
.sr-only-custom {
    display: none !important;
}
.whatif-input-disabled {
    margin-bottom: 5px;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-muted);
}
.whatif-input-disabled-spaced {
    margin-bottom: 15px;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-muted);
}
.wi-result-col-border {
    border-left: 1px solid var(--border);
    padding-left: 10px;
}
.eco-positive {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 2px solid rgba(16, 185, 129, 0.2);
    display: inline-block;
    padding: 10px 25px;
    border-radius: 30px;
}
.eco-negative {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 2px solid rgba(239, 68, 68, 0.2);
    display: inline-block;
    padding: 10px 25px;
    border-radius: 30px;
}
.eco-neutral {
    background: rgba(14, 165, 233, 0.1);
    color: #0ea5e9;
    border: 2px solid rgba(14, 165, 233, 0.2);
    display: inline-block;
    padding: 10px 25px;
    border-radius: 30px;
}
.wi-report-header {
    grid-column: 1 / -1;
    margin-bottom: 10px;
    border-bottom: 1px dashed var(--border);
    padding-bottom: 5px;
}
.wi-primary-text { color: var(--primary); }
.wi-mb-10 { margin-bottom: 10px; }
.wi-small-text { font-size: 0.8rem; }
.text-success { color: #10b981 !important; }
.text-danger { color: #ef4444 !important; }
.text-info { color: #0ea5e9 !important; }
.card-per-grup1 { margin-bottom:6px; font-weight:600; font-size:0.85rem; }
.card-per-grup2 { margin-bottom:6px; font-weight:600; font-size:0.85rem; color: var(--text-main); }
.whatif-label-main { color: var(--text-main); }
/* Suport Mobil */
@media (max-width: 850px) {
    .whatif-grid { grid-template-columns: 1fr; gap: 20px; }
    .whatif-vs-badge { display: none; }
    .whatif-header h2 { font-size: 1.2rem; }
    .whatif-body { padding: 20px; }
}

/* =========================================
   DARK MODE PENTRU WHAT-IF
   ========================================= */
body.dark-mode .whatif-overlay {
    background: rgba(2, 6, 23, 0.85);
}
body.dark-mode .whatif-container {
    background: #0f172a;
    border-color: #334155;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.7), 0 0 0 1px #334155;
}
body.dark-mode .whatif-header {
    background: #1e293b;
    border-color: #334155;
}
body.dark-mode .whatif-body {
    background: #0f172a;
}
body.dark-mode .whatif-distributie-card,
body.dark-mode .whatif-col-card {
    background: #1e293b;
    border-color: #334155;
}
body.dark-mode .whatif-col-card:hover {
    border-color: #38bdf8;
}
body.dark-mode .whatif-vs-badge {
    border-color: #0f172a;
    background: #38bdf8;
    color: #0f172a;
}
body.dark-mode .whatif-rezultat-final {
    background: #1e293b;
    border-color: #334155;
}
body.dark-mode .whatif-close-btn {
    background: #450a0a;
    color: #f87171;
}
body.dark-mode .whatif-close-btn:hover {
    background: #7f1d1d;
    color: white;
}
body.dark-mode .whatif-cost-curent-box {
    background: rgba(52, 211, 153, 0.1);
    border-color: #059669;
}

/* Dark Mode Override */
body.dark-mode .wi-result-details {
    background: #1e293b; /* Fundal închis premium */
    border-color: #334155;
    color: #94a3b8;
}

/* --- ANIMAȚII OPTIMIZATE PENTRU ECRANE DE ÎNALTĂ FRECVENȚĂ (120Hz - 300Hz) --- */
@keyframes softFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes softSlide {
    from { 
        opacity: 0;
        transform: scale(0.97) translateY(15px); /* O mișcare foarte fină de jos în sus, extrem de elegantă */
    }
    to { 
        opacity: 1;
        transform: scale(1) translateY(0); 
    }
}