/**
 * optimized-mobile.css - أنماط مخصصة حصرياً للشاشات المحمولة (< 768px)
 * دون التعديل أو التأثير إطلاقاً على عرض أجهزة الكمبيوتر والمكتب
 */

/* إخفاء عناصر الجوال تماماً على أجهزة الكمبيوتر والمكتب */
@media (min-width: 768px) {
    .mobile-bottom-nav,
    .mobile-sticky-action-bar,
    .mobile-categories-scroll,
    .mobile-products-grid {
        display: none !important;
    }
}

/* الأنماط الخاصة بالهاتف المحمول فقط */
@media (max-width: 767.98px) {
    :root {
        --mobile-nav-height: 64px;
        --mobile-safe-bottom: env(safe-area-inset-bottom, 0px);
        --primary-orange: #FF7A00;
        --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
        --card-radius: 14px;
        --btn-radius: 10px;
    }

    /* جعل خلفية الصفحة والفوتر داكنة موحدة لإلغاء أي شريط أبيض سفلي */
    html, body {
        background-color: #f5f5f5 !important;
        -webkit-tap-highlight-color: transparent;
    }

    footer.footer {
        margin-bottom: 0 !important;
        padding-bottom: calc(var(--mobile-nav-height) + var(--mobile-safe-bottom) + 16px) !important;
        background-color: #121212 !important;
        border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    }

    /* ============================================================
       1. تصغير زر التراجع للأعلى (Back to Top Button)
       ============================================================ */
    .back-to-top,
    #back-to-top,
    .scroll-to-top {
        bottom: calc(var(--mobile-nav-height, 64px) + 12px) !important;
        right: 12px !important;
        z-index: 1035 !important;
        width: 35px !important;
        height: 35px !important;
        font-size: 14px !important;
        background: #FF7A00 !important;
        border: none !important;
        box-shadow: 0 3px 10px rgba(255, 122, 0, 0.4) !important;
    }

    /* ============================================================
       2. تصغير نافذة المقترحات المصغرة للجوال (Smaller Suggestion Popup)
       ============================================================ */
    .suggestion-popup {
        width: 200px !important;
        bottom: calc(var(--mobile-nav-height, 64px) + 12px) !important;
        left: 10px !important;
        z-index: 1035 !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35) !important;
        border-radius: 10px !important;
        overflow: hidden !important;
    }

    .suggestion-popup-header {
        padding: 5px 10px !important;
        background-color: #FF7A00 !important;
    }

    .suggestion-popup-header h5 {
        font-size: 12px !important;
        font-weight: 700 !important;
        margin: 0 !important;
    }

    .suggestion-popup-header .suggestion-popup-close {
        font-size: 16px !important;
    }

    .suggestion-popup-body {
        padding: 8px 10px !important;
        background-color: #ffffff !important;
    }

    .suggestion-popup-body p {
        font-size: 11px !important;
        margin-bottom: 8px !important;
        color: #333333 !important;
        line-height: 1.2 !important;
    }

    .suggestion-popup-body .btn {
        padding: 3px 10px !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        border-radius: 6px !important;
        background-color: #FF7A00 !important;
        border: none !important;
        color: #ffffff !important;
    }

    /* ============================================================
       3. شريط التنقل السفلي للجوال (Mobile Bottom Navigation)
       ============================================================ */
    .mobile-bottom-nav {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        height: calc(var(--mobile-nav-height) + var(--mobile-safe-bottom)) !important;
        padding-bottom: var(--mobile-safe-bottom) !important;
        background: rgba(18, 18, 18, 0.98) !important;
        backdrop-filter: blur(16px) !important;
        -webkit-backdrop-filter: blur(16px) !important;
        display: flex !important;
        justify-content: space-around !important;
        align-items: center !important;
        z-index: 1040 !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1) !important;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.35) !important;
    }

    .mobile-bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: #999999;
        text-decoration: none !important;
        padding: 6px 0;
        font-size: 11px;
        font-weight: 500;
        position: relative;
        transition: all 0.2s ease;
        min-height: 48px;
    }

    .mobile-bottom-nav-item i {
        font-size: 20px;
        margin-bottom: 3px;
        transition: all 0.2s ease;
    }

    .mobile-bottom-nav-item.active,
    .mobile-bottom-nav-item:active {
        color: var(--primary-orange) !important;
    }

    .mobile-bottom-nav-item.active i {
        transform: translateY(-2px) scale(1.15);
        color: var(--primary-orange);
    }

    .mobile-bottom-nav-item .mobile-nav-badge {
        position: absolute;
        top: 4px;
        right: 50%;
        margin-right: -18px;
        background: var(--primary-orange);
        color: #ffffff;
        font-size: 10px;
        font-weight: 700;
        min-width: 18px;
        height: 18px;
        line-height: 18px;
        border-radius: 9px;
        text-align: center;
        padding: 0 4px;
        box-shadow: 0 2px 6px rgba(255, 122, 0, 0.5);
    }

    /* ============================================================
       4. تصغير وتنسيق أزرار السلايدر باللون البرتقالي (#FF7A00) وعدم حجب النص
       ============================================================ */
    .hero-section {
        padding: 10px 0 !important;
    }

    .hero-slider {
        position: relative !important;
        margin-bottom: 20px !important;
        border-radius: 16px !important;
        overflow: hidden !important;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25) !important;
        background: transparent !important;
        padding: 0 !important;
    }

    .slick-hero-slider .slide-item,
    .hero-slider .slide-item {
        height: 250px !important;
        position: relative !important;
        border-radius: 16px !important;
        overflow: hidden !important;
    }

    .slick-hero-slider .slide-item img,
    .hero-slider .slide-item img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        border-radius: 16px !important;
    }

    .slick-hero-slider .slide-overlay,
    .hero-slider .slide-overlay {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background: linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.8) 100%) !important;
        border-radius: 16px !important;
    }

    .slick-hero-slider .slide-caption,
    .hero-slider .slide-caption {
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        padding: 18px 45px 18px 45px !important; /* مسافة جانبية كافية لتفادي أزرار الأسهم */
        z-index: 2 !important;
        color: #ffffff !important;
        text-align: center !important;
    }

    .slick-hero-slider .slide-caption h2,
    .hero-slider .slide-caption h2 {
        font-size: 1.25rem !important;
        font-weight: 800 !important;
        color: #ffffff !important;
        margin-bottom: 6px !important;
        text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7) !important;
    }

    .slick-hero-slider .slide-caption p,
    .hero-slider .slide-caption p {
        font-size: 0.82rem !important;
        color: rgba(255, 255, 255, 0.9) !important;
        margin-bottom: 10px !important;
        line-height: 1.3 !important;
    }

    .slick-hero-slider .slide-caption .btn,
    .hero-slider .slide-caption .btn {
        font-size: 0.8rem !important;
        font-weight: 700 !important;
        padding: 5px 16px !important;
        border-radius: 18px !important;
        background: #FF7A00 !important;
        border: none !important;
        color: #ffffff !important;
        box-shadow: 0 3px 10px rgba(255, 122, 0, 0.4) !important;
    }

    /* حاوية أزرار السلايدر */
    .slider-navigation {
        display: block !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        height: 100% !important;
        width: 100% !important;
        transform: none !important;
        pointer-events: none !important;
        z-index: 10 !important;
        padding: 0 !important;
    }

    /* تصغير أزرار أسهم السلايدر بلون #FF7A00 لعدم حجب النص على الصورة */
    .slider-prev, .slider-next,
    .slick-prev, .slick-next {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        position: absolute !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        width: 32px !important; /* حجم مصغر أنيق */
        height: 32px !important;
        border-radius: 50% !important;
        background: #FF7A00 !important; /* لون برتقالي ff7a00 */
        color: #ffffff !important;
        border: 1.5px solid #ffffff !important;
        pointer-events: auto !important;
        box-shadow: 0 3px 10px rgba(255, 122, 0, 0.5) !important;
        font-size: 14px !important;
    }

    .slider-prev i, .slider-next i,
    .slick-prev i, .slick-next i {
        color: #ffffff !important;
        font-weight: bold !important;
    }

    .slider-prev {
        right: 6px !important;
        left: auto !important;
    }

    .slider-next {
        left: 6px !important;
        right: auto !important;
    }

    /* ============================================================
       5. كروت الفعاليات (عروض حصرية + منتجات جديدة 2x2 Grid)
       ============================================================ */
    .hero-title h1 {
        font-size: 1.3rem !important;
        font-weight: 800 !important;
        margin-bottom: 6px !important;
        color: #ffffff !important;
    }

    .hero-title p {
        font-size: 0.85rem !important;
        margin-bottom: 14px !important;
        color: rgba(255, 255, 255, 0.8) !important;
    }

    .feature-cards {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
        margin-top: 15px !important;
    }

    .feature-card {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: 165px !important;
        border-radius: 14px !important;
        margin-bottom: 0 !important;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18) !important;
    }

    .feature-card .card-content {
        padding: 12px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
    }

    .feature-card .card-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 18px !important;
        margin-bottom: 4px !important;
    }

    .feature-card .card-title {
        font-size: 13px !important;
        font-weight: 700 !important;
        margin-bottom: 4px !important;
    }

    .feature-card .card-text {
        font-size: 10px !important;
        line-height: 1.25 !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        margin-bottom: 6px !important;
        opacity: 0.9 !important;
    }

    .feature-card .card-btn {
        font-size: 10px !important;
        padding: 4px 10px !important;
        border-radius: 6px !important;
        display: inline-block !important;
        align-self: flex-start !important;
    }

    /* ============================================================
       6. سلايدر صور التصنيفات للجوال (Clean Mobile Category Slider)
       ============================================================ */
    .categories-icons-section {
        padding: 15px 0 !important;
    }

    .categories-slider {
        margin-bottom: 10px !important;
    }

    .categories-slider .category-slide-item {
        padding: 0 4px !important;
    }

    .categories-slider .category-slide-content {
        background: #2C323B !important;
        border-radius: 16px !important;
        padding: 14px 8px 10px 8px !important;
        text-align: center !important;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2) !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
    }

    .categories-slider .category-description,
    .categories-slider .btn,
    .categories-slider-navigation {
        display: none !important;
    }

    .categories-slider .category-image-wrapper,
    .categories-slider .category-icon-wrapper {
        width: 72px !important;
        height: 72px !important;
        border-radius: 50% !important;
        border: 3.5px solid #FF7A00 !important;
        box-shadow: 0 0 14px rgba(255, 122, 0, 0.5) !important;
        margin: 0 auto 8px auto !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        overflow: hidden !important;
        background: #1E232A !important;
    }

    .categories-slider .category-image {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        border-radius: 50% !important;
    }

    .categories-slider .category-icon-wrapper i {
        font-size: 28px !important;
        color: #FF7A00 !important;
    }

    .categories-slider .category-name {
        font-size: 12px !important;
        font-weight: 700 !important;
        color: #ffffff !important;
        margin: 0 !important;
        line-height: 1.2 !important;
        text-align: center !important;
        max-width: 90px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    /* ============================================================
       7. تعبئة صورة المنتج المتاحة بالكامل داخل الإطار المخصص
       ============================================================ */
    #products-grid {
        display: flex !important;
        flex-wrap: wrap !important;
        margin-left: -5px !important;
        margin-right: -5px !important;
    }

    #products-grid > [class*="col"] {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        padding-left: 5px !important;
        padding-right: 5px !important;
        margin-bottom: 12px !important;
    }

    .row-cols-2 > [class*="col-"] {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        width: 50% !important;
    }

    .product-card, .card.h-100 {
        border-radius: var(--card-radius) !important;
        box-shadow: var(--card-shadow) !important;
        border: 1px solid rgba(0, 0, 0, 0.06) !important;
        background: #ffffff !important;
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
        height: 100% !important;
    }

    .product-card-image {
        position: relative !important;
        width: 100% !important;
        height: 176px !important;
        min-height: 176px !important;
        max-height: 176px !important;
        padding-top: 0 !important;
        background: #ffffff !important;
        overflow: hidden !important;
        border-radius: 12px 12px 0 0 !important;
    }

    .product-card-image img {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        border-radius: 12px 12px 0 0 !important;
    }

    .product-card > a > .card-img-top,
    .product-card > .card-img-top {
        width: 100% !important;
        height: 176px !important;
        min-height: 176px !important;
        max-height: 176px !important;
        object-fit: cover !important;
        object-position: center !important;
        border-radius: 12px 12px 0 0 !important;
        background: #ffffff !important;
    }

    .product-card .card-body {
        padding: 8px 10px 10px 10px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: space-between !important;
        flex-grow: 1 !important;
    }

    .product-card .card-title {
        font-size: 12px !important;
        font-weight: 700 !important;
        line-height: 1.3 !important;
        height: 2.6em !important;
        overflow: hidden !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        margin-bottom: 4px !important;
        color: #212326 !important;
    }

    .product-card .product-price {
        font-size: 13px !important;
        font-weight: 800 !important;
        color: var(--primary-orange) !important;
        margin-bottom: 6px !important;
    }

    .product-card .btn {
        width: 100% !important;
        font-size: 11px !important;
        font-weight: 700 !important;
        padding: 6px 4px !important;
        border-radius: var(--btn-radius) !important;
    }

    /* ضمان عدم تداخل زر السلة مع زر التفاصيل على الجوال */
    .quick-cart-inline {
        display: flex !important;
        flex-wrap: nowrap !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 6px !important;
        width: 100% !important;
        min-width: 0 !important;
        overflow: visible !important;
    }

    .quick-cart-inline > a.btn,
    .quick-cart-inline .btn[href*="product-details"] {
        flex: 1 1 5px !important;
        min-width: 0 !important;
        width: auto !important;
        max-width: 100% !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        padding: 8px 6px !important;
        font-size: 11px !important;
    }

    .quick-cart-inline .quick-add-to-cart-btn {
        flex: 0 0 40px !important;
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        height: 40px !important;
        padding: 0 !important;
        margin: 0 !important;
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        transform: none !important;
    }

    .store-card .store-card-header {
        height: 176px !important;
        max-height: 176px !important;
        overflow: hidden !important;
    }

    .store-card .store-logo {
        max-height: 160px !important;
        object-fit: contain !important;
    }

    .store-card .store-card-body {
        padding: 10px !important;
    }

    .store-card .store-name {
        font-size: 0.95rem !important;
        margin-bottom: 8px !important;
    }
}

/* ===== كاروسيل صور المنتجات (نمط موحد مطابق لمنتجات/الرئيسية) ===== */
.product-card-image {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #f8f9fa !important;
}

.product-card-image .carousel,
.product-card-image .carousel-inner,
.product-card-image .carousel-item {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: transparent !important;
}

.product-card-image .carousel-item {
    display: block !important;
    opacity: 0 !important;
    transform: none !important;
    transition: opacity 0.35s ease !important;
    pointer-events: none !important;
}

.product-card-image .carousel-item.active {
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 2 !important;
}

.product-card-image .carousel-item img,
.product-card-image .carousel .card-img-top,
.product-card-image > img.card-img-top {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: 100% !important;
    max-width: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
    display: block !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    mix-blend-mode: normal !important;
}

@media (min-width: 769px) {
    .product-card-image {
        height: 250px !important;
        background: #ffffff !important;
    }
    .product-card-image .carousel-item img,
    .product-card-image .carousel .card-img-top,
    .product-card-image > img {
        object-fit: contain !important;
    }
}

/* أزرار التنقل في الصورة */
.product-card-image .carousel-control-prev,
.product-card-image .carousel-control-next {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 40px !important;
    height: 40px !important;
    background-color: rgba(255, 122, 0, 0.95) !important;
    border: 2px solid #ffffff !important;
    border-radius: 50% !important;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 999 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    pointer-events: auto !important;
}

.product-card:hover .product-card-image .carousel-control-prev,
.product-card:hover .product-card-image .carousel-control-next {
    opacity: 1;
}

.product-card-image .carousel-control-prev {
    right: 6px !important;
    left: auto !important;
}

.product-card-image .carousel-control-next {
    left: 6px !important;
    right: auto !important;
}

.product-card-image .carousel-control-prev-icon,
.product-card-image .carousel-control-next-icon {
    width: 20px !important;
    height: 20px !important;
    background-size: 100% !important;
    filter: brightness(0) invert(1) !important;
}

/* على الهاتف: أزرار ظاهرة دائمًا */
@media (max-width: 768px) {
    .product-card-image .carousel-control-prev,
    .product-card-image .carousel-control-next {
        width: 46px !important;
        height: 46px !important;
        border-width: 2px !important;
        opacity: 1 !important;
    }
    .product-card-image .carousel-control-prev {
        right: 8px !important;
    }
    .product-card-image .carousel-control-next {
        left: 8px !important;
    }
    .product-card-image .carousel-control-prev-icon,
    .product-card-image .carousel-control-next-icon {
        width: 22px !important;
        height: 22px !important;
    }
}

/* زر الاتصال بلون أزرق بدل الأخضر */
.btn-call {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: #ffffff !important;
}

.btn-call:hover,
.btn-call:active,
.btn-call:focus {
    background-color: #0b5ed7 !important;
    border-color: #0a58ca !important;
    color: #ffffff !important;
}

/* ============================================================
   store-page: تقليص ارتفاع بطاقات المنتج في صفحة المتجر للجوال
   ============================================================ */
@media (max-width: 767.98px) {

    .product-card .card-price {
        font-size: 13px !important;
        font-weight: 800 !important;
        color: var(--primary-orange) !important;
        margin: 2px 0 4px 0 !important;
        text-align: center !important;
    }

    .product-card .product-meta {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 6px !important;
        flex-wrap: nowrap !important;
        margin: 3px 0 4px 0 !important;
    }

    .product-card .rating-pill,
    .product-card .likes-pill {
        padding: 2px 8px !important;
        font-size: 10px !important;
        border: 1px solid rgba(0, 0, 0, 0.06) !important;
        box-shadow: none !important;
        margin-right: 0 !important;
    }

    .product-card .rating-pill .value {
        width: 18px !important;
        height: 18px !important;
        line-height: 18px !important;
        font-size: 10px !important;
        margin-right: 3px !important;
        background: #ffb400 !important;
    }

    .product-card .stars-wrap {
        letter-spacing: -2px !important;
        margin: 0 2px !important;
    }

    .product-card .rate-star {
        font-size: 10px !important;
    }

    .product-card .meta-count {
        margin-left: 2px !important;
        font-size: 10px !important;
    }

    .product-card .likes-pill i {
        font-size: 10px !important;
        margin-right: 2px !important;
    }

    .product-card .category-badge {
        display: inline-flex !important;
        align-items: center !important;
        font-size: 10px !important;
        padding: 2px 8px !important;
        margin: 0 0 4px 0 !important;
        border: 1px solid rgba(0, 0, 0, 0.06) !important;
        background: #f6f7f9 !important;
    }

    .product-card .card-body > .text-center.mb-2 {
        margin-bottom: 2px !important;
    }
}
