/* ============================================================
   APP SHELL — sidebar + top bar
   Styled from design tokens defined in app.css.
   ============================================================ */

.page {
    position: relative;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    background: transparent; /* let the body background show through */
}

/* ---------- Sidebar (dark navy app shell) ---------- */
.sidebar {
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
}

/* ---------- Top bar ---------- */
.top-row {
    background-color: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    justify-content: flex-end;
    height: 3.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* logged-in user chip */
.topbar-user {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    color: var(--text);
    font-size: var(--text-sm);
}
.topbar-user__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    flex-shrink: 0;
    border-radius: 50%;
    background-color: var(--navy-700);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
}
.topbar-user__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 16rem;
    font-weight: 500;
}

.topbar-link {
    white-space: nowrap;
    text-decoration: none;
    color: var(--link);
    font-weight: 500;
    font-size: var(--text-sm);
    transition: color var(--transition);
}
.topbar-link:hover {
    color: var(--link-hover);
    text-decoration: none;
}

/* ---------- Theme toggle button ---------- */
#theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    margin-left: 0.75rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background-color: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: background-color var(--transition), color var(--transition), border-color var(--transition);
}

#theme-toggle:hover {
    background-color: var(--surface-2);
    color: var(--heading-color);
    border-color: var(--border-strong);
}

#theme-toggle:focus-visible {
    outline: none;
    box-shadow: var(--ring);
}

#theme-toggle svg {
    width: 1.15rem;
    height: 1.15rem;
}

/* show the correct icon for the active theme */
#theme-toggle .icon-moon { display: inline-flex; }
#theme-toggle .icon-sun  { display: none; }
[data-theme="dark"] #theme-toggle .icon-moon { display: none; }
[data-theme="dark"] #theme-toggle .icon-sun  { display: inline-flex; }

/* ---------- Responsive ---------- */
@media (min-width: 641px) {
    .page {
        flex-direction: row;
    }

    .sidebar {
        width: 250px;
        height: 100vh;
        position: sticky;
        top: 0;
    }

    .top-row {
        position: sticky;
        top: 0;
        z-index: 1;
    }

    .top-row,
    article {
        padding-left: 2rem !important;
        padding-right: 1.5rem !important;
    }
}

/* ---------- Unhandled-error banner ---------- */
#blazor-error-ui {
    background: var(--amber-400);
    color: #3A2A00;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}
