/* DNav Modals, Stories & Contact Popups */

@media (max-width: 1024px) {
    /* Search Bar - رفع مشکل رفتن زیر نوار با sticky و z-index */
    .dnav-search-bar-wrap { 
        padding: 10px 15px; 
        background: #ffffff; 
        border-bottom: 1px solid rgba(0,0,0,0.05); 
        width: 100%; 
        box-sizing: border-box; 
        flex-shrink: 0; 
        position: sticky; 
        top: 0; 
        z-index: 100; 
    }
    
    .dnav-search-box { 
        display: flex; 
        align-items: center; 
        background: var(--dnav-search-bg); 
        border: 1px solid var(--dnav-search-border); 
        border-radius: 8px; 
        padding: 8px 12px; 
        width: 100%; 
        box-sizing: border-box; 
        gap: 8px; 
    }
    
    .dnav-search-icon { 
        color: #a1a3a8; 
        flex-shrink: 0; 
    }
    
    .dnav-search-input { 
        background: transparent; 
        border: none; 
        outline: none; 
        width: 100%; 
        font-family: inherit; 
        font-size: 13px; 
        color: #3f4064; 
        padding: 0; 
        box-shadow: none; 
    }
    
    .dnav-search-input::placeholder { 
        color: #a1a3a8; 
    }
    
    .dnav-search-results-container { 
        flex: 1; 
        width: 100%; 
        background: #fff; 
        overflow-y: auto; 
        overflow-x: hidden; 
        border-radius: 0 0 var(--dnav-border-radius) var(--dnav-border-radius); 
        
        /* مخفی کردن اسکرول‌بار */
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE and Edge */
    }
    
    /* مخفی کردن اسکرول‌بار در مرورگرهای کروم و سافاری */
    .dnav-search-results-container::-webkit-scrollbar {
        display: none;
    }
    
    .dnav-search-loading { 
        display: flex; 
        justify-content: center; 
        padding: 30px; 
    }
    
    .dnav-spinner { 
        width: 30px; 
        height: 30px; 
        border: 3px solid rgba(239, 64, 86, 0.2); 
        border-top-color: #ef4056; 
        border-radius: 50%; 
        animation: dnavSpin 1s linear infinite; 
    }
    
    @keyframes dnavSpin { 
        to { transform: rotate(360deg); } 
    }
    
    /* فاصله دادن نتایج از بالای نوار جستجو و رفع باگ آخرین نتیجه */
    .dnav-search-results-list { 
        display: flex; 
        flex-direction: column; 
        padding-top: 8px; 
        /* اضافه کردن پدینگ داینامیک پایین برای جلوگیری از رفتن زیر نوار */
        padding-bottom: calc(95px + var(--dnav-margin-bottom, 0px));
    }
    
    .dnav-p-no-results { 
        padding: 30px; 
        text-align: center; 
        color: #62666d; 
        font-size: 14px; 
    }
    
    .dnav-p-card { 
        display: flex; 
        padding: 15px; 
        border-bottom: 1px solid #f0f0f1; 
        text-decoration: none; 
        color: inherit; 
        align-items: flex-start; 
    }
    
    .dnav-p-card:active { 
        background-color: #fafafa; 
    }
    
    .dnav-p-image { 
        width: 110px; 
        height: 110px; 
        flex-shrink: 0; 
        margin-left: 15px; 
        display: flex; 
        justify-content: center; 
        align-items: center; 
    }
    
    .dnav-p-image img { 
        max-width: 100%; 
        max-height: 100%; 
        object-fit: contain; 
        mix-blend-mode: multiply; 
    }
    
    .dnav-p-details { 
        flex: 1; 
        display: flex; 
        flex-direction: column; 
        min-width: 0; 
    }
    
    .dnav-p-title { 
        font-size: 13px; 
        font-weight: 500; 
        color: #424750; 
        line-height: 1.6; 
        margin: 0 0 10px 0; 
        display: -webkit-box; 
        -webkit-line-clamp: 2; 
        -webkit-box-orient: vertical; 
        overflow: hidden; 
    }
    
    .dnav-p-meta { 
        display: flex; 
        justify-content: space-between; 
        align-items: center; 
        margin-bottom: 8px; 
        font-size: 11px; 
    }
    
    .dnav-p-stock { 
        color: #ef4056; 
    }
    
    .dnav-p-rating { 
        color: #424750; 
        display: flex; 
        align-items: center; 
        gap: 2px; 
    }
    
    .dnav-p-price-box { 
        display: flex; 
        flex-direction: column; 
        align-items: flex-end; 
        width: 100%; 
    }
    
    .dnav-p-price-row { 
        display: flex; 
        align-items: center; 
        justify-content: flex-end; 
        gap: 8px; 
        width: 100%; 
    }
    
    .dnav-p-discount { 
        background: #ef4056; 
        color: #fff; 
        font-size: 12px; 
        font-weight: bold; 
        padding: 0 6px; 
        border-radius: 12px; 
        line-height: 20px; 
    }
    
    .dnav-p-new-price { 
        font-size: 15px; 
        font-weight: bold; 
        color: #424750; 
    }
    
    .dnav-currency { 
        font-size: 10px; 
        font-weight: normal; 
    }
    
    .dnav-p-old-price { 
        font-size: 12px; 
        color: #a1a3a8; 
        text-decoration: line-through; 
        margin-top: 2px; 
    }

    /* Stories Slider */
    .dnav-stories-wrapper { 
        display: flex; 
        gap: 12px; 
        padding: 15px 15px; 
        overflow-x: auto; 
        background: #fff; 
        border-bottom: 1px solid #f0f0f1; 
        scrollbar-width: none; 
        -ms-overflow-style: none; 
        box-sizing: border-box; 
        width: 100%; 
        flex-shrink: 0; 
        scroll-snap-type: x mandatory; 
    }
    
    .dnav-stories-wrapper::-webkit-scrollbar { 
        display: none; 
    }
    
    .dnav-story-item { 
        display: flex; 
        flex-direction: column; 
        align-items: center; 
        cursor: pointer; 
        flex-shrink: 0; 
        width: calc(100% / var(--dnav-story-vis) - 10px); 
        scroll-snap-align: start; 
        -webkit-tap-highlight-color: transparent; 
    }
    
    .dnav-story-thumb { 
        width: 100%; 
        aspect-ratio: 1/1; 
        border-radius: 50%; 
        padding: 2.5px; 
        background: linear-gradient(45deg, var(--dnav-story-border), #ff7a00); 
        display: flex; 
        align-items: center; 
        justify-content: center; 
        box-sizing: border-box; 
        transition: transform 0.2s ease; 
    }
    
    .dnav-story-item:active .dnav-story-thumb { 
        transform: scale(0.92); 
    }
    
    .dnav-story-thumb img { 
        width: 100%; 
        height: 100%; 
        border-radius: 50%; 
        object-fit: cover; 
        border: 2.5px solid #fff; 
        box-sizing: border-box; 
    }
    
    .dnav-story-text { 
        font-size: 11px; 
        margin-top: 6px; 
        text-align: center; 
        color: var(--dnav-story-text); 
        white-space: nowrap; 
        overflow: hidden; 
        text-overflow: ellipsis; 
        max-width: 100%; 
        font-weight: 500; 
    }
}

/* Stories Modal Base */
.dnav-story-viewer-modal { 
    position: fixed !important; 
    top: 0 !important; 
    left: 0 !important; 
    width: 100vw !important; 
    height: 100dvh !important; 
    background: #0c0c0c !important; 
    z-index: 999999999 !important; 
    display: none; 
    flex-direction: column; 
}

.dnav-story-viewer-modal.active { 
    display: flex; 
    animation: dnavFadeInModal 0.3s ease; 
}

@keyframes dnavFadeInModal { 
    from { opacity: 0; } 
    to { opacity: 1; } 
}

.dnav-story-header { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    padding: 15px 10px 30px 10px; 
    z-index: 2; 
    background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent); 
    box-sizing: border-box; 
}

.dnav-story-progress-container { 
    display: flex; 
    gap: 5px; 
    width: 100%; 
    height: 3px; 
    margin-bottom: 15px; 
}

.dnav-story-progress-bar { 
    flex: 1; 
    background: rgba(255,255,255,0.3); 
    border-radius: 3px; 
    overflow: hidden; 
}

.dnav-story-progress-fill { 
    height: 100%; 
    background: #fff; 
    width: 0%; 
}

.dnav-story-close { 
    color: #fff; 
    cursor: pointer; 
    float: left; 
    margin-left: 5px; 
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); 
}

.dnav-story-body { 
    flex: 1; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    position: relative; 
    width: 100%; 
    height: 100%; 
}

.dnav-story-link { 
    display: block; 
    width: 100%; 
    height: 100%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

.dnav-story-body img { 
    max-width: 100%; 
    max-height: 100dvh; 
    object-fit: contain; 
}

.dnav-story-like-wrapper { 
    position: absolute; 
    bottom: 40px; 
    right: 20px; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    gap: 5px; 
    z-index: 5; 
}

.dnav-story-like-btn { 
    background: rgba(0,0,0,0.4); 
    border: none; 
    color: #fff; 
    border-radius: 50%; 
    width: 50px; 
    height: 50px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    cursor: pointer; 
    backdrop-filter: blur(5px); 
    -webkit-backdrop-filter: blur(5px); 
    transition: all 0.2s; 
    outline: none; 
    -webkit-tap-highlight-color: transparent; 
}

.dnav-story-like-btn.liked { 
    color: #ff3040; 
    animation: heartPulse 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
}

@keyframes heartPulse { 
    0% { transform: scale(1); } 
    50% { transform: scale(1.3); } 
    100% { transform: scale(1); } 
}

.dnav-story-like-count { 
    color: #fff; 
    font-size: 13px; 
    font-weight: bold; 
    text-shadow: 0 1px 3px rgba(0,0,0,0.8); 
}

/* Contact Popup */
.dnav-contact-popup-modal { 
    position: fixed !important; 
    inset: 0 !important; 
    width: 100vw !important; 
    height: 100dvh !important; 
    z-index: 999997 !important; 
    display: none; 
    align-items: flex-end; 
    justify-content: center; 
    box-sizing: border-box; 
    padding: 0; 
}

.dnav-contact-popup-modal.active { 
    display: flex !important; 
}

.dnav-contact-popup-overlay { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background-color: rgba(0, 0, 0, 0.5); 
    backdrop-filter: blur(4px); 
    -webkit-backdrop-filter: blur(4px); 
    transition: all 0.3s ease; 
}

.dnav-contact-popup-content { 
    position: relative; 
    background: var(--dnav-contact-bg); 
    color: var(--dnav-contact-text); 
    width: 100%; 
    max-width: var(--dnav-contact-width); 
    border-radius: 20px 20px 0 0; 
    box-shadow: 0 -5px 25px rgba(0,0,0,0.15); 
    overflow: hidden; 
    z-index: 10; 
    margin-bottom: calc(var(--dnav-margin-bottom) + 60px); 
    animation: dnavPopupSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1); 
    direction: rtl; 
    text-align: right; 
    box-sizing: border-box; 
    display: flex; 
    flex-direction: column; 
}

@media (max-width: 1024px) {
    .dnav-contact-popup-modal { 
        align-items: flex-end !important; 
        padding: 0 var(--dnav-margin-side) !important; 
        justify-content: center; 
    }
    
    .dnav-contact-popup-content { 
        max-width: 100% !important; 
        border-radius: 24px !important; 
        margin-bottom: calc(var(--dnav-margin-bottom) + 80px) !important; 
        padding-bottom: 20px !important; 
        animation: dnavPopupSlideUpMob 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important; 
    }
}

@keyframes dnavPopupSlideUp { 
    from { transform: translateY(100%); } 
    to { transform: translateY(0); } 
}

@keyframes dnavPopupSlideUpMob { 
    from { transform: translateY(80px); opacity: 0; } 
    to { transform: translateY(0); opacity: 1; } 
}

.dnav-contact-popup-header { 
    padding: 20px 20px 15px 20px; 
    border-bottom: 1px solid rgba(0,0,0,0.06); 
    position: relative; 
}

.dnav-contact-popup-header h3 { 
    margin: 0 0 5px 0; 
    font-size: 16px; 
    font-weight: bold; 
    color: var(--dnav-contact-text); 
}

.dnav-contact-popup-desc { 
    margin: 0; 
    font-size: 12px; 
    opacity: 0.8; 
}

.dnav-contact-popup-close-btn { 
    position: absolute; 
    top: 18px; 
    left: 18px; 
    background: transparent; 
    border: none; 
    color: var(--dnav-contact-text); 
    cursor: pointer; 
    padding: 0; 
    outline: none; 
    opacity: 0.7; 
    transition: opacity 0.2s; 
}

.dnav-contact-popup-close-btn:hover { 
    opacity: 1; 
}

.dnav-contact-popup-body { 
    padding: 20px; 
    overflow-y: auto; 
    max-height: calc(80vh - 100px); 
}

.dnav-contact-grid-presets { 
    display: flex; 
    flex-direction: column; 
    gap: 12px; 
}

.dnav-contact-preset-item { 
    display: flex; 
    align-items: center; 
    padding: 12px 15px; 
    border-radius: 10px; 
    text-decoration: none !important; 
    background: rgba(0,0,0,0.02); 
    transition: background 0.2s, transform 0.2s; 
    box-sizing: border-box; 
    border: 1px solid rgba(0,0,0,0.03); 
}

.dnav-contact-preset-item:active { 
    transform: scale(0.98); 
}

.preset-icon-wrap { 
    width: 36px; 
    height: 36px; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    margin-left: 12px; 
    flex-shrink: 0; 
    color: #ffffff; 
    overflow: hidden; 
}

.preset-icon-wrap img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
}

.preset-title { 
    font-size: 12px; 
    font-weight: 700; 
    flex: 1; 
    color: var(--dnav-contact-text); 
}

.preset-val { 
    font-size: 11px; 
    opacity: 0.9; 
    font-weight: 500; 
    color: var(--dnav-contact-text); 
    margin-right: 10px; 
}

.dnav-contact-channels-divider { 
    border-top: 1px solid rgba(0,0,0,0.06); 
    margin: 20px 0 15px 0; 
}

.dnav-contact-channels-title { 
    margin: 0 0 12px 0; 
    font-size: 13px; 
    font-weight: bold; 
    color: var(--dnav-contact-text); 
}

.dnav-social-channels-row { 
    display: flex; 
    flex-direction: row; 
    flex-wrap: nowrap; 
    overflow-x: auto; 
    gap: 15px; 
    padding-bottom: 5px; 
    scrollbar-width: none; 
    -ms-overflow-style: none; 
}

.dnav-social-channels-row::-webkit-scrollbar { 
    display: none; 
}

.dnav-social-item { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    gap: 6px; 
    text-decoration: none !important; 
    flex-shrink: 0; 
    transition: transform 0.1s; 
}

.dnav-social-item:active { 
    transform: scale(0.90); 
}

.dnav-social-item .social-icon { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    width: var(--dnav-social-icon-size); 
    height: var(--dnav-social-icon-size); 
}

.dnav-social-item .social-icon img { 
    width: 100%; 
    height: 100%; 
    object-fit: contain; 
}

.dnav-social-item .social-name { 
    font-size: var(--dnav-social-text-size); 
    font-weight: 600; 
    white-space: nowrap; 
}