/* Header Base Styles */
header {
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%;
    background-color: rgba(255, 255, 255, 0.98); 
    backdrop-filter: blur(8px); 
    z-index: 1000;
    border-bottom: 1px solid var(--border-color, #eee);
}

header .container { 
    max-width: 100%; 
    width: 85%; 
    margin: 0 auto; 
    padding: 0 20px; 
    box-sizing: border-box; 
    position: relative; 
} 

.header-wrapper { 
    display: flex; 
    flex-direction: column; 
    padding: 10px 0 0 0; 
    gap: 5px; 
    align-items: center; 
    width: 100%; 
}

.header-top { 
    width: 100%; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    position: relative; 
    direction: rtl; 
    padding: 10px 0; 
}

.header-bottom { 
    width: 100%; 
    display: flex; 
    justify-content: flex-start; 
    align-items: center; 
    position: relative; 
    direction: rtl;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease, margin-bottom 0.3s ease;
    max-height: 100px;
    opacity: 1;
    overflow: visible;
}

.header-bottom.hidden-row {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
    overflow: hidden;
}

.desktop-only { display: flex; }
.mobile-only { display: none; }

.logo-link { margin: 0; text-decoration: none; }

.site-title { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px;
    font-size: 26px; 
    font-weight: bold; 
    letter-spacing: 2px; 
    margin: 0; 
    text-transform: uppercase; 
    color: #000; 
    text-align: center; 
    font-family: "SFUIDisplay-Semibold", "Vazirmatn", Tahoma, sans-serif; 
    direction: ltr; 
}

.title-inline-logo {
    width: 1.25em; 
    height: 1.25em; 
    max-width: 40px; 
    max-height: 40px;
    flex-shrink: 0; 
    object-fit: contain; 
    display: inline-block;
}

.header-actions-left { display: flex; align-items: center; } 
/* تنظیم فاصله کلی باکس‌های سمت راست */
.header-actions-right { display: flex; align-items: center; gap: 15px; } 

/* =========================================
   استایل جستجوی دسکتاپ (عرض یکپارچه)
   ========================================= */
.search-box-desktop {
    display: flex; 
    align-items: center;
    border: 1px solid #000; 
    border-radius: 0; 
    padding: 6px 12px; 
    background: #fafafa; 
    transition: background 0.3s;
    margin-right: 30px; 
    position: relative;
    width: 350px; 
    box-sizing: border-box;
}
.search-box-desktop:focus-within { background: #fff; }
.search-box-desktop input {
    border: none; 
    outline: none; 
    background: transparent; 
    font-family: inherit; 
    font-size: 14px; 
    width: 100%; 
    text-align: right; 
    color: #000;
}
.search-box-desktop input::placeholder { color: #888; }

.mega-menu-nav { 
    display: flex; 
    justify-content: flex-start; 
    gap: 35px; 
    padding: 0; 
    border-top: 1px solid #f5f5f5; 
    width: 100%; 
    direction: rtl;
}
.mega-menu-item { position: static; } 
.mega-title { 
    font-weight: bold; 
    font-size: 15px; 
    cursor: default; 
    padding: 16px 0; 
    color: #000; 
    font-family: "SFUIDisplay-Semibold", "Vazirmatn", Tahoma, sans-serif; 
    transition: color 0.2s; 
    display: inline-block;
}

.mega-content {
    display: none; 
    position: absolute; 
    right: 0; 
    top: 100%; 
    width: 100%;
    box-sizing: border-box;
    background: #fff; 
    border-top: 2px solid #ddd; 
    box-shadow: 0 10px 15px rgba(0,0,0,0.05);
    padding: 30px 0; 
    z-index: 2000;
}
@keyframes fadeInMega { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.mega-columns { 
    display: flex; 
    justify-content: space-between; 
    max-width: 1300px; 
    margin: 0 auto; 
    direction: rtl;
}

.mega-sub-links-container {
    display: flex; 
    flex-direction: column; 
    flex-wrap: wrap; 
    max-height: 160px; 
    gap: 14px 60px; 
    flex: 1;
}
.mega-sub-links-container a { 
    color: #333; 
    text-decoration: none; 
    font-size: 14px; 
    font-weight: bold;
    transition: color 0.2s; 
    font-family: "Vazirmatn", Tahoma, sans-serif; 
}

.mega-images-container { 
    display: flex; 
    gap: 20px; 
    flex-shrink: 0; 
    border-right: 1px solid #eee; 
    padding-right: 25px; 
}
.mega-image-card { text-align: center; width: 160px; }
.mega-image-card img { 
    width: 100%; 
    height: 110px; 
    object-fit: cover; 
    margin-bottom: 4px; 
    border: 1px solid #eaeaea; 
    transition: transform 0.3s; 
}
.mega-image-card a { 
    color: #000; 
    font-weight: bold; 
    text-decoration: none; 
    font-size: 13px; 
    font-family: inherit; 
    transition: color 0.2s;
}
.mega-image-card span { display: block; line-height: 1.4; margin-top: 2px; }

/* تنظیم آیکون‌ها برای قرارگیری و تراز دقیق */
.cart-icon, .user-icon-btn, .bell-icon { 
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, color 0.3s; 
}

.mega-menu-item:hover .mega-title { color: #000; }
.mega-menu-item:hover .mega-content { display: block; animation: fadeInMega 0.3s ease; }
.mega-sub-links-container a:hover { color: #000; font-weight: bold; text-decoration: underline; }
.mega-image-card:hover img { transform: scale(1.03); }
.mega-image-card:hover a { color: #000; }
.cart-icon:hover, .user-icon-btn:hover, .bell-icon:hover { transform: scale(1.1); color: #000; }
.close-auth:hover { color: #e10718; }
.btn-auth:hover { background: #333; color: #fff; }
.btn-google:hover { background: #fafafa; box-shadow: 0 4px 10px rgba(0,0,0,0.05); color: #000; }

.cart-badge {
    position: absolute; 
    top: -6px; 
    right: -8px; 
    background-color: #e10718; 
    color: #fff;
    font-size: 10px; 
    font-weight: bold; 
    min-width: 16px; 
    height: 16px; 
    display: flex;
    align-items: center; 
    justify-content: center; 
    border-radius: 10px; 
    padding: 0 4px;
    font-family: Tahoma, sans-serif;
}

@media (min-width: 769px) { 
    .mobile-menu { display: none; } 
}

@media (max-width: 768px) {
    header .container { width: 100%; padding: 0 15px; }
    .desktop-only { display: none; }
    .mobile-only { display: flex; }
    
    .site-title { font-size: 20px; gap: 6px; }
    .header-top { 
        flex-direction: row; 
        position: relative; 
        z-index: 100001; 
        background-color: rgba(255, 255, 255, 0.98);
    } 
    .header-actions-left { flex: 1; display: flex; justify-content: flex-end; }
    
    /* اصلاح شده: gap به 8px تغییر یافت */
    .header-actions-right { flex: 1; display: flex; justify-content: flex-start; gap: 8px;}
    
    .mobile-menu {
        position: fixed; 
        top: 0; 
        right: -100%; 
        width: 85%; 
        height: 100vh;
        background: #fff; 
        z-index: 100000; 
        transition: right 0.3s ease;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1); 
        overflow-y: auto; 
        display: block;
        padding-top: 65px; 
        box-sizing: border-box;
    }
    #mobileMenuWrapper.menu-active-force { right: 0; }
    
    .mob-menu-item { border-bottom: 1px solid #f0f0f0; position: relative; }
    .mob-title-btn { 
        width: 100%; 
        text-align: right; 
        padding: 18px 20px; 
        background: none; 
        border: none; 
        font-size: 16px; 
        color: #111; 
        display: flex; 
        justify-content: space-between; 
        align-items: center; 
        cursor: pointer; 
        font-family: inherit; 
        font-weight: bold;
    }
    
    .mob-sub-menu {
        position: fixed; 
        top: 0; 
        right: -100%; 
        width: 85%; 
        height: 100vh;
        background: #fafafa; 
        z-index: 100000; 
        transition: right 0.3s ease;
        display: flex; 
        flex-direction: column; 
        box-sizing: border-box; 
        padding: 65px 0 10px 0; 
        overflow-y: auto;
    }
    .mob-sub-menu.active { right: 0; }
    
    .mob-back-btn { 
        background: #eee; 
        border: none; 
        padding: 18px 20px; 
        border-bottom: 1px solid #ddd;
        cursor: pointer; 
        text-align: right; 
        font-weight: bold; 
        font-size: 15px; 
        color: #000; 
        font-family: inherit;
    }
    .mob-sub-link { 
        padding: 15px 25px; 
        border-bottom: 1px solid #eee; 
        color: #000; 
        text-decoration: none; 
        font-size: 15px; 
        display: block; 
        transition: none;
    }
}

[data-theme="dark"] header { border-bottom-color: #333; }
[data-theme="dark"] .header-top { background-color: rgba(18, 18, 18, 0.98); }
[data-theme="dark"] .mega-content { background-color: #1e1e1e; border-top-color: #444; box-shadow: 0 10px 30px rgba(255,255,255,0.05); }
[data-theme="dark"] .mega-title, [data-theme="dark"] .site-title { color: #fff; }
[data-theme="dark"] .mega-sub-links-container a { color: #ccc; }
[data-theme="dark"] .mega-sub-links-container a:hover { color: #fff; }
[data-theme="dark"] .mega-image-card a { color: #fff; }
[data-theme="dark"] .mega-image-card img { border-color: #333; }
[data-theme="dark"] .search-box-desktop { background-color: #1e1e1e; border-color: #fff; }
[data-theme="dark"] .search-box-desktop input { color: #fff; }
[data-theme="dark"] .cart-badge { background-color: #e10718; color: #fff; }
[data-theme="dark"] .mob-sub-link { color: #ccc; }

.auth-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 3000; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(5px); }
.auth-modal-content { background: #fff; width: 90%; max-width: 400px; border-radius: 12px; padding: 20px 30px; position: relative; box-shadow: 0 15px 30px rgba(0,0,0,0.15); animation: modalFadeIn 0.3s ease-out; direction: rtl; }
@keyframes modalFadeIn { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.close-auth { position: absolute; top: 15px; right: 15px; font-size: 24px; cursor: pointer; color: #888; transition: color 0.2s; line-height: 1;}

.auth-tabs { display: flex; border-bottom: 2px solid #eee; margin-bottom: 15px; }
.auth-tab { flex: 1; background: none; border: none; padding: 12px; font-family: inherit; font-size: 16px; font-weight: bold; color: #aaa; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all 0.3s ease; }
.auth-tab.active { color: #000; border-bottom-color: #000; }
.auth-input-group { margin-bottom: 15px; }
.auth-form input { width: 100%; padding: 12px 15px; border: 1px solid #ddd; border-radius: 8px; font-family: inherit; font-size: 14px; box-sizing: border-box; outline: none; transition: border 0.2s; text-align: right; }
.auth-form input:focus { border-color: #000; }
.auth-form input.ltr-input { direction: ltr; text-align: left; }
.password-wrapper { position: relative; display: flex; align-items: center; width: 100%; }
.password-wrapper input { padding-left: 35px; padding-right: 15px; }
.toggle-password { position: absolute; left: 10px; cursor: pointer; color: #888; display: flex; align-items: center; justify-content: center; background: none; border: none; padding: 0; transition: color 0.2s; z-index: 2; }
.toggle-password:hover { color: #000; }

.btn-auth { width: 100%; height: 48px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; background: #000; color: #fff; border: none; border-radius: 8px; font-family: inherit; font-size: 15px; font-weight: bold; cursor: pointer; transition: background 0.3s; margin-top: 10px; }

.auth-msg-box { text-align: center; font-size: 13px; font-weight: bold; margin-top: 15px; min-height: 20px; }
.auth-msg-box.error { color: #e10718; }
.auth-msg-box.success { color: #28a745; }

.btn-google { width: 100%; height: 48px; box-sizing: border-box; background: #fff; border: 1px solid #ddd; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; font-family: inherit; font-size: 14px; font-weight: bold; color: #444; transition: background 0.3s, box-shadow 0.3s; }

/* ابزار ترجمه گوگل */
.goog-te-banner-frame.skiptranslate, 
.goog-te-gadget-icon, 
.goog-te-gadget-simple, 
#goog-gt-tt, 
.goog-te-spinner-pos, 
.goog-te-spinner-animation,
.VIpgJd-ZVi9od-ORHb-OEVmcd,
.VIpgJd-ZVi9od-aZ2wEe,
.VIpgJd-ZVi9od-aZ2wEe-wOHMyf,
.VIpgJd-ZVi9od-l4eHX-hSRGPd { 
    display: none !important; 
    visibility: hidden !important;
    opacity: 0 !important;
}
#google_translate_element { display: none !important; }

.goog-text-highlight { background-color: transparent !important; box-shadow: none !important; color: inherit !important; }

.notranslate { translate: no; }

/* اصلاح انتخابگر زبان برای یکدستی */
.lang-selector {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0; 
    color: inherit;
}
.lang-selector select {
    border: none;
    background: transparent;
    font-family: "SFUIDisplay-Semibold", "Vazirmatn", Tahoma, sans-serif;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    color: inherit;
    -webkit-appearance: none;
    appearance: none;
    padding-right: 5px;
}
[data-theme="dark"] .lang-selector select { color: #fff; }
[data-theme="dark"] .lang-selector select option { background: #1e1e1e; color: #fff; }

[dir="ltr"] .search-box-desktop input {
    text-align: left;
    direction: ltr;
}
[dir="ltr"] .mob-title-btn,
[dir="ltr"] .mob-back-btn,
[dir="ltr"] .mob-sub-link {
    text-align: left;
}

/* =========================================
   Live Search Styles (Desktop & Mobile)
   ========================================= */
.live-search-results {
    position: absolute; 
    top: 100%; 
    right: -1px; 
    width: calc(100% + 2px); 
    background: #fff; 
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    border-radius: 0 0 8px 8px; 
    border: 1px solid #eee; 
    border-top: none;
    z-index: 100000; 
    display: none; 
    max-height: 400px; 
    overflow-y: auto; 
    text-align: right; 
    direction: rtl;
}
.search-section-title { font-size: 12px; font-weight: bold; color: #888; padding: 10px 15px; background: #fdfdfd; border-bottom: 1px solid #eee; margin: 0; }
.search-item-row { display: flex; align-items: center; padding: 10px 15px; gap: 12px; text-decoration: none; border-bottom: 1px solid #f9f9f9; transition: background 0.2s; color: inherit; }
.search-item-row:hover { background: #f5f5f5; }
.search-item-img { width: 45px; height: 45px; object-fit: cover; border-radius: 4px; border: 1px solid #eee; flex-shrink: 0; }
.search-item-artist-img { border-radius: 50%; }
.search-item-info { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.search-item-title { font-size: 14px; font-weight: bold; color: #111; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item-subtitle { font-size: 11px; color: #666; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Mobile Takeover Search */
@media (max-width: 768px) {
    .mobile-search-dropdown {
        position: absolute; 
        top: 100%; 
        left: 0;
        right: 0;
        height: calc(100vh - 100px); 
        background: #fff;
        z-index: 100001; 
        overflow-y: auto; 
        padding-bottom: 20vh; 
        display: none;
        border-radius: 0;
        border: none;
        max-height: none;
        width: 100%;
        min-width: unset;
        box-shadow: 0 15px 25px rgba(0,0,0,0.1);
    }
}

/* Dark Mode for Search */
[data-theme="dark"] .live-search-results { background: #1e1e1e; border-color: #333; }
[data-theme="dark"] .search-section-title { background: #121212; border-color: #333; color: #aaa; }
[data-theme="dark"] .search-item-row { border-color: #333; }
[data-theme="dark"] .search-item-row:hover { background: #2a2a2a; }
[data-theme="dark"] .search-item-title { color: #fff; }
[data-theme="dark"] .mobile-search-dropdown { background: #121212; }