:root {
    --primary: #0056b3;
    --primary-dark: #00448f;
    --success: #2e7d32;
    --bg-body: #f4f7fa;
    --card-bg: #ffffff;
    --text-main: #2d3436;
    --text-secondary: #636e72;
    --accent: #d4af37;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
}

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

/* Typography */
h1, h2, h3, h4 {
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 24px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    font-size: 0.95rem;
    gap: 8px;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background: #e9ecef;
    color: #495057;
}

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

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(0,0,0,0.05);
}

/* Nav */
.nav {
    background: white;
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-section h1 {
    font-size: 1.25rem;
    color: var(--success);
    margin: 0;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.9rem;
}

input, select, textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
}

.hidden {
    display: none !important;
}

/* Utilities */
.text-center { text-align: center; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }

/* Responsive Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Dashboard Filter Bar */
.filter-bar {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1.25fr 1.25fr;
    gap: 20px;
    background: #f8fafc;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    align-items: end;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.02);
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .filter-bar {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .nav {
        padding: 0.8rem 15px;
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .logo-section h1 {
        font-size: 1.1rem;
    }

    .grid-2 { grid-template-columns: 1fr; }
    
    .card {
        padding: 1.25rem;
        border-radius: 12px;
        margin-bottom: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .filter-bar {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1rem;
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.3rem; }
    h3 { font-size: 1.1rem; }

    .btn {
        width: 100%;
        padding: 12px;
    }

    .mob-stack { flex-direction: column !important; }
    .mob-hide { display: none !important; }
    .mob-full { width: 100% !important; }
    .mob-text-center { text-align: center !important; }

    .chart-container-mobile {
        height: 250px !important;
    }
}

img {
    max-width: 100%;
    height: auto;
}

/* Professional Multi-select UI */
.multi-select-container {
    position: relative;
    width: 100%;
}

.multi-select-trigger {
    background: #fff;
    border: 1px solid #ced4da;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.multi-select-trigger:hover {
    border-color: var(--primary);
}

.multi-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ced4da;
    border-radius: 8px;
    margin-top: 5px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    z-index: 1100;
    max-height: 250px;
    overflow-y: auto;
    padding: 8px;
    display: none;
}

.multi-select-dropdown.active {
    display: block;
}

.multi-select-option {
    padding: 8px 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.85rem;
}

.multi-select-option:hover {
    background: #f1f5f9;
}

.multi-select-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

/* New: Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.3s ease;
}
.loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
.spinner-large {
    width: 60px;
    height: 60px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* New: Tool Buttons */
.btn-download {
    background: #10b981;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}
.btn-download:hover {
    background: #059669;
    transform: translateY(-1px);
}
