/* ================= ROOT VARIABLES ================= */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --bg-dark: #000000;
    --bg-card: #0e0e0e;
    --text-primary: #e5e7eb;
    --text-muted: #9ca3af;
    --border: #333333;
    --destructive: #ef4444;
    --accent: #60a5fa;
}

/* ================= RESET & BASE STYLES ================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
}

/* ================= NAVBAR ================= */
.navbar {
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid var(--border);
    background-color: var(--bg-card);
    padding: 1rem;
}

.navbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 100%;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.3s;

}

.menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.navbar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-circle img {
    width: 62 px;
    height: 40px;
    border-radius: 0.5rem;
    /* background-color: var(--primary); */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.875rem;
    color: white;
    flex-shrink: 0;
}

.logo-text h1 {
    font-size: 1.125rem;
    font-weight: 700;
}

.logo-text p {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.system-status {
    display: none;
    align-items: center;
    gap: 0.5rem;
    background-color: rgba(14, 165, 233, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--primary);
}

.status-indicator {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background-color: var(--primary);
}

.user-btn {
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.3s;
}

.user-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* ================= NAVIGATION ITEMS & TOOLTIPS ================= */
.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--primary);
    color: white;
}

.nav-item span:first-of-type {
    flex: 1;
    text-align: left;
}

/* Tooltip styling for nav items */
.nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 80px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 23, 42, 0.95);
    color: #e5e7eb;
    padding: 0.4rem 0.7rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background-color: var(--destructive);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
}

/* ================= DASHBOARD CONTAINER ================= */
.dashboard-container {
    display: flex;
    height: calc(100vh - 64px);
    overflow: hidden;
}

/* ================= SIDEBAR ================= */
.sidebar {
    width: 72px;
    height: 100%;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 50;
    overflow: hidden;
}

@media (min-width: 769px) {
    .sidebar:hover {
        width: 240px;
    }
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1rem 0.75rem;
}

.sidebar-header {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.sidebar-header h2 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sidebar-header p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sidebar-nav a,
.sidebar-footer a {
    text-decoration: none;
    color: var(--text-muted);
}

.nav-item svg {
    min-width: 20px;
    flex-shrink: 0;
}

.nav-item span {
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 0.875rem;
}

.sidebar:hover .nav-item span {
    opacity: 1;
}

.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    margin-top: auto;
}

.settings-btn {
    width: 100%;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 30;
}

/* ================= MAIN CONTENT ================= */
.main-content {
    flex: 1;
    height: 100%;
    overflow-y: auto;
}

.content-container {
    padding: 1.5rem;
}

.menu-content {
    display: none;
}

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

.placeholder-content {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

/* ================= CAROUSEL / SWIPER ================= */
.carousel-wrapper {
    position: relative;
    width: 100%;
}

.swiper {
    width: 100%;
    aspect-ratio: 1280 / 460;
}

.swiper-slide {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;

}

.slide-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    z-index: 10;
}

.slide-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    z-index: 1;
    /* object-fit: cover; */
}

.slide-hover-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;

    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}


.slide-hover-overlay h2 {
    font-size: 3rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
}

.slide-hover-overlay p {
    margin-top: 0.5rem;
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
}

/* .slide-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
} */

.slide-title {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    margin-bottom: 1rem;
    max-width: 800px;
}

.slide-description {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    max-width: 800px;
}

.swiper-button-prev,
.swiper-button-next {
    width: 40px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    margin-left: 1rem;
    margin-right: 1rem;
    transition: background-color 0.3s;
}

.swiper-button-prev:hover,
.swiper-button-next:hover {
    background-color: rgba(0, 0, 0, 0.7);
}

.swiper-button-prev::after,
.swiper-button-next::after {
    color: white;
    font-size: 20px;
}

.swiper-pagination-bullet {
    background-color: rgba(255, 255, 255, 0.5);
}

.swiper-pagination-bullet-active {
    background-color: white;
}

.swiper-slide:hover .slide-hover-overlay {
    opacity: 1;
    pointer-events: auto;
}

.swiper-slide.active .slide-hover-overlay {
    opacity: 1;
    pointer-events: auto;
}

.slide-link {
    margin-top: 0.5rem;
    color: #fff;
    font-weight: 600;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .slide-hover-overlay {
        padding: 0.5rem;
        justify-content: center;
        align-items: center;
    }

    .slide-hover-overlay h2,
    .slide-hover-overlay p {
        max-width: 90%;
        /* 🔑 prevents edge stretching */
        margin-left: auto;
        margin-right: auto;
        text-align: center;
    }

    .slide-hover-overlay h2 {
        font-size: 1.1rem;
        line-height: 1.25;
        margin-bottom: rem;
    }

    .slide-hover-overlay p {
        font-size: 0.6rem;
        line-height: 1.4;
    }

    .slide-bg {
        background-size: contain;
        background-position: center;
        background-repeat: no-repeat;
        background-color: #000;
        /* or match your theme */
    }

    .slide-link {
        font-size: 0.4rem;
    }

    .swiper {
        aspect-ratio: 16 / 9;
    }
}



/* ================= STATS GRID ================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

/* Consolidated stat card styles (removed 3 duplicates) */
.stat-card {
    position: relative;
    padding: 1.6rem 1.4rem;
    border-radius: 18px;
    display: flex;
    align-items: stretch;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
    min-height: 160px;
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.stat-card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 35%, transparent), transparent 60%);
    opacity: 0.35;
    pointer-events: none;
    z-index: 1;
}

/* Consolidated stat content styles (removed 1 duplicate) */
.stat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 2;
}

/* Consolidated stat label styles (removed 2 duplicates) */
.stat-label {
    font-size: 1rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-primary);
    position: relative;
    z-index: 2;
}

/* Consolidated stat value styles (removed 3 duplicates) */
.stat-value {
    margin-top: 0.6rem;
    font-size: 2.1rem;
    font-weight: 800;
    color: var(--accent);
    text-shadow: 0 0 18px color-mix(in srgb, var(--accent) 40%, transparent);
    position: relative;
    z-index: 2;
    transition: opacity 0.4s ease;
}

/* Consolidated stat middle styles (removed 2 duplicates) */
.stat-middle {
    margin-top: 0.6rem;
    min-height: 2.4rem;
    position: relative;
    z-index: 2;
}

/* Consolidated skeleton loader styles (removed 1 duplicate) */
.stat-skeleton {
    width: 70%;
    height: 20px;
    border-radius: 10px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.06));
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite linear;
}

.stat-card:not(.loading) .stat-skeleton {
    display: none;
}

@keyframes shimmer {
    from {
        background-position: 200% 0;
    }

    to {
        background-position: -200% 0;
    }
}

/* Consolidated illustration container styles (removed 1 duplicate) */
.stat-illustration-container {
    width: 140px;
    height: auto;
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: -1.4rem;
    margin-top: -1.6rem;
    margin-bottom: -1.6rem;
    opacity: 0.9;
    transition: opacity 0.35s ease;
    position: relative;
    overflow: hidden;
    padding: 0.5rem;
}

.stat-card:hover .stat-illustration-container {
    opacity: 1;
}

/* Consolidated card illustration styles (removed 1 duplicate) */
.card-illustration {
    width: 100%;
    height: 100%;
    max-width: 160px;
    max-height: 160px;
    opacity: 0.65;
    transition: opacity 0.3s ease;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.stat-card:hover .card-illustration {
    opacity: 0.85;
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.4));
}

/* ================= CHARTS SECTION ================= */

.charts-section {
    margin-top: 32px;
}

/* Main charts card */
.charts-card {
    background: #0e0e0e;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}

/* Header */
.charts-header {
    margin-bottom: 24px;
}

.charts-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Grid layout */
.charts-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
    gap: 24px;
}

/* Chart cards */
.charts-grid .chart-card {
    background: #141414;
    border-radius: 12px;
    padding: 16px;
    min-width: 0;
    height: 360px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.charts-grid .chart-card h3 {
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 500;
    color: #bdb7ff;
}

/* Pie chart */
.charts-grid .pie-card {
    max-width: 380px;
    justify-self: end;
}

/* Full width update chart */
.charts-grid .full-width {
    grid-column: 1 / -1;
    height: 420px;
}

/* Canvas safety */
.charts-grid canvas {
    padding: 1rem;
    flex: 1;
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* Prevent overflow */
.charts-grid>* {
    min-width: 0;
    max-width: 100%;
}

/* Responsive */
@media (max-width: 900px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }

    .charts-grid .chart-card {
        height: 320px;
    }

    .charts-grid .full-width {
        height: 360px;
    }

    .charts-grid .pie-card {
        max-width: 100%;
        justify-self: stretch;
    }
}


/* ================= SCROLLBAR ================= */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #26354d;
    border-radius: 999px;
    border: 3px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

* {
    scrollbar-width: thin;
    scrollbar-color: #1e293b transparent;
}

/* ================= RESPONSIVE DESIGN ================= */

/* Consolidated responsive media queries (removed duplicates) */

/* Tablet and smaller screens (≤ 768px) */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    .system-status {
        display: none !important;
    }

    .logo-text {
        display: none;
    }

    .sidebar {
        position: fixed;
        top: 64px;
        left: 0;
        width: 240px;
        height: calc(100vh - 64px);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 10001;
    }

    #sidebarOverlay {
        position: fixed;
        z-index: 10000;
        pointer-events: auto;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    .sidebar.open .nav-item span {
        opacity: 1;
    }

    .nav-item span {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 0.75rem;
        pointer-events: auto;
    }

    .nav-item:hover::after {
        opacity: 1;
        transform: translate(4px, -50%);
    }

    .swiper {
        height: 300px;
    }

    .slide-title {
        font-size: 1.5rem;
    }

    .slide-description {
        font-size: 1rem;
    }

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

    .stat-card {
        padding: 1.2rem 1rem;
        min-height: 140px;
    }

    .stat-illustration-container {
        width: 110px;
        opacity: 0.7;
    }

    .card-illustration {
        max-width: 130px;
        max-height: 130px;
    }

    .content-container {
        padding: 1rem;
    }
}

/* Mobile screens (≤ 480px) */
@media (max-width: 480px) {
    .swiper {
        height: 200px;
    }

    .slide-title {
        font-size: 1.25rem;
    }

    .slide-description {
        font-size: 0.875rem;
    }

    .map-container {
        height: 250px;
    }

    .swiper-button-prev,
    .swiper-button-next {
        width: 32px;
        height: 32px;
        margin: 0.5rem;
    }

    .stat-card {
        flex-direction: row;
        padding: 1rem;
        min-height: 120px;
    }

    .stat-illustration-container {
        width: 90px;
        min-width: 90px;
        opacity: 0.6;
    }

    .card-illustration {
        max-width: 100px;
        max-height: 100px;
    }

    .stat-value {
        font-size: 1.8rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .content-container {
        padding: 12px;
    }
}