/* ============================================================
   topbar.css — استایل نوار بالای صفحه (هدر سراسری)
   شامل: لوگو، منوی اصلی، دکمه‌های آیکنی (چت/تم/تنظیمات/پروفایل/خروج)
   و منوی همبرگری موبایل. در partials/topbar.php استفاده می‌شود
   ============================================================ */

.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 200;
    height: 56px;
    background: var(--surface);
    border-bottom: 1.5px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

.logo {
    font-size: 1rem;
    font-weight: 800;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    flex-shrink: 0;
}

/* ── منوی اصلی (دسکتاپ) ──────────────────────────────────── */
.main-menu {
    display: flex;
    gap: 16px;
    align-items: center;
}
.main-menu a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: .9rem;
    padding: 4px 8px;
    border-radius: 6px;
    transition: .2s;
}
.main-menu a:hover {
    color: var(--accent);
    background: var(--accent-faint);
}

/* ── دکمه‌های سمت راست هدر ───────────────────────────────── */
.tb-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-right: auto; }

.icon-btn {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: var(--surface-alt);
    border: 1.5px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: .2s;
    color: var(--text-primary);
    text-decoration: none;
    position: relative;
    flex-shrink: 0;
}
.icon-btn:hover { background: var(--accent-faint); border-color: var(--accent); color: var(--accent); }

.avatar-btn {
    width: 34px; height: 34px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--accent);
    cursor: pointer;
    flex-shrink: 0;
    background: var(--accent-faint);
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem;
    text-decoration: none;
    transition: .2s;
}
.avatar-btn:hover { box-shadow: 0 0 0 3px var(--accent-faint); }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }

.badge {
    position: absolute;
    top: -5px; left: -5px;
    min-width: 17px; height: 17px;
    border-radius: 9px;
    background: var(--danger);
    color: #fff;
    font-size: .6rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    padding: 0 3px;
    border: 2px solid var(--surface);
}

/* ── دکمه و منوی همبرگری (موبایل) ────────────────────────── */
.hamburger-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-primary);
    padding: 0 6px;
}

.mobile-menu {
    display: none;
    flex-direction: column;
    background: var(--surface);
    border-top: 1.5px solid var(--border);
    padding: 8px 16px;
    position: fixed;
    top: 56px; right: 0; left: 0;
    z-index: 150;
    box-shadow: var(--shadow-lg);
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
    padding: 12px 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
}
.mobile-menu a:last-child { border-bottom: none; }

/* ── واکنش‌گرایی هدر ──────────────────────────────────────── */
@media (max-width: 780px) {
    .main-menu     { display: none; }
    .hamburger-btn { display: block; }
}

/* ── سایدبار چپ (میانبرها) ──────────────────────────────────── */
.left-sidebar-toggle {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 185;
    width: 22px;
    height: 44px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-left: none;
    border-radius: 0 8px 8px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    color: var(--text-muted);
    transition: left .3s cubic-bezier(.4,0,.2,1), background .2s, color .2s;
    box-shadow: 2px 2px 10px rgba(0,0,0,.07);
    padding: 0;
    line-height: 1;
}
.left-sidebar-toggle:hover {
    background: var(--accent-faint);
    color: var(--accent);
}
/* وقتی سایدبار باز است، دکمه به لبه راست سایدبار می‌چسبد */
.left-sidebar.open + .left-sidebar-toggle {
    left: 50px;
}
.left-sidebar {
    position: fixed;
    left: 0;
    top: 56px;
    bottom: 0;
    width: 50px;
    max-width: 50px;
    background: var(--surface);
    border-right: 1.5px solid var(--border);
    z-index: 170;
    transform: translateX(-50px);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    gap: 6px;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: none;
}
.left-sidebar.open {
    transform: translateX(0);
    box-shadow: 2px 0 12px rgba(0,0,0,.06);
}
.left-sidebar-item {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.15rem;
    color: var(--text-secondary);
    transition: .2s;
    text-decoration: none;
    flex-shrink: 0;
    position: relative;
}
.left-sidebar-item:hover {
    background: var(--accent-faint);
    color: var(--accent);
}
/* تولتیپ برای آیتم‌ها */
.left-sidebar-item::after {
    content: attr(data-tip);
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--text-primary);
    color: var(--bg-page);
    font-size: .72rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
    z-index: 200;
}
.left-sidebar-item:hover::after {
    opacity: 1;
}
.left-sidebar-sep {
    width: 28px;
    height: 1px;
    background: var(--border);
    margin: 4px 0;
    flex-shrink: 0;
}
