/* =========================================================
   FARASOD — UNIFIED HEADER UI (Desktop & Mobile)
   ساختار یکپارچه: منوی کشویی در همه دستگاه‌ها
   ========================================================= */

:root {
    --farasod-primary: #4F46E5;
    --farasod-primary-dark: #4338CA;
    --farasod-primary-light: #EEF2FF;

    --farasod-text: #111827;
    --farasod-text-soft: #64748B;
    --farasod-border: #E5E7EB;

    --farasod-white: #FFFFFF;
    --farasod-bg: #F8FAFC;

    --header-height: 76px;
    --header-radius: 18px;

    --header-shadow:
        0 8px 30px rgba(15, 23, 42, 0.055);
}


/* =========================================================
   RESET
   ========================================================= */

.site-header *,
.mobile-nav *,
.mobile-nav-overlay * {
    box-sizing: border-box;
}

.site-header a,
.mobile-nav a {
    text-decoration: none;
}


/* =========================================================
   MAIN HEADER
   ========================================================= */

.site-header {
    position: fixed;
    top: 12px;
    right: 0;
    left: 0;

    /* عرض خودکار بر اساس محتوا */
    width: fit-content;
    max-width: calc(100% - 32px);
    min-width: 300px;
    
    height: var(--header-height);

    margin: 0 auto;

    z-index: 9999;

    background: rgba(255, 255, 255, 0.90);

    border: 1px solid rgba(226, 232, 240, 0.85);

    border-radius: var(--header-radius);

    box-shadow: var(--header-shadow);

    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);

    transition:
        top .3s ease,
        width .3s ease,
        box-shadow .3s ease,
        background .3s ease;
}

@supports not (width: fit-content) {
    .site-header {
        width: auto;
        display: table;
    }
}


/* وقتی اسکرول شد */

.site-header.scrolled {
    top: 8px;

    background: rgba(255, 255, 255, 0.96);

    box-shadow:
        0 14px 40px rgba(15, 23, 42, 0.09);
}


/* =========================================================
   HEADER INNER
   ========================================================= */

.header-inner {
    width: 100%;
    height: 100%;

    padding: 0 16px;

    display: flex;
    align-items: center;

    /* فاصله کمتر */
    gap: 10px;

    flex-wrap: nowrap;
    white-space: nowrap;
}


/* =========================================================
   BRAND / LOGO
   ========================================================= */

.site-branding {
    display: flex;
    align-items: center;

    flex-shrink: 0;

    min-width: max-content;

    gap: 10px;

    color: var(--farasod-text);
}


/* لوگو */

.site-branding img {
    width: 200px;
    height: auto;

    object-fit: contain;

    display: block;

    border-radius: 12px;
}


/* اگر لوگو وجود نداشت */

.brand-icon {
    width: 200px;
    height: auto;

    border-radius: 13px;

    display: flex;
    align-items: center;
    justify-content: center;

    color: #fff;

    background:
        linear-gradient(
            135deg,
            var(--farasod-primary),
            #6366F1
        );

    font-size: 20px;

    box-shadow:
        0 8px 18px rgba(79, 70, 229, .20);
}


/* نام سایت */

.brand-name {
    display: flex;
    flex-direction: column;

    gap: 2px;

    line-height: 1.2;
}

.brand-name span:first-child {
    font-size: 17px;
    font-weight: 800;

    color: var(--farasod-text);
}

.brand-name span:last-child {
    font-size: 10px;
    font-weight: 500;

    color: var(--farasod-text-soft);

    max-width: 170px;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* =========================================================
   PRIMARY NAVIGATION
   در حالت یکپارچه، این بخش مخفی می‌شود
   ========================================================= */

.primary-nav {
    display: none !important;
}


/* =========================================================
   HEADER ACTIONS
   ========================================================= */

.header-actions {
    display: flex;
    align-items: center;

    gap: 7px;

    flex-shrink: 0;

    margin-right: auto;
}


/* =========================================================
   NOTIFICATION
   ========================================================= */

.header-actions .notification-bell,
.header-actions .notification-btn,
.header-actions > a.notification-bell {
    width: 42px;
    height: 42px;

    display: flex;
    align-items: center;
    justify-content: center;

    position: relative;

    border-radius: 12px;

    color: #475569;

    background: #F8FAFC;

    border: 1px solid #E2E8F0;

    transition:
        background .2s ease,
        color .2s ease,
        transform .2s ease;
}

.header-actions .notification-bell:hover,
.header-actions .notification-btn:hover,
.header-actions > a.notification-bell:hover {
    color: var(--farasod-primary);

    background: var(--farasod-primary-light);

    transform: translateY(-1px);
}


/* بج آیکون اعلان */

.notification-bell .badge {
    position: absolute;
    top: -6px;
    left: -6px;

    min-width: 20px;
    height: 20px;

    padding: 0 4px;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #EF4444;
    color: #fff;

    border-radius: 50%;

    font-size: 10px;
    font-weight: 700;

    border: 2px solid #fff;
}


/* =========================================================
   RECHARGE BUTTON
   ========================================================= */

.btn-recharge-header {
    height: 42px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    padding: 0 13px;

    border-radius: 12px;

    color: var(--farasod-primary);

    background: var(--farasod-primary-light);

    border: 1px solid #E0E7FF;

    font-size: 12px;
    font-weight: 700;

    transition:
        background .2s ease,
        color .2s ease,
        transform .2s ease;
}

.btn-recharge-header:hover {
    color: #fff;

    background: var(--farasod-primary);

    transform: translateY(-1px);
}

.btn-recharge-header i {
    font-size: 14px;
}


/* =========================================================
   USER PROFILE
   ========================================================= */

.user-profile-btn {
    height: 44px;

    display: flex;
    align-items: center;

    gap: 8px;

    padding: 3px 5px 3px 12px;

    border-radius: 14px;

    color: var(--farasod-text);

    background: #F8FAFC;

    border: 1px solid #E2E8F0;

    transition:
        border-color .2s ease,
        background .2s ease,
        box-shadow .2s ease;
}

.user-profile-btn:hover {
    background: #fff;

    border-color: #C7D2FE;

    box-shadow:
        0 5px 18px rgba(79, 70, 229, .08);
}


/* نام کاربر */

.user-profile-btn > span {
    max-width: 110px;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    font-size: 12px;
    font-weight: 700;
}


/* آواتار */

.user-profile-btn .avatar {
    width: 36px;
    height: 36px;

    object-fit: cover;

    border-radius: 11px;

    display: block;

    border: 2px solid #fff;

    box-shadow:
        0 2px 8px rgba(15, 23, 42, .12);
}


/* Login */

.header-actions > .btn-cta:not(.user-profile-btn) {
    min-height: 42px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 7px;

    padding: 0 15px;

    color: #fff;

    background:
        linear-gradient(
            135deg,
            var(--farasod-primary),
            #6366F1
        );

    border-radius: 12px;

    font-size: 12px;
    font-weight: 700;

    box-shadow:
        0 7px 18px rgba(79, 70, 229, .18);

    transition:
        transform .2s ease,
        box-shadow .2s ease;
}

.header-actions > .btn-cta:not(.user-profile-btn):hover {
    transform: translateY(-1px);

    box-shadow:
        0 10px 24px rgba(79, 70, 229, .25);
}


/* =========================================================
   HAMBURGER
   در ساختار یکپارچه، همیشه نمایش داده می‌شود
   ========================================================= */

.hamburger {
    width: 43px;
    height: 43px;

    padding: 0;

    border: 0;

    border-radius: 12px;

    background: #F8FAFC;

    border: 1px solid #E2E8F0;

    display: flex;

    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 5px;

    cursor: pointer;

    transition:
        background .2s ease,
        border-color .2s ease;
}

.hamburger:hover {
    background: #EEF2FF;
    border-color: #C7D2FE;
}

.hamburger span {
    width: 19px;
    height: 2px;

    border-radius: 10px;

    background: #334155;

    transition:
        transform .25s ease,
        opacity .2s ease,
        background .2s ease;
}

.hamburger:hover span {
    background: #4F46E5;
}

.hamburger.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}


/* =========================================================
   HEADER SPACER
   ========================================================= */

.header-spacer {
    height: 100px;
}


/* =========================================================
   MOBILE OVERLAY
   ========================================================= */

.mobile-nav-overlay {
    position: fixed;

    inset: 0;

    z-index: 10000;

    background: rgba(15, 23, 42, .42);

    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);

    opacity: 0;
    visibility: hidden;

    transition:
        opacity .3s ease,
        visibility .3s ease;
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}


/* =========================================================
   MOBILE NAV (Sliding Panel)
   ========================================================= */

.mobile-nav {
    position: fixed;

    top: 0;
    right: 0;

    width: min(400px, 90vw);
    height: 100dvh;

    z-index: 10001;

    background: #fff;

    box-shadow:
        -15px 0 50px rgba(15, 23, 42, .14);

    transform: translateX(105%);

    transition:
        transform .35s cubic-bezier(.4, 0, .2, 1);

    overflow: hidden;

    display: flex;
    flex-direction: column;
}

.mobile-nav.active {
    transform: translateX(0);
}


/* =========================================================
   MOBILE HEADER
   ========================================================= */

.mobile-nav-header {
    height: 76px;

    flex-shrink: 0;

    padding: 0 18px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    border-bottom: 1px solid #F1F5F9;
}


/* لوگوی موبایل */

.mobile-nav-logo {
    display: flex;
    align-items: center;

    gap: 10px;

    color: var(--farasod-text);
}

.mobile-nav-logo img {
    width: 43px;
    height: 43px;

    object-fit: contain;

    border-radius: 11px;
}

.mobile-site-name {
    font-size: 16px;
    font-weight: 800;
}


/* Close */

.mobile-close-btn {
    width: 40px;
    height: 40px;

    border: 0;

    border-radius: 11px;

    background: #F8FAFC;

    color: #475569;

    cursor: pointer;

    font-size: 16px;

    transition:
        background .2s ease,
        color .2s ease,
        transform .2s ease;
}

.mobile-close-btn:hover {
    color: var(--farasod-primary);

    background: var(--farasod-primary-light);

    transform: rotate(90deg);
}


/* =========================================================
   MOBILE CONTENT
   ========================================================= */

.mobile-nav-content {
    flex: 1;

    overflow-y: auto;

    padding: 18px;
}


/* =========================================================
   MOBILE USER
   ========================================================= */

.mobile-user-section {
    margin-bottom: 18px;
}

.mobile-user-info {
    display: flex;
    align-items: center;

    gap: 12px;

    padding: 13px;

    background:
        linear-gradient(
            135deg,
            #EEF2FF,
            #F8FAFC
        );

    border: 1px solid #E0E7FF;

    border-radius: 16px;
}

.mobile-user-info .avatar {
    width: 48px;
    height: 48px;

    border-radius: 13px;

    object-fit: cover;

    box-shadow:
        0 4px 12px rgba(15, 23, 42, .10);
}

.mobile-user-details {
    display: flex;
    flex-direction: column;

    gap: 3px;
}

.mobile-user-details .user-name {
    font-size: 14px;
    font-weight: 800;

    color: var(--farasod-text);
}

.mobile-user-details .user-role {
    font-size: 11px;

    color: var(--farasod-text-soft);
}


/* Login */

.mobile-user-login {
    padding: 18px;

    text-align: center;

    background: #F8FAFC;

    border: 1px solid #E2E8F0;

    border-radius: 17px;

    color: #64748B;
}

.mobile-user-login > i {
    display: block;

    margin-bottom: 8px;

    font-size: 34px;

    color: #818CF8;
}

.mobile-user-login span {
    display: block;

    margin-bottom: 12px;

    font-size: 13px;
    font-weight: 600;
}

.mobile-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;

    height: 43px;

    border-radius: 11px;

    color: #fff !important;

    background: var(--farasod-primary);

    font-size: 12px;
    font-weight: 700;

    transition:
        background .2s ease,
        transform .2s ease;
}

.mobile-login-btn:hover {
    background: var(--farasod-primary-dark);
    transform: translateY(-1px);
}


/* =========================================================
   MOBILE MENU ITEMS
   ========================================================= */

.mobile-main-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.mobile-main-menu > li {
    margin: 0 0 5px;
    border-bottom: 1px solid #222a31; /* خط خاکستری روشن */
    padding-bottom: 5px;
}

.mobile-main-menu > li::after {
    content: "";
    position: absolute;
    bottom: 0;
    right: 14px;
    left: 14px;
    height: 1px;
    background: linear-gradient(
        to left,
        transparent,
        #231e24 20%,
        #314099 80%,
        transparent
    );
}


/* =========================================================
   MENU ROW
   ========================================================= */

.mobile-menu-item-row {
    width: 100%;

    min-height: 50px;

    display: flex;
    align-items: center;

    border-radius: 13px;

    transition:
        background .2s ease;
}


/* =========================================================
   LINK
   ========================================================= */

.mobile-menu-link {
    flex: 1;

    min-height: 50px;

    display: flex;
    align-items: center;

    gap: 10px;

    padding: 0 14px;

    color: #475569;

    font-size: 13px;
    font-weight: 600;

    border-radius: 13px;

    transition:
        color .2s ease,
        background .2s ease,
        padding-right .2s ease;
}


/* آیکون */

.mobile-menu-icon {
    width: 20px;

    flex-shrink: 0;

    text-align: center;

    color: #64748B;

    font-size: 14px;

    transition: color .2s ease;
}


/* عنوان */

.mobile-menu-title {
    flex: 1;
}


/* Hover */

.mobile-menu-link:hover {
    color: #4F46E5;

    background: #F8FAFC;
}

.mobile-menu-link:hover .mobile-menu-icon {
    color: #4F46E5;
}


/* =========================================================
   ACTIVE ITEM
   ========================================================= */

.mobile-main-menu
li.current-menu-item > .mobile-menu-link,
.mobile-main-menu
li.current-menu-ancestor > .mobile-menu-item-row > .mobile-menu-link {

    color: #4F46E5;

    background: #EEF2FF;

    font-weight: 700;
}


/* =========================================================
   SUBMENU BUTTON
   ========================================================= */

.mobile-sub-toggle {
    width: 44px;
    height: 44px;

    flex-shrink: 0;

    margin-left: 4px;

    padding: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;
    outline: none;

    border-radius: 11px;

    background: transparent;

    color: #64748B;

    cursor: pointer;

    -webkit-tap-highlight-color: transparent;

    transition:
        background .2s ease,
        color .2s ease;
}


/* Hover */

.mobile-sub-toggle:hover {
    color: #4F46E5;

    background: #EEF2FF;
}


/* =========================================================
   ARROW
   ========================================================= */

.mobile-sub-toggle .mobile-arrow {
    font-size: 10px;

    transition:
        transform .3s ease;
}


/* باز */

.mobile-sub-toggle.open {
    color: #4F46E5;

    background: #EEF2FF;
}

.mobile-sub-toggle.open .mobile-arrow {
    transform: rotate(180deg);
}


/* =========================================================
   SUB MENU
   ========================================================= */

.mobile-sub-menu {
    list-style: none;

    margin: 0;
    padding: 0 10px 0 0;

    max-height: 0;

    overflow: hidden;

    opacity: 0;

    visibility: hidden;

    transition:
        max-height .3s ease,
        opacity .2s ease,
        padding .3s ease;
}


/* باز */

.mobile-sub-menu.open {
    opacity: 1;

    visibility: visible;

    padding-top: 5px;
    padding-bottom: 5px;
}


/* =========================================================
   SUB MENU ITEMS
   ========================================================= */

.mobile-sub-menu > li {
    margin: 2px 0;
}


/* لینک */

.mobile-sub-menu .mobile-menu-link {
    min-height: 44px;

    padding: 0 14px;

    border-radius: 10px;

    color: #64748B;

    font-size: 12px;

    font-weight: 500;
}


/* نقطه کنار لینک */

.mobile-sub-menu .mobile-menu-link::before {
    content: "";

    width: 5px;
    height: 5px;

    flex-shrink: 0;

    border-radius: 50%;

    background: #C7D2FE;

    transition:
        background .2s ease,
        transform .2s ease;
}


/* Hover */

.mobile-sub-menu .mobile-menu-link:hover {
    color: #4F46E5;

    background: #F8FAFC;

    padding-right: 18px;
}

.mobile-sub-menu .mobile-menu-link:hover::before {
    background: #4F46E5;

    transform: scale(1.3);
}


/* =========================================================
   SUBMENU دارای CHILD
   ========================================================= */

.mobile-sub-menu
li.menu-item-has-children
> .mobile-menu-item-row {

    margin-top: 2px;
}


/* =========================================================
   NESTED SUBMENU
   ========================================================= */

.mobile-sub-menu .mobile-sub-menu {
    padding-right: 14px;
}


/* =========================================================
   MOBILE TOUCH
   ========================================================= */

.mobile-sub-toggle,
.mobile-menu-link {
    touch-action: manipulation;
}


/* =========================================================
   MOBILE ACTIONS
   ========================================================= */

.mobile-actions {
    display: flex;
    flex-direction: column;

    gap: 8px;

    margin-top: 18px;

    padding-top: 18px;

    border-top: 1px solid #F1F5F9;
}

.mobile-action-btn {
    min-height: 52px;

    padding: 0 14px;

    display: flex;
    align-items: center;

    gap: 11px;

    border-radius: 13px;

    font-size: 12px;
    font-weight: 700;

    transition:
        background .2s ease,
        transform .2s ease;
}

.mobile-action-btn:hover {
    transform: translateY(-1px);
}

.mobile-action-btn > i:last-child {
    margin-right: auto;
}

.mobile-action-btn.recharge-btn {
    color: var(--farasod-primary);

    background: #EEF2FF;

    border: 1px solid #E0E7FF;
}

.mobile-action-btn.recharge-btn:hover {
    background: #E0E7FF;
}

.mobile-action-btn.notification-btn {
    color: #475569;

    background: #F8FAFC;

    border: 1px solid #E2E8F0;

    cursor: pointer;
}

.mobile-action-btn.notification-btn:hover {
    background: #EEF2FF;
    color: var(--farasod-primary);
}


/* =========================================================
   MOBILE FOOTER
   ========================================================= */

.mobile-nav-footer {
    margin-top: 25px;
    padding-top: 18px;

    border-top: 1px solid #F1F5F9;

    display: flex;
    align-items: center;
    justify-content: space-between;
}

.footer-text {
    color: #94A3B8;

    font-size: 10px;
}

.footer-social {
    display: flex;
    gap: 5px;
}

.footer-social a {
    width: 30px;
    height: 30px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 9px;

    color: #64748B;

    background: #F8FAFC;

    font-size: 12px;

    transition:
        background .2s ease,
        color .2s ease;
}

.footer-social a:hover {
    background: var(--farasod-primary);
    color: #fff;
}


/* =========================================================
   BODY LOCK WHEN MENU OPEN
   ========================================================= */

body.mobile-menu-open {
    overflow: hidden;
}


/* =========================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================= */

@media (max-width: 1100px) {

    .site-header {
        width: calc(100% - 24px);
    }

    .header-inner {
        gap: 12px;
    }

    .brand-name span:last-child {
        display: none;
    }

    .user-profile-btn > span {
        max-width: 75px;
    }

}


@media (max-width: 820px) {

    .site-header {
        top: 0; /* چسبیدن به بالای صفحه */
        right: 0;
        left: 0;

        width: 100%; /* تمام عرض صفحه */
        max-width: 100%;

        height: 68px;

        border-radius: 0; /* حذف گردی گوشه‌ها */
        
        border-left: none; /* حذف بوردرهای کناری */
        border-right: none;
        border-top: none;
        
        box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08); /* سایه ملایم */
    }

    .site-header.scrolled {
        top: 0;
        box-shadow: 0 4px 20px rgba(15, 23, 42, 0.12);
    }

    .header-inner {
        padding: 0 12px;
        gap: 8px;
    }

    .header-actions {
        margin-right: auto;
        gap: 4px;
    }

    .header-actions .notification-bell,
    .header-actions .notification-btn,
    .header-actions > a.notification-bell {
        width: 40px;
        height: 40px;
    }

    .btn-recharge-header {
        width: 40px;
        height: 40px;
        padding: 0;
    }

    .btn-recharge-header .recharge-label {
        display: none;
    }

    .user-profile-btn {
        width: 40px;
        height: 40px;
        padding: 2px;
        justify-content: center;
        border-radius: 11px;
    }

    .user-profile-btn > span {
        display: none;
    }

    .user-profile-btn .avatar {
        width: 34px;
        height: 34px;
        border-radius: 9px;
    }

    .header-actions > .btn-cta:not(.user-profile-btn) {
        width: 40px;
        height: 40px;
        padding: 0;
        font-size: 0;
        border-radius: 11px;
    }

    .header-actions > .btn-cta:not(.user-profile-btn) i {
        font-size: 15px;
    }

    .site-branding img,
    .brand-icon {
        width: 120px;
        height: auto;
    }

    .brand-name span:first-child {
        font-size: 15px;
    }

    .header-spacer {
        height: 68px; /* هماهنگ با ارتفاع هدر */
    }

    .mobile-nav {
        width: min(360px, 90vw);
    }

}


@media (max-width: 480px) {

    .site-header {
        top: 0;
        right: 0;
        left: 0;

        width: 100%; /* تمام عرض */
        max-width: 100%;

        height: 62px; /* کمی کوتاه‌تر برای موبایل */

        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: none;
    }

    .header-inner {
        gap: 5px;
        padding: 0 10px;
    }

    .header-actions {
        gap: 3px;
    }

    .brand-name span:first-child {
        font-size: 14px;
    }

    .site-branding {
        gap: 7px;
    }

    .site-branding img,
    .brand-icon {
        width: 90px; /* لوگو کوچکتر */
        height: auto;
    }

    .header-actions .notification-bell,
    .header-actions .notification-btn,
    .header-actions > a.notification-bell,
    .btn-recharge-header,
    
    .header-actions > .btn-cta:not(.user-profile-btn),
    .hamburger {
        width: 46px;
        height: 46px;
    }

    .user-profile-btn .avatar {
        width: 28px;
        height: 28px;
    }

    .header-spacer {
        height: 62px; /* هماهنگ با ارتفاع هدر */
    }

    .mobile-nav {
        width: 100vw;
        height: 100dvh;
    }
        .user-profile-btn {
        display: none !important;
    }
	
			.btn-cta {
			display: none !important;
		}

}


/* ─── رفع تداخل Admin Bar ─────────────────── */
body.admin-bar .site-header { top: 32px; }
body.admin-bar .mobile-nav-overlay { top: 32px; }
body.admin-bar .mobile-nav { top: 32px; height: calc(100dvh - 32px); }
body.admin-bar .header-spacer { height: 112px; }
@media (max-width: 782px) {
    body.admin-bar .site-header { top: 46px; }
    body.admin-bar .mobile-nav-overlay { top: 46px; }
    body.admin-bar .mobile-nav { top: 46px; height: calc(100dvh - 46px); }
    body.admin-bar .header-spacer { height: 126px; }
}