/* ── Layer 1: AppShell layout ─────────────────
   Full-viewport column layout with optional
   fixed banners, announcement, surface, and footer.
   ──────────────────────────────────────────── */

.sw-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    overflow: hidden;
    background: var(--bg);
    /* Safe-area insets for notched devices */
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
}

/* ── Banner (fixed top / bottom — identical component) ── */

.sw-shell__banner {
    position: fixed;
    left: 0;
    right: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.45rem 1rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.sw-shell__banner--top    { top: 0; }
.sw-shell__banner--bottom { bottom: 0; }

.sw-shell__banner--info    { background: var(--accent-dim); color: var(--accent-light); }
.sw-shell__banner--warn    { background: var(--warning-dim); color: var(--warning-light); }
.sw-shell__banner--error   { background: var(--danger-dim); color: var(--danger-light); }
.sw-shell__banner--success { background: var(--success-dim); color: var(--success-light); }

.sw-shell__banner-text {
    flex: 1;
    text-align: center;
}

.sw-shell__banner-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 0.3rem;
    opacity: 0.7;
    line-height: 1;
}
.sw-shell__banner-close:hover { opacity: 1; }

/* ── Shell body — insets for fixed banners ─── */

.sw-shell__body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    padding-top: var(--banner-top-height, 0px);
    padding-bottom: var(--banner-bottom-height, 0px);
}

/* ── Announcement bar ─────────────────────── */

.sw-shell__announcement {
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
}

.sw-shell__announcement-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    font-size: 0.85rem;
}

.sw-shell__announcement--info    { background: var(--bg-surface); color: var(--text-2); }
.sw-shell__announcement--warn    { background: var(--warning-dim); color: var(--warning-light); }
.sw-shell__announcement--error   { background: var(--danger-dim); color: var(--danger-light); }
.sw-shell__announcement--success { background: var(--success-dim); color: var(--success-light); }

.sw-shell__announcement-text {
    flex: 1;
}

/* ── Surface (main content area) ──────────── */

.sw-shell__surface {
    flex: 1;
    overflow: auto;
    position: relative;
}

/* ── Footer ───────────────────────────────── */

.sw-shell__footer {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-3);
    text-align: center;
    background: var(--bg-surface);
}

/* ── Surface viewport ────────────────────── */

.sw-surface-viewport {
    flex: 1;
    position: relative;
    overflow: auto;
    display: flex;
    flex-direction: column;
}

/* ── Topbar — standard surface navigation bar ── */

.sw-topbar {
    display: flex;
    align-items: center;
    height: 44px;
    padding: 0 12px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    gap: 10px;
}

.sw-topbar__title {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
    flex-shrink: 0;
    white-space: nowrap;
}

.sw-topbar__spacer {
    flex: 1;
}

.sw-topbar__slot {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sw-topbar__right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── User menu trigger ───────────────────── */

.sw-user-menu__trigger {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    border-radius: 50%;
    transition: box-shadow var(--transition, 0.15s ease);
}
.sw-user-menu__trigger:hover {
    box-shadow: 0 0 0 2px var(--accent-dim);
}
.sw-user-menu__trigger:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ── Notification Bell ───────────────────── */

.sw-notification-bell {
    position: relative;
}

.sw-notification-bell__trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    border-radius: 6px;
    color: var(--text-3, #555);
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.sw-notification-bell__trigger:hover {
    color: var(--text, #eee);
    background: var(--bg, #0e0e10);
}

.sw-notification-bell__badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger, #ef4444);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    min-width: 14px;
    height: 14px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0 3px;
}

.sw-notification-bell__panel {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    width: 320px;
    max-height: 420px;
    background: var(--bg-secondary, #151517);
    border: 1px solid var(--border, #2a2a2e);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    z-index: 200;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sw-notification-bell__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border, #2a2a2e);
    font-size: 13px;
    font-weight: 600;
    color: var(--text, #eee);
}

.sw-notification-bell__mark-all {
    background: none;
    border: none;
    color: var(--accent, #b38a4e);
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}

.sw-notification-bell__mark-all:hover {
    background: var(--accent-dim, rgba(179, 138, 78, 0.1));
}

.sw-notification-bell__list {
    overflow-y: auto;
    flex: 1;
}

.sw-notification-bell__empty {
    padding: 24px 14px;
    text-align: center;
    color: var(--text-3, #555);
    font-size: 12px;
}

.sw-notification-bell__item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border, #2a2a2e);
    cursor: pointer;
    transition: background 0.15s;
}

.sw-notification-bell__item:last-child {
    border-bottom: none;
}

.sw-notification-bell__item:hover {
    background: var(--bg, #0e0e10);
}

.sw-notification-bell__item--unread {
    background: var(--accent-dim, rgba(179, 138, 78, 0.05));
}

.sw-notification-bell__item--unread::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent, #b38a4e);
    margin-right: 8px;
    vertical-align: middle;
}

.sw-notification-bell__item-text {
    font-size: 12px;
    color: var(--text, #eee);
    display: inline;
}

.sw-notification-bell__item-body {
    font-size: 11px;
    color: var(--text-3, #555);
    margin-top: 3px;
    line-height: 1.4;
}

.sw-notification-bell__item-time {
    font-size: 10px;
    color: var(--text-3, #555);
    margin-top: 3px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sw-notification-bell__item--navigable {
    cursor: pointer;
}

.sw-notification-bell__item-action {
    font-size: 10px;
    color: var(--accent, #4a9eff);
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.15s;
}

.sw-notification-bell__item:hover .sw-notification-bell__item-action {
    opacity: 1;
}

/* ── Notification Bell — Mobile ──────────── */

@media (max-width: 768px) {
    .sw-notification-bell__panel {
        width: calc(100vw - 24px);
        max-width: 320px;
        right: -8px;
    }

    .sw-notification-bell__trigger {
        min-width: 44px;
        min-height: 44px;
    }
}
