/* ==========================================================================
   components/nav.css — sidebar, topbar, bell and mobile drawer
   --------------------------------------------------------------------------
   Used by: account dashboard (and mirrored by admin-theme.css for admin).
   RULES: the sidebar has NO header, NO logo, NO title — menu items only.
   Every sub-menu item is a SEPARATE PAGE (never tabs). On mobile the
   sidebar becomes a drawer opened by the hamburger in the topbar.
   ========================================================================== */

/* ----- Sidebar --------------------------------------------------------------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100%;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    padding: var(--space-3) 0;            /* no header/logo — items start right away */
    z-index: 80;
}

/* Category label (Users, Security, Developers...) */
.sidebar .nav-category {
    display: block;
    padding: var(--space-3) var(--space-4) var(--space-1);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

/* Menu / sub-menu item — each one links to its own page */
.sidebar .nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 40px;
    padding: 0 var(--space-4);
    font-size: var(--font-size-base);
    color: var(--color-text);
    border-left: 2px solid transparent;   /* active marker (flat) */
    transition: background var(--transition-fast);
}

.sidebar .nav-item:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}

/* Current page */
.sidebar .nav-item.is-active {
    color: var(--color-primary);
    border-left-color: var(--color-primary);
    background: var(--color-primary-soft);
}

.sidebar .nav-item i {
    font-size: 18px;                       /* Phosphor icon size in menu */
}

/* ⤿ action sub-item — page actions (edit, add, create...) live in the
   menu under their page, never as buttons inside the page. */
.sidebar .nav-item.nav-action {
    min-height: 32px;
    padding-left: calc(var(--space-4) + var(--space-5));
    font-size: var(--font-size-sm);
    color: var(--color-text-muted);
}

.sidebar .nav-item.nav-action i {
    font-size: 14px;
}

.sidebar .nav-item.nav-action:hover {
    color: var(--color-primary);
}

/* Collapsible group (Settings) — hidden until its parent is clicked
   or one of its pages is active. */
.sidebar .nav-parent {
    width: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: var(--font-family);
    text-align: left;
}

.sidebar .nav-parent {
    font-weight: var(--font-weight-normal);   /* bold is for categories only */
}

.sidebar .nav-group {
    display: none;
}

.sidebar .nav-group.is-open {
    display: block;
}

/* Items inside a group are SUB-items — same look as the ⤿ actions
   (regular weight, smaller, indented); bold belongs to categories only. */
.sidebar .nav-group .nav-item {
    min-height: 34px;
    padding-left: calc(var(--space-4) + var(--space-4));
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
}

.sidebar .nav-group .nav-item i {
    font-size: 15px;
}

.sidebar .nav-group .nav-item.nav-action {
    padding-left: calc(var(--space-4) + var(--space-6) + var(--space-2));
}

/* ----- Topbar ------------------------------------------------------------------ */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 0 var(--space-5);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    z-index: 70;
}

/* Hamburger — hidden on desktop, opens the drawer on mobile */
.topbar .nav-burger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    color: var(--color-text);
    font-size: 20px;
    cursor: pointer;
}

/* ----- Bell (notifications) — user AND admin topbars --------------------------- */
.bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    color: var(--color-text);
    font-size: 20px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.bell:hover {
    background: var(--color-surface-alt);
}

/* Unread counter — hidden when empty (JS sets text + .is-visible) */
.bell .bell-count {
    position: absolute;
    top: 6px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: var(--color-danger);
    color: var(--color-text-invert);
    font-size: 10px;
    font-weight: var(--font-weight-semibold);
    line-height: 16px;
    text-align: center;
    display: none;
}

.bell .bell-count.is-visible {
    display: block;
}

/* ----- Content area next to sidebar/topbar --------------------------------------
   Every dashboard page is FULL WIDTH (project rule). */
.app-content {
    margin-left: var(--sidebar-width);
    padding: calc(var(--topbar-height) + var(--space-5)) var(--space-5) var(--space-7);
}

/* ----- Mobile drawer (<= 900px) --------------------------------------------------
   Sidebar slides in from the left; nav.js toggles .is-open. */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition);
        z-index: 95;
    }

    .sidebar.is-open {
        transform: translateX(0);
    }

    .topbar {
        left: 0;
    }

    .topbar .nav-burger {
        display: inline-flex;
    }

    .app-content {
        margin-left: 0;
        padding-left: var(--space-4);
        padding-right: var(--space-4);
    }
}
