/* =========================================================
   APEX GAMES — GLOBAL NAVIGATION
   ========================================================= */

:root {
    --apex-nav-height: 68px;
    --apex-nav-bg: #080b10;
    --apex-nav-surface: #10141b;
    --apex-nav-surface-hover: #191e27;
    --apex-nav-border: rgba(255, 255, 255, 0.09);
    --apex-nav-text: #f5f7fa;
    --apex-nav-muted: #8f99a8;
    --apex-nav-blue: #168cff;
}

* {
    box-sizing: border-box;
}

.topbar {
    position: relative;
    z-index: 1000;

    width: 100%;
    height: var(--apex-nav-height);

    display: flex;
    align-items: center;

    padding: 0 24px;

    background: var(--apex-nav-bg);
    border-bottom: 1px solid var(--apex-nav-border);
}

.nav-left {
    display: flex;
    align-items: center;
    min-width: 0;
}

.brand {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 auto;
    margin-right: 19px;
}

.brand img {
    display: block;
    width: 38px;
    height: 38px;
    object-fit: contain;
}

.main-nav {
    height: var(--apex-nav-height);

    display: flex;
    align-items: stretch;
    gap: 2px;
}

.nav-item {
    position: relative;

    display: flex;
    align-items: center;
}

.nav-link,
.nav-dropdown-trigger {
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0 12px;

    border: 0;
    background: transparent;

    color: #aab2bf;
    font: inherit;
    font-size: 14px;
    font-weight: 600;

    text-decoration: none;
    white-space: nowrap;

    cursor: pointer;

    transition: color 130ms ease;
}

/*
   ALL NORMAL NAV WORDS:
   Hover = text turns white only.
   No gray background.
*/
.nav-link:hover,
.nav-dropdown-trigger:hover {
    color: #ffffff;
    background: transparent;
}

/*
   Keep the current/open nav item white without adding
   a background highlight.
*/
.nav-item.dropdown-open > .nav-dropdown-trigger {
    color: #ffffff;
    background: transparent;
}

.nav-link.active,
.nav-dropdown-trigger.active {
    color: #ffffff;
}

.nav-link.active::after,
.nav-dropdown-trigger.active::after {
    content: "";

    position: absolute;
    left: 11px;
    right: 11px;
    bottom: 0;

    height: 2px;

    background: var(--apex-nav-blue);
}

.nav-dropdown-trigger {
    gap: 6px;
}

.nav-chevron {
    width: 7px;
    height: 7px;

    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;

    transform: rotate(45deg) translateY(-2px);

    opacity: 0.7;

    transition:
        transform 140ms ease,
        color 130ms ease,
        opacity 130ms ease;
}

.dropdown-open .nav-chevron {
    transform: rotate(225deg) translate(-1px, -1px);
}

.nav-dropdown {
    position: absolute;

    top: calc(100% + 7px);
    left: 0;

    width: 215px;

    padding: 7px;

    background: #11151c;
    border: 1px solid rgba(255, 255, 255, 0.11);

    box-shadow: 0 16px 35px rgba(0, 0, 0, 0.38);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform: translateY(-4px);

    transition:
        opacity 120ms ease,
        transform 120ms ease,
        visibility 120ms ease;
}

.nav-item.dropdown-open > .nav-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;

    transform: translateY(0);
}

.nav-dropdown a,
.nav-dropdown button {
    width: 100%;
    min-height: 38px;

    display: flex;
    align-items: center;

    padding: 0 11px;

    border: 0;
    background: transparent;

    color: #c3cad4;
    font: inherit;
    font-size: 13px;
    font-weight: 500;

    text-decoration: none;
    text-align: left;

    cursor: pointer;

    transition:
        background-color 120ms ease,
        color 120ms ease;
}

.nav-dropdown a:hover,
.nav-dropdown button:hover,
.nav-dropdown a:focus-visible,
.nav-dropdown button:focus-visible {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.065);
    outline: none;
}

.nav-dropdown-separator {
    height: 1px;
    margin: 6px 5px;

    background: rgba(255, 255, 255, 0.08);
}


/* =========================================================
   SEARCH
   ========================================================= */

.nav-search {
    width: min(300px, 22vw);
    height: 36px;

    display: flex;
    align-items: center;

    margin-left: auto;
    margin-right: 14px;

    padding: 0 11px;

    background: #11161e;
    border: 1px solid rgba(255, 255, 255, 0.09);
}

.nav-search:focus-within {
    border-color: rgba(255, 255, 255, 0.18);
}

.search-icon {
    flex: 0 0 auto;

    margin-right: 8px;

    color: #8791a0;
    font-size: 18px;
}

.nav-search input {
    width: 100%;
    min-width: 0;

    border: 0;
    outline: 0;
    background: transparent;

    color: #ffffff;
    font: inherit;
    font-size: 13px;
}

.nav-search input::placeholder {
    color: #707a89;
}


/* =========================================================
   RIGHT SIDE
   ========================================================= */

.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;

    flex: 0 0 auto;
}

.install-client-button {
    height: 34px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0 13px;

    background: #202630;
    border: 1px solid rgba(255, 255, 255, 0.1);

    color: #e9edf3;
    font-size: 12px;
    font-weight: 650;
    text-decoration: none;

    transition:
        background-color 120ms ease,
        border-color 120ms ease;
}

.install-client-button:hover {
    background: #2a313c;
    border-color: rgba(255, 255, 255, 0.16);
}

.notification-wrapper {
    position: relative;
}

.notification-button {
    position: relative;

    width: 36px;
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid transparent;
    background: transparent;

    color: #aab3c0;

    cursor: pointer;

    transition:
        color 120ms ease,
        background-color 120ms ease;
}

.notification-button:hover,
.notification-wrapper.dropdown-open .notification-button {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
}

.notification-bell {
    position: relative;

    width: 15px;
    height: 17px;

    border: 1.7px solid currentColor;
    border-radius: 8px 8px 5px 5px;
}

.notification-bell::before {
    content: "";

    position: absolute;

    width: 5px;
    height: 2px;

    left: 50%;
    bottom: -5px;

    border-radius: 0 0 5px 5px;

    background: currentColor;

    transform: translateX(-50%);
}

.notification-bell::after {
    content: "";

    position: absolute;

    width: 4px;
    height: 4px;

    top: -4px;
    left: 50%;

    border-radius: 50%;

    background: currentColor;

    transform: translateX(-50%);
}

.notification-badge {
    position: absolute;

    top: 4px;
    right: 3px;

    min-width: 15px;
    height: 15px;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 0 4px;

    border: 2px solid var(--apex-nav-bg);
    border-radius: 20px;

    background: #168cff;

    color: white;
    font-size: 9px;
    font-weight: 800;
}

.notification-badge.visible {
    display: flex;
}


/* =========================================================
   NOTIFICATIONS PANEL
   ========================================================= */

.notification-panel {
    position: absolute;

    top: calc(100% + 9px);
    right: 0;

    width: 355px;
    max-height: min(520px, calc(100vh - 90px));

    background: #10141b;
    border: 1px solid rgba(255, 255, 255, 0.11);

    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform: translateY(-4px);

    transition:
        opacity 120ms ease,
        transform 120ms ease,
        visibility 120ms ease;
}

.notification-wrapper.dropdown-open .notification-panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;

    transform: translateY(0);
}

.notification-header {
    height: 52px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 15px;

    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.notification-header strong {
    color: #ffffff;
    font-size: 14px;
}

.notification-header button {
    border: 0;
    background: transparent;

    color: #8ebbe8;
    font: inherit;
    font-size: 11px;

    cursor: pointer;
}

.notification-header button:hover {
    color: #ffffff;
}

.notification-list {
    max-height: 380px;
    overflow-y: auto;
}

.notification-empty {
    padding: 34px 18px;

    color: #7f8997;
    font-size: 13px;
    text-align: center;
}

.notification-row {
    width: 100%;

    display: grid;
    grid-template-columns: 38px 1fr;
    gap: 10px;

    padding: 12px 14px;

    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.055);

    background: transparent;

    text-align: left;
    cursor: pointer;
}

.notification-row:hover {
    background: rgba(255, 255, 255, 0.055);
}

.notification-row.unread {
    background: rgba(22, 140, 255, 0.055);
}

.notification-icon {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    background: #1b222c;
    border: 1px solid rgba(255, 255, 255, 0.08);

    color: #aeb7c4;
    font-size: 15px;
}

.notification-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.notification-copy {
    min-width: 0;
}

.notification-message {
    display: block;

    color: #d7dde6;
    font-size: 12px;
    line-height: 1.45;
}

.notification-time {
    display: block;

    margin-top: 4px;

    color: #727d8c;
    font-size: 10px;
}

.notification-footer {
    min-height: 43px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.notification-footer a {
    color: #aeb8c6;
    font-size: 12px;
    text-decoration: none;
}

.notification-footer a:hover {
    color: #ffffff;
}


/* =========================================================
   ACCOUNT
   ========================================================= */

.nav-account {
    position: relative;

    display: flex;
    align-items: center;
}

.logged-out-account {
    display: flex;
    align-items: center;
    gap: 7px;
}

.login-link,
.create-account-button {
    min-height: 34px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0 11px;

    color: #d7dde6;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}

.login-link:hover {
    background: rgba(255, 255, 255, 0.055);
    color: #ffffff;
}

.create-account-button {
    background: #168cff;
    color: #ffffff;
}

.create-account-button:hover {
    background: #2a97ff;
}

.profile-widget {
    min-width: 142px;
    height: 42px;

    display: flex;
    align-items: center;

    padding: 4px 7px;

    border: 0;
    background: transparent;

    color: inherit;
    text-decoration: none;

    cursor: pointer;

    transition: background-color 120ms ease;
}

.profile-widget:hover,
.nav-account.dropdown-open .profile-widget {
    background: rgba(255, 255, 255, 0.06);
}

.profile-widget img {
    width: 32px;
    height: 32px;

    flex: 0 0 auto;

    object-fit: cover;

    background: #1b212a;
}

.profile-widget-copy {
    min-width: 0;

    display: flex;
    flex-direction: column;

    margin-left: 8px;
}

#profileGamertag {
    max-width: 105px;

    overflow: hidden;

    color: #eef2f7;
    font-size: 12px;
    font-weight: 650;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-wallet {
    margin-top: 2px;

    color: #808b9a;
    font-size: 10px;
}

.profile-arrow {
    width: 7px;
    height: 7px;

    flex: 0 0 auto;

    margin-left: auto;
    margin-right: 3px;

    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;

    color: #87919f;

    transform: rotate(45deg) translateY(-2px);

    transition:
        color 130ms ease,
        transform 140ms ease;
}

.nav-account.dropdown-open .profile-arrow {
    transform: rotate(225deg);
}


/* =========================================================
   ACCOUNT DROPDOWN
   ========================================================= */

.account-dropdown {
    position: absolute;

    top: calc(100% + 8px);
    right: 0;

    width: 245px;

    padding: 7px;

    background: #10141b;
    border: 1px solid rgba(255, 255, 255, 0.11);

    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform: translateY(-4px);

    transition:
        opacity 120ms ease,
        transform 120ms ease,
        visibility 120ms ease;
}

.nav-account.dropdown-open .account-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;

    transform: translateY(0);
}

.account-dropdown-header {
    display: grid;
    grid-template-columns: 38px 1fr;
    gap: 10px;

    padding: 9px 9px 12px;

    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.account-dropdown-header img {
    width: 38px;
    height: 38px;

    object-fit: cover;

    background: #1c222b;
}

.account-dropdown-name {
    display: block;

    overflow: hidden;

    color: #ffffff;
    font-size: 13px;
    font-weight: 700;

    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-dropdown-status {
    display: flex;
    align-items: center;
    gap: 5px;

    margin-top: 5px;

    color: #8e98a7;
    font-size: 10px;
}

.account-status-dot {
    width: 6px;
    height: 6px;

    border-radius: 50%;

    background: #39c875;
}

.account-menu {
    padding-top: 6px;
}

.account-menu a,
.account-menu button {
    width: 100%;
    min-height: 37px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 10px;

    border: 0;
    background: transparent;

    color: #c1c9d4;
    font: inherit;
    font-size: 12px;

    text-align: left;
    text-decoration: none;

    cursor: pointer;
}

.account-menu a:hover,
.account-menu button:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
}

.account-menu-secondary {
    color: #788392;
    font-size: 10px;
}

.account-menu-separator {
    height: 1px;
    margin: 6px 5px;

    background: rgba(255, 255, 255, 0.08);
}


/* =========================================================
   TOAST NOTIFICATIONS
   ========================================================= */

.apex-toast-container {
    position: fixed;

    right: 18px;
    bottom: 18px;

    z-index: 5000;

    width: min(355px, calc(100vw - 36px));

    display: flex;
    flex-direction: column;
    gap: 8px;

    pointer-events: none;
}

.apex-toast {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    gap: 11px;

    align-items: center;

    min-height: 66px;

    padding: 10px;

    background: #10151c;
    border: 1px solid rgba(255, 255, 255, 0.12);

    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);

    opacity: 0;
    transform: translateY(12px);

    transition:
        opacity 180ms ease,
        transform 180ms ease;

    pointer-events: auto;
}

.apex-toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.apex-toast-icon {
    width: 44px;
    height: 44px;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: hidden;

    background: #1d242e;

    color: #aeb8c5;
}

.apex-toast-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.apex-toast-copy strong {
    display: block;

    margin-bottom: 3px;

    color: #ffffff;
    font-size: 11px;
}

.apex-toast-copy span {
    color: #b5beca;
    font-size: 12px;
    line-height: 1.35;
}

.apex-toast-close {
    align-self: start;

    width: 25px;
    height: 25px;

    border: 0;
    background: transparent;

    color: #76808e;

    cursor: pointer;
}

.apex-toast-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
}


/* =========================================================
   ACCESSIBILITY
   ========================================================= */

.nav-link:focus-visible,
.nav-dropdown-trigger:focus-visible,
.install-client-button:focus-visible,
.notification-button:focus-visible,
.profile-widget:focus-visible,
.login-link:focus-visible,
.create-account-button:focus-visible,
.nav-arrow-trigger:focus-visible,
.profile-arrow-trigger:focus-visible {
    outline: 2px solid rgba(22, 140, 255, 0.8);
    outline-offset: -2px;
}


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

@media (max-width: 1180px) {
    .nav-link,
    .nav-dropdown-trigger {
        padding-left: 8px;
        padding-right: 8px;
    }

    .nav-search {
        width: 210px;
    }

    .install-client-button {
        padding: 0 9px;
    }
}

@media (max-width: 980px) {
    .main-nav,
    .nav-search,
    .install-client-button {
        display: none;
    }

    .topbar {
        justify-content: space-between;
    }

    .nav-right {
        margin-left: auto;
    }
}

@media (max-width: 620px) {
    .topbar {
        height: 60px;
        padding: 0 12px;
    }

    .brand {
        margin-right: 8px;
    }

    .brand img {
        width: 34px;
        height: 34px;
    }

    .notification-panel {
        position: fixed;

        top: 66px;
        left: 10px;
        right: 10px;

        width: auto;
    }

    .account-dropdown {
        position: fixed;

        top: 66px;
        left: 10px;
        right: 10px;

        width: auto;
    }

    .profile-widget {
        min-width: 0;
    }

    .profile-widget-copy,
    .profile-arrow {
        display: none;
    }

    .logged-out-account .create-account-button {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nav-dropdown,
    .notification-panel,
    .account-dropdown,
    .apex-toast {
        transition: none;
    }
}


/* =========================================================
   SPLIT NAV CONTROLS
   Text navigates — ONLY arrow opens dropdown
   ========================================================= */

.nav-split-control {
    display: flex;
    align-items: stretch;
    height: 100%;
}

.nav-split-link {
    display: flex;
    align-items: center;
    padding-right: 5px !important;

    background: transparent !important;
}

/*
   Library / Store / Community WORD:
   only the word turns white.
*/
.nav-split-link:hover {
    color: #ffffff !important;
    background: transparent !important;
}

.nav-arrow-trigger {
    appearance: none;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 22px;
    min-width: 22px;
    padding: 0;

    border: 0;
    background: transparent;

    color: #aab2bf;

    cursor: pointer;

    transition: color 130ms ease;
}

/*
   Library / Store / Community ARROW:
   only the arrow turns white.
*/
.nav-arrow-trigger:hover {
    color: #ffffff;
    background: transparent;
}

.nav-arrow-trigger .nav-chevron {
    margin: 0;
    color: inherit;
}

/*
   Keep arrow white while its dropdown is open.
*/
.nav-item.dropdown-open .nav-arrow-trigger {
    color: #ffffff;
}


/* =========================================================
   SPLIT PROFILE CONTROL
   Profile area navigates — ONLY arrow opens dropdown
   ========================================================= */

.profile-widget {
    display: flex;
    align-items: stretch;
    padding: 0 !important;
}

/*
   PROFILE IS THE EXCEPTION:
   it keeps the existing gray highlight.
*/
.profile-main-link {
    min-width: 0;

    display: flex;
    align-items: center;
    gap: 9px;

    padding: 6px 4px 6px 8px;

    color: inherit;
    text-decoration: none;

    transition: background-color 120ms ease;
}

.profile-main-link:hover {
    background: rgba(255, 255, 255, 0.04);
}

.profile-main-link img {
    flex: 0 0 auto;
}

.profile-arrow-trigger {
    appearance: none;

    width: 28px;
    min-width: 28px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 0;
    background: transparent;

    color: #87919f;

    cursor: pointer;

    transition:
        color 130ms ease,
        background-color 120ms ease;
}

/*
   Profile arrow turns white when directly hovered.
*/
.profile-arrow-trigger:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.06);
}

.profile-arrow-trigger .profile-arrow {
    color: inherit;
}

/*
   Keep profile arrow white while account menu is open.
*/
.nav-account.dropdown-open .profile-arrow-trigger {
    color: #ffffff;
}
