:root {
    /* Brand Colors */
    --primary: #818cf8;
    --primary-hover: #6366f1;
    --bg-color: #0f172a;
    /* Deep Charcoal */

    /* Semantic Colors */
    --success: #34d399;
    /* Soft Mint */
    --failure: #fb7185;
    /* Muted Coral */

    /* Text Colors */
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;

    /* Glassmorphism Variables */
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
}

/* Background Effects */
.background-blur {
    position: fixed;
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    background: radial-gradient(circle at 15% 50%, rgba(76, 29, 149, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.1), transparent 25%);
    z-index: -1;
    pointer-events: none;
}

/* Main Container */
.container {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: 24px;
    padding: 3rem;
    width: 90%;
    max-width: 1400px;
    margin: 40px auto;
    text-align: center;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #a5b4fc 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 3rem;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--glass-border);
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 3rem;
    max-width: 600px;
    margin: 0 auto;
    transition: all 0.3s ease;
}

.upload-area:hover,
.upload-area.highlight {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.icon-container {
    color: var(--primary);
    margin-bottom: 1rem;
}

/* Buttons */
.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    margin: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    /* box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4); */
}

.primary-btn:hover {
    transform: translateY(-2px);
    /* box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6); */
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

/* States */
.hidden {
    display: none;
}

.loader {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Success Check */
.success-icon {
    font-size: 4rem;
    color: var(--success);
    margin-bottom: 1rem;
    text-shadow: 0 0 20px rgba(52, 211, 153, 0.4);
}

/* --- DASHBOARD GRID --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-top: 3rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    text-align: left;
}

.stat-card h3 {
    margin: 0;
    font-size: 0.9rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.stat-card p {
    margin: 0.5rem 0 0;
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #fff, #cbd5e1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Charts Row */
.charts-row {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    /* Chart takes less space, table takes more */
    gap: 1.5rem;
    margin-bottom: 3rem;
    align-items: start;
}

.chart-card,
.summary-card {
    padding: 1.5rem;
    min-height: 400px;
    display: flex;
    flex-direction: column;
}

.glass-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: 16px;
}

.chart-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    max-height: 350px;
    width: 100%;
}

/* Summary Table Styling */
.summary-card h4,
.chart-card h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    color: var(--text-main);
    text-align: left;
}

/* Global Table Styles */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    color: var(--text-main);
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.data-table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.data-table img {
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

/* Custom Scroller for tables */
#preview-box,
#dashboard-box {
    overflow-x: auto;
}

/* Dashboard summary specific overrides */
.dashboard-table td:first-child {
    font-weight: 600;
    color: var(--primary);
}

/* Helpers */
.preview-section {
    margin-top: 2rem;
    text-align: left;
    border-top: 1px solid var(--glass-border);
    padding-top: 2rem;
}