:root {
    --primary-blue: #2563eb;
    --primary-blue-hover: #1d4ed8;
    --bg-slate: #f4f7fb;
    --card-bg: rgba(255, 255, 255, 0.85);
    --border-light: rgba(255, 255, 255, 0.4);
    --text: #0f172a;
    --text-muted: #64748b;
    --radius-xl: 22px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --ring: 0 0 0 4px rgba(37, 99, 235, 0.18);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] {
    --bg-slate: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.65);
    --border-light: rgba(255, 255, 255, 0.08);
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-slate);
    color: var(--text);
    margin: 0;
    overflow-x: hidden;
}

.bg-light-slate {
    background:
        radial-gradient(900px 520px at 6% 6%, rgba(59, 130, 246, 0.18) 0%, rgba(59, 130, 246, 0.00) 60%),
        radial-gradient(900px 520px at 94% 10%, rgba(16, 185, 129, 0.12) 0%, rgba(16, 185, 129, 0.00) 62%),
        radial-gradient(900px 520px at 50% 110%, rgba(99, 102, 241, 0.10) 0%, rgba(99, 102, 241, 0.00) 65%),
        linear-gradient(180deg, #ffffff 0%, #f4f7fb 100%);
}

[data-theme="dark"] .bg-light-slate {
    background:
        radial-gradient(900px 520px at 6% 6%, rgba(59, 130, 246, 0.08) 0%, rgba(59, 130, 246, 0.00) 60%),
        radial-gradient(900px 520px at 94% 10%, rgba(16, 185, 129, 0.06) 0%, rgba(16, 185, 129, 0.00) 62%),
        radial-gradient(900px 520px at 50% 110%, rgba(99, 102, 241, 0.05) 0%, rgba(99, 102, 241, 0.00) 65%),
        linear-gradient(180deg, #0f172a 0%, #020617 100%);
}

.bg-light-slate::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        repeating-linear-gradient(0deg, rgba(15, 23, 42, 0.012) 0px, rgba(15, 23, 42, 0.012) 1px, rgba(255, 255, 255, 0.0) 3px, rgba(255, 255, 255, 0.0) 6px),
        radial-gradient(700px 400px at 50% -10%, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0.0) 60%);
    opacity: 0.65;
    z-index: 0;
}

#bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.9;
}

.wrapper {
    min-height: 100vh;
}

.content-area {
    position: relative;
    z-index: 1;
}

.content-inner {
    max-width: 1220px;
}

.tracking-wide {
    letter-spacing: 0.05em;
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary-blue), #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.glass-panel {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-card:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(255, 255, 255, 0.88);
}

.drop-shadow-sm {
    box-shadow: var(--shadow-sm);
}

.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.btn,
.nav-link,
.form-control,
.form-control-plaintext {
    font-family: inherit;
}

.btn:focus-visible,
.nav-link:focus-visible,
.form-control:focus-visible,
.form-control-plaintext:focus-visible {
    outline: none;
    box-shadow: var(--ring) !important;
}

.btn.btn-light {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(148, 163, 184, 0.25);
}
.btn.btn-light:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(148, 163, 184, 0.35);
}

.nav-link {
    transition: all 0.2s ease;
}
.nav-link.active {
    background: var(--primary-blue) !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}
.nav-link:not(.active):hover {
    background: rgba(37, 99, 235, 0.05);
    color: var(--primary-blue) !important;
}
.nav-link:not(.active):hover i {
    color: var(--primary-blue) !important;
}

.sidebar {
    width: 280px;
    position: sticky;
    top: 0;
    height: calc(100vh - 32px);
    z-index: 100;
    margin: 16px;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.55);
}

.logo-icon {
    width: 36px;
    height: 36px;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.4);
}

.dashboard-header {
    padding: 18px 18px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 50;
}

.dashboard-header .text-secondary {
    color: var(--text-muted) !important;
}

.search-bar input:focus {
    outline: none;
    box-shadow: none;
}

.search-bar {
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.search-bar input::placeholder {
    color: rgba(100, 116, 139, 0.9);
}

.premium-gradient-card {
    background: linear-gradient(135deg, #1e40af 0%, var(--primary-blue) 100%);
    overflow: hidden;
}

.bubble-1 {
    width: 200px;
    height: 200px;
    background: #60a5fa;
    border-radius: 50%;
    top: -50px;
    right: -50px;
    filter: blur(50px);
    opacity: 0.6;
    animation: float 6s ease-in-out infinite alternate;
}

.bubble-2 {
    width: 150px;
    height: 150px;
    background: #3b82f6;
    border-radius: 50%;
    bottom: -30px;
    left: 20%;
    filter: blur(40px);
    opacity: 0.5;
    animation: float 8s ease-in-out infinite alternate-reverse;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(20px, 20px) scale(1.1); }
}

.apexcharts-tooltip {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0,0,0,0.05) !important;
    box-shadow: var(--shadow-md) !important;
    border-radius: 8px !important;
    font-family: inherit !important;
}

[data-theme="dark"] .apexcharts-tooltip {
    background: rgba(30, 41, 59, 0.95) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .apexcharts-tooltip-title {
    background: rgba(15, 23, 42, 0.5) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #f1f5f9 !important;
}

[data-theme="dark"] .apexcharts-tooltip-text-y-value,
[data-theme="dark"] .apexcharts-tooltip-text-y-label,
[data-theme="dark"] .apexcharts-tooltip-text-value,
[data-theme="dark"] .apexcharts-tooltip-text-label {
    color: #f1f5f9 !important;
}

.apexcharts-tooltip-title {
    background: transparent !important;
    border-bottom: 1px solid rgba(0,0,0,0.05) !important;
    font-weight: 600 !important;
    padding: 8px 12px !important;
}
.apexcharts-text tspan {
    font-family: 'Outfit', sans-serif !important;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.image-tile {
    display: block;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(255, 255, 255, 0.85);
    box-shadow: var(--shadow-sm);
}

.image-tile img {
    width: 100%;
    height: 72px;
    object-fit: cover;
    display: block;
}

.dropzone {
    border-radius: 16px;
    border: 1px dashed rgba(148, 163, 184, 0.6);
    background: rgba(255, 255, 255, 0.72);
    padding: 14px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.dropzone:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
    border-color: rgba(37, 99, 235, 0.55);
}

.dropzone.is-dragover {
    border-color: rgba(37, 99, 235, 0.75);
    box-shadow: var(--shadow-md);
}

.map-shell {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(255, 255, 255, 0.85);
}

.map-canvas {
    height: 230px;
    width: 100%;
}

.modal-content {
    border-radius: 18px;
}

.table > :not(caption) > * > * {
    border-bottom-color: rgba(148, 163, 184, 0.22);
}

@media (max-width: 768px) {
    .sidebar {
        width: 80px;
        margin: 12px;
        height: calc(100vh - 24px);
    }
    .sidebar span.fs-4, .sidebar .nav-link span, .sidebar .nav-link:not(.active) i.me-3 {
        display: none !important;
    }
    .sidebar .nav-link i.me-3 {
        margin-right: 0 !important;
        font-size: 1.5rem;
    }
    .content-area {
        padding: 1.5rem !important;
    }
    .image-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .image-tile img {
        height: 64px;
    }
}

.page-link {
    transition: all 0.2s ease;
}
.page-link:focus {
    box-shadow: none;
}
.hover-bg-light:hover {
    background-color: #f1f5f9 !important;
}
[data-theme="dark"] .hover-bg-light:hover {
    background-color: #334155 !important;
}

.scroll-indicator {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease-out;
    pointer-events: none;
}

.scroll-indicator.visible {
    opacity: 0.8;
    transform: translateY(0);
    animation: bounce 2s infinite;
}

[data-theme="dark"] .scroll-indicator {
    color: var(--primary-blue);
    text-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Dark mode utility overrides */
[data-theme="dark"] .bg-white {
    background-color: #1e293b !important; /* Slate 800 */
    color: #f1f5f9;
}
[data-theme="dark"] .text-secondary {
    color: #cbd5e1 !important; /* Slate 300 - lighter for better contrast */
}
[data-theme="dark"] .text-muted {
    color: #94a3b8 !important; /* Slate 400 */
}
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}
[data-theme="dark"] .form-control::placeholder {
    color: #94a3b8; /* Slate 400 - lighter than before */
}
[data-theme="dark"] .btn-light {
    background-color: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}
[data-theme="dark"] .btn-light:hover {
    background-color: #334155;
    border-color: #475569;
}
[data-theme="dark"] .dropdown-menu {
    background-color: #1e293b;
    border-color: #334155;
}
[data-theme="dark"] .dropdown-item {
    color: #f1f5f9;
}
[data-theme="dark"] .dropdown-item:hover {
    background-color: #334155;
}
[data-theme="dark"] .dropdown-divider {
    border-top-color: #334155;
}
[data-theme="dark"] .glass-panel,
[data-theme="dark"] .dashboard-header {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .card {
    background-color: rgba(30, 41, 59, 0.65);
    border-color: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
}
[data-theme="dark"] .metric-click {
    color: #f1f5f9;
}
[data-theme="dark"] .metric-click .text-secondary {
    color: #cbd5e1 !important;
}
[data-theme="dark"] .modal-content {
    background-color: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    color: #f1f5f9;
}
[data-theme="dark"] .modal-content .card {
    background-color: #334155; /* Lighter slate for inner cards to pop */
    border: 1px solid rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .modal-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(30, 41, 59, 0.95); /* Slight transparency */
}
[data-theme="dark"] .modal-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(30, 41, 59, 0.95);
}
[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: 0.8;
}
[data-theme="dark"] .btn-close:hover {
    opacity: 1;
}
[data-theme="dark"] .nav-link {
    color: #94a3b8;
}
[data-theme="dark"] .nav-link:hover {
    color: #e2e8f0;
    background-color: rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .nav-link.active {
    background-color: #3b82f6 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .table {
    color: #e2e8f0;
}
[data-theme="dark"] .table .text-secondary {
    color: #cbd5e1 !important; /* Make labels brighter */
}
[data-theme="dark"] .table .fw-semibold {
    color: #ffffff;
}
[data-theme="dark"] .bg-light {
    background-color: #0f172a !important; /* Darkest slate for map containers/headers */
}
[data-theme="dark"] .border-bottom {
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

#scrollToTopBtn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

#scrollToTopBtn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#scrollToTopBtn:hover {
    transform: translateY(-5px);
}
