/* ===== هدر و منوی اصلی ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(8, 15, 30, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
}

.header-container {
    max-width: var(--container-width, 1200px);
    margin: 0 auto;
    padding: 0.5rem 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8rem;
    direction: rtl;
    min-height: 70px;
}

/* ===== بخش‌های هدر ===== */
.header-right,
.header-center,
.header-left {
    display: flex;
    align-items: center;
}

.header-right {
    flex: 0 0 auto;
}

.header-center {
    flex: 0 1 auto;
    justify-content: center;
}

.header-left {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ===== لوگو ===== */
.logo-text {
    font-size: 1.5rem;
    font-weight: bold;
    background: linear-gradient(135deg, #fff, #a5b4fc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    white-space: nowrap;
}

/* ===== منوی دسکتاپ ===== */
.main-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 0.5rem;
}

.main-nav ul li {
    position: relative;
}

.main-nav ul li a {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.7rem 1.2rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
    white-space: nowrap;
    cursor: pointer;
}

.main-nav ul li a i {
    font-size: 0.7rem;
    opacity: 0.6;
    transition: transform 0.3s ease;
}

.main-nav ul li:hover > a i {
    transform: rotate(180deg);
}

.main-nav ul li a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* ===== زیرمنوها ===== */
.main-nav ul ul {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 220px;
    background: rgba(15, 22, 40, 0.95);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    padding: 0.5rem;
    flex-direction: column;
    z-index: 1000;
}

.main-nav ul li:hover > ul {
    display: flex;
    animation: fadeInDown 0.3s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main-nav ul ul li {
    width: 100%;
}

.main-nav ul ul li a {
    padding: 0.7rem 1rem;
    white-space: nowrap;
    border-radius: 6px;
}

.main-nav ul ul li a:hover {
    background: rgba(100, 130, 200, 0.2);
}

/* ===== سرچ باکس ===== */
.live-search-wrapper {
    position: relative;
    width: 300px;
}

.live-search-box {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 40px;
    padding: 0.3rem;
    transition: all 0.3s ease;
    width: 100%;
}

.live-search-box:focus-within {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(100, 130, 200, 0.5);
    box-shadow: 0 0 0 3px rgba(100, 130, 200, 0.15);
}

.search-icon {
    color: rgba(255, 255, 255, 0.4);
    padding: 0 1rem;
    font-size: 0.9rem;
}

.live-search-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.7rem 0;
    color: white;
    font-size: 0.95rem;
    outline: none;
    direction: rtl;
}

.live-search-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.live-search-clear {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    padding: 0 1rem;
    cursor: pointer;
    display: none;
    transition: all 0.3s ease;
}

.live-search-input:not(:placeholder-shown) ~ .live-search-clear {
    display: block;
}

.live-search-clear:hover {
    color: white;
    transform: scale(1.1);
}

.search-loading {
    padding: 0 1rem;
    display: none;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: rgba(100, 130, 200, 0.8);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== دکمه همبرگر ===== */
.hamburger-menu {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    flex-direction: column;
    gap: 6px;
    width: 40px;
    height: 40px;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.hamburger-menu:hover {
    background: rgba(255, 255, 255, 0.1);
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 2px;
    background: white;
    border-radius: 3px;
    transition: all 0.3s ease;
}

/* ===== سایدبار موبایل ===== */
.mobile-sidebar {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    height: 100vh;
    background: rgba(10, 17, 34, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2000;
    transition: right 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex-direction: column;
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.5);
    /* مخفی در دسکتاپ */
    display: none;
    direction: rtl;
}

.mobile-sidebar.active {
    right: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    font-size: 1.3rem;
    font-weight: bold;
    background: linear-gradient(135deg, #fff, #a5b4fc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.sidebar-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: rotate(90deg);
}

/* ===== منوی موبایل ===== */
.mobile-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.mobile-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav li {
    margin-bottom: 0.5rem;
}

.mobile-nav a,
.mobile-submenu-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: transparent;
    border: none;
    width: 100%;
    cursor: pointer;
}

.mobile-submenu-toggle i {
    transition: transform 0.3s ease;
}

.mobile-submenu-toggle.active i {
    transform: rotate(180deg);
}

.mobile-nav a:hover,
.mobile-submenu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.mobile-submenu {
    display: none;
    padding-right: 1rem;
    margin-top: 0.5rem;
    border-right: 2px solid rgba(100, 130, 200, 0.3);
}

.mobile-submenu.active {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-submenu li {
    margin-bottom: 0.3rem;
}

.mobile-submenu a {
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
}

/* ===== فوتر سایدبار ===== */
.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-social {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.sidebar-social a {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.sidebar-social a:hover {
    color: white;
    transform: translateY(-3px);
}

/* ===== اوورلی ===== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    /* مخفی در دسکتاپ */
    display: none;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ===== رسپانسیو - فقط در موبایل ===== */
@media (max-width: 1200px) {
    .header-container {
        gap: 4rem;
    }
    
    .live-search-wrapper {
        width: 250px;
    }
}

@media (max-width: 992px) {
    .header-container {
        gap: 2rem;
        justify-content: space-between;
    }
    
    .desktop-menu {
        display: none;
    }
    
    .hamburger-menu {
        display: flex;
    }
    
    .header-left {
        gap: 0.5rem;
    }
    
    .live-search-wrapper {
        width: 200px;
    }
    
    /* فعال کردن سایدبار فقط در موبایل */
    .mobile-sidebar {
        display: flex;
    }
    
    .sidebar-overlay {
        display: block;
    }
}

@media (max-width: 768px) {
    .header-container {
        gap: 1rem;
        padding: 0.5rem 20px;
    }
    
    .live-search-wrapper {
        width: 180px;
    }
    
    .search-icon {
        padding: 0 0.5rem;
    }
    
    .live-search-input {
        padding: 0.5rem 0;
        font-size: 0.85rem;
    }
}

@media (max-width: 576px) {
    .live-search-wrapper {
        width: 140px;
    }
    
    .logo-text {
        font-size: 1.2rem;
    }
}

/* ===== دسکتاپ خالص - تضمین مخفی بودن سایدبار ===== */
@media (min-width: 993px) {
    .mobile-sidebar,
    .sidebar-overlay {
        display: none !important;
    }
}