/* =========================================
   APP SHELL
   ========================================= */

.app-shell {
    width: 100%;
    min-height: 100vh;

    display: flex;
    flex-direction: column;

    background: var(--background);
}


/* =========================================
   TOP BAR
   ========================================= */

.top-bar {
    height: var(--topbar-height);

    display: grid;

    grid-template-columns:
        minmax(220px, 1fr)
        minmax(300px, 600px)
        minmax(220px, 1fr);

    align-items: center;

    padding: 0 18px;

    background: var(--topbar);

    border-bottom: 1px solid var(--border);

    z-index: 10;
}


.top-bar-left {
    display: flex;
    align-items: center;
}


.app-title {
    display: flex;
    align-items: baseline;

    gap: 8px;
}


.app-title-main {
    font-weight: 600;

    color: var(--text-primary);
}


.app-title-sub {
    font-size: 0.85rem;

    color: var(--text-muted);
}


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

.top-bar-center {
    display: flex;
    justify-content: center;
}


.search-box {
    width: 100%;

    display: flex;
    align-items: center;

    gap: 10px;

    padding: 9px 14px;

    background: var(--surface);

    border: 1px solid var(--border-soft);
    border-radius: 6px;

    transition:
        border-color 0.2s ease,
        background 0.2s ease;
}


.search-box:focus-within {
    border-color: var(--accent);

    background: var(--surface-secondary);
}


.search-icon {
    color: var(--text-muted);

    font-size: 1rem;
}


.search-box input {
    width: 100%;

    border: none;
    outline: none;

    background: transparent;

    color: var(--text-primary);

    font-size: 0.9rem;
}


.search-box input::placeholder {
    color: var(--text-muted);
}


/* =========================================
   TOP RIGHT
   ========================================= */

.top-bar-right {
    display: flex;
    justify-content: flex-end;
    align-items: center;

    gap: 16px;
}


.status {
    display: flex;
    align-items: center;

    gap: 7px;

    color: var(--text-secondary);

    font-size: 0.85rem;
}


.status-dot {
    width: 8px;
    height: 8px;

    border-radius: 50%;

    background: var(--success);

    box-shadow:
        0 0 0 3px rgba(107, 189, 110, 0.1);
}


/* =========================================
   APP BODY
   ========================================= */

.app-body {
    height: calc(
        100vh - var(--topbar-height)
    );

    display: flex;

    overflow: hidden;
}


/* =========================================
   SIDEBAR
   ========================================= */

.sidebar {
    position: relative;

    width: var(--sidebar-width);

    flex-shrink: 0;

    display: flex;
    flex-direction: column;

    padding: 20px 12px;

    background: var(--sidebar);

    border-right: 1px solid var(--border);

    overflow: visible;
}


/* =========================================
   PROFILE
   ========================================= */

.profile-section {
    display: flex;
    align-items: center;

    gap: 12px;

    padding: 6px 8px 18px;
}


.profile-image-wrapper {
    position: relative;

    flex-shrink: 0;
}


.profile-image {
    width: 48px;
    height: 48px;

    object-fit: cover;

    border-radius: 50%;

    border: 2px solid var(--border);

    cursor: pointer;
}


.profile-status {
    position: absolute;

    right: 0;
    bottom: 2px;

    width: 12px;
    height: 12px;

    background: var(--success);

    border: 2px solid var(--sidebar);

    border-radius: 50%;
}


.profile-info h1 {
    font-size: 1rem;
    font-weight: 600;

    line-height: 1.3;
}


.profile-info p {
    margin-top: 3px;

    color: var(--text-muted);

    font-size: 0.76rem;
}


/* =========================================
   PROFILE HOVER CARD
   ========================================= */

.profile-hover-container {
    position: relative;

    display: inline-flex;
    align-items: center;
}


.profile-hover-card {
    position: absolute;

    width: 360px;

    padding: 20px;

    background: #2c2b31;

    border: 1px solid var(--border);
    border-radius: 8px;

    box-shadow:
        0 12px 35px rgba(0, 0, 0, 0.45),
        0 2px 8px rgba(0, 0, 0, 0.25);

    opacity: 0;
    visibility: hidden;

    transform: translateY(-6px);

    transition:
        opacity 0.15s ease,
        visibility 0.15s ease,
        transform 0.15s ease;

    z-index: 1000;

    pointer-events: none;
}


.sidebar-hover-card {
    top: -8px;
    left: calc(100% + 14px);
}


.profile-hover-container:hover
.profile-hover-card,
.profile-hover-container:focus-within
.profile-hover-card {
    opacity: 1;
    visibility: visible;

    transform: translateY(0);

    pointer-events: auto;
}


/* =========================================
   PROFILE HOVER CARD HEADER / BANNER
   ========================================= */

.hover-card-header {
    position: relative;

    display: flex;
    align-items: center;

    gap: 15px;

    min-height: 112px;

    margin:
        -20px
        -20px
        0;

    padding:
        20px;

    overflow: hidden;

    border-radius:
        8px
        8px
        0
        0;
}


/* =========================================
   HEADER BANNER IMAGE
   ========================================= */

.hover-card-header::before {
    content: "";

    position: absolute;
    inset: 0;

    z-index: 0;

    background-image:
        url("../Images/Banners/PFP_BANNER.png");

    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;

    filter:
        brightness(1.12)
        saturate(1.05);
}


/* =========================================
   TRANSLUCENT BLACK MASK
   ========================================= */

.hover-card-header::after {
    content: "";

    position: absolute;
    inset: 0;

    z-index: 1;

    pointer-events: none;

    background:
        linear-gradient(
            90deg,
            rgba(0, 0, 0, 0.05) 0%,
            rgba(0, 0, 0, 0.10) 20%,
            rgba(0, 0, 0, 0.18) 40%,
            rgba(0, 0, 0, 0.30) 60%,
            rgba(0, 0, 0, 0.45) 80%,
            rgba(0, 0, 0, 0.58) 100%
        );
}


/* =========================================
   PROFILE IMAGE WRAPPER
   ========================================= */

.hover-card-image-wrapper {
    position: relative;

    flex-shrink: 0;

    z-index: 2;
}


/* =========================================
   PROFILE IMAGE
   ========================================= */

.hover-card-image {
    width: 68px;
    height: 68px;

    object-fit: cover;

    border-radius: 50%;

    border:
        2px solid rgba(
            255,
            255,
            255,
            0.35
        );

    box-shadow:
        0 3px 12px rgba(
            0,
            0,
            0,
            0.45
        );
}


/* =========================================
   STATUS DOT
   ========================================= */

.hover-card-status-dot {
    position: absolute;

    right: 1px;
    bottom: 4px;

    width: 15px;
    height: 15px;

    border-radius: 50%;

    background:
        var(--success);

    border:
        3px solid rgba(
            20,
            20,
            23,
            0.92
        );
}


/* =========================================
   PROFILE IDENTITY
   ========================================= */

.hover-card-identity {
    position: relative;

    min-width: 0;

    z-index: 2;
}


.hover-card-identity h3 {
    margin-bottom: 4px;

    color:
        #ffffff;

    font-size: 1.05rem;

    font-weight: 600;

    text-shadow:
        0 1px 4px rgba(
            0,
            0,
            0,
            0.65
        );
}


.hover-card-identity p {
    margin-bottom: 7px;

    color:
        rgba(
            255,
            255,
            255,
            0.82
        );

    font-size: 0.84rem;

    text-shadow:
        0 1px 4px rgba(
            0,
            0,
            0,
            0.6
        );
}


.hover-status {
    display: flex;

    align-items: center;

    gap: 7px;

    color:
        rgba(
            255,
            255,
            255,
            0.72
        );

    font-size: 0.78rem;

    text-shadow:
        0 1px 4px rgba(
            0,
            0,
            0,
            0.6
        );
}


.hover-status .status-dot {
    width: 7px;
    height: 7px;
}


.hover-card-status-dot {
    position: absolute;

    right: 1px;
    bottom: 4px;

    width: 15px;
    height: 15px;

    border-radius: 50%;

    background:
        var(--success);

    border:
        3px solid rgba(
            20,
            20,
            23,
            0.92
        );
}


.hover-card-identity {
    position: relative;

    min-width: 0;

    z-index: 1;
}


.hover-card-identity h3 {
    margin-bottom: 4px;

    color:
        #ffffff;

    font-size: 1.05rem;
    font-weight: 600;

    text-shadow:
        0 1px 4px rgba(
            0,
            0,
            0,
            0.65
        );
}


.hover-card-identity p {
    margin-bottom: 7px;

    color:
        rgba(
            255,
            255,
            255,
            0.82
        );

    font-size: 0.84rem;

    text-shadow:
        0 1px 4px rgba(
            0,
            0,
            0,
            0.6
        );
}


.hover-status {
    display: flex;
    align-items: center;

    gap: 7px;

    color:
        rgba(
            255,
            255,
            255,
            0.7
        );

    font-size: 0.78rem;

    text-shadow:
        0 1px 4px rgba(
            0,
            0,
            0,
            0.6
        );
}


.hover-status .status-dot {
    width: 7px;
    height: 7px;
}


.hover-card-divider {
    width: 100%;
    height: 1px;

    margin: 17px 0;

    background: var(--border);
}


.hover-card-details {
    display: flex;
    flex-direction: column;

    gap: 13px;
}


.hover-detail {
    display: flex;
    flex-direction: column;

    gap: 3px;

    color: var(--text-secondary);

    font-size: 0.82rem;

    line-height: 1.4;
}


.hover-detail-label {
    color: var(--text-muted);

    font-size: 0.7rem;
    font-weight: 600;

    text-transform: uppercase;

    letter-spacing: 0.06em;
}


.hover-card-links {
    display: flex;
    align-items: center;

    gap: 8px;
}


.hover-card-links a {
    flex: 1;

    padding: 8px 10px;

    text-align: center;

    color: var(--accent-light);

    background: var(--surface-secondary);

    border: 1px solid var(--border);
    border-radius: 5px;

    text-decoration: none;

    font-size: 0.8rem;
    font-weight: 500;

    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        color 0.15s ease;
}


.hover-card-links a:hover {
    color: white;

    background: var(--accent);

    border-color: var(--accent);
}


/* =========================================
   SIDEBAR DIVIDER
   ========================================= */

.sidebar-divider {
    height: 1px;

    margin: 0 8px 12px;

    background: var(--border);
}


/* =========================================
   NAVIGATION
   ========================================= */

.sidebar-nav {
    position: relative;

    display: flex;
    flex-direction: column;

    gap: 4px;
}


/* =========================================
   SIDEBAR SLIDING INDICATOR
   ========================================= */

.sidebar-nav-indicator {
    position: absolute;

    top: 0;
    left: 0;
    right: 0;

    height: 0;

    background:
        var(--surface-secondary);

    border-radius:
        6px;

    pointer-events:
        none;

    z-index: 0;

    transition:
        transform 220ms ease,
        height 220ms ease;
}


/* Accent bar on sliding indicator */

.sidebar-nav-indicator::before {
    content: "";

    position: absolute;

    left: 0;
    top: 50%;

    width: 3px;
    height: 22px;

    background:
        var(--accent);

    border-radius:
        0 3px 3px 0;

    transform:
        translateY(-50%);
}


/* =========================================
   NAV ITEMS
   ========================================= */

.nav-item {
    position: relative;

    display: flex;
    align-items: center;

    gap: 12px;

    padding: 11px 12px;

    border-radius: 6px;

    color:
        var(--text-secondary);

    background:
        transparent;

    text-decoration:
        none;

    font-size:
        0.9rem;

    font-weight:
        500;

    transition:
        background 150ms ease,
        color 150ms ease;
}


.sidebar-nav .nav-item {
    z-index: 1;
}


button.nav-item {
    width: 100%;

    border: none;

    text-align: left;

    cursor: pointer;
}


/* =========================================
   HOVER
   ========================================= */

.nav-item:hover {
    background:
        var(--surface-hover);

    color:
        var(--text-primary);
}


/* =========================================
   ACTIVE
   ========================================= */

.sidebar-nav .nav-item.active {
    background:
        transparent;

    color:
        var(--text-primary);
}


/*
    The old active ::before bar is no longer
    needed because it now moves with the
    sidebar indicator.
*/

.sidebar-nav .nav-item.active::before {
    display: none;
}


/* =========================================
   NAV ICON
   ========================================= */

.nav-icon {
    width: 25px;

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

    color:
        var(--accent-light);

    font-family:
        "Cascadia Code",
        "Fira Code",
        Consolas,
        monospace;

    font-size:
        0.82rem;
}


/* =========================================
   SIDEBAR BOTTOM
   ========================================= */

.sidebar-bottom {
    margin-top: auto;

    padding-top: 12px;

    border-top:
        1px solid var(--border);
}


/* =========================================
   WORKSPACE
   ========================================= */

.workspace {
    flex: 1;

    min-width: 0;
    min-height: 0;

    display: flex;
    flex-direction: column;

    background: var(--surface);

    overflow: hidden;
}


/* =========================================
   WORKSPACE HEADER
   ========================================= */

.workspace-header {
    min-height: 92px;

    display: flex;
    align-items: center;

    padding: 18px 30px;

    background: var(--surface);

    border-bottom:
        1px solid var(--border-soft);
}


.workspace-path {
    display: block;

    margin-bottom: 5px;

    color: var(--text-muted);

    font-family:
        "Cascadia Code",
        "Fira Code",
        Consolas,
        monospace;

    font-size: 0.75rem;
}


.workspace-header h2 {
    font-size: 1.4rem;

    font-weight: 600;
}


/* =========================================
   WORKSPACE TABS
   ========================================= */

.workspace-tabs {
    position: relative;

    min-height: 48px;

    display: flex;
    align-items: flex-end;

    gap: 5px;

    padding: 0 26px;

    background: var(--surface);

    border-bottom:
        1px solid var(--border);

    overflow-x: auto;
    overflow-y: hidden;

    scrollbar-width: none;
}


.workspace-tabs::-webkit-scrollbar {
    display: none;
}


.workspace-tab {
    position: relative;

    height: 48px;

    padding: 0 14px;

    flex-shrink: 0;

    border: none;

    background: transparent;

    color: var(--text-secondary);

    font-size: 0.86rem;
    font-weight: 500;

    cursor: pointer;
}


.workspace-tab:hover {
    color: var(--text-primary);
}


.workspace-tab.active {
    color: var(--text-primary);
}


/* =========================================
   SLIDING TAB INDICATOR
   ========================================= */

.workspace-tab-indicator {
    position: absolute;

    bottom: 0;
    left: 0;

    height: 3px;
    width: 0;

    background: var(--accent);

    border-radius:
        3px 3px 0 0;

    pointer-events: none;

    transition:
        left 180ms ease,
        width 180ms ease;
}

/* =========================================
   WORKSPACE HEADER / TAB TRANSITIONS
   ========================================= */

.workspace-header,
.workspace-tabs {
    opacity: 1;

    transform:
        translateX(0);
}


/* =========================================
   HEADER + TABS FADE OUT
   ========================================= */

.workspace-header.workspace-meta-switching,
.workspace-tabs.workspace-meta-switching {
    opacity: 0;

    transform:
        translateX(0);

    transition:
        opacity 275ms ease;

    pointer-events:
        none;
}


/* =========================================
   HEADER + TABS FADE IN START
   ========================================= */

.workspace-header.workspace-meta-entering,
.workspace-tabs.workspace-meta-entering {
    opacity: 0;

    transform:
        translateX(-14px);

    transition:
        none;

    pointer-events:
        none;
}


/* =========================================
   HEADER + TABS FADE IN ACTIVE
   ========================================= */

.workspace-header.workspace-meta-entering.workspace-meta-entering-active,
.workspace-tabs.workspace-meta-entering.workspace-meta-entering-active {
    opacity: 1;

    transform:
        translateX(0);

    transition:
        opacity 400ms ease,
        transform 400ms ease;
}


/* =========================================
   SLIGHT TAB DELAY
   ========================================= */

.workspace-tabs.workspace-meta-entering.workspace-meta-entering-active {
    transition-delay:
        45ms;
}


/* =========================================
   WORKSPACE CONTENT
   ========================================= */

.workspace-content {
    flex: 1;

    min-height: 0;

    padding: 30px;

    overflow-y: auto;
    overflow-x: hidden;

    scroll-behavior: auto;

    background:
        linear-gradient(
            180deg,
            var(--surface) 0%,
            #25242a 100%
        );

    opacity: 1;

    transform:
        translateY(0);
}


/* =========================================
   PAGE FADE OUT
   ========================================= */

.workspace-content.workspace-switching {
    opacity: 0;

    transform:
        translateY(6px);

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

    pointer-events: none;
}


/* =========================================
   PAGE FADE IN - START
   ========================================= */

.workspace-content.workspace-entering {
    opacity: 0;

    transform:
        translateY(8px);

    transition: none;

    pointer-events: none;
}


/* =========================================
   PAGE FADE IN - ACTIVE
   ========================================= */

.workspace-content.workspace-entering.workspace-entering-active {
    opacity: 1;

    transform:
        translateY(0);

    transition:
        opacity 400ms ease,
        transform 400ms ease;
}


/* =========================================
   PAGE VIEWS
   ========================================= */

.page-view {
    display: none;
}


.page-view.active {
    width: 100%;

    max-width: 1250px;

    margin: 0 auto;

    display: flex;
    flex-direction: column;

    gap: 22px;
}


.page-section {
    width: 100%;

    scroll-margin-top: 20px;
}


/* =========================================
   WORKSPACE SCROLLBAR
   ========================================= */

.workspace-content::-webkit-scrollbar {
    width: 10px;
}


.workspace-content::-webkit-scrollbar-track {
    background: transparent;
}


.workspace-content::-webkit-scrollbar-thumb {
    background: #46454d;

    border:
        3px solid transparent;

    background-clip:
        padding-box;

    border-radius: 10px;
}


.workspace-content::-webkit-scrollbar-thumb:hover {
    background: #56555e;

    border:
        3px solid transparent;

    background-clip:
        padding-box;
}

/* =========================================
   DESKTOP TAB SCROLL RUNWAY
   ========================================= */

/*
    Desktop layouts are much shorter because
    cards can sit beside each other.

    This extra space allows sections near the
    bottom of a page to still scroll all the
    way to the top when their workspace tab
    is clicked.
*/

@media (min-width: 701px) {

    .page-view.active::after {
        content: "";

        display: block;

        flex-shrink: 0;

        width: 100%;

        height:
            calc(
                100dvh -
                var(--topbar-height) -
                220px
            );

        min-height: 250px;

        pointer-events: none;
    }

}