/* Modern CSS Variables - Midnight Blue & Neon Accent Theme */
:root {
    --primary: #4f46e5;
    /* Indigo 600 */
    --primary-light: #6366f1;
    /* Indigo 500 */
    --primary-dark: #4338ca;
    /* Indigo 700 */

    --accent: #0ea5e9;
    /* Sky 500 */
    --accent-glow: rgba(14, 165, 233, 0.3);

    --success: #10b981;
    /* Emerald 500 */
    --danger: #ef4444;
    /* Red 500 */
    --warning: #f59e0b;
    /* Amber 500 */
    --info: #3b82f6;
    /* Blue 500 */

    /* Dark Mode Defaults */
    --bg-body: #0f172a;
    /* Slate 900 */
    --bg-card: #1e293b;
    /* Slate 800 */
    --bg-card-hover: #334155;
    /* Slate 700 */
    --bg-input: #020617;
    /* Slate 950 */

    --text-primary: #f8fafc;
    /* Slate 50 */
    --text-secondary: #94a3b8;
    /* Slate 400 */
    --text-muted: #64748b;
    /* Slate 500 */

    --border: #334155;
    /* Slate 700 */
    --border-light: #475569;
    /* Slate 600 */

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
    --shadow-glow: 0 0 15px var(--accent-glow);

    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

/* Layout Grid */
.app-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    background-color: #000000;
    border-right: 1px solid var(--border);
    padding: 2rem;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 50;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
    color: var(--accent);
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
}

.brand i {
    font-size: 1.75rem;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    font-size: 1rem;
    text-align: left;
}

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

.nav-btn.active {
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-light);
    border-color: rgba(79, 70, 229, 0.2);
    box-shadow: 0 0 20px rgba(79, 70, 229, 0.1);
}

.nav-btn i {
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    padding: 2.5rem;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

.section {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.section.active {
    display: block;
}

/* Cards & Panels */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-lg);
}

/* Upload Area */
.upload-wrapper {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 2rem;
}

.upload-area {
    background: radial-gradient(circle at center, var(--bg-card-hover) 0%, var(--bg-card) 100%);
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-xl);
    padding: 5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    max-width: 600px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    background: var(--primary);
    filter: blur(80px);
    opacity: 0.1;
    border-radius: 50%;
    transition: var(--transition);
}

.upload-area:hover::before {
    opacity: 0.2;
    width: 250px;
    height: 250px;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: var(--shadow-glow);
}

.upload-icon {
    font-size: 4rem;
    color: var(--primary-light);
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 2;
}

.upload-text h2 {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    position: relative;
    z-index: 2;
}

.upload-text p {
    color: var(--text-secondary);
    position: relative;
    z-index: 2;
}

/* Summary Cards (Redesigned) */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: linear-gradient(145deg, var(--bg-card) 0%, var(--bg-input) 100%);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: var(--primary);
    filter: blur(60px);
    opacity: 0.15;
    border-radius: 50%;
}

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

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

.stat-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--bg-card-hover);
    color: var(--primary-light);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: var(--font-heading);
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 2;
}

/* Charts Section */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    height: 400px;
    position: relative;
}

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

.chart-title {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Tables */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
}

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

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

th {
    text-align: left;
    padding: 1rem 1.5rem;
    background: var(--bg-input);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 0.95rem;
}

tr:last-child td {
    border-bottom: none;
}

/* Badges & TextColors */
.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Tabs */
.tabs-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: var(--bg-input);
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    width: fit-content;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn.active {
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* Search Input */
.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 500px;
}

.search-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    padding: 1rem 1.5rem 1rem 3rem;
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* Loading */
.loading-overlay {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
}

/* Keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        height: auto;
        padding: 1rem;
        position: relative;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .brand {
        margin-bottom: 0;
    }

    .nav-menu {
        flex-direction: row;
        flex: 0;
    }

    .nav-btn span {
        display: none;
    }

    .nav-btn {
        padding: 0.75rem;
    }
}

/* Tooltips */
.info-icon {
    margin-left: 10px;
    color: var(--text-muted);
    cursor: help;
    font-size: 0.9em;
    position: relative;
    display: inline-block;
    vertical-align: middle;
    transition: color 0.2s;
}

.info-icon:hover {
    color: var(--accent);
}

.info-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 150%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card-hover);
    color: var(--text-primary);
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.4;
    white-space: normal;
    width: 250px;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s, visibility 0.2s;
    box-shadow: var(--shadow-lg);
    text-align: left;
    pointer-events: none;
}

.info-icon:hover::after {
    visibility: visible;
    opacity: 1;
}

/* Arrow for tooltip */
.info-icon::before {
    content: '';
    position: absolute;
    bottom: 130%;
    /* Slightly closer than tooltip */
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: var(--bg-card-hover) transparent transparent transparent;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s;
}

.info-icon:hover::before {
    visibility: visible;
    opacity: 1;
}

/* Custom Date Dropdown */
.date-selector-wrapper {
    position: relative;
    min-width: 220px;
    z-index: 100;
}

.custom-dropdown {
    position: relative;
    width: 100%;
    font-family: var(--font-body);
}

.custom-dropdown-trigger {
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
}

.custom-dropdown-trigger:hover {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.2);
}

.custom-dropdown-trigger:focus {
    outline: none;
    border-color: var(--primary);
}

.custom-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    width: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: none;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
}

.custom-dropdown.open .custom-dropdown-menu {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

.custom-option {
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.custom-option:hover {
    background-color: var(--bg-card-hover);
}

.custom-option.selected {
    background-color: rgba(79, 70, 229, 0.1);
    color: var(--primary-light);
    font-weight: 500;
}

.check-icon {
    width: 16px;
    height: 16px;
    opacity: 0;
    color: var(--success);
    margin-right: 0.5rem;
    /* Explicit spacing for alignment */
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-option.selected .check-icon {
    opacity: 1;
}

/* Scrollbar for dropdown */
.custom-dropdown-menu::-webkit-scrollbar {
    width: 6px;
}

.custom-dropdown-menu::-webkit-scrollbar-track {
    background: transparent;
}

.custom-dropdown-menu::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 20px;
}/* Header Search */
.header-search-container {
    flex: 1;
    display: flex;
    justify-content: center;
    margin: 0 2rem;
}

.header-search {
    max-width: 400px;
}

.header-search .search-input {
    background: var(--bg-card);
    border-color: var(--border);
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    font-size: 0.95rem;
}

.header-search .search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
}

.header-search .search-icon {
    left: 0.8rem;
    font-size: 0.9rem;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    animation: fadeIn 0.2s ease-out;
}

.modal-overlay.active {
    display: flex;
}

.modal-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal-header h2 {
    font-size: 1.25rem;
    margin: 0;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.modal-close-btn:hover {
    background: var(--bg-input);
    color: var(--danger);
}

.modal-body {
    padding: 1.5rem;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}