/* ==========================================
   PRIMEFORGE APP SIDEBAR
   Desktop: fixed vertical navigation.
   Mobile: off-canvas drawer opened by swipe.
========================================== */

#sidebar {
    width: 0;
    height: 0;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 252px;
    height: 100vh;
    box-sizing: border-box;
    padding: 20px 14px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow-y: auto;
    overflow-x: hidden;
    background: #0d0d10;
    border-right: 1px solid #24252b;
    color: #f5f5f7;
    z-index: 1000;
    scrollbar-width: none;
}

.sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar-top {
    min-width: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 4px 8px 20px;
    color: #f7f7f8;
    text-decoration: none;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.sidebar-brand-logo {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    display: block;
    object-fit: contain;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 100%;
}

.sidebar-nav a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 44px;
    padding: 10px 11px;
    box-sizing: border-box;
    color: #a9abb3;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.sidebar-nav a:hover {
    color: #fff;
    background: #17181d;
    border-color: #24252b;
}

.sidebar-nav a.active {
    color: #fff;
    background: #1b1c21;
    border-color: #2a2b32;
}

.nav-icon {
    width: 20px;
    flex: 0 0 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #d7d8dc;
    font-size: 16px;
    line-height: 1;
}

.sidebar-nav a > span:nth-child(2) {
    min-width: 0;
    flex: 1;
}

.pro-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 18px;
    padding: 0 5px;
    box-sizing: border-box;
    background: #f4f4f5;
    color: #101114;
    border-radius: 4px;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: .06em;
}

#logoutBtn {
    width: 100%;
    min-height: 42px;
    margin-top: 18px;
    padding: 10px 12px;
    color: #a9abb3;
    background: transparent;
    border: 1px solid #292a30;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    text-align: left;
    transition: background .16s ease, color .16s ease, border-color .16s ease;
}

#logoutBtn:hover {
    color: #fff;
    background: #17181d;
    border-color: #3a3b43;
}

/* The normal app content leaves room for the desktop rail. */
.page-content,
.content,
.workspace-page,
.templates-page,
.history-page,
.campaign-page,
.business-page,
.smart-campaign-page {
    margin-left: 252px;
    min-width: 0;
}

/* No hamburger: mobile navigation is gesture-first. */
.mobile-sidebar-toggle {
    display: none !important;
}

/* ==========================================
   MOBILE DRAWER
========================================== */
@media (max-width: 900px) {
    #sidebar {
        position: fixed !important;
        inset: 0 auto 0 0 !important;
        width: min(318px, 86vw) !important;
        height: 100dvh !important;
        min-height: 100dvh !important;
        margin: 0 !important;
        padding: 0 !important;
        z-index: 2000 !important;
        pointer-events: none;
        transform: translateX(-105%);
        transition: transform .22s ease;
    }

    #sidebar .sidebar {
        position: relative !important;
        inset: auto !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 100% !important;
        padding: 20px 16px 16px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
        overflow-y: auto !important;
        background: #0d0d10 !important;
        border-right: 1px solid #24252b !important;
        box-shadow: 18px 0 50px rgba(0,0,0,.45);
    }

    #sidebar .sidebar-brand {
        padding-bottom: 22px;
    }

    #sidebar .sidebar-nav {
        flex-direction: column !important;
        gap: 3px !important;
        overflow: visible !important;
    }

    #sidebar .sidebar-nav a {
        flex: none !important;
        width: 100% !important;
        min-height: 46px !important;
        padding: 11px 12px !important;
        white-space: normal !important;
        font-size: 14px !important;
    }

    #sidebar #logoutBtn {
        width: 100% !important;
        align-self: stretch !important;
        margin-top: 18px !important;
    }

    .page-content,
    .content,
    .workspace-page,
    .templates-page,
    .history-page,
    .campaign-page,
    .business-page,
    .smart-campaign-page {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: none !important;
    }

    body.pf-sidebar-open {
        overflow: hidden !important;
        touch-action: none;
    }

    body.pf-sidebar-open #sidebar {
        pointer-events: auto;
        transform: translateX(0);
    }

    .mobile-sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1900;
        width: 100%;
        height: 100%;
        padding: 0;
        border: 0;
        background: rgba(0,0,0,.58);
        display: none;
    }

    body.pf-sidebar-open .mobile-sidebar-backdrop {
        display: block;
    }

    .mobile-sidebar-close {
        display: none !important;
    }
}

/* ==========================================
   NEW-USER MOBILE TOUR
========================================== */
.pf-mobile-tour {
    display: none;
}

@media (max-width: 900px) {
    .pf-mobile-tour {
        position: fixed;
        inset: 0;
        z-index: 3000;
        pointer-events: none;
    }

    .pf-mobile-tour.is-visible {
        display: block;
    }

    .pf-mobile-tour-card {
        position: absolute;
        left: 18px;
        right: 18px;
        bottom: 26px;
        padding: 18px 18px 16px;
        background: #15161b;
        border: 1px solid #343640;
        border-radius: 16px;
        box-shadow: 0 18px 55px rgba(0,0,0,.48);
        pointer-events: auto;
    }

    .pf-mobile-tour-kicker {
        margin: 0 0 6px;
        color: #9fa3ad;
        font-size: 10px;
        font-weight: 800;
        letter-spacing: .12em;
        text-transform: uppercase;
    }

    .pf-mobile-tour-title {
        margin: 0;
        color: #fff;
        font-size: 17px;
        line-height: 1.25;
    }

    .pf-mobile-tour-copy {
        margin: 7px 0 12px;
        color: #b8bac2;
        font-size: 13px;
        line-height: 1.55;
    }

    .pf-mobile-tour-arrow {
        position: absolute;
        top: -54px;
        left: 22px;
        color: #fff;
        font-size: 40px;
        line-height: 1;
        text-shadow: 0 5px 20px rgba(0,0,0,.7);
    }

    .pf-mobile-tour-actions {
        display: flex;
        justify-content: flex-end;
        gap: 8px;
    }

    .pf-mobile-tour-actions button {
        min-height: 36px;
        padding: 7px 12px;
        border: 1px solid #343640;
        border-radius: 8px;
        background: #202127;
        color: #fff;
        font: inherit;
        font-size: 12px;
        cursor: pointer;
    }

    .pf-mobile-tour-actions .primary {
        background: #f4f4f5;
        color: #111216;
        border-color: #f4f4f5;
    }
}
