/* Personal Finance Dashboard - Modern CSS */

/* Import modern monospace fonts */
@import url('https://fonts.googleapis.com/css2?family=Departure+Mono:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap');

:root {
    --primary-color: #1e3a8a;
    --primary-gradient: linear-gradient(180deg, #1e3a8a 0%, #3b82f6 40%, #60a5fa 80%, #93c5fd 100%);
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    
    --bg-primary: #ffffff;
    --bg-secondary: #fafafa;
    --bg-sidebar: #1e293b;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --border-color: #e2e8f0;
    
    /* Consistent Category Colors - designed to work with navy aesthetic */
    --category-living: #ef4444;           /* Red - consistent with danger color */
    --category-transport: #f59e0b;        /* Orange/Amber - consistent with warning */
    --category-subscriptions: #8b5cf6;    /* Purple - complements navy */
    --category-investment: #3b82f6;       /* Blue - matches info/primary blue */
    --category-sports-wellness-health: #10b981; /* Green - matches success */
    --category-shopping: #64748b;         /* Gray - matches secondary */
    --category-groceries: #06b6d4;        /* Cyan - distinctive but harmonious */
    --category-eating-out-bars-social: #ec4899; /* Pink - distinctive accent */
    --category-other: #94a3b8;            /* Light gray - neutral */
    
    /* Income/Expense/Net colors for financial overview */
    --finance-income: #10b981;            /* Green - matches sports-wellness-health */
    --finance-expense: #ec4899;           /* Pink - matches eating-out-bars-social */
    --finance-net: #3b82f6;              /* Blue - matches investment */
    
    --font-family: 'Departure Mono', 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Consolas', 'Courier New', monospace;
    --border-radius: 4px;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-secondary);
    background-image: 
        linear-gradient(rgba(203, 213, 225, 0.3) 1px, transparent 1px),
        linear-gradient(90deg, rgba(203, 213, 225, 0.3) 1px, transparent 1px);
    background-size: 48px 48px;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.05em;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Navigation */
.top-nav {
    background: rgba(203, 213, 225, 0.25);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    color: var(--text-primary);
    padding: 0 3rem;
    position: sticky;
    top: 1rem;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    margin: 1rem 1rem 2rem 1rem;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 2px 16px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.nav-brand h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
    color: white;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    text-transform: none;
    position: relative;
    background: var(--primary-gradient);
    padding: 0.375rem 0.75rem;
    border-radius: 10px;
    box-shadow: 
        0 4px 12px rgba(30, 58, 138, 0.4),
        0 2px 6px rgba(30, 58, 138, 0.3);
}

.nav-brand h2::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    background: var(--primary-gradient);
    z-index: -1;
    border-radius: inherit;
}

.nav-menu {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0;
    margin: 0;
    padding: 0;
}

.nav-item {
    margin: 0;
}

.nav-separator {
    color: rgba(148, 163, 184, 0.7);
    margin: 0 0.5rem;
    font-weight: 300;
    font-size: 1rem;
    user-select: none;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    height: auto;
    white-space: nowrap;
    border-radius: 8px;
    margin: 0.5rem 0.25rem;
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.nav-link.active {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
    background-color: rgba(255, 255, 255, 0.15);
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.badge {
    background: var(--danger-color);
    color: white;
    border-radius: 12px;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    margin-left: 0.5rem;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem 3rem 3rem 3rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: -0.06em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.loading-indicator {
    color: var(--primary-color);
    font-size: 0.875rem;
    letter-spacing: -0.01em;
}

/* Cards */
.card {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.12),
        0 2px 8px rgba(0, 0, 0, 0.08),
        0 1px 4px rgba(0, 0, 0, 0.04);
    margin-bottom: 2rem;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Allow overflow for cards containing filter dropdowns */
.card:has(.filter-dropdown) {
    overflow: visible;
}

/* Fallback for browsers that don't support :has() */
.card.filter-card {
    overflow: visible;
}

.card.filter-card .card-body {
    overflow: visible;
    min-height: 450px; /* Ensure enough space for filter dropdowns */
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: #f5f5f5;
}

.card-header h3 {
    font-size: 1.125rem;
    font-weight: 400;
    color: var(--text-primary);
    letter-spacing: -0.05em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.card-body {
    padding: 1.25rem;
}

/* Filter Controls */
.filter-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-controls label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.filter-controls .form-select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    font-size: 0.875rem;
    min-width: 120px;
    color: var(--text-primary);
}

.filter-controls .form-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background: linear-gradient(180deg, #1d4ed8 0%, #2563eb 50%, #3b82f6 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

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

.btn-secondary:hover {
    background: #475569;
}

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

.btn-danger:hover {
    background: #dc2626;
}

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

.btn-success:hover {
    background: #059669;
}

/* Clear Data Button - Custom styling for upload page */
.btn-clear-data {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.05) 100%);
    color: var(--danger-color);
    border: 1.5px solid rgba(239, 68, 68, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-weight: 500;
    padding: 0.75rem 1.25rem;
    margin-top: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 2px 8px rgba(239, 68, 68, 0.15),
        0 1px 4px rgba(239, 68, 68, 0.1);
}

.btn-clear-data:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.08) 100%);
    border-color: rgba(239, 68, 68, 0.5);
    color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 
        0 4px 16px rgba(239, 68, 68, 0.2),
        0 2px 8px rgba(239, 68, 68, 0.15);
}

.btn-clear-data:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 8px rgba(239, 68, 68, 0.2),
        0 1px 4px rgba(239, 68, 68, 0.15);
}

.btn-clear-data i {
    margin-right: 0.5rem;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.btn-clear-data:hover i {
    opacity: 1;
}

/* Upload Area */
.upload-section {
    display: flex;
    gap: 1.5rem;
    width: 100%;
}

.upload-section .card {
    flex: 1;
    margin-bottom: 0;
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(30, 58, 138, 0.02);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(30, 58, 138, 0.05);
}

.upload-content i {
    font-size: 3rem;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.upload-content p {
    font-size: 1.125rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.upload-content small {
    color: var(--text-secondary);
}

/* CSV Format Guide */
.csv-format-guide {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.csv-format-guide h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.csv-format-guide h4 i {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.format-columns {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.format-column {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.format-column strong {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-color);
    font-family: var(--font-family);
}

.format-column .format-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 0.25rem;
}

.format-column code {
    font-size: 0.75rem;
    font-family: var(--font-family);
    background: rgba(30, 58, 138, 0.08);
    color: var(--primary-color);
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-weight: 500;
}

.format-column.optional {
    opacity: 0.7;
}

.format-column.optional strong {
    color: var(--text-secondary);
}

.format-column.optional .format-desc::after {
    content: " (Optional)";
    font-style: italic;
    color: var(--warning-color);
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    font-family: var(--font-family);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.tab-btn.active {
    color: #1e3a8a;
    border-bottom: 3px solid;
    border-image: var(--primary-gradient) 1;
    font-weight: 600;
}

.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    background: var(--text-secondary);
    border-radius: 10px;
}

.tab-btn.active .tab-badge {
    background: var(--primary-gradient);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Category badges and empty states */
.category-badge {
    display: inline-block;
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--color-bg);
    background: var(--color-gray-600);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.empty-state {
    text-align: center;
    padding: var(--space-12);
    color: var(--color-gray-500);
}

.empty-state i {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--space-4);
    display: block;
}

.empty-state p {
    font-family: var(--font-mono);
    font-size: var(--font-size-base);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin: 0;
}

/* Tables */
.table-container,
.transaction-table-container,
.mappings-table-container {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
}

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

.table th,
.table td,
.transaction-table th,
.transaction-table td,
.mappings-table th,
.mappings-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th,
.transaction-table th,
.mappings-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

.transaction-row:hover {
    background: var(--bg-secondary);
}

.category-select {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    min-width: 120px;
}

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

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

/* Analytics Container */
.analytics-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    overflow: visible;
}

.analytics-container .card {
    margin-bottom: 0; /* Remove default margin since we're using gap */
}

.chart-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.period-selector {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--bg-primary);
    font-size: 0.875rem;
    min-width: 120px;
}

.period-selector:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.analytics-overview {
    grid-column: span 2;
}

.chart-card.full-width {
    grid-column: span 2;
}

.overview-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.stat-box {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    background: var(--bg-secondary);
}

.stat-box.income {
    border-left: 4px solid var(--success-color);
}

.stat-box.expense {
    border-left: 4px solid var(--danger-color);
}

.stat-box.net {
    border-left: 4px solid var(--info-color);
}

.stat-icon {
    margin-right: 1rem;
    font-size: 1.5rem;
}

.stat-box.income .stat-icon {
    color: var(--success-color);
}

.stat-box.expense .stat-icon {
    color: var(--danger-color);
}

.stat-box.net .stat-icon {
    color: var(--info-color);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Charts */
.chart-container {
    width: 100%;
    height: 500px;
    min-height: 400px;
    position: relative;
    overflow: visible;
}

.card-body {
    padding: 1.5rem;
    min-height: 500px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
    margin-bottom: 1.5rem;
}

.card-header {
    flex-shrink: 0;
}

/* Bank Transactions Table */
.transactions-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
}

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

.transactions-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-primary);
    position: sticky;
    top: 0;
    z-index: 1;
    position: relative;
}

.transactions-table tbody tr:hover {
    background: var(--bg-secondary);
}

/* Table Filters */
.table-container th {
    position: relative;
    text-align: left;
    padding-right: 35px !important;
}

.table-container {
    overflow: visible;
    position: relative;
    min-height: 400px; /* Ensure minimum height to prevent filter clipping */
}

.transactions-table {
    overflow: visible;
    min-height: 300px; /* Minimum height for small filtered results */
}

/* Ensure table tbody has minimum height to prevent filter clipping */
.transactions-table tbody {
    min-height: 250px;
    display: table-row-group; /* Maintain table layout */
}

.transactions-table thead th {
    overflow: visible;
    position: relative;
    min-height: 50px; /* Ensure adequate header height */
}

.filter-dropdown {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.filter-btn {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    font-size: 12px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    padding: 2px 4px;
    border-radius: 3px;
}

.filter-btn:hover {
    color: var(--primary-color);
    background: rgba(30, 58, 138, 0.1);
}

.filter-btn.active {
    color: var(--primary-color);
    background: rgba(30, 58, 138, 0.15);
}

.filter-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    min-width: 280px;
    max-width: 380px;
    z-index: 9999;
    max-height: 350px;
    overflow-y: auto;
}

/* Smaller width for date filter dropdown */
#dateFilter.filter-menu {
    min-width: 150px;
    max-width: 160px;
}

.filter-menu.show-above {
    top: auto;
    bottom: 100%;
}

.filter-menu.show {
    display: block;
}

.filter-search {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.filter-search-input {
    width: 100%;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 0.875rem;
}

.filter-options {
    max-height: 200px;
    overflow-y: auto;
    padding: 0.25rem 0;
}

.filter-option {
    display: flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.filter-option:hover {
    background: var(--bg-secondary);
}

.filter-option input[type="checkbox"] {
    margin-right: 0.5rem;
}

.filter-actions {
    padding: 0.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    background: var(--bg-secondary);
}

.filter-clear {
    color: var(--danger-color);
    border-color: var(--danger-color);
}

.filter-clear:hover {
    background: rgba(239, 68, 68, 0.1);
}

.filter-apply {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.filter-apply:hover {
    background: rgba(30, 58, 138, 0.1);
}

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

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

.category-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.text-center {
    text-align: center;
}

#bankTransactionsTableContainer {
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body {
    padding: 1.25rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 1.25rem;
    border-top: 1px solid var(--border-color);
}

/* Toast */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1100;
}

.toast {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-left: 4px solid var(--info-color);
    max-width: 300px;
    animation: slideIn 0.3s ease;
}

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

.toast.error {
    border-left-color: var(--danger-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Upload Status */
.upload-status {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: var(--border-radius);
}

.upload-status.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success-color);
    color: var(--success-color);
}

.upload-status.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger-color);
    color: var(--danger-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .top-nav {
        padding: 0 1rem;
        height: auto;
        min-height: 64px;
        flex-wrap: wrap;
        margin: 0.5rem 1rem 0 1rem;
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.08);
    }
    
    .nav-menu {
        flex-wrap: wrap;
        gap: 0;
        width: 100%;
        justify-content: center;
    }
    
    .nav-separator {
        display: none;
    }
    
    .nav-link {
        padding: 1rem 1.25rem;
        font-size: 0.875rem;
        margin: 0.125rem;
        border-radius: 10px;
    }
    
    .nav-link span {
        display: none;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .analytics-container {
        gap: 1rem;
    }
    
    .chart-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .period-selector {
        min-width: 100%;
    }
    
    .overview-stats {
        grid-template-columns: 1fr;
    }
    
    .upload-section {
        flex-direction: column;
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .top-nav {
        flex-direction: column;
        gap: 0.5rem;
        padding: 1.25rem;
        margin: 0.25rem 0.5rem 0 0.5rem;
        border-radius: 16px;
        background: rgba(255, 255, 255, 0.1);
    }
    
    .nav-brand {
        width: 100%;
        text-align: center;
    }
    
    .nav-menu {
        width: 100%;
        justify-content: space-around;
    }
    
    .nav-link {
        padding: 0.5rem;
        flex-direction: column;
        gap: 0.25rem;
        margin: 0.125rem;
        border-radius: 6px;
    }
    
    .nav-link span {
        display: block;
        font-size: 0.75rem;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Demo-specific styles */
.demo-banner {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    color: white;
    padding: 0.45rem 0 0.4rem 0; /* thinner */
    text-align: center;
    font-size: 0.8rem; /* slightly smaller */
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 0.75rem; /* gap below banner */
}

.demo-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.demo-content i {
    font-size: 1rem;
    opacity: 0.9;
}

.demo-badge {
    font-size: 0.7rem;
    font-weight: 400;
    opacity: 0.8;
    margin-left: 0.25rem;
    padding: 0.125rem 0.375rem;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.demo-notice {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-style: italic;
}

.demo-notice i {
    color: var(--warning-color);
}

/* Adjust top navigation for demo banner */
.top-nav {
    margin-top: 0;
    top: 0;
}
