/* =========================================
   UNIFIED TOP BAR — Shared across all modules
   JUZKO Network (juzko.net)
   ========================================= */

/* --- Variables (matching Library/Keyshop palette) --- */
.unified-topbar {
    --tb-bg: #0d1117;
    --tb-surface: #161b22;
    --tb-border: #30363d;
    --tb-text: #f0f6fc;
    --tb-text-muted: #8b949e;
    --tb-accent: #58a6ff;
    --tb-accent-hover: #79b8ff;
    --tb-badge-bg: #21262d;
    --tb-hover: #1f242c;
    --tb-radius: 0px;
    --tb-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* --- Top Bar Container --- */
.unified-topbar {
    background-color: var(--tb-surface);
    border-bottom: 1px solid var(--tb-border);
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    font-family: var(--tb-font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.unified-topbar *,
.unified-topbar *::before,
.unified-topbar *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.unified-topbar a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease, opacity 0.2s ease;
}

/* --- Inner Layout --- */
.topbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 1.5rem;
    gap: 1rem;
}

/* --- Logo --- */
.topbar-logo {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--tb-text);
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.topbar-logo:hover {
    color: var(--tb-accent);
}

.topbar-logo-icon {
    font-size: 1.1rem;
}

/* --- Module Navigation --- */
.topbar-modules {
    display: flex;
    align-items: center;
    gap: 2px;
}

.topbar-module-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    color: var(--tb-text-muted);
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--tb-radius);
    transition: all 0.2s ease;
    white-space: nowrap;
}

.topbar-module-link:hover {
    color: var(--tb-text);
    background-color: var(--tb-hover);
}

.topbar-module-link.active {
    color: var(--tb-accent);
    background-color: var(--tb-badge-bg);
}

.topbar-module-icon {
    font-size: 1rem;
    line-height: 1;
}

/* --- Right Side (User Area) --- */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.topbar-user-link {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-user-link:hover .topbar-username {
    color: var(--tb-accent);
}

.topbar-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--tb-border);
}

.topbar-avatar-placeholder {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--tb-badge-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--tb-text);
    border: 1px solid var(--tb-border);
}

.topbar-username {
    font-weight: 500;
    color: var(--tb-text-muted);
    font-size: 13px;
    transition: color 0.2s ease;
}

.topbar-icon-btn {
    font-size: 1.1rem;
    color: var(--tb-text-muted);
    padding: 4px;
    transition: color 0.2s ease;
    background: none;
    border: none;
    cursor: pointer;
    line-height: 1;
}

.topbar-icon-btn:hover {
    color: var(--tb-text);
}

.topbar-login-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    background-color: var(--tb-badge-bg);
    border: 1px solid var(--tb-border);
    color: var(--tb-text-muted);
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--tb-radius);
    transition: all 0.2s ease;
}

.topbar-login-link:hover {
    color: var(--tb-text);
    border-color: var(--tb-text-muted);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .topbar-inner {
        padding: 0 1rem;
        height: 44px;
        gap: 8px;
    }

    .topbar-module-label {
        display: none;
    }

    .topbar-module-link {
        padding: 6px 10px;
    }

    .topbar-username {
        display: none;
    }
}

@media (max-width: 360px) {
    .topbar-inner {
        padding: 0 0.5rem;
        gap: 4px;
    }

    .topbar-module-link {
        padding: 6px 8px;
    }

    .topbar-logo span {
        display: none;
    }
}

/* --- Notification Badge --- */
.topbar-avatar-btn {
    position: relative;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}
.topbar-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    border: 2px solid var(--tb-surface);
    pointer-events: none;
    box-sizing: border-box;
    line-height: 1;
}

/* --- Notification Drawer --- */
.notif-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.6);
    z-index: 900;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}
.notif-overlay.open {
    opacity: 1;
    pointer-events: auto;
}
.notif-drawer {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 340px;
    max-width: 88vw;
    background: #111418;
    border-left: 1px solid rgba(255,255,255,.08);
    box-shadow: -4px 0 20px rgba(0,0,0,.5);
    z-index: 901;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
}
.notif-drawer.open {
    transform: translateX(0);
}
.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    font-size: 16px;
    font-weight: 600;
    color: #f0f6fc;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.notif-close {
    background: none; border: none;
    color: #666; font-size: 22px;
    cursor: pointer; line-height: 1;
}
.notif-close:hover { color: #fff; }
.notif-list {
    flex: 1;
    overflow-y: auto;
}
.notif-list::-webkit-scrollbar { width: 5px; }
.notif-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }
.notif-empty {
    padding: 32px 20px;
    text-align: center;
    color: #555;
    font-size: 13px;
}
.notif-item {
    display: block;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,.03);
    border-left: 3px solid transparent;
    text-decoration: none;
    color: inherit;
    transition: background .15s;
}
.notif-item:hover { background: rgba(255,255,255,.03); }
.notif-item.unread {
    border-left-color: #ffd700;
    background: rgba(255,215,0,.04);
}
.notif-msg { font-size: 13px; color: #ddd; line-height: 1.45; }
.notif-msg b { color: #fff; font-weight: 600; }
.notif-time { font-size: 11px; color: #555; margin-top: 4px; }
.notif-profile-link {
    display: block;
    padding: 12px 20px;
    text-align: left;
    text-decoration: none;
    color: #8b949e;
    font-size: 13px;
    font-weight: 500;
    border-bottom: 1px solid rgba(255,255,255,.06);
    transition: color .2s, background .2s;
}
.notif-profile-link:hover {
    color: #fff;
    background: rgba(255,255,255,.04);
}

/* --- Notification Drawer Tabs --- */
.notif-tabs {
    display: flex;
    gap: 0;
    flex: 1;
    min-width: 0;
}
.notif-tab {
    background: none;
    border: none;
    color: #8b949e;
    font-size: 13px;
    font-weight: 600;
    padding: 0 2px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    padding-bottom: 2px;
    transition: color .2s, border-color .2s;
    white-space: nowrap;
}
.notif-tab:first-child { margin-right: 16px; }
.notif-tab:hover { color: #f0f6fc; }
.notif-tab.active {
    color: #f0f6fc;
    border-bottom-color: #58a6ff;
}
.notif-tab-content {
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
    display: none;
}
.notif-tab-content.active {
    display: flex;
}

/* --- Preferences Panel --- */
.notif-prefs-intro {
    padding: 14px 20px;
    font-size: 12px;
    color: #8b949e;
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.notif-prefs-list {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
}
.notif-prefs-list::-webkit-scrollbar { width: 5px; }
.notif-prefs-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 3px; }

.notif-prefs-group {
    border-bottom: 1px solid rgba(255,255,255,.06);
}
.notif-prefs-group-title {
    padding: 12px 20px 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 600;
    color: #58a6ff;
}
.notif-pref-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    gap: 12px;
}
.notif-pref-row:hover {
    background: rgba(255,255,255,.02);
}
.notif-pref-label {
    font-size: 13px;
    color: #ddd;
    flex: 1;
    min-width: 0;
}
.notif-pref-toggles {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
    align-items: center;
}
.notif-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
.notif-toggle-icon {
    font-size: 18px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
}
.notif-toggle-icon--svg {
    color: #fbbf24;
}
.notif-toggle-icon--svg svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* Toggle switch (matching library mockup pattern) */
.notif-switch {
    position: relative;
    width: 36px;
    height: 20px;
    background: #21262d;
    border-radius: 10px;
    cursor: pointer;
    transition: background .2s;
    flex-shrink: 0;
}
.notif-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #8b949e;
    border-radius: 50%;
    transition: all .2s;
}
.notif-switch.on {
    background: #58a6ff;
}
.notif-switch.on::after {
    left: 18px;
    background: #fff;
}