/* ===================================================
   Chrome-Stats v11 – Modern Design System
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

html {
    scroll-behavior: unset !important;
}

:root {
    /* ── Colour Palette ── */
    --primary-color: #06b6d4;
    --primary-color-light: #22d3ee;
    --primary-color-dark: #0891b2;
    --accent-gold: #f59e0b;

    --surface-bg: #0f172a;
    --surface-bg-lighter: #1e293b;
    --surface-card: #fefefe;
    --surface-sidebar: rgba(15, 23, 42, 0.55);

    --text-primary: #f1f5f9;
    --text-muted: #94a3b8;
    --text-body: #334155;
    --caption-color: #64748b;

    --custom-bg-primary: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #0e3d53 100%);
    --custom-bg-nav: rgba(15, 23, 42, 0.72);
    --custom-bg-highlighted: rgba(6, 182, 212, 0.15);
    --custom-bg-highlighted-strong: rgba(6, 182, 212, 0.25);

    --sidebar-width: 280px;
    --nav-height: 56px;

    --border-subtle: rgba(148, 163, 184, 0.12);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);

    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset / Base ── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

[id] {
    scroll-margin-top: calc(var(--nav-height) + 16px);
}

a {
    text-decoration: none;
    word-break: break-word;
    transition: color var(--transition-fast);
}

dt,
dd {
    display: inline;
}

dd::after {
    content: '';
    display: block;
}

dt {
    font-weight: 600;
}

/* ── Full-page Background ── */
.app-bg {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--custom-bg-primary) no-repeat;
    background-size: cover;
    z-index: -9999;
}

/* ── Navbar ── */
nav.navbar {
    left: 0;
    right: 0;
    top: 0;
    width: 100%;
    height: var(--nav-height);
    z-index: 1051;
    position: sticky;
    background: var(--custom-bg-nav);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    transition:
        box-shadow var(--transition-slow),
        background-color var(--transition-slow);
}

nav.navbar.scrolled {
    background: rgba(15, 23, 42, 0.92);
    box-shadow:
        0 1px 0 var(--glass-border),
        0 4px 20px rgba(0, 0, 0, 0.35);
}

.main-logo {
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.main-logo:hover {
    background-color: var(--custom-bg-highlighted);
}

/* ── Main Content Grid ── */
main {
    margin: 0.5rem;
    background-color: var(--surface-card);
    position: relative;
    padding: 1rem;
    overflow: hidden;
    border-radius: var(--radius-lg);
    flex-grow: 1;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.main-content {
    grid-template-columns: var(--sidebar-width) 1fr;
}

.main-content.three-columns {
    grid-template-columns: var(--sidebar-width) 1fr var(--sidebar-width);
}

.full-width {
    grid-column: 1 / -1;
}

.overflow-visible {
    overflow: visible;
}

/* ── Sidebar Shell ── */
.nav-sidebar {
    position: relative;
    float: left;
    width: var(--sidebar-width);
    z-index: 1050;
}

.sidebar {
    width: var(--sidebar-width);
    position: sticky;
    top: calc(var(--nav-height) + 4px);
    height: calc(100vh - var(--nav-height) - 4px);
    height: calc(100dvh - var(--nav-height) - 4px);
    overflow-y: auto;
    padding: 0.25rem;
}

/* Styled thin scrollbar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.25);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.45);
}

/* Firefox */
.sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.25) transparent;
}

/* ── Sidebar Items ── */
.item-wrapper {
    padding: 0.55rem 0.85rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition:
        background-color var(--transition-fast),
        box-shadow var(--transition-fast),
        transform var(--transition-fast);
}

.item-wrapper:hover {
    background-color: var(--custom-bg-highlighted);
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.1);
    color: var(--text-primary);
}

.item-wrapper.active {
    background-color: var(--custom-bg-highlighted-strong);
    box-shadow: inset 3px 0 0 var(--primary-color), 0 2px 8px rgba(6, 182, 212, 0.12);
    color: #fff;
}

/* ── Submenu ── */
.submenu-container {
    overflow: hidden;
}

.submenu-item-wrapper {
    padding: 0.4rem 0.85rem 0.4rem 2.75rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 400;
    position: relative;
    transition:
        background-color var(--transition-fast),
        color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.submenu-item-wrapper::before {
    content: '';
    position: absolute;
    left: 1.65rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.5;
    transition: opacity var(--transition-fast), background var(--transition-fast);
}

.submenu-item-wrapper:hover {
    background-color: var(--custom-bg-highlighted);
    color: var(--text-primary);
    box-shadow: 0 1px 4px rgba(6, 182, 212, 0.08);
}

.submenu-item-wrapper:hover::before {
    background: var(--primary-color-light);
    opacity: 1;
}

.submenu-item-wrapper.active {
    background-color: var(--custom-bg-highlighted-strong);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--primary-color);
}

.submenu-item-wrapper.active::before {
    background: var(--primary-color);
    opacity: 1;
    width: 6px;
    height: 6px;
}

.submenu-separator {
    margin: 0.4rem 1rem 0.4rem 2.75rem;
    height: 1px;
    background: linear-gradient(90deg, var(--glass-border), transparent);
    pointer-events: none;
    user-select: none;
}

.animate-chevron {
    transition: transform var(--transition-slow);
}

/* ── Sidebar Section Dividers ── */
.sidebar-section-label {
    padding: 0.75rem 0.85rem 0.3rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    opacity: 0.7;
}

.sidebar-section-divider {
    margin: 0.5rem 0.85rem;
    height: 1px;
    background: linear-gradient(90deg, var(--glass-border), transparent 80%);
}

/* ── Footer ── */
footer.modern-footer {
    position: relative;
    padding-top: 3rem;
    padding-bottom: 1rem;
}

footer.modern-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 5%;
    right: 5%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
}

footer.modern-footer .footer-heading {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

footer.modern-footer ul {
    list-style: none;
    padding: 0;
}

footer.modern-footer ul li {
    margin-bottom: 0.4rem;
}

footer.modern-footer a {
    color: var(--text-muted);
    font-size: 0.85rem;
    transition:
        color var(--transition-fast),
        padding-left var(--transition-fast);
}

footer.modern-footer a:hover {
    color: var(--primary-color-light);
    padding-left: 4px;
}

.footer-social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    transition:
        background-color var(--transition-fast),
        transform var(--transition-fast),
        border-color var(--transition-fast);
}

.footer-social-link:hover {
    background: var(--custom-bg-highlighted);
    transform: translateY(-2px);
    border-color: var(--primary-color);
}

.footer-copyright {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
    text-align: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    opacity: 0.7;
}

/* ── Misc Utilities (carried forward) ── */
.jumbotron {
    background-color: #e9ecef;
    border-radius: 10px;
}

.stats-chart-container {
    max-width: 800px;
    max-height: 500px;
    margin: auto !important;
    position: relative;
}

.toast-container {
    background-color: white;
    position: fixed;
    right: 1em;
    bottom: 1em;
    z-index: 10000;
}

.search-input {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.search-dropdown {
    min-width: 180px;
    z-index: 1000;
}

.text-warning {
    color: #e9a100 !important;
}

.caption {
    font-size: 0.75rem;
    color: var(--caption-color);
}

.modal-content pre,
.modal-content code.hljs {
    background: inherit;
    overflow: visible !important;
}

.light-bold {
    font-weight: 600 !important;
}

.fixed-toast {
    position: fixed;
    bottom: 5px;
    right: 5px;
}

.hljs {
    background: #0d1117 !important;
}

.hide-on-desktop {
    display: none;
}

.speedometer {
    height: 200px !important;
}

.meta-summary h1,
.meta-summary h2,
.meta-summary h3,
.meta-summary h4,
.meta-summary h5,
.meta-summary h6 {
    font-size: 1.2rem;
}

/* ── Dropdown Menus (profile, etc) ── */
.dropdown-menu {
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--glass-shadow);
    padding: 0.5rem;
}

.dropdown-menu .dropdown-item {
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.75rem;
    font-size: 0.875rem;
    transition: background-color var(--transition-fast);
}

.dropdown-menu .dropdown-item:hover,
.dropdown-menu .dropdown-item:focus {
    background-color: var(--custom-bg-highlighted);
    color: #fff;
}

.dropdown-menu .dropdown-divider {
    border-color: var(--glass-border);
    margin: 0.35rem 0;
}

.dropdown-menu .dropdown-header {
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 0.45rem 0.75rem;
}

/* ── Animations ── */
@keyframes fade_in {
    0% {
        opacity: 0;
        transform: translateY(-16px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Responsive ── */
@media only screen and (max-width: 800px) {
    .hide-on-mobile {
        display: none;
    }

    .hide-on-desktop {
        display: inherit;
    }

    main {
        padding: 0.5rem;
    }
}

@media only screen and (max-width: 992px) {
    .sidebar {
        width: 100%;
    }

    .nav-sidebar {
        display: none;
        transform-origin: top;
        width: 100%;
        background: var(--surface-bg);
        height: 100%;
        position: fixed;
        animation: fade_in 0.25s ease-out;
    }

    main {
        border-radius: 0;
        margin: 0;
    }

    .item-wrapper {
        padding: 0.4rem 0.65rem;
    }

    .submenu-item-wrapper {
        padding: 0.3rem 0.65rem 0.3rem 2rem;
        font-size: 0.82rem;
    }

    .submenu-item-wrapper::before {
        left: 1.15rem;
    }

    .submenu-separator {
        margin: 0.3rem 0.65rem 0.3rem 2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fade {
        transition: opacity 0.15s linear !important;
    }

    .collapsing {
        transition: height 0.35s ease !important;
    }
}