/* ============================================
   NAVBAR (wrapper for both bars)
   ============================================ */
.navbar {
    background-color: rgba(15, 17, 23, 0.92) !important;
    -webkit-backdrop-filter: blur(15px);
    -moz-backdrop-filter: blur(15px);
    backdrop-filter: blur(15px);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding-top: 0;
    padding-bottom: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

/* ============================================
   TOP BAR — flexbox: left | center | right
   ============================================ */
.topbar-container {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: var(--max-container-width);
    margin: 0 auto;
    padding: 14px 20px 10px;
    /* border-bottom: 1px solid rgba(255, 255, 255, 0.08); */
    background-color: var(--topbar-color-primary);
    position: relative;
    color: var(--text-color-primary);
}

/* ---------- LEFT: brand + logo ---------- */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--static-nav-color);
    font-weight: 700;
    font-size: 1.3rem;
    flex-shrink: 0;
    z-index: 2;
}

.brand-logo {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #4e2780;
}

.brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* ---------- CENTER: nav links (absolutely centered) ---------- */
.topbar-links-container {
    display: flex;
    align-items: center;
    gap: 55px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
}

.topbar-link {
    text-decoration: none;
    color: var(--text-color-primary);
    font-size: var(--text-size-primary);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
    white-space: nowrap;
}

/* ---------- RIGHT: theme toggle ---------- */
.topbar-right {
    display: flex;
    align-items: center;
    margin-left: auto;
    flex-shrink: 0;
    z-index: 2;
}

#themeToggle {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--static-nav-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 50%;
    font-size: 1.4rem;
    transition: transform 0.3s ease, color 0.3s ease, background-color 0.2s ease;
}

#themeToggle:hover {
    transform: rotate(20deg) scale(1.1);
}

[data-theme='dark'] #themeToggle {
    color: #facc15;
}

/* ============================================
   MAIN NAVBAR
   ============================================ */
.navbar-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    margin-right: auto;
}

.nav-link {
    font-size: var(--text-size-small);
    font-weight: 500;
    color: var(--text-color-primary) !important;
    margin-left: 0;
    padding: 8px 14px !important;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 8px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

/* ============================================
   ☰ HAMBURGER
   ============================================ */
.navbar-toggle-btn {
    background: transparent;
    border: none;
    /* remove the square box */
    padding: 6px 10px;
    cursor: pointer;
}

.navbar-toggle-btn i {
    font-size: 1.6rem;
    line-height: 1;
    color: var(--text-color-primary);
    /* ← your dynamic var */
    transition: color 0.3s ease;
}

/* ============================================
   ✕ CLOSE BUTTON (hidden by default)
   ============================================ */
.navbar-close-btn {
    display: none;
    background: transparent;
    color: #ffffff;
    font-size: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: auto;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.navbar-close-btn:hover {
    background-color: rgba(167, 139, 250, 0.15);
    border-color: #a78bfa;
    color: #a78bfa;
}

/* ============================================
   RESPONSIVE — MOBILE
   ============================================ */
@media (max-width: 991.98px) {

    /* ---------- TOP BAR ---------- */
    .nav-brand span {
        display: none;
    }

    /* Links: truly centered on the page + evenly spaced */
    .topbar-links-container {
        align-items: center;
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        gap: 0;
        /* let flex distribute the space */
        width: 100%;
        max-width: 240px;
        /* keeps them from hitting logo/toggle */
        justify-content: space-between;
    }

    .topbar-link {
        font-size: 0.78rem;
        gap: 3px;
    }

    .topbar-link i {
        font-size: 0.75rem;
    }

    .brand-logo {
        width: 32px;
        height: 32px;
    }

    #themeToggle {
        font-size: 1.2rem;
        padding: 4px 8px;
    }

    /* ---------- MAIN NAVBAR: ☰ left ---------- */
    .navbar-container {
        display: flex;
        align-items: center;
        justify-content: flex-end !important;
        flex-wrap: wrap;
        padding: 6px 16px 10px !important;
        position: relative;
        /* border-top: 1px solid var(--border-color-primary); */
    }

    /* ✕ absolutely positioned top-right */
    .navbar-close-btn {
        position: absolute;
        top: 6px;
        right: 16px;
    }

    .navbar-close-btn.show {
        display: inline-flex;
    }

    .navbar-toggler.hide {
        display: none;
    }

    /* ---------- COLLAPSE MENU ---------- */
    .navbar-collapse {
        width: 100%;
        flex-basis: 100%;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--border-color-primary);
    }

    .navbar-nav {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 4px;
        margin-right: 0;
    }

    .navbar-nav .nav-item {
        width: 100%;
        color: var(--text-color-primary);
    }

    .nav-link {
        width: 100%;
        justify-content: flex-start;
        padding: 10px 14px !important;
        font-size: var(--text-size-primary);
    }

    .navbar-nav .nav-item {
        border-bottom: 1px solid var(--border-color-primary);
    }
}

/* Sun visible in light mode, moon hidden */
.theme-toggle .icon-sun {
    display: inline-block;
    color: #1E1E2E;
}

.theme-toggle .icon-moon {
    display: none;
}

/* Dark mode → show moon, hide sun */
[data-theme='dark'] .theme-toggle .icon-sun {
    display: none;
}

[data-theme='dark'] .theme-toggle .icon-moon {
    display: inline-block;
    color: #ffffff;
}