/* Base Styles */
* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); 
    color: #eee; 
    min-height: 100vh; 
}

/* Header */
.site-header {
    background: rgba(0, 0, 0, 0.3);
    padding: 15px 20px;
    border-bottom: 1px solid #333;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ff6b35;
    text-decoration: none;
}

.nav-links a {
    color: #4ecdc4;
    text-decoration: none;
    margin-left: 20px;
    font-size: 14px;
}

.nav-links a:hover {
    color: #fff;
}

/* Main Content */
main {
    padding: 20px;
}

h1 { 
    text-align: center; 
    margin-bottom: 20px; 
    color: #ff6b35; 
}

/* Intro Section */
.intro-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.intro-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #333;
    border-radius: 10px;
    padding: 15px;
}

.intro-card h2 {
    font-size: 14px;
    color: #4ecdc4;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.intro-card p {
    font-size: 13px;
    color: #bbb;
    line-height: 1.6;
    margin-bottom: 8px;
}

.intro-card ul {
    font-size: 12px;
    color: #aaa;
    line-height: 1.8;
    padding-left: 18px;
}

.intro-card li {
    margin-bottom: 4px;
}

.intro-card strong {
    color: #fff;
}

.intro-card.highlight {
    background: rgba(78, 205, 196, 0.08);
    border-color: #4ecdc4;
}

.intro-card .formula {
    font-family: 'Consolas', monospace;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    color: #4ecdc4;
    margin-top: 10px;
}

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

/* Controls Grid */
.controls { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); 
    gap: 15px; 
    margin-bottom: 20px; 
}

/* Scenario Cards */
.scenario-card { 
    background: rgba(255,255,255,0.05); 
    border-radius: 12px; 
    padding: 15px; 
    border: 2px solid #333; 
}

.scenario-card h3 { 
    color: #4ecdc4; 
    margin-bottom: 10px; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

.scenario-card.s1 { border-color: #2E86AB; } 
.scenario-card.s1 h3 { color: #2E86AB; }

.scenario-card.s2 { border-color: #A23B72; } 
.scenario-card.s2 h3 { color: #A23B72; }

.scenario-card.s3 { border-color: #F18F01; } 
.scenario-card.s3 h3 { color: #F18F01; }

/* Form Elements */
.form-group { 
    margin-bottom: 8px; 
}

label { 
    display: block; 
    font-size: 11px; 
    color: #aaa; 
    margin-bottom: 2px; 
}

input, select { 
    width: 100%; 
    padding: 6px 10px; 
    border: 1px solid #444; 
    border-radius: 6px; 
    background: #1a1a2e; 
    color: #fff; 
    font-size: 13px; 
}

input:focus { 
    outline: none; 
    border-color: #4ecdc4; 
}

.section-label { 
    font-size: 11px; 
    color: #666; 
    margin: 10px 0 5px 0; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    border-bottom: 1px solid #333; 
    padding-bottom: 3px; 
}

.row-group { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 8px; 
}

/* Emergency Section */
.emergency-section { 
    margin-top: 10px; 
}

.emergency-list { 
    max-height: 150px; 
    overflow-y: auto; 
    background: rgba(0,0,0,0.2); 
    border-radius: 6px; 
    padding: 8px; 
    margin-top: 5px; 
}

.emergency-item { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    margin-bottom: 6px; 
    font-size: 12px; 
}

.emergency-item input { 
    width: 60px; 
    padding: 4px 6px; 
}

.emergency-item .year-label { 
    width: 50px; 
    color: #aaa; 
}

.emergency-item .remove-btn { 
    background: #ff6b6b; 
    border: none; 
    color: white; 
    width: 20px; 
    height: 20px; 
    border-radius: 4px; 
    cursor: pointer; 
    font-size: 14px; 
    line-height: 1; 
}

.emergency-item .remove-btn:hover { 
    background: #ff4757; 
}

.add-emergency-btn { 
    background: #4ecdc4; 
    border: none; 
    color: #1a1a2e; 
    padding: 6px 12px; 
    border-radius: 6px; 
    cursor: pointer; 
    font-size: 11px; 
    margin-top: 8px; 
    font-weight: bold; 
}

.add-emergency-btn:hover { 
    background: #45b7aa; 
}

.emergency-inputs { 
    display: flex; 
    gap: 8px; 
    margin-top: 8px; 
}

.emergency-inputs input { 
    flex: 1; 
}

/* Results Section */
.results { 
    display: grid; 
    grid-template-columns: 1fr 1fr; 
    gap: 20px; 
    margin-top: 20px; 
}

.chart-container { 
    background: rgba(255,255,255,0.05); 
    border-radius: 12px; 
    padding: 20px; 
}

canvas { 
    width: 100% !important; 
    height: 400px !important; 
}

/* Table */
table { 
    width: 100%; 
    border-collapse: collapse; 
    font-size: 12px; 
}

th, td { 
    padding: 8px; 
    text-align: right; 
    border-bottom: 1px solid #333; 
}

th { 
    background: rgba(78, 205, 196, 0.2); 
    color: #4ecdc4; 
    position: sticky; 
    top: 0; 
}

td:first-child, th:first-child { 
    text-align: center; 
}

.table-container { 
    max-height: 450px; 
    overflow-y: auto; 
    background: rgba(255,255,255,0.05); 
    border-radius: 12px; 
    padding: 10px; 
}

/* Summary Cards */
.summary { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 15px; 
    margin-top: 20px; 
}

.summary-card { 
    background: rgba(255,255,255,0.05); 
    border-radius: 12px; 
    padding: 15px; 
    text-align: center; 
}

.summary-card .label { 
    font-size: 12px; 
    color: #aaa; 
}

.summary-card .value { 
    font-size: 24px; 
    font-weight: bold; 
    margin: 5px 0; 
}

.summary-card .sub { 
    font-size: 12px; 
    color: #4ecdc4; 
}

/* Color Classes */
.s1-color { color: #2E86AB; } 
.s2-color { color: #A23B72; } 
.s3-color { color: #F18F01; }

/* Bar Chart Section */
.bar-chart-section {
    margin-top: 30px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.bar-chart-container {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 20px;
}

.bar-chart-container canvas {
    width: 100% !important;
    height: 300px !important;
}

.milestone-chart-container {
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    padding: 20px;
}

.milestone-row {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 15px;
    margin-bottom: 15px;
    align-items: center;
}

.milestone-label {
    font-size: 14px;
    color: #4ecdc4;
    font-weight: bold;
}

.milestone-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.milestone-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.milestone-bar-fill {
    height: 20px;
    border-radius: 4px;
    min-width: 5px;
    transition: width 0.3s ease;
}

.milestone-bar-text {
    font-size: 11px;
    color: #aaa;
    white-space: nowrap;
}

.milestone-bar-text.never {
    color: #ff6b6b;
    font-style: italic;
}

/* Footer */
.site-footer {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    text-align: center;
    margin-top: 40px;
    border-top: 1px solid #333;
}

.site-footer p {
    color: #666;
    font-size: 12px;
    margin: 5px 0;
}

.site-footer .copyright {
    color: #444;
}

/* Chart Tooltip */
.chart-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #4ecdc4;
    border-radius: 8px;
    padding: 10px 14px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 100;
    min-width: 150px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.chart-tooltip.visible {
    opacity: 1;
}

.tooltip-year {
    font-weight: bold;
    color: #4ecdc4;
    margin-bottom: 8px;
    font-size: 13px;
    border-bottom: 1px solid #333;
    padding-bottom: 6px;
}

.tooltip-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
    font-size: 12px;
}

.tooltip-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tooltip-name {
    color: #aaa;
    flex: 1;
}

.tooltip-value {
    font-weight: bold;
    color: #fff;
}

/* Responsive */
@media (max-width: 900px) { 
    .results { 
        grid-template-columns: 1fr; 
    }
    
    .summary {
        grid-template-columns: 1fr;
    }
    
    .bar-chart-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .controls {
        grid-template-columns: 1fr;
    }
    
    .row-group {
        grid-template-columns: 1fr;
    }
}
