:root {
    --primary: #2563eb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --critical: #dc2626;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

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

header {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, #1e40af 100%);
    color: white;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.card h2 {
    margin-bottom: 20px;
    color: var(--text);
}

/* Upload Section */
.upload-options {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.upload-box {
    flex: 1;
    min-width: 250px;
}

.or-divider {
    font-weight: bold;
    color: var(--text-muted);
}

.file-name {
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.settings {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: var(--bg);
    border-radius: 8px;
    flex-wrap: wrap;
}

.settings label {
    font-weight: 600;
}

.settings input[type="number"] {
    width: 100px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-secondary {
    background: var(--text-muted);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
    border-left: 4px solid var(--primary);
}

.stat-card.critical {
    border-left-color: var(--critical);
}

.stat-card.success {
    border-left-color: var(--success);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-card.critical .stat-value {
    color: var(--critical);
}

.stat-card.success .stat-value {
    color: var(--success);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Scenarios */
.scenario-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.scenario-tab {
    padding: 12px 24px;
    border: none;
    background: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-muted);
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.scenario-tab:hover {
    color: var(--text);
}

.scenario-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.scenario-content {
    padding: 20px 0;
}

.scenario-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.scenario-metric {
    padding: 20px;
    background: var(--bg);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

.scenario-metric.highlight {
    border-left-color: var(--success);
    background: #f0fdf4;
}

.scenario-metric-value {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.scenario-metric-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.scenario-description {
    padding: 20px;
    background: #fef3c7;
    border-radius: 8px;
    margin-top: 20px;
    border-left: 4px solid var(--warning);
}

/* Table */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.table-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.table-actions input,
.table-actions select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: var(--bg);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    cursor: pointer;
    user-select: none;
}

th:hover {
    background: var(--border);
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

tr:hover {
    background: var(--bg);
}

/* Rating badges */
.rating {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.rating-Excellent {
    background: #d1fae5;
    color: #065f46;
}

.rating-Good {
    background: #dbeafe;
    color: #1e40af;
}

.rating-Fair {
    background: #fef3c7;
    color: #92400e;
}

.rating-Poor {
    background: #fed7aa;
    color: #9a3412;
}

.rating-Critical {
    background: #fee2e2;
    color: #991b1b;
}

/* Action badges */
.action {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.action-PAUSE {
    background: #fee2e2;
    color: #991b1b;
}

.action-DECREASE {
    background: #fef3c7;
    color: #92400e;
}

.action-MAINTAIN {
    background: #dbeafe;
    color: #1e40af;
}

.action-INCREASE {
    background: #d1fae5;
    color: #065f46;
}

/* Utility */
.hidden {
    display: none !important;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .table-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .table-actions {
        flex-direction: column;
    }
}
