/**
 * ETM Mobile Bar - Desktop Bar Styles (Complete)
 * استایل کامل نوار دسکتاپ — نسخه نهایی
 *
 * @package ETM_MobileBar
 * @version 2.1.0
 */

/* ═══════════════════════════════════════════════════
   🎯 Base
   ═══════════════════════════════════════════════════ */

.etm-mbu-desktop-bar {
    position: relative;
    width: 100%;
    z-index: 9000;
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    direction: rtl;
    background: var(--etm-bg, #ffffff);
    border-bottom: 1px solid var(--etm-border, #e2e8f0);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.etm-mbu-desktop-bar *,
.etm-mbu-desktop-bar *::before,
.etm-mbu-desktop-bar *::after {
    box-sizing: border-box;
}

/* ─── Sticky ─── */
.etm-mbu-desktop-bar.etm-mbu-sticky {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.etm-mbu-desktop-bar.etm-mbu-desktop-position-bottom.etm-mbu-sticky {
    top: auto;
    bottom: 0;
    border-bottom: none;
    border-top: 1px solid var(--etm-border, #e2e8f0);
}

/* ─── Transparent ─── */
.etm-mbu-desktop-bar.etm-mbu-transparent {
    background: transparent;
    border-color: transparent;
}

/* ─── Glass Effect ─── */
.etm-mbu-desktop-bar.etm-mbu-glass {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-color: rgba(226, 232, 240, 0.6);
}

@media (prefers-color-scheme: dark) {
    .etm-mbu-desktop-bar.etm-mbu-glass {
        background: rgba(26, 22, 37, 0.85);
        border-color: rgba(45, 38, 64, 0.6);
    }
}

/* ─── Scroll Behavior ─── */
.etm-mbu-desktop-bar.etm-mbu-scrolled {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.etm-mbu-desktop-bar.etm-mbu-hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.etm-mbu-desktop-bar.etm-mbu-desktop-position-bottom.etm-mbu-hidden {
    transform: translateY(100%);
}

/* ═══════════════════════════════════════════════════
   📦 Container
   ═══════════════════════════════════════════════════ */

.etm-mbu-dt-container {
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: var(--etm-desktop-height, 56px);
    width: 100%;
}

/* ═══════════════════════════════════════════════════
   🎨 Logo
   ═══════════════════════════════════════════════════ */

.etm-mbu-dt-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: var(--etm-text, #1e293b);
    flex-shrink: 0;
    transition: transform 0.25s;
    gap: 10px;
}

.etm-mbu-dt-logo:hover {
    transform: scale(1.03);
}

.etm-mbu-dt-logo img {
    max-height: 40px;
    max-width: 180px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.etm-mbu-dt-logo-text {
    font-size: 18px;
    font-weight: 900;
    color: var(--etm-text, #1e293b);
    letter-spacing: -0.3px;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════
   📋 Menu
   ═══════════════════════════════════════════════════ */

.etm-mbu-dt-menu {
    flex: 1;
    min-width: 0;
    overflow: visible;
}

.etm-mbu-dt-menu-list {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: nowrap;
}

.etm-mbu-dt-menu-item {
    position: relative;
    flex-shrink: 0;
}

.etm-mbu-dt-menu-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    color: var(--etm-text, #1e293b);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 700;
    border-radius: 10px;
    transition: all 0.2s;
    position: relative;
    white-space: nowrap;
    line-height: 1.4;
}

.etm-mbu-dt-menu-link::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--etm-primary, #7c3aed);
    opacity: 0;
    border-radius: inherit;
    transition: opacity 0.2s;
    z-index: -1;
}

.etm-mbu-dt-menu-link:hover::before {
    opacity: 0.08;
}

.etm-mbu-dt-menu-link:hover {
    color: var(--etm-primary, #7c3aed);
}

.etm-mbu-dt-menu-text {
    position: relative;
    z-index: 1;
}

.etm-mbu-dt-menu-arrow {
    display: flex;
    align-items: center;
    opacity: 0.6;
    transition: transform 0.25s;
    font-size: 12px;
}

.etm-mbu-dt-menu-arrow svg {
    width: 14px;
    height: 14px;
}

.etm-mbu-dt-menu-item:hover .etm-mbu-dt-menu-arrow {
    transform: rotate(180deg);
    opacity: 1;
}

/* ─── Active State ─── */
.etm-mbu-dt-menu-item.current-menu-item > .etm-mbu-dt-menu-link,
.etm-mbu-dt-menu-item.current-menu-ancestor > .etm-mbu-dt-menu-link {
    color: var(--etm-primary, #7c3aed);
}

.etm-mbu-dt-menu-item.current-menu-item > .etm-mbu-dt-menu-link::before {
    opacity: 0.12;
}

/* ═══════════════════════════════════════════════════
   🔽 Sub-menu (Dropdown)
   ═══════════════════════════════════════════════════ */

.etm-mbu-dt-submenu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 220px;
    background: var(--etm-bg, #ffffff);
    border: 1.5px solid var(--etm-border, #e2e8f0);
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
    padding: 8px;
    list-style: none;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 100;
}

.etm-mbu-dt-menu-item:hover > .etm-mbu-dt-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.etm-mbu-dt-submenu::before {
    content: '';
    position: absolute;
    top: -8px;
    right: 24px;
    width: 14px;
    height: 14px;
    background: var(--etm-bg, #ffffff);
    border-top: 1.5px solid var(--etm-border, #e2e8f0);
    border-left: 1.5px solid var(--etm-border, #e2e8f0);
    transform: rotate(45deg);
}

.etm-mbu-dt-submenu .etm-mbu-dt-menu-item {
    width: 100%;
}

.etm-mbu-dt-submenu .etm-mbu-dt-menu-link {
    width: 100%;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 600;
    justify-content: space-between;
}

/* ═══════════════════════════════════════════════════
   🔍 Search
   ═══════════════════════════════════════════════════ */

.etm-mbu-dt-search {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.etm-mbu-dt-search-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    min-width: 240px;
    background: rgba(0, 0, 0, 0.04);
    border: 1.5px solid var(--etm-border, #e2e8f0);
    border-radius: 12px;
    color: var(--etm-text, #1e293b);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: right;
}

.etm-mbu-dt-search-trigger:hover {
    background: rgba(124, 58, 237, 0.06);
    border-color: var(--etm-primary, #7c3aed);
    color: var(--etm-primary, #7c3aed);
}

.etm-mbu-dt-search-trigger svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.etm-mbu-dt-search-hint {
    flex: 1;
    opacity: 0.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.etm-mbu-dt-search-kbd {
    padding: 2px 8px;
    background: var(--etm-bg, #ffffff);
    border: 1px solid var(--etm-border, #e2e8f0);
    border-radius: 6px;
    font-family: monospace;
    font-size: 11px;
    font-weight: 700;
    color: var(--etm-text, #1e293b);
    opacity: 0.6;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.etm-mbu-dt-search-trigger:hover .etm-mbu-dt-search-kbd {
    opacity: 0.9;
    border-color: var(--etm-primary, #7c3aed);
}

/* ═══════════════════════════════════════════════════
   ⚡ Actions
   ═══════════════════════════════════════════════════ */

.etm-mbu-dt-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.etm-mbu-dt-action {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--etm-text, #1e293b);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    font-family: inherit;
    flex-shrink: 0;
}

.etm-mbu-dt-action::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--etm-primary, #7c3aed);
    opacity: 0;
    border-radius: inherit;
    transition: opacity 0.2s;
    z-index: 0;
}

.etm-mbu-dt-action:hover::before {
    opacity: 0.1;
}

.etm-mbu-dt-action:hover {
    color: var(--etm-primary, #7c3aed);
    transform: translateY(-1px);
}

.etm-mbu-dt-action:active {
    transform: translateY(0) scale(0.95);
}

.etm-mbu-dt-action svg,
.etm-mbu-dt-action .etm-mbu-icon {
    width: 20px;
    height: 20px;
    position: relative;
    z-index: 1;
}

/* ─── WhatsApp Action ─── */
.etm-mbu-dt-whatsapp:hover {
    color: #25d366;
}

.etm-mbu-dt-whatsapp:hover::before {
    background: #25d366;
}

/* ═══════════════════════════════════════════════════
   🔴 Badge
   ═══════════════════════════════════════════════════ */

.etm-mbu-dt-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ef4444;
    color: #fff;
    border-radius: 9px;
    font-size: 10px;
    font-weight: 900;
    line-height: 18px;
    text-align: center;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    border: 2px solid var(--etm-bg, #ffffff);
    animation: etm-badge-bounce-desktop 2s ease-in-out infinite;
    direction: ltr;
}

@keyframes etm-badge-bounce-desktop {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

/* ─── Cart Badge ─── */
.etm-mbu-dt-cart .etm-mbu-dt-badge {
    background: linear-gradient(135deg, #10b981, #059669);
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.4);
}

/* ─── Notification Badge ─── */
.etm-mbu-dt-notification .etm-mbu-dt-badge {
    animation: etm-badge-ping-desktop 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes etm-badge-ping-desktop {
    0% { transform: scale(1); }
    75%, 100% { transform: scale(1.15); }
}

/* ═══════════════════════════════════════════════════
   👤 User Avatar
   ═══════════════════════════════════════════════════ */

.etm-mbu-dt-user-logged-in {
    padding: 0;
}

.etm-mbu-dt-user-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #fff;
    font-size: 14px;
    font-weight: 900;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.25s;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.etm-mbu-dt-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.etm-mbu-dt-user-logged-in:hover .etm-mbu-dt-user-avatar {
    transform: scale(1.08);
}

/* ═══════════════════════════════════════════════════
   🎯 Megamenu Container
   ═══════════════════════════════════════════════════ */

.etm-mbu-dt-megamenu-container {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    background: var(--etm-bg, #ffffff);
    border-top: 1.5px solid var(--etm-border, #e2e8f0);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    z-index: 100;
    max-height: 70vh;
    overflow-y: auto;
    animation: etm-dt-megamenu-in 0.3s ease;
}

.etm-mbu-dt-megamenu-container[hidden] {
    display: none;
}

@keyframes etm-dt-megamenu-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══════════════════════════════════════════════════
   📱 Responsive
   ═══════════════════════════════════════════════════ */

@media (max-width: 1300px) {
    .etm-mbu-dt-container {
        padding: 0 20px;
        gap: 14px;
    }

    .etm-mbu-dt-search-trigger {
        min-width: 200px;
    }

    .etm-mbu-dt-menu-link {
        padding: 8px 12px;
        font-size: 13px;
    }
}

@media (max-width: 1200px) {
    .etm-mbu-dt-search-trigger {
        min-width: 180px;
    }

    .etm-mbu-dt-search-hint {
        display: none;
    }

    .etm-mbu-dt-menu-link {
        padding: 8px 10px;
        font-size: 12.5px;
    }
}

@media (max-width: 1024px) {
    .etm-mbu-desktop-bar {
        display: none !important;
    }
}

/* ═══════════════════════════════════════════════════
   🌙 Dark Mode
   ═══════════════════════════════════════════════════ */

@media (prefers-color-scheme: dark) {
    .etm-mbu-desktop-bar:not(.etm-mbu-glass) {
        background: #1a1625;
        border-color: #2d2640;
        color: #f1f5f9;
    }

    .etm-mbu-dt-search-trigger {
        background: rgba(255, 255, 255, 0.06);
        color: #f1f5f9;
        border-color: #2d2640;
    }

    .etm-mbu-dt-menu-link {
        color: #f1f5f9;
    }
}

/* ═══════════════════════════════════════════════════
   ♿ Accessibility
   ═══════════════════════════════════════════════════ */

.etm-mbu-dt-menu-link:focus-visible,
.etm-mbu-dt-action:focus-visible,
.etm-mbu-dt-search-trigger:focus-visible,
.etm-mbu-dt-logo:focus-visible {
    outline: 2px solid var(--etm-primary, #7c3aed);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .etm-mbu-desktop-bar,
    .etm-mbu-dt-menu-link,
    .etm-mbu-dt-action,
    .etm-mbu-dt-submenu,
    .etm-mbu-dt-search-trigger {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ═══════════════════════════════════════════════════
   🖨️ Print
   ═══════════════════════════════════════════════════ */

@media print {
    .etm-mbu-desktop-bar {
        display: none !important;
    }
}

/* ═══════════════════════════════════════════════════
   🎯 Body padding (وقتی Sticky)
   ═══════════════════════════════════════════════════ */

body.etm-mbu-desktop-sticky-active {
    padding-top: var(--etm-desktop-height, 56px);
}

body.etm-mbu-desktop-sticky-bottom-active {
    padding-bottom: var(--etm-desktop-height, 56px);
    padding-top: 0;
}

@media (max-width: 1024px) {
    body.etm-mbu-desktop-sticky-active,
    body.etm-mbu-desktop-sticky-bottom-active {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }
}