:root {
    --bg-dark: #020617;
    --bg-card: rgba(15, 23, 42, 0.6);
    --border-glow: rgba(16, 185, 129, 0.2);
    --primary: #10b981;
    --secondary: #64748b;
    --accent: #22d3ee;
    --danger: #ef4444;
    --warning: #f59e0b;
    --safe: #10b981;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --font-main: 'Outfit', sans-serif;
}

.text-primary { color: var(--primary) !important; }
.text-accent { color: var(--accent) !important; }

body {
    background: var(--bg-dark);
    background-image: radial-gradient(circle at 50% 0%, rgba(34, 211, 238, 0.1) 0%, transparent 50%),
                      radial-gradient(circle at 0% 100%, rgba(16, 185, 129, 0.05) 0%, transparent 50%);
    color: var(--text-main);
    font-family: var(--font-main);
    margin: 0;
    padding: 1.5rem;
    min-height: 100vh;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header & Badges */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
}

header h1 {
    font-size: 2.2rem;
    background: linear-gradient(to right, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin: 0;
}

.premium-badge {
    padding: 0.4rem 1rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.premium-badge.locked {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-muted);
}

.premium-badge.unlocked {
    background: linear-gradient(45deg, #f59e0b, #fbbf24);
    color: #451a03;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.5);
}

/* Layout */
.calculator {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 2rem;
}

.section-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 18px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 1.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Inputs */
.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.input-group input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 0.8rem;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.select-premium {
    width: 100%;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 0.8rem;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    outline: none;
    transition: all 0.3s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2rem;
}

.select-premium:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--border-glow);
}

/* Toggle Switch */
.toggle-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.toggle-label {
    font-size: 0.9rem;
    color: var(--text-main);
    font-weight: 500;
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.input-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--border-glow);
}

.row {
    display: flex;
    gap: 1rem;
}

.row .input-group {
    flex: 1;
}

/* Risk Alerts */
.risk-card {
    border-radius: 18px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.5s ease;
}

.risk-level-safe { background: rgba(16, 185, 129, 0.15); border: 1px solid var(--safe); }
.risk-level-warning { background: rgba(245, 158, 11, 0.15); border: 1px solid var(--warning); }
.risk-level-critical { background: rgba(239, 68, 68, 0.15); border: 1px solid var(--danger); animation: pulse 2s infinite; }

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.risk-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.risk-header h3 { margin: 0; font-size: 1.3rem; }

/* Result Cards */
.result-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Visualization Modes */
.view-simple .hide-basic {
    display: none !important;
}
.view-simple .hide-expert {
    display: block !important;
}
.hide-expert {
    display: none !important;
}

.card {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 18px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.card.highlight p { color: var(--accent); }
.card.savings p { color: var(--primary); }
.card p { font-size: 1.8rem; font-weight: 700; margin: 0; }
.card small { font-size: 0.9rem; font-weight: 400; color: var(--text-muted); }

/* Buttons & History */
.btn {
    width: 100%;
    padding: 0.8rem;
    border-radius: 10px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 0.5rem;
}

.btn-primary { background: var(--primary); color: #064e3b; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4); }

.btn-secondary { background: rgba(255, 255, 255, 0.1); color: white; border: 1px solid rgba(255,255,255,0.1); }

.history-list {
    margin-top: 1.5rem;
    max-height: 150px;
    overflow-y: auto;
}

.history-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #0f172a;
    border: 1px solid rgba(255, 184, 0, 0.3);
    padding: 3rem;
    border-radius: 30px;
    max-width: 500px;
    text-align: center;
}

.premium-tag {
    background: #f59e0b;
    color: #451a03;
    padding: 0.2rem 0.8rem;
    border-radius: 4px;
    font-weight: 800;
    font-size: 0.7rem;
}

.features-list {
    text-align: left;
    margin: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    color: var(--text-muted);
}

.hidden { display: none !important; }

.chart-container {
    background: var(--bg-card);
    border-radius: 18px;
    padding: 1.5rem;
    height: 300px;
    margin-bottom: 2rem;
}

.info-block {
    background: rgba(245, 158, 11, 0.05);
    border-left: 4px solid #f59e0b;
    padding: 1.2rem;
    border-radius: 12px;
}

.info-block h4 {
    margin: 0 0 0.5rem 0;
    color: #f59e0b;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-block p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
}

@media (max-width: 900px) {
    .calculator { grid-template-columns: 1fr; }
    .result-cards { grid-template-columns: 1fr; }
    .btn { padding: 1rem; font-size: 1rem; border-radius: 14px; }
}

/* Solar Project Styling */
.solar-card {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(15, 23, 42, 1) 100%);
    border: 1px solid rgba(245, 158, 11, 0.3);
    margin-bottom: 20px;
}

.solar-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 1.5rem;
    align-items: center;
    margin-top: 10px;
}

.solar-col-left {
    text-align: center;
    border-right: 1px solid rgba(245, 158, 11, 0.2);
    padding-right: 1rem;
}

.solar-info-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 5px;
}

.info-label { color: #d97706; }
.info-value { color: #fdfdfd; font-weight: bold; }

.solar-card .result-title {
    color: #f59e0b; /* Amber 500 */
}

.solar-card .result-value {
    color: #fbbf24; /* Amber 400 */
    font-size: 2.2rem;
    margin: 0;
}

.solar-card .result-footer {
    color: #10b981; /* Emerald 500 for total savings long term */
    font-size: 0.8rem;
    font-weight: 700;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed rgba(16, 185, 129, 0.2);
}

.solar-timeline-container {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.timeline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: #94a3b8;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.timeline-bar {
    height: 8px;
    background: #10b981; /* Green by default (profit area) */
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

.timeline-progress {
    height: 100%;
    background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%); /* Amber for payback */
    width: 0%; /* Dynamic */
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.timeline-caption {
    display: block;
    font-size: 0.6rem;
    text-align: center;
    color: #fbbf24;
    margin-top: 4px;
    opacity: 0.8;
}

.solar-note {
    font-size: 0.72rem;
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.05);
    padding: 8px 12px;
    border-radius: 8px;
    margin-top: 15px;
    border-left: 3px solid #fbbf24;
}

.solar-note strong { color: #fbbf24; }

.solar-disclaimer {
    font-size: 0.65rem;
    color: #64748b;
    margin-top: 8px;
    font-style: italic;
    opacity: 0.8;
    text-align: center;
}

@media (max-width: 600px) {
    .solar-grid {
        grid-template-columns: 1fr;
    }
    .solar-col-left {
        border-right: none;
        border-bottom: 1px solid rgba(245, 158, 11, 0.2);
        padding-right: 0;
        padding-bottom: 1rem;
    }
}

/* =========================================================
   OPTIMIZACIÓN DE IMPRESIÓN (MVP PDF VÍA NAVEGADOR)
   ========================================================= */
@media print {
    body {
        background: white !important;
        background-image: none !important;
        color: black !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        padding: 0 !important;
    }
    
    header, .input-panel, .view-mode-selector, .btn, .premium-badge, #pdf-checkbox, label[for="pdf-checkbox"] {
        display: none !important;
    }

    .calculator {
        display: block !important;
    }

    .output-panel {
        width: 100% !important;
    }

    .card, .solar-card, .risk-card, .chart-container {
        background: white !important;
        border: 1px solid #cbd5e1 !important;
        color: #0f172a !important;
        box-shadow: none !important;
        margin-bottom: 1rem !important;
        page-break-inside: avoid;
    }

    h3, p, span, .result-value, .result-title, .info-label, .timeline-caption, .solar-note {
        color: #0f172a !important;
        text-shadow: none !important;
    }
    
    .timeline-bar {
        border: 1px solid #cbd5e1;
    }
    
    .risk-level-safe { border-left: 5px solid #10b981 !important; }
    .risk-level-warning { border-left: 5px solid #f59e0b !important; }
    .risk-level-critical { border-left: 5px solid #ef4444 !important; }
}

