/* ============================================================
   topbar.css — استایل نوار بالای صفحه (هدر سراسری)
   شامل: لوگو، منوی اصلی، دکمه‌های آیکنی (یادداشت/نوتیفیکیشن/چت/PWA/
   تم/پروفایل/خروج) و منوی همبرگری موبایل. دکمه‌ی «تنظیمات» دیگر اینجا
   نیست — به سایدبار چپ (بخش «سایدبار چپ» پایین همین فایل) منتقل شده.
   در 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;
    display: flex;
    align-items: center;
    gap: 8px;
}
.logo-img {
    height: 34px;
    max-width: 160px;
    object-fit: contain;
    display: block;
}
/* لوگوی اختصاصی تم تاریک (اختیاری) — هر دو تصویر رندر می‌شوند و فقط با
   data-theme سوییچ می‌شوند تا تعویض تم بدون رفرش صفحه هم درست کار کند. */
.logo-img-dark { display: none; }
html[data-theme="dark"] .logo-img-light { display: none; }
html[data-theme="dark"] .logo-img-dark { display: block; }

/* ── منوی اصلی (دسکتاپ) ──────────────────────────────────── */
.main-menu {
    display: flex;
    gap: 16px;
    align-items: center;
}
.main-menu a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: .78rem;
    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: 5px; flex-shrink: 0; margin-right: auto; }

.icon-btn {
    width: 30px; 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 i { font-size: .95rem; line-height: 1; }
.icon-btn:hover { background: var(--accent-faint); border-color: var(--accent); color: var(--accent); }

/* ── منوی کشویی «بیشتر» (فاز ۸) ──────────────────────────────
   در دسکتاپ با display:contents کاملاً نامرئی است — فرزندانش عیناً مثل
   قبل به‌صورت آیکون‌های مجزا در ردیف .tb-actions ظاهر می‌شوند (بدون
   تغییر چیدمان دسکتاپ). در موبایل به یک پنل کشویی تبدیل می‌شود. ──────── */
.tb-more-panel { display: contents; }
.tb-more-form  { display: contents; }
.tb-more-label { display: none; }
.tb-more-btn   { display: none; }
.tb-notes-wrap { display: contents; } /* یادداشت همیشه (دسکتاپ و موبایل) به‌صورت مستقیم دیده می‌شود */

.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.3rem;
    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;
    font-size: .82rem;
}
.mobile-menu a:last-child { border-bottom: none; }

/* ── واکنش‌گرایی هدر ──────────────────────────────────────── */
@media (max-width: 780px) {
    .main-menu     { display: none; }
    .hamburger-btn { display: block; }
    .logo span     { display: none; } /* در موبایل فقط آیکون/لوگوی تصویری کافی است، جای عنوان صرفه‌جویی شود */
.tb-actions {  gap: 1px;}

    /* یادداشت، نوتیفیکیشن و چت در موبایل هم مستقیم دیده می‌شوند (تغییری لازم نیست) */

    /* دکمه «بیشتر» نمایش داده می‌شود؛ پنل به یک منوی کشویی تبدیل می‌شود */
    .tb-more-btn { display: flex; }
    .tb-more-panel {
        display: none;
        position: fixed;
        top: 62px;
        left: 10px;
        z-index: 9600;
        min-width: 210px;
        max-width: calc(100vw - 20px);
        background: color-mix(in srgb, var(--surface) 85%, transparent);
        backdrop-filter: blur(18px) saturate(160%);
        -webkit-backdrop-filter: blur(18px) saturate(160%);
        border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
        border-radius: 14px;
        box-shadow: var(--shadow-lg);
        padding: 8px;
        flex-direction: column;
        gap: 3px;
    }
    .tb-more-panel.open { display: flex; }
    .tb-more-form { display: block; }
    .tb-more-panel .icon-btn,
    .tb-more-form  .icon-btn {
        width: 100%; height: auto;
        justify-content: flex-start;
        gap: 10px;
        padding: 10px 12px;
        border: none;
        background: none;
        border-radius: 8px;
        font-size: .85rem;
    }
    .tb-more-panel .icon-btn:hover,
    .tb-more-form  .icon-btn:hover { background: var(--accent-faint); }
    .tb-more-panel .avatar-btn { width: 100%; height: auto; border-radius: 8px; border: none; }
    .tb-more-panel .avatar-btn img { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; }
    .tb-more-panel .avatar-btn i { width: 24px; text-align: center; flex-shrink: 0; }
    .tb-more-label { display: inline; font-weight: 600;  font-family: 'Vazirmatn', sans-serif; }
    .tb-more-panel .badge { position: static; margin-right: auto; border: none; }
}

.tb-more-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 9500;
    pointer-events: none; /* کلیک از روی این پرده عبور می‌کند؛ بستن منو با تشخیص «کلیک بیرون» در common.js انجام می‌شود، نه با گرفتن کلیک — تا کلیک روی دکمه همبرگر/چت در پس‌زمینه هم بلافاصله کار کند */
}
.tb-more-overlay.show { 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.open + .left-sidebar-toggle i {
    transform: rotate(180deg);
}
.left-sidebar-toggle i { transition: transform .25s; }
.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;
}

