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

:root {
    --primary-color: #3498db;
    --secondary-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --background: #f5f7fa;
    --card-background: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #dce1e6;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

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

/* Header */
header {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary-color), #2980b9);
    color: white;
    border-radius: 12px;
    margin-bottom: 40px;
    box-shadow: var(--shadow);
}

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

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 300;
}

/* Upload Section */
.upload-section {
    background: var(--card-background);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 30px;
}

.form-group label {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.label-icon {
    font-size: 1.3rem;
    margin-right: 8px;
}

.form-group input[type="file"] {
    display: block;
    width: 100%;
    padding: 15px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    background: var(--background);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.form-group input[type="file"]:hover {
    border-color: var(--primary-color);
    background: #f8f9fa;
}

.file-info {
    margin-top: 10px;
    padding: 10px;
    background: #e8f5e9;
    border-left: 4px solid var(--success-color);
    border-radius: 4px;
    display: none;
}

.file-name {
    font-weight: 600;
    color: var(--success-color);
}

.file-size {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-left: 8px;
}

/* Buttons */
.btn-submit, .btn-secondary, .btn-download {
    width: 100%;
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-submit {
    background: linear-gradient(135deg, var(--primary-color), #2980b9);
    color: white;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.4);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-download {
    background: linear-gradient(135deg, var(--success-color), #229954);
    color: white;
    box-shadow: 0 4px 12px rgba(39, 174, 96, 0.3);
    margin-bottom: 15px;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(39, 174, 96, 0.4);
}

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

.btn-secondary:hover {
    background: #6c7a89;
    transform: translateY(-2px);
}

/* Loader */
.loader {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Progress Section */
.progress-section {
    background: var(--card-background);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: var(--background);
    border-radius: 15px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #2ecc71);
    border-radius: 15px;
    transition: width 0.5s ease;
    width: 0%;
}

.progress-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Results Section */
.results-section {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.results-section h2 {
    font-size: 2rem;
    margin-bottom: 30px;
    color: var(--text-primary);
    text-align: center;
}

.results-section h3 {
    font-size: 1.5rem;
    margin: 40px 0 20px 0;
    color: var(--text-primary);
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.card {
    background: var(--card-background);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.card h3 {
    font-size: 1.1rem;
    margin: 0 0 15px 0;
    color: var(--text-secondary);
    font-weight: 600;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.metric-change {
    font-size: 1rem;
    margin-top: 10px;
}

.improvement {
    color: var(--success-color);
    font-weight: 600;
}

.decline {
    color: var(--danger-color);
    font-weight: 600;
}

/* Detailed Metrics */
.detailed-metrics {
    background: var(--card-background);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.metric-detail h4 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: var(--text-primary);
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

/* Tables */
.metrics-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.metrics-table thead {
    background: var(--background);
}

.metrics-table th,
.metrics-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.metrics-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
}

.metrics-table td {
    color: var(--text-primary);
}

.metrics-table tr.highlight {
    background: #fff9e6;
    font-weight: 600;
}

.metrics-table tbody tr:hover {
    background: var(--background);
}

/* Graphs Section */
.graphs-section {
    background: var(--card-background);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.graphs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 30px;
    margin-top: 20px;
}

.graph-item {
    background: var(--background);
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.graph-item:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-hover);
}

.graph-item img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
}

/* Action Buttons */
.action-buttons {
    text-align: center;
    margin-top: 40px;
}

/* Error Section */
.error-section {
    background: var(--card-background);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
}

.error-message {
    max-width: 600px;
    margin: 0 auto;
}

.error-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 20px;
}

.error-message p {
    font-size: 1.2rem;
    color: var(--danger-color);
    margin-bottom: 30px;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .upload-section {
        padding: 25px;
    }

    .summary-cards {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .graphs-grid {
        grid-template-columns: 1fr;
    }

    .metric-value {
        font-size: 2rem;
    }

    .container {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    header {
        padding: 30px 15px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .upload-section {
        padding: 20px;
    }

    .btn-submit, .btn-secondary {
        padding: 14px 24px;
        font-size: 1rem;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.card {
    animation: slideIn 0.5s ease forwards;
}

.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }