body {
    font-family: 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Custom Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 10px;
    border: 2px solid var(--bg-color);
}

::-webkit-scrollbar-thumb:hover {
    background: #444;
}

/* Firefox Scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: #333 transparent;
}

/* Global UI Fixes */
.mobile-fab {
    display: none !important;
}

body.dashboard-layout {
    flex-direction: row;
    height: 100vh;
    overflow: hidden;
    align-items: stretch;
}

/* ===== DASHBOARD LAYOUT ===== */
.dashboard-sidebar {
    width: 260px;
    min-width: 260px;
    background: #08080a;
    border-right: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    z-index: 100;
    scrollbar-width: thin;
    scrollbar-color: #222 transparent;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== SIDEBAR SEARCH (New for mobile menu) ===== */
.sidebar-search-container {
    padding: 12px 16px;
    border-bottom: 1px solid var(--card-border);
}

.sidebar-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0 12px;
    height: 40px;
}

.sidebar-search-wrapper input {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 0.9rem;
    width: 100%;
    outline: none;
}

/* ===== BACK TO HUB BUTTON ===== */
.back-to-hub {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.15s, background 0.15s, padding-left 0.15s;
    border-bottom: 1px solid var(--card-border);
    background: rgba(255, 255, 255, 0.02);
}

.back-to-hub:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    padding-left: 24px;
}

.back-to-hub svg {
    transition: transform 0.15s, color 0.15s;
    color: var(--accent-start);
    filter: drop-shadow(0 0 5px rgba(59, 130, 246, 0.2));
}

.back-to-hub:hover svg {
    transform: translateX(-4px);
    color: #fff;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.4));
}

.dashboard-main {
    flex: 1;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--bg-color);
    min-width: 0;
}

/* ===== SIDEBAR HEADER ===== */
.dashboard-sidebar .header-wrapper {
    width: 100%;
}

.dashboard-sidebar header {
    text-align: left;
}

.dashboard-sidebar #headerContent {
    padding: 22px 20px 14px 20px;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 0;
}

.dashboard-sidebar h1 {
    font-size: 1.5rem;
    letter-spacing: 1.5px;
    line-height: 1.1;
}

.dashboard-sidebar .credits-badges {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    justify-content: flex-start;
    align-items: stretch;
}

.dashboard-sidebar .credit-badge {
    width: 100%;
    box-sizing: border-box;
}

/* ===== SIDEBAR FOOTER ===== */
.sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    border-top: 1px solid var(--card-border);
    margin-top: auto;
}

.sidebar-footer-btn {
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    padding: 10px 16px;
    font-size: 0.78rem;
    color: var(--text-secondary) !important;
    border-radius: 8px;
    border: 1px solid transparent !important;
}

.sidebar-footer-btn:hover {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: #fff !important;
}

html.no-scroll,
body.no-scroll {
    overflow: hidden !important;
    height: 100% !important;
}

body.scroll-locked {
    position: fixed;
    width: 100%;
    top: var(--scroll-offset, 0px);
}

header {
    text-align: center;
    width: 100%;
}

#headerContent {
    padding-top: 20px;
    padding-bottom: 10px;
}

h1 {
    font-size: 2.5rem;
    margin: 0;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: linear-gradient(to right, var(--accent-start), var(--accent-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* CREDITS BADGES */
.credits-badges {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.credit-badge {
    display: inline-flex;
    align-items: center;
    background: #0f1014;
    border: 1px solid #2d2f36;
    border-radius: 8px;
    padding: 0;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
    user-select: none;
    overflow: hidden;
    height: 32px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.credit-badge:hover {
    background: #1a1b21;
    border-color: #555;
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.5);
}

.badge-role {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    padding: 0 12px;
    height: 100%;
    display: flex;
    align-items: center;
    letter-spacing: 1px;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.credit-badge.owner .badge-role {
    background: rgba(168, 85, 247, 0.1);
    color: #7b00ff;
    text-shadow: 0 0 15px #0a0147, 0 0 5px #0a0147;
}

.credit-badge.helper .badge-role {
    background: rgba(59, 130, 246, 0.1);
    color: #0073ff;
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.badge-content {
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 8px;
}

.badge-pfp {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    margin-left: -4px;
    flex-shrink: 0;
}

.badge-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: #e0e0e0;
    white-space: nowrap;
}

.discord-icon {
    color: #5865F2;
    opacity: 0.8;
    transition: 0.2s;
    margin-top: 1px;
    flex-shrink: 0;
}

.credit-badge:hover .discord-icon {
    opacity: 1;
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 0 8px rgba(88, 101, 242, 0.8));
}

.discord-link-btn {
    background: transparent;
    border: none;
    color: #a1a1aa;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    margin-left: 0px;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.discord-link-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    transform: translateY(-1px);
}

.external-link-icon {
    width: 14px;
    height: 14px;
}

/* HEADER COLLAPSE LOGIC */
.header-wrapper {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

.header-inner {
    overflow: hidden;
    min-height: 0;
}

#sticky-sentinel {
    width: 100%;
    height: 1px;
    visibility: hidden;
    pointer-events: none;
    margin-bottom: -1px;
}

.header-toggle-strip {
    width: 100%;
    background: transparent;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    text-align: center;
    z-index: 1100;
    padding: 2px 0;
    display: block;
}

.header-toggle-strip:hover .header-toggle-btn {
    color: var(--accent-start);
}

body.header-collapsed .header-toggle-btn {
    transform: rotate(180deg);
}

/* ===== STICKY TOPBAR ===== */
.sticky-toolbar-container {
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    background: #050505;
    border-bottom: 1px solid var(--card-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.sticky-toolbar-container .injector-panel {
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
    max-height: 200vh;
    opacity: 1;
}

/* ===== SIDEBAR NAV ===== */
.nav-bar {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 12px;
    width: 100%;
    box-sizing: border-box;
    flex: 1;
}

.dashboard-sidebar .nav-btn {
    text-align: left;
    padding: 11px 16px;
    width: 100%;
    box-sizing: border-box;
    border-radius: 8px;
    font-size: 0.82rem;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
}

.dashboard-sidebar .nav-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
}

.dashboard-sidebar .nav-btn.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(168, 85, 247, 0.2));
    border-color: rgba(59, 130, 246, 0.35);
    color: white;
    box-shadow: none;
}

/* Mobile-only menu items */
.mobile-only-btn {
    display: none;
}

.mobile-only-block {
    display: none;
}

.desktop-only {
    display: inline-flex;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .mobile-only-btn {
        display: flex;
    }

    .mobile-only-block {
        display: block;
    }

    /* Keep topbar visible for pagination selector */
    .sticky-toolbar-container.dashboard-topbar {
        display: flex !important;
        background: #08080a;
    }

    .injector-panel {
        padding: 5px 10px !important;
        justify-content: center !important;
    }

    /* Hide everything in topbar except pagination center */
    .injector-left,
    .injector-right {
        display: none !important;
    }

    .injector-center {
        flex: 1 !important;
        justify-content: center !important;
    }

    /* Sidebar adjustments */
    .sidebar-mobile-controls {
        padding: 0 12px;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .sidebar-divider {
        font-size: 0.65rem;
        color: #444;
        text-transform: uppercase;
        font-weight: 800;
        margin: 15px 0 5px 10px;
        letter-spacing: 1px;
    }

    .nav-toggle-label.sidebar-toggle {
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(255, 255, 255, 0.05);
        justify-content: space-between;
        margin-left: 0;
        padding: 12px 16px;
    }
}

/* ===== TOPBAR INJECTOR PANEL ===== */
.injector-panel {
    width: 100%;
    background: transparent;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 10px 20px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    transition: opacity 0.15s;
    box-sizing: border-box;
    flex-wrap: wrap;
    position: relative;
    z-index: 50;
}

.injector-left {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1;
    justify-content: flex-start;
}

.injector-center {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 60;
    flex: 1;
    justify-content: center;
}

.injector-right {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex: 1;
}

.top-pagination-container .pagination-bar {
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    gap: 6px;
    height: 34px;
}

.top-pagination-container .pg-btn {
    height: 32px;
    min-width: 32px;
    font-size: 0.75rem;
    padding: 0 8px;
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

.top-pagination-container .pg-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.top-pagination-container .pg-btn.pg-active {
    background: var(--accent-start);
    border-color: var(--accent-start);
    color: white;
}

.top-pagination-container .pg-nav {
    font-weight: 700;
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.2);
    color: var(--accent-start);
}

.top-pagination-container .pg-info {
    display: none;
}

.global-buffs-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    padding-top: 15px;
    margin-top: 5px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    animation: slideDown 0.2s ease-out;
}

.injector-panel .nav-toggle-label {
    height: 34px;
    padding-top: 0;
    padding-bottom: 0;
}

/* PAGES & LAYOUTS */

/* --- MOBILE NAV SCROLLING & TOGGLES --- */
@media (max-width: 768px) {
    body.dashboard-layout {
        flex-direction: column !important;
        height: 100vh !important;
        overflow: hidden !important;
    }

    .dashboard-sidebar {
        position: fixed !important;
        top: 0;
        left: 0;
        width: 280px !important;
        min-width: 280px !important;
        height: 100vh !important;
        transform: translateX(-100%);
        z-index: 2100;
        background: #08080a;
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.9);
        display: flex !important;
    }

    body.mobile-menu-open .dashboard-sidebar {
        transform: translateX(0);
    }

    .dashboard-main {
        height: 100vh !important;
        overflow-y: auto !important;
    }

    .nav-bar {
        flex-direction: column;
        overflow-y: auto;
        padding: 20px;
        gap: 8px;
    }

    .nav-btn {
        flex-shrink: 0;
        white-space: nowrap;
    }

    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.3);
        z-index: 2090;
    }

    body.mobile-menu-open .mobile-overlay {
        display: block !important;
    }

    .mobile-fab {
        display: flex !important;
        position: fixed;
        bottom: 25px;
        right: 25px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
        color: white;
        align-items: center;
        justify-content: center;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
        z-index: 2000;
        border: none;
        cursor: pointer;
        transition: transform 0.2s;
    }

    .mobile-fab:active {
        transform: scale(0.9);
    }

    body.mobile-menu-open .mobile-fab,
    body.modal-open .mobile-fab {
        display: none !important;
    }

    .dashboard-sidebar .sidebar-footer {
        padding: 20px;
        background: rgba(255, 255, 255, 0.02);
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }
}

/* Toggle Switch Visuals */
.mini-switch {
    width: 36px;
    height: 20px;
    background: #333;
    border-radius: 20px;
    position: relative;
    transition: background 0.15s;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.mini-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.15s;
}

input:checked+.mini-switch {
    background: var(--accent-start);
}

input:checked+.mini-switch::after {
    transform: translateX(16px);
}

.pages-container {
    width: 100%;
    padding: 20px 20px 350px 20px;
    box-sizing: border-box;
}

.page {
    display: none;
    width: 100%;
    animation: fadeIn 0.4s ease;
}

.page.active {
    display: grid;
}

.db-grid {
    grid-template-columns: repeat(auto-fill, minmax(370px, 1fr));
    gap: 18px;
    width: 100%;
    align-content: start;
}

.guide-container {
    width: 100%;
}

.guide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(370px, 1fr));
    gap: 18px;
    width: 100%;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* GLOBAL SEARCH BAR */
.global-search-container {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0 14px;
    height: 40px;
    width: 320px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

@media (max-width: 1100px) {
    .global-search-container {
        width: 100%;
        max-width: 400px;
    }
}

.global-search-container:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.global-search-container:focus-within {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-start);
    width: 400px;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.search-icon {
    width: 18px;
    height: 18px;
    color: rgba(255, 255, 255, 0.4);
    margin-right: 12px;
    transition: color 0.3s;
}

.global-search-container:focus-within .search-icon {
    color: var(--accent-start);
}

#globalSearch {
    background: none;
    border: none;
    color: #fff;
    font-size: 0.9rem;
    width: 100%;
    outline: none;
    font-family: inherit;
    letter-spacing: 0.3px;
}

#globalSearch::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.search-clear-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.search-clear-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* ===== PAGINATION ===== */
.pagination-wrapper {
    grid-column: 1 / -1;
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 24px 0 8px;
}

.pagination-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 8px 14px;
    backdrop-filter: blur(8px);
    flex-wrap: wrap;
    justify-content: center;
}

.pg-numbers {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pg-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #a0a0a8;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    letter-spacing: 0.3px;
    min-width: 36px;
    text-align: center;
}

.pg-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
    transform: translateY(-1px);
}

.pg-btn:active:not(:disabled) {
    transform: translateY(0);
}

.pg-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pg-btn.pg-active {
    background: linear-gradient(135deg, var(--accent-start), var(--accent-end));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.3);
}

.pg-btn.pg-nav {
    font-weight: 700;
    padding: 6px 14px;
    letter-spacing: 0.5px;
}

.pg-ellipsis {
    color: #555;
    padding: 0 4px;
    font-size: 0.9rem;
    user-select: none;
}

.pg-info {
    color: #555;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-left: 8px;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .pagination-bar {
        padding: 6px 10px;
        gap: 4px;
    }

    .pg-btn {
        padding: 5px 8px;
        font-size: 0.75rem;
        min-width: 30px;
    }

    .pg-btn.pg-nav {
        padding: 5px 10px;
    }

    .pg-info {
        display: none;
        /* Keep top bar clean on mobile */
    }
}

.bottom-pagination {
    display: none;
}