/* منوی پایین موبایل — مطابق نمونه TEXT.md */

:root {
    --mobile-nav-offset: 5.75rem;
}

.mobile-nav {
    display: none;
    position: fixed;
    z-index: 85;
    inset-inline: 0;
    inset-block-end: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100vw;
    font-family: "Vazirmatn", "Vazirmatn FD", sans-serif;
    pointer-events: none;
    /* لایهٔ جدا تا در بعضی Chromeها با اسکرول/نوار آدرس از پایین جدا نشود */
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.mobile-nav .navbar-wrapper {
    position: relative;
    display: flex;
    align-items: flex-end;
    width: 100%;
    min-height: calc(90px + env(safe-area-inset-bottom, 0px));
    pointer-events: none;
}

.mobile-nav .navbar {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    background: linear-gradient(180deg, #020b18 0%, #031227 100%);
    padding: 0 8px env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
    width: 100%;
    min-height: calc(60px + env(safe-area-inset-bottom, 0px));
    height: auto;
    border-radius: 0;
    border-top: 1px solid rgba(0, 162, 255, 0.25);
    border-bottom: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    position: relative;
    z-index: 1;
    pointer-events: auto;
}

.mobile-nav .nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #f3f6fb;
    cursor: pointer;
    transition: color 0.2s ease;
    user-select: none;
    height: 100%;
    text-decoration: none;
    min-width: 0;
}

.mobile-nav .nav-item:hover {
    color: #ffffff;
}

.mobile-nav .nav-item svg {
    width: 20px;
    height: 20px;
    margin-bottom: 2px;
    opacity: 1;
}

.mobile-nav .nav-item span {
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.mobile-nav .nav-item.is-active {
    color: #ffffff;
}

.mobile-nav .nav-item.is-active svg {
    opacity: 1;
    filter: drop-shadow(0 0 3px rgba(0, 191, 255, 0.5));
}

.mobile-nav .chatbot-wrapper {
    position: relative;
    width: 60px;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    flex-shrink: 0;
    z-index: 2;
}

.mobile-nav .chatbot-btn {
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 56px;
    height: 56px;
    padding: 0;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.14), rgba(0, 68, 153, 0.55) 55%, rgba(0, 31, 77, 0.92) 100%);
    display: grid;
    place-items: center;
    overflow: visible;
    border: 0;
    box-shadow:
        0 4px 12px rgba(0, 153, 255, 0.3),
        inset 0 2px 4px rgba(255, 255, 255, 0.35),
        inset 0 -3px 6px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    color: #fff;
}

.mobile-nav .chatbot-btn::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1.5px solid #1c63b3;
    pointer-events: none;
    z-index: 5;
}

/* پایه پشت دکمه — روی خود دکمه تا همیشه هم‌مرکز بماند */
.mobile-nav .chatbot-btn::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 64px;
    height: 64px;
    transform: translate(-50%, -50%);
    background: linear-gradient(180deg, #020b18 0%, #031227 100%);
    border-radius: 50%;
    z-index: -1;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

.mobile-nav .chatbot-btn:hover {
    transform: translateX(-50%) scale(1.03);
}

.mobile-nav .chatbot-btn:active {
    transform: translateX(-50%) scale(0.98);
}

.mobile-nav .chatbot-btn-lottie {
    position: absolute;
    inset: 1.5px;
    border-radius: 50%;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
    background: transparent;
}

.mobile-nav .chatbot-btn-lottie,
.mobile-nav .chatbot-btn dotlottie-wc {
    display: block;
    width: 100%;
    height: 100%;
    background: transparent !important;
}

.mobile-nav .chatbot-btn dotlottie-wc {
    transform: scale(1.62);
    transform-origin: center center;
}

.mobile-nav .chatbot-btn dotlottie-wc::part(canvas),
.mobile-nav .chatbot-btn canvas {
    background: transparent !important;
}

.mobile-nav .mobile-nav-chat-badge {
    position: absolute;
    top: 0.1rem;
    inset-inline-end: 0.05rem;
    inset-inline-start: auto;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 0.28rem;
    border-radius: 999px;
    background: #d92d20;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    display: inline-grid;
    place-items: center;
    z-index: 8;
    box-shadow: 0 0 0 2px #031227;
    pointer-events: none;
}

.mobile-nav .mobile-nav-chat-badge:not([hidden]) {
    display: inline-grid !important;
}

body.chat-sheet-open .mobile-nav .chatbot-btn {
    visibility: hidden;
    pointer-events: none;
}

/* تم روشن: نوار سفید شیشه‌ای با تأکید برند */
[data-theme="light"] .mobile-nav .navbar {
    background: linear-gradient(180deg, #ffffff 0%, #f3f7fc 100%);
    border-top-color: rgba(28, 99, 179, 0.22);
    box-shadow:
        0 -4px 18px rgba(17, 40, 71, 0.08),
        0 6px 16px rgba(17, 40, 71, 0.06);
}

[data-theme="light"] .mobile-nav .chatbot-btn::before {
    background: linear-gradient(180deg, #ffffff 0%, #f3f7fc 100%);
    box-shadow: 0 -4px 12px rgba(17, 40, 71, 0.1);
}

[data-theme="light"] .mobile-nav .nav-item {
    color: #1a2b40;
}

[data-theme="light"] .mobile-nav .nav-item:hover {
    color: #0f1c2e;
}

[data-theme="light"] .mobile-nav .nav-item.is-active {
    color: #1c63b3;
}

[data-theme="light"] .mobile-nav .nav-item.is-active svg {
    filter: drop-shadow(0 0 3px rgba(28, 99, 179, 0.35));
}

[data-theme="light"] .mobile-nav .chatbot-btn {
    background: radial-gradient(circle at 35% 30%, #6eb0f5 0%, #1c63b3 55%, #0f3f78 100%);
    border-color: #5aa2f0;
    box-shadow:
        0 4px 14px rgba(28, 99, 179, 0.28),
        inset 0 2px 4px rgba(255, 255, 255, 0.45),
        inset 0 -3px 6px rgba(15, 63, 120, 0.35);
}

[data-theme="light"] .mobile-nav .mobile-nav-chat-badge {
    box-shadow: 0 0 0 2px #ffffff;
}

body.has-mobile-nav {
    padding-bottom: calc(var(--mobile-nav-offset) + env(safe-area-inset-bottom));
}

/* روی موبایل لانچر شناور مخفی است؛ دکمهٔ نوبار جایگزین است.
   با media query از اول مخفی می‌ماند تا قبل از JS پایین صفحه چشمک نزند. */
@media (max-width: 991.98px) {
    .mobile-nav {
        display: block;
    }

    .site-chatbot-launcher {
        display: none !important;
    }

    body.app-body {
        padding-bottom: calc(var(--mobile-nav-offset) + env(safe-area-inset-bottom));
    }
}

@media (min-width: 992px) {
    .mobile-nav {
        display: none !important;
    }

    body.has-mobile-nav {
        padding-bottom: 0;
    }

    .site-chatbot-launcher {
        display: block !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mobile-nav .nav-item,
    .mobile-nav .chatbot-btn {
        transition: none;
    }

    .mobile-nav .chatbot-btn:hover,
    .mobile-nav .chatbot-btn:active {
        transform: translateX(-50%);
    }
}
