:root {
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --card-bg: rgba(39, 43, 74, 1);
    --card-border: rgba(148, 163, 184, 0.1);
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --glass-shadow: none;
    /* Disabled for performance */
    --glass-border: 1px solid rgba(255, 255, 255, 0.05);
    --font-main: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-main);
    min-height: 100vh;
    position: relative;
    isolation: isolate;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-color: var(--bg-color);
    /* Complex gradients removed for performance */
    background-image: none;
    pointer-events: none;
}

.dashboard-container {
    width: 100%;
    height: 100vh;
    overflow: hidden;
}


/* Upload Section */
.upload-section {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.upload-card {
    background: rgba(30, 41, 59, 0.6);
    border: var(--glass-border);
    border-radius: 1.5rem;
    padding: 3rem;
    max-width: 600px;
    width: 100%;
    text-align: center;
    backdrop-filter: blur(10px);
}

.upload-card h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.upload-subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.upload-area {
    border: 2px dashed rgba(99, 102, 241, 0.5);
    border-radius: 1rem;
    padding: 3rem 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(99, 102, 241, 0.05);
}

.upload-area:hover {
    border-color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
}

.upload-area svg {
    color: #6366f1;
    margin-bottom: 1rem;
}

.upload-area p {
    margin: 0.5rem 0;
    color: var(--text-color);
}

.file-types {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Dashboard Section */
.dashboard-section {
    height: 100vh;
    overflow: hidden;
}

.dashboard-layout {
    display: flex;
    height: 100%;
}

/* Filters Sidebar */
.filters-sidebar {
    width: 320px;
    background: rgba(15, 23, 42, 0.95);
    /* Solid background */
    border-right: var(--glass-border);
    padding: 1.5rem;
    overflow-y: auto;
    /* backdrop-filter: blur(4px); REMOVED */
}

.filters-header {
    margin-bottom: 1.5rem;
}

.filters-header h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.upload-new-btn {
    width: 100%;
    padding: 0.75rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.5);
    color: #818cf8;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.2s;
}

.upload-new-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: #818cf8;
}

/* Filter Presets */
.filter-presets {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.preset-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.preset-btn {
    padding: 0.5rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #818cf8;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.2s;
    font-family: var(--font-main);
}

.preset-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: #818cf8;
}

.preset-btn:active {
    transform: scale(0.98);
}

/* Filter Select Buttons (All/None for each group) */
.filter-select-btn {
    padding: 0.25rem 0.5rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #818cf8;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.2s;
    font-family: var(--font-main);
}

.filter-select-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: #818cf8;
}

.filter-select-btn:active {
    transform: scale(0.95);
}


.filter-group {
    margin-bottom: 1.5rem;
}

.filter-group label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.filter-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.25rem;
    transition: background 0.2s;
}

.filter-label:hover {
    background: rgba(255, 255, 255, 0.05);
}

.filter-label input[type="checkbox"] {
    width: 0.9rem;
    height: 0.9rem;
    cursor: pointer;
    accent-color: #6366f1;
}

.date-input {
    width: 100%;
    padding: 0.4rem 0.5rem;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.375rem;
    color: var(--text-color);
    font-family: var(--font-main);
    font-size: 0.8125rem;
    margin-bottom: 0;
    line-height: 1.2;
}

.date-input:focus {
    outline: none;
    border-color: #6366f1;
}

/* Style calendar icon for dark theme */
.date-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    filter: invert(1);
    opacity: 0.7;
}

.date-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.date-input::-webkit-inner-spin-button,
.date-input::-webkit-clear-button {
    display: none;
}

.date-range-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.date-range-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.date-range-item label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 500;
}


.date-nav {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.date-nav-btn {
    padding: 0.4rem 0.5rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #818cf8;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.8125rem;
    transition: all 0.2s;
    line-height: 1.2;
}

.date-nav-btn:hover {
    background: rgba(99, 102, 241, 0.2);
}

.multiselect {
    width: 100%;
    padding: 0.5rem;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    color: var(--text-color);
    font-family: var(--font-main);
    cursor: pointer;
    font-size: 0.875rem;
    min-height: 120px;
}

.multiselect option {
    padding: 0.5rem;
    background: rgba(30, 41, 59, 0.9);
    color: var(--text-color);
    border-radius: 0.25rem;
    margin: 2px 0;
}

.multiselect option:checked {
    background: rgba(99, 102, 241, 0.6);
    color: white;
}

.multiselect:focus {
    outline: none;
    border-color: #6366f1;
}

/* Checkbox List */
.checkbox-list {
    max-height: 200px;
    overflow-y: auto;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    padding: 0.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 0.25rem;
    transition: background 0.2s;
    font-size: 0.875rem;
}

.checkbox-label:hover {
    background: rgba(255, 255, 255, 0.05);
}

.checkbox-label input[type="checkbox"] {
    width: 0.9rem;
    height: 0.9rem;
    cursor: pointer;
    accent-color: #6366f1;
    flex-shrink: 0;
}


.checkbox-label span {
    color: var(--text-color);
    user-select: none;
    padding-left: 4px;
}


/* Main Content */
.dashboard-main {
    flex: 1;
    padding: 2rem;
    padding-bottom: 12rem;
    /* Extra space to prevent cutoff */
    overflow-y: auto;
    padding-right: 0.2rem;
    contain: content;
    /* optimize rendering without breaking scroll size */
    transform: translateZ(0);
    will-change: scroll-position;
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: rgba(30, 41, 59, 0.95);
    /* Solid for performance */
    border: var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
    /* backdrop-filter: blur(4px); REMOVED */
}

.chart-full-width {
    grid-column: 1 / -1;
}

/* Data Table */
.data-table-section {
    background: rgba(30, 41, 59, 0.95);
    /* Solid for performance */
    border: var(--glass-border);
    border-radius: 1rem;
    padding: 1.5rem;
    /* backdrop-filter: blur(4px); REMOVED */
}

.data-table-section h3 {
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.table-controls {
    display: flex;
    gap: 0.5rem;
}

.table-control-btn {
    width: 40px;
    height: 40px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #818cf8;
    border-radius: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.table-control-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: #818cf8;
}

.search-box {
    margin-bottom: 1rem;
}

.search-input {
    width: 100%;
    padding: 0.75rem;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    color: var(--text-color);
    font-family: var(--font-main);
}

.search-input:focus {
    outline: none;
    border-color: #6366f1;
}

.row-count {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0;
}

.table-wrapper {
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
}

/* Fullscreen mode */
.data-table-section.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: var(--bg-color);
    padding: 2rem;
    margin: 0;
}

.data-table-section.fullscreen .table-wrapper {
    max-height: calc(100vh - 200px);
}


.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table thead {
    position: sticky;
    top: 0;
    background: rgba(15, 23, 42, 0.95);
    z-index: 10;
}

.data-table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    min-width: fit-content;
}

.data-table td {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    min-width: 130px;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: all 0.2s;
}

.data-table td.expanded {
    white-space: normal;
    word-wrap: break-word;
    max-width: none;
    background: rgba(99, 102, 241, 0.1);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.5);
    border-radius: 4px;
}


/* Stats Bar */
/* Stats Bar */
.stats-grid {
    display: flex;
    overflow-x: auto;
    gap: 0.4rem;
    margin-bottom: 2rem;
    padding-bottom: 0.5rem;
    /* For scrollbar spacing */
}

/* Hide scrollbar for cleaner look if not needed */
.stats-grid::-webkit-scrollbar {
    height: 4px;
}

.stats-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

.stats-card {
    background: rgba(30, 41, 59, 0.95);
    /* High opacity solid color */
    border: var(--glass-border);
    border-radius: 0.5rem;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    /* backdrop-filter: blur(4px); REMOVED for performance */
    transition: all 0.2s;
    overflow: hidden;
    min-width: 70px;
    /* Ultra compact */
    flex: 1;
    /* Distribute space */
}

.stats-card:hover {
    border-color: rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
}

.stats-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1;
}

.stats-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}