/* layout.css — global site chrome: header, sidebar, root variables
   Extracted from Views/Shared/_Layout.cshtml */


.br-side {
    display: none;
}

:root {
    --sidebar-w: 264px;
    --sidebar-w-collapsed: 76px;
    --header-h: 60px;
    --dark-bg: #09090b;
    --dark-surface: #0f0f12;
    --dark-card: #18181b;
    --dark-border: #27272a;
    --dark-hover: #202025;
    --dark-text: #f4f4f5;
    --dark-text-secondary: #d4d4d8;
    --dark-text-muted: #a1a1aa;
    --accent-a: #6366f1;
    --accent-b: #a855f7;
    --accent-grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #a855f7 100%);
}

/* بزرگ‌کردن کل متن‌های سایت: همه‌ی rem ها (و Tailwind) با این عدد مقیاس می‌گیرند.
   برای کوچک‌تر/بزرگ‌تر کردن فقط همین عدد را عوض کنید (100% = 16px) */
html {
    font-size: 112.5%;
}

body {
    background-color: var(--dark-bg);
}

    /* Ambient background glow */
    body::before,
    body::after {
        content: '';
        position: fixed;
        pointer-events: none;
        z-index: 0;
        border-radius: 50%;
        filter: blur(80px);
    }

    body::before {
        top: -180px;
        left: 30%;
        width: 620px;
        height: 460px;
        background: radial-gradient(circle, rgba(99, 102, 241, 0.14) 0%, rgba(0, 0, 0, 0) 70%);
    }

    body::after {
        bottom: -140px;
        right: 5%;
        width: 480px;
        height: 400px;
        background: radial-gradient(circle, rgba(168, 85, 247, 0.1) 0%, rgba(0, 0, 0, 0) 70%);
    }

/* =========================================================
   لودینگ سراسری سایت: با کلیک روی هر تگ <a>، وسط صفحه
   چند نقطه‌ی پرشی + پس‌زمینه‌ی نیمه‌شفاف مشکی روی کل صفحه نشون داده می‌شه
   (اسکریپت مربوطه: layout.js)
   ========================================================= */
.global-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .15s ease;
}

    .global-loading-overlay.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .global-loading-overlay .typing-dots {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        padding: 13px 22px;
        background: var(--dark-card);
        border: 1px solid var(--dark-border);
        border-radius: 999px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    }

        .global-loading-overlay .typing-dots i {
            width: 7px;
            height: 7px;
            border-radius: 50%;
            background: var(--dark-text-secondary);
            font-style: normal;
            animation: global-dot-bounce 1.1s ease-in-out infinite;
        }

            .global-loading-overlay .typing-dots i:nth-child(2) {
                animation-delay: .15s;
            }

            .global-loading-overlay .typing-dots i:nth-child(3) {
                animation-delay: .3s;
            }

@keyframes global-dot-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: .35;
    }

    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* دکمه‌ی همبرگری موبایل — جایگزین هدر حذف‌شده */
.mobile-hamburger-btn {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 40;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: rgba(15, 15, 18, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--dark-border);
    color: var(--dark-text-secondary);
    cursor: pointer;
}

    .mobile-hamburger-btn:hover {
        color: var(--dark-text);
        background: var(--dark-hover);
    }

/* =========================================================
               منوی عمودی (Sidebar) سمت راست صفحه
               ========================================================= */
#layoutRoot {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    left: auto;
    width: 280px;
    max-width: 84vw;
    display: flex;
    flex-direction: column;
    background: rgba(15, 15, 18, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: none;
    border-left: 1px solid var(--dark-border);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.35);
    z-index: 50;
    transform: translateX(100%);
    transition: transform .25s ease, width .2s ease;
}

#layoutRoot.mobile-sidebar-open .app-sidebar {
    transform: translateX(0);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 45;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}

#layoutRoot.mobile-sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
}

#pageWrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: margin-right .2s ease;
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 14px 12px;
    border-bottom: 1px solid var(--dark-border);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    text-decoration: none;
    color: var(--dark-text);
    font-weight: 700;
}

.sidebar-brand-logo {
    content: '';
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 2px;
    background: var(--accent-grad);
    box-shadow: inset 0 0 0 3px rgba(255,255,255,.35), 0 2px 6px rgba(99,102,241,.35);
}

.sidebar-brand-logo-img {
    height: 40px;
    width: auto;
    max-width: 100%;
    flex-shrink: 0;
    object-fit: contain;
    transition: height .2s ease;
}

.sidebar-brand-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-icon-btn {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--dark-text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background .15s, color .15s;
}

    .sidebar-icon-btn:hover {
        background: var(--dark-hover);
        color: var(--dark-text);
    }

.sidebar-actions {
    padding: 12px;
}

.sidebar-new-chat {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    color: var(--dark-text);
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .15s, border-color .15s;
}

    .sidebar-new-chat:hover {
        background: var(--dark-hover);
        border-color: rgba(99, 102, 241, 0.4);
    }

.sidebar-icon-wrap {
    width: 18px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-chats {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px 12px;
}

.sidebar-section-title {
    font-size: .8rem;
    color: var(--dark-text-muted);
    font-weight: 600;
    padding: 10px 8px 6px;
}

.sidebar-chat-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    color: var(--dark-text-secondary);
    text-decoration: none;
    font-size: .87rem;
    min-width: 0;
}

    .sidebar-chat-item:hover {
        background: var(--dark-hover);
        color: var(--dark-text);
    }

    .sidebar-chat-item.active {
        background: rgba(99, 102, 241, 0.14);
        color: #a5b4fc;
        font-weight: 600;
    }

.sidebar-chat-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.sidebar-empty {
    font-size: .8rem;
    color: var(--dark-text-muted);
    padding: 8px;
}

.sidebar-bottom {
    padding: 12px;
    border-top: 1px solid var(--dark-border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--dark-text);
    font-size: .87rem;
    font-weight: 600;
}

    .sidebar-user:hover {
        background: var(--dark-hover);
    }

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--dark-card);
    border: 1px solid var(--dark-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--dark-text-secondary);
}

/* ---- دسکتاپ: سایدبار همیشه ثابت در سمت راست ---- */
@media (min-width: 768px) {
    .app-sidebar {
        top: 0;
        transform: translateX(0);
        width: var(--sidebar-w);
        box-shadow: none;
        transition: width .2s ease;
    }

    .sidebar-backdrop {
        display: none;
    }

    #pageWrapper {
        margin-right: var(--sidebar-w);
        margin-left: 0;
    }

    #layoutRoot.collapsed .app-sidebar {
        width: var(--sidebar-w-collapsed);
    }

    #layoutRoot.collapsed #pageWrapper {
        margin-right: var(--sidebar-w-collapsed);
        margin-left: 0;
    }

    #layoutRoot.collapsed .sidebar-label,
    #layoutRoot.collapsed .sidebar-section-title,
    #layoutRoot.collapsed .sidebar-empty,
    #layoutRoot.collapsed .sidebar-chat-item {
        display: none;
    }

    #layoutRoot.collapsed .br-side {
        display: block;
    }

    #layoutRoot.collapsed .sidebar-new-chat,
    #layoutRoot.collapsed .sidebar-chat-item,
    #layoutRoot.collapsed .sidebar-user,
    #layoutRoot.collapsed .sidebar-top {
        justify-content: center;
    }

    #layoutRoot.collapsed .sidebar-brand {
        justify-content: center;
    }

    #layoutRoot.collapsed .sidebar-brand-logo-img {
        height: 28px;
    }

    #sidebarCollapseBtn svg {
        transition: transform .2s ease;
    }

    #layoutRoot.collapsed #sidebarCollapseBtn svg {
        transform: rotate(180deg);
    }

    /* مخفی کردن آیکون چت‌ها در حالت بسته بودن سایدبار */
    #layoutRoot.collapsed .sidebar-chats .sidebar-icon-wrap {
        display: none;
    }
}
