﻿:root {
    --pj-bg: #f3f4f6;
    --pj-card-bg: #ffffff;
    --pj-card-border: #e5e7eb;
    --pj-text: #0f172a;
    --pj-muted: #6b7280;
    --pj-primary: #0063b1;
    --pj-secondary: #00a2ff;
    --pj-accent: #ffc107;
    --pj-success: #22c55e;
    --pj-danger: #ef4444;
    --pj-radius-lg: 16px;
    --pj-radius-md: 12px;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --pj-bg: #020617;
        --pj-card-bg: #0b1120;
        --pj-card-border: #1f2937;
        --pj-text: #e5e7eb;
        --pj-muted: #9ca3af;
        --pj-primary: #38bdf8;
        --pj-secondary: #0ea5e9;
        --pj-accent: #facc15;
        --pj-success: #22c55e;
        --pj-danger: #ef4444;
    }
}

/* Page background */
body {
    background: var(--pj-bg);
    color: var(--pj-text);
}

/* Hero */
.dashboard-hero {
    position: relative;
    min-height: 240px; /* FIX: allow hero to grow */
    height: auto;
    border-radius: var(--pj-radius-lg);
    overflow: hidden;
    background: linear-gradient(135deg, #003a89, #0063b1 45%, #00a2ff);
    margin-top: 1rem;
}

    .dashboard-hero .hero-bg {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        opacity: .35;
    }

    .dashboard-hero .hero-content {
        position: absolute;
        bottom: 24px;
        left: 28px;
        right: 28px;
        color: #ffffff;
    }

    .dashboard-hero .hero-title {
        font-size: 1.8rem;
        font-weight: 700;
    }

    .dashboard-hero .hero-subtitle {
        font-size: 1rem;
        opacity: .9;
    }

/* Summary cards */
.summary-card {
    background: var(--pj-card-bg);
    border-radius: var(--pj-radius-md);
    overflow: hidden;
    border: 1px solid var(--pj-card-border);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.summary-img {
    width: 100%;
    height: auto; /* FIX: prevent overflow */
    aspect-ratio: 16 / 9; /* FIX: consistent height */
    object-fit: cover;
    display: block; /* FIX: remove inline spacing */
}

.summary-body {
    padding: 0.9rem 1rem 1rem;
}

    .summary-body h5 {
        margin-bottom: 0.25rem;
    }

.summary-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--pj-primary);
}

/* Profile card */
.profile-card {
    display: flex;
    gap: 18px;
    padding: 18px;
    border-radius: var(--pj-radius-md);
    background: var(--pj-card-bg);
    border: 1px solid var(--pj-card-border);
    overflow: hidden; /* FIX */
}

.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 12px;
    object-fit: cover;
    background: #111827;
    color: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    flex-shrink: 0; /* FIX: prevent shrinking */
}

/* Section header */
.section-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 0.75rem;
}

    .section-header img {
        width: 44px;
        height: 44px;
        border-radius: 10px;
        object-fit: cover;
        flex-shrink: 0; /* FIX: prevent shrinking */
    }

    .section-header h4 {
        margin: 0;
    }

/* Analytics card */
.analytics-card {
    background: var(--pj-card-bg);
    border-radius: var(--pj-radius-md);
    padding: 18px;
    border: 1px solid var(--pj-card-border);
    margin-bottom: 1.25rem;
    overflow: hidden; /* FIX */
}

.analytics-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 0.75rem;
}

    .analytics-header img {
        width: 36px;
        height: 36px;
        border-radius: 8px;
        object-fit: cover;
        flex-shrink: 0; /* FIX */
    }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
}

.empty-img {
    max-width: 220px; /* FIX */
    width: 100%;
    height: auto;
    object-fit: contain; /* FIX */
    opacity: .9;
    margin-bottom: 1rem;
}

/* Tables */
.table-card {
    background: var(--pj-card-bg);
    border-radius: var(--pj-radius-md);
    border: 1px solid var(--pj-card-border);
    padding: 1rem;
    overflow: hidden; /* FIX */
}

/* Mobile-first tweaks */
@media (max-width: 768px) {
    .dashboard-hero {
        min-height: 200px;
        border-radius: 0;
        margin-top: 0;
    }

        .dashboard-hero .hero-content {
            left: 16px;
            right: 16px;
            bottom: 18px;
        }

    .profile-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .summary-img {
        aspect-ratio: 4 / 3; /* FIX: better mobile scaling */
    }

    .summary-card {
        margin-bottom: 1rem;
    }
}

/* Sidebar container */
.pj-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    background: var(--pj-card-bg);
    border-right: 1px solid var(--pj-card-border);
    padding-top: 1rem;
    z-index: 1000;
    transition: transform .3s ease;
}

/* Logo */
.pj-sidebar-logo {
    width: 160px;
    margin: 0 auto 1rem;
    display: block;
}

/* Navigation */
.pj-sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

    .pj-sidebar-nav li {
        margin-bottom: .5rem;
    }

    .pj-sidebar-nav a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: .75rem 1rem;
        color: var(--pj-text);
        text-decoration: none;
        font-weight: 500;
        border-radius: 8px;
        transition: background .2s;
    }

        .pj-sidebar-nav a:hover {
            background: var(--pj-bg);
        }

    .pj-sidebar-nav i {
        font-size: 1.2rem;
    }

/* Content shift */
body.pj-has-sidebar main {
    margin-left: 240px;
}

/* Mobile */
@media (max-width: 992px) {
    .pj-sidebar {
        transform: translateX(-240px);
    }

        .pj-sidebar.open {
            transform: translateX(0);
        }

    body.pj-has-sidebar main {
        margin-left: 0;
    }

    .pj-sidebar-toggle {
        display: inline-block;
    }
}

/* Hamburger button */
.pj-sidebar-toggle {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--pj-text);
    cursor: pointer;
    margin-right: 1rem;
    display: none;
}
