/* © Mahdi Amouzegar — All rights reserved | مهدی آموزگار — همه حقوق محفوظ است */
/* navigation.css — App Shell: Drawer + Workspace stubs (Phase 8 — T3) */

/* ═══════════════════════════════════════════════════════════════════════════
   Drawer
   ⚠️ جهت بازشدن با logical properties: fa (rtl) از راست، en (ltr) از چپ
   ⚠️ ورود نرم: اسلاید از لبه + fade (کلاس open با کمی تأخیر بعد از unhide
      اضافه می‌شود تا transition اجرا شود — منطق در sidebar.js)
   ═══════════════════════════════════════════════════════════════════════════ */
.drawer-root {
    position: fixed;
    inset: 0;
    z-index: 300;
}

.drawer-root[hidden] {
    display: none;
}

.drawer-scrim {
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 20, 0.6);
    opacity: 0;
    transition: opacity 0.22s ease;
}

.drawer {
    position: absolute;
    top: 0;
    bottom: 0;
    inset-inline-start: 0;
    width: min(320px, 85vw);
    overflow-y: auto;
    /* جای ثابت برای اسکرول‌بار تا با ظاهر/ناپدید شدنش عرض اجزا نپرد */
    scrollbar-gutter: stable;
    background: var(--bg-2);
    border-inline-end: 1px solid var(--border-medium);
    padding: 16px 12px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.22s ease;
}

html[dir="rtl"] .drawer {
    transform: translateX(100%);
}

html[dir="ltr"] .drawer {
    transform: translateX(-100%);
}

.drawer-root.open .drawer-scrim {
    opacity: 1;
}

.drawer-root.open .drawer {
    transform: none;
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    .drawer,
    .drawer-scrim {
        transition: none;
    }
}

.drawer-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-title);
    padding: 4px 8px 12px;
}

.drawer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    text-align: start;
    cursor: pointer;
}

.drawer-item:hover {
    background: var(--bg-4);
}

.drawer-item.active {
    background: var(--bg-4);
    font-weight: 700;
}

.drawer-item-label {
    flex: 1;
}

.drawer-duo {
    display: flex;
    gap: 8px;
}

.drawer-duo .drawer-duo-btn {
    flex: 1;
    justify-content: center;
}

.drawer-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 4px 2px;
}

.drawer-tab {
    flex: 1;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.82rem;
    padding: 7px 4px;
    cursor: pointer;
    text-align: center;
}

.drawer-tab.active {
    background: var(--bg-4);
    color: var(--text-primary);
    font-weight: 700;
}

.drawer-mini-btn {
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.drawer-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-inline-end: 4px;
}

.drawer-item-label-btn {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: start;
    cursor: pointer;
    padding: 0;
    min-width: 0;
}

.drawer-item-label-btn .drawer-item-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drawer-recent {
    transition: opacity .22s ease, max-height .22s ease, margin .22s ease, padding .22s ease;
}

.drawer-recent.drawer-row-leaving {
    opacity: 0;
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
}

@media (prefers-reduced-motion: reduce) {
    .drawer-recent {
        transition: none;
    }
}

.drawer-more {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-md);
}

.drawer-more:hover {
    background: var(--bg-4);
    color: var(--text-primary);
}

.drawer-badge {
    min-width: 22px;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 1px 6px;
    background: var(--accent-purple);
    color: #fff;
}

.drawer-badge[hidden] {
    display: none;
}

.drawer-sep {
    height: 1px;
    background: var(--border-subtle);
    margin: 10px 4px;
}

.drawer-section {
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 10px 12px 2px;
}

.drawer-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 2px 12px;
}

/* بج «بلاک شده» در نتایج جستجو — هشدار با رنگ مناسب */
.blocked-tag {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent-pink);
    padding: 2px 12px;
    white-space: nowrap;
}

.drawer-login {
    font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Workspace stubs (T3 — نمای موقت تا 8-2/8-3)
   ═══════════════════════════════════════════════════════════════════════════ */
.workspace-root[hidden] {
    display: none;
}

.ws-stub {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    background: var(--bg-2);
    padding: 28px 20px;
    margin: 12px 0;
    text-align: center;
}

.ws-stub h2 {
    margin: 0 0 8px;
    color: var(--text-title);
    font-size: 1.1rem;
}

.ws-stub p {
    margin: 0;
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Hamburger trigger (T3 — چیدمان کامل هدر در T4)
   ═══════════════════════════════════════════════════════════════════════════ */
.drawer-trigger {
    font-size: 1.2rem;
    line-height: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Header slots (T4 — ۵ اسلاتی، بدون gear)
   ⚠️ بازنویسی قانون قدیمی display:contents (دسکتاپ) که دکمه‌ها را ستونی می‌کند
   ═══════════════════════════════════════════════════════════════════════════ */
.header .header-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 8px;
    margin-top: 0;
    margin-bottom: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   POLISH (8-1 visual pass — ۳۰ سپتامبر)
   ۱. Bottom Nav فقط موبایل (خلاف قرارداد در دسکتاپ دیده می‌شد)
   ۲. هدر دسکتاپ تک‌ردیفه، تگ‌لاین مخفی، تاریخ secondary
   ۳. هدر موبایل فشرده (تاریخ در عرض کم حذف، دات سینک می‌ماند)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── تگ‌لاین در هدر نیست (همه‌ی عرض‌ها) ─── */
.tagline-toggle {
    display: none;
}

/* ─── ۱. Bottom Nav: مخفی در دسکتاپ ─── */
@media (min-width: 901px) {
    .bottom-actions {
        display: none;
    }
}

/* ─── ۲. هدر دسکتاپ: یک ردیف افقی واقعی ─── */
@media (min-width: 901px) {
    .header {
        display: flex;
        align-items: center;
        gap: 12px;
        text-align: start;
        margin-bottom: 16px;
    }

    .header .site-logo {
        width: 40px;
        height: 40px;
        margin: 0;
        flex: none;
    }

    .header-main {
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
        flex-direction: row;
        align-items: baseline;
        gap: 8px;
    }

    .header-main h1 {
        font-size: 1.35rem;
        margin: 0;
        white-space: nowrap;
    }

    .header-context {
        font-size: 0.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
    }

    .header-side {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 10px;
        min-width: 0;
        margin: 0;
    }

    .header-side .today-line {
        display: flex;
        align-items: center;
        gap: 6px;
        margin: 0;
        font-size: 0.78rem;
        color: var(--text-muted);
        white-space: nowrap;
    }
}

/* ─── تاریخ secondary: در لپ‌تاپ باریک حذف، دات سینک می‌ماند ─── */
@media (min-width: 901px) and (max-width: 1180px) {
    #todayLine,
    #timeSourceIcon {
        display: none;
    }
}

/* ─── ۳. هدر فشرده در موبایل و تبلت عمودی (تا ۹۰۰px): نوار واقعی، نه هیرو ─── */
@media (max-width: 900px) {
    .header {
        display: flex;
        align-items: center;
        gap: 10px;
        text-align: start;
        margin-bottom: 12px;
    }

    .header .site-logo {
        width: 36px;
        height: 36px;
        margin: 0;
        flex: none;
    }

    .header-main {
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    .header-main h1 {
        font-size: 1.1rem;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-context {
        font-size: 0.7rem;
    }

    .header-side {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        margin: 0;
        flex: none;
    }

    .header-side .today-line {
        display: flex;
        align-items: center;
        margin: 0;
    }

    #todayLine,
    #timeSourceIcon {
        display: none;
    }

    .drawer-trigger,
    .notif-bell,
    .account-trigger {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

.drawer-trigger,
.notif-bell,
.account-trigger {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-medium);
    border-radius: 50%;
    background: var(--bg-3);
    color: var(--text-secondary);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    position: relative;
}

.drawer-trigger:hover,
.notif-bell:hover,
.account-trigger:hover {
    color: var(--accent-cyan);
    border-color: var(--accent-cyan-border);
    background: var(--bg-4);
}

.notif-bell .drawer-badge {
    position: absolute;
    inset-block-start: -4px;
    inset-inline-end: -4px;
}

.header-context {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Messages workspace (8.2-A — تخت و کم‌قاب، طبق قرارداد بصری)
   ═══════════════════════════════════════════════════════════════════════════ */
.conv-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 8px;
}

.conv-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 8px;
    border: 0;
    border-bottom: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    text-align: start;
    cursor: pointer;
}

.conv-row:hover {
    background: var(--bg-4);
}

.conv-avatar {
    width: 38px;
    height: 38px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-4);
    color: var(--text-secondary);
    font-weight: 700;
}

.conv-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.conv-name {
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conv-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0 10px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 8px;
}

.conv-back {
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    cursor: pointer;
    padding: 4px 8px;
}

.conv-title {
    font-weight: 700;
    color: var(--text-title);
}

.conv-box {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 50vh;
    overflow-y: auto;
    padding: 4px 2px;
}

.msg {
    max-width: 85%;
    align-self: flex-start;
    display: flex;
    align-items: flex-end;
    gap: 6px;
}

.msg-mine {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 26px;
    height: 26px;
    font-size: 0.75rem;
    flex: none;
}

.msg-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.conv-avatar {
    overflow: hidden;
}

.conv-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.msg-body {
    background: var(--bg-4);
    border-radius: 12px;
    padding: 8px 12px;
    overflow-wrap: anywhere;
}

.msg-mine .msg-body {
    background: var(--accent-purple-soft);
}

.msg-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
    padding: 0 4px;
}

.msg-more {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
    font-size: 0.9rem;
}

.conv-more {
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    cursor: pointer;
    padding: 8px;
}

.conv-composer {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.conv-input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-1);
    color: var(--text-primary);
    font: inherit;
    padding: 10px 12px;
}

.conv-input:disabled {
    opacity: 0.5;
}

.conv-send {
    border: 0;
    border-radius: var(--radius-md);
    background: var(--accent-purple);
    color: #fff;
    font: inherit;
    padding: 0 16px;
    cursor: pointer;
}

.conv-send:disabled {
    opacity: 0.5;
}

/* ─── 8.2-B: درخواست‌ها، جستجو، منوی گفتگو ─── */
.conv-section {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-top: 10px;
}

.conv-request {
    cursor: default;
}

.conv-mini-btn {
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-1);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.8rem;
    padding: 4px 10px;
    cursor: pointer;
    white-space: nowrap;
}

.conv-mini-btn:disabled {
    opacity: 0.5;
}

.conv-new {
    margin-top: 12px;
}

.conv-search {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.conv-search-results {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.conv-menu-btn {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    cursor: pointer;
    padding: 4px 8px;
    margin-inline-start: auto;
}

/* ─── 8.2-C: کارت تسک و مکان (تخت، سلسله‌مراتب واضح) ─── */
.msg-task-card {
    background: var(--bg-4);
    border: 1px solid var(--border-medium);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.msg-task-title {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.msg-task-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.msg-task-add {
    border: 0;
    border-radius: var(--radius-md);
    background: var(--accent-purple);
    color: #fff;
    font: inherit;
    padding: 8px 12px;
    cursor: pointer;
    align-self: flex-start;
}

.msg-task-add:disabled {
    opacity: 0.55;
}

.msg-loc-card {
    background: var(--bg-4);
    border: 1px solid var(--border-medium);
    border-radius: 12px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.msg-loc-name {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.loc-preview {
    height: 170px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-1);
}

.msg-loc-route {
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    padding: 8px 12px;
    cursor: pointer;
    align-self: flex-start;
}

.loc-modal-box {
    width: min(560px, 92vw);
}

.loc-modal-map {
    height: 60vh;
    min-height: 280px;
    border-radius: 8px;
    overflow: hidden;
}

.conv-loc {
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    padding: 0 12px;
    cursor: pointer;
}

.conv-loc:disabled {
    opacity: 0.5;
}

/* ─── 8.3-A: گروه (reuse الگوی گفتگو) ─── */
.conv-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    border: 1px solid var(--border-medium);
    border-radius: 999px;
    padding: 1px 8px;
    white-space: nowrap;
}

/* ─── 8.3-D: فرم ساخت گروه + جستجو ─── */
.conv-vis-row {
    display: flex;
    gap: 12px;
}

.conv-vis-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.conv-type-select {
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-1);
    color: var(--text-primary);
    font: inherit;
    padding: 10px 8px;
}

/* ─── 8.3-C: نشانگر pending صف گروه ─── */
.conv-pending {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 2px 4px;
}
.conv-pending[hidden] {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Quick Action Sheet (T4)
   ═══════════════════════════════════════════════════════════════════════════ */
.sheet-root {
    position: fixed;
    inset: 0;
    z-index: 300;
}

.sheet-root[hidden] {
    display: none;
}

.sheet-scrim {
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 20, 0.6);
}

.sheet {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    max-height: 70vh;
    overflow-y: auto;
    background: var(--bg-2);
    border-block-start: 1px solid var(--border-medium);
    border-start-start-radius: 16px;
    border-start-end-radius: 16px;
    padding: 12px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sheet-title {
    font-weight: 700;
    color: var(--text-title);
    padding: 4px 8px 8px;
}

.sheet-action {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    text-align: start;
    cursor: pointer;
}

.sheet-action:hover {
    background: var(--bg-4);
}

.sheet-action-icon {
    font-size: 1.2rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Welcome wizard (8B)
   ═══════════════════════════════════════════════════════════════════════════ */
.wizard-step {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wizard-close {
    align-self: flex-end;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px 8px;
}

.wizard-dots {
    display: flex;
    gap: 6px;
    justify-content: center;
}

.wizard-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-medium);
}

.wizard-dot.active {
    background: var(--accent-purple);
}

.wizard-dot.done {
    background: var(--accent-cyan);
}

.wizard-nav {
    margin-top: 4px;
}

.wizard-spacer {
    flex: 1;
}

.wizard-text,
.wizard-hint {
    margin: 0;
}

.wizard-text {
    color: var(--text-primary);
}

.wizard-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.welcome-opt.selected {
    border-color: var(--accent-cyan);
}
