* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    background: #f5f7f5;
    color: #222;
    line-height: 1.6;
}

/* =========================================================
   Header
   ========================================================= */

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #2d6a2d, #3f8f3f);
    padding: 15px 30px;
}

.navbar-brand {
    color: #fff;
    font-size: 22px;
    font-weight: bold;
    text-decoration: none;
}

.navbar-links a {
    color: #eef7ee;
    text-decoration: none;
    margin-right: 20px;
    font-size: 15px;
}

    .navbar-links a:hover {
        color: #fff;
    }

/* =========================================================
   Container
   ========================================================= */

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 30px 20px 90px 20px;
}

/* =========================================================
   Product Grid
   ========================================================= */

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

/* =========================================================
   Product Cards
   ========================================================= */

.product-card {
    position: relative;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: pointer;
}

    .product-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
    }

    .product-card img {
        width: 100%;
        height: 180px;
        object-fit: contain;
        display: block;
    }

        .product-card img[style*="display: none"] {
            display: none !important;
        }

.product-card-body {
    padding: 14px;
}

.product-card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #1a1a1a;
}

.product-card-price {
    color: #2d6a2d;
    font-weight: bold;
    font-size: 17px;
}

.product-card-price-old {
    color: #999;
    text-decoration: line-through;
    font-size: 14px;
    margin-left: 8px;
}

/* =========================================================
   Discount Badge
   ========================================================= */

.discount-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #e63946;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 20px;
    z-index: 2;
}

/* =========================================================
   Add To Cart
   ========================================================= */

.add-to-cart-btn {
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    background: #2d6a2d;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

    .add-to-cart-btn:hover {
        background: #245524;
    }

/* =========================================================
   Category Filters
   ========================================================= */

.category-filters {
    margin-bottom: 20px;
}

    .category-filters a {
        display: inline-block;
        padding: 6px 14px;
        background: #eee;
        border-radius: 20px;
        color: #333;
        text-decoration: none;
        margin-left: 8px;
        font-size: 14px;
    }

        .category-filters a.active {
            background: #2d6a2d;
            color: #fff;
        }

/* =========================================================
   Footer
   ========================================================= */

footer {
    text-align: center;
    padding: 20px;
    color: #888;
    font-size: 13px;
}

/* =========================================================
   Floating Cart Button
   ========================================================= */

#floating-cart-btn {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 60px;
    height: 60px;
    background: #2d6a2d;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    cursor: pointer;
    z-index: 1000;
    transition: transform 0.15s;
}

    #floating-cart-btn:hover {
        transform: scale(1.08);
    }

    #floating-cart-btn svg {
        width: 28px;
        height: 28px;
        fill: #fff;
    }

#floating-cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e63946;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* =========================================================
   Cart Drawer
   ========================================================= */

#cart-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1001;
    display: none;
}

#cart-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 360px;
    max-width: 90vw;
    background: #fff;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 1002;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
}

    #cart-drawer.open {
        transform: translateX(0);
    }

#cart-drawer-overlay.open {
    display: block;
}

.cart-drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid #eee;
    background: #2d6a2d;
    color: #fff;
}

    .cart-drawer-header h3 {
        margin: 0;
    }

.cart-drawer-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
}

#cart-drawer-items {
    flex: 1;
    overflow-y: auto;
    padding: 15px 20px;
}

.cart-drawer-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
}

    .cart-drawer-footer button {
        width: 100%;
        padding: 12px;
        background: #2d6a2d;
        color: #fff;
        border: none;
        border-radius: 8px;
        font-size: 15px;
        font-weight: 600;
        cursor: pointer;
    }

/* =========================================================
   Toast
   ========================================================= */

#toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: #2d6a2d;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
}

    #toast.show {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

/* =========================================================
   Company Logo
   ========================================================= */

.company-logo {
    height: 40px;
    border-radius: 6px;
}

/* =========================================================
   Kinds Bar
   ========================================================= */

.kinds-bar {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 15px 20px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 20px;
}

.kind-pill {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    transition: background 0.15s;
    min-width: 70px;
}

    .kind-pill:hover {
        background: #f0f7f0;
    }

    .kind-pill img {
        width: 55px;
        height: 55px;
        border-radius: 50%;
        object-fit: cover;
        background: #eee;
    }

    .kind-pill span {
        font-size: 13px;
        text-align: center;
        white-space: nowrap;
    }

/* =========================================================
   Promo Slider
   ========================================================= */

.promo-slider {
    position: relative;
    width: 100%;
    height: 220px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 25px;
    background: #eee;
}

.promo-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
}

    .promo-slide.active {
        opacity: 1;
        z-index: 1;
    }

    .promo-slide img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

/* =========================================================
   Powered By
   ========================================================= */

.powered-by-bar {
    text-align: center;
    padding: 14px;
    background: #1a1a1a;
    margin-top: 40px;
}

    .powered-by-bar a {
        color: #ccc;
        text-decoration: none;
        font-size: 13px;
    }

        .powered-by-bar a:hover {
            color: #fff;
            text-decoration: underline;
        }

/* =========================================================
   نتائج البحث
   ========================================================= */

#search-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    padding: 10px;
}

/* =========================================================
   معلومات نتيجة البحث
   ========================================================= */

.search-product-info {
    flex: 1;
    min-width: 0;
}

.search-product-title {
    font-size: 17px;
    font-weight: 700;
    color: #222;
    margin-bottom: 4px;
}

.search-product-level {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
}

/* =========================================================
   صورة نتيجة البحث
   ========================================================= */

.search-product-image {
    width: 90px;
    min-width: 90px;
    height: 90px;
    border-radius: 12px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .search-product-image img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

.search-no-image {
    font-size: 12px;
    color: #999;
    text-align: center;
}

/* =========================================================
   الوحدات
   =========================================================

   الشكل المطلوب:

   ك                         199.00 جنيه
   -------------------------------------
   ع                         100.00 جنيه
   -------------------------------------

   كل وحدة في سطر مستقل.
   ========================================================= */

/* الحاوية نفسها BLOCK وليست FLEX */
.product-card.catalog-item .search-units {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-top: 8px !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

    /* =========================================================
   زر الوحدة
   ========================================================= */

    /*
   مهم:
   لا نستخدم flex للحاوية الخارجية.

   كل button عبارة عن صف مستقل بعرض البطاقة بالكامل.
*/

    .product-card.catalog-item .search-units .search-unit-btn {
        display: flex !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 38px !important;
        margin: 0 0 6px 0 !important;
        padding: 8px 10px !important;
        border: 1px solid #ddd !important;
        border-radius: 8px !important;
        background: #fff !important;
        box-sizing: border-box !important;
        align-items: center !important;
        justify-content: space-between !important;
        /*
       الاسم والسعر داخل نفس الزر أفقيًا
       ولكن الأزرار نفسها رأسيًا.
    */
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        direction: rtl !important;
        text-align: right !important;
        font-family: inherit !important;
        font-size: 14px !important;
        font-weight: normal !important;
        cursor: pointer !important;
        transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease !important;
    }

        /* آخر زر بدون مسافة تحته */
        .product-card.catalog-item .search-units .search-unit-btn:last-child {
            margin-bottom: 0 !important;
        }

        /* =========================================================
   Hover على الوحدة
   ========================================================= */

        .product-card.catalog-item .search-units .search-unit-btn:hover {
            background: #f5f5f5 !important;
            border-color: #aaa !important;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08) !important;
        }

        /* =========================================================
   اسم الوحدة
   ========================================================= */

        .product-card.catalog-item .search-units .search-unit-btn > span {
            display: block !important;
            width: auto !important;
            min-width: 0 !important;
            flex: 0 1 auto !important;
            font-weight: 700 !important;
            white-space: nowrap !important;
            text-align: right !important;
            margin: 0 !important;
            padding: 0 !important;
        }

        /* =========================================================
   السعر
   ========================================================= */

        .product-card.catalog-item .search-units .search-unit-btn > strong {
            display: block !important;
            width: auto !important;
            min-width: 0 !important;
            flex: 0 0 auto !important;
            margin-right: auto !important;
            margin-left: 0 !important;
            white-space: nowrap !important;
            font-size: 14px !important;
            font-weight: 700 !important;
            text-align: left !important;
            color: #2d6a2d !important;
        }

/* =========================================================
   في حالة عدم وجود سعر
   ========================================================= */

.search-no-price {
    font-size: 12px;
    color: #999;
    padding-top: 8px;
}

/* =========================================================
   لا توجد نتائج
   ========================================================= */

.search-empty {
    text-align: center;
    padding: 30px;
    color: #888;
    font-size: 16px;
}

/* =========================================================
   مهم جدًا:
   إذا كان catalog-container هو الحاوية الفعلية للكروت
   ========================================================= */

#catalog-container {
    width: 100%;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

/* =========================================================
   موبايل
   ========================================================= */

@media (max-width: 600px) {

    #search-results {
        grid-template-columns: 1fr;
        padding: 6px;
    }

    .search-product-image {
        width: 75px;
        min-width: 75px;
        height: 75px;
    }

    .search-product-title {
        font-size: 15px;
    }

    .product-card.catalog-item .search-units .search-unit-btn {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        padding: 7px 8px !important;
        min-height: 36px !important;
    }
}

/* =========================================================
   وحدات المنتج العادي
   كل وحدة في سطر مستقل
   ========================================================= */

/* =========================================================
   وحدات المنتج العادي
   الوحدة يمين - السعر شمال
   كل وحدة في سطر
   ========================================================= */

.product-card .product-units {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
    gap: 6px !important;
}

    .product-card .product-units .product-unit-btn {
        display: flex !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        /* الوحدة في اليمين والسعر في الشمال */
        direction: rtl !important;
        align-items: center !important;
        justify-content: space-between !important;
        text-align: right !important;
        padding: 8px 10px !important;
        margin: 0 !important;
        border: 1px solid #ddd !important;
        border-radius: 8px !important;
        background: #fff !important;
    }


        /* اسم الوحدة - يمين */

        .product-card .product-units .product-unit-btn > span:first-child {
            margin-right: 0 !important;
            margin-left: auto !important;
            text-align: right !important;
            white-space: nowrap !important;
        }


        /* السعر - شمال */

        .product-card .product-units .product-unit-btn > span:last-child {
            margin-right: auto !important;
            margin-left: 0 !important;
            text-align: left !important;
            white-space: nowrap !important;
            font-weight: bold !important;
            color: #2d6a2d !important;
        }

/* =========================================================
   موقع التوصيل داخل السلة
   ========================================================= */

.delivery-location-cart {
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 100%;
    margin: 10px 0;
    padding: 10px;
    background: #f7f7f7;
    border: 1px solid #ddd;
    border-radius: 8px;
    direction: rtl;
}

.delivery-location-btn {
    width: 100%;
    border: none;
    border-radius: 7px;
    background: #198754;
    color: #fff;
    padding: 10px;
    cursor: pointer;
    font-size: 15px;
}

    .delivery-location-btn:hover {
        background: #157347;
    }

#delivery-location-status {
    color: #555;
    font-size: 13px;
    text-align: center;
    direction: ltr;
    min-height: 18px;
}


/* =========================================================
   نافذة تحديد موقع التوصيل
   ========================================================= */

#delivery-location-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999999;
    background: rgba(0, 0, 0, 0.65);
    align-items: center;
    justify-content: center;
    padding: 15px;
}


/* =========================================================
   صندوق الخريطة
   ========================================================= */

.delivery-location-box {
    width: 100%;
    max-width: 700px;
    background: #fff;
    border-radius: 14px;
    padding: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
    direction: rtl;
    position: relative;
}


    /* =========================================================
   عنوان النافذة
   ========================================================= */

    .delivery-location-box h3 {
        margin: 0 0 8px 0;
        font-size: 20px;
    }


/* =========================================================
   التعليمات
   ========================================================= */

.delivery-location-info {
    color: #666;
    font-size: 14px;
    margin-bottom: 10px;
}


/* =========================================================
   الخريطة - مهم جدًا
   ========================================================= */

#delivery-map {
    width: 100% !important;
    height: 450px !important;
    min-height: 450px !important;
    display: block !important;
    position: relative;
    background: #ddd;
    border: 1px solid #ddd;
    border-radius: 10px;
    overflow: hidden;
}


/* =========================================================
   الإحداثيات
   ========================================================= */

.delivery-coordinates {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

    .delivery-coordinates > div {
        background: #f7f7f7;
        border: 1px solid #ddd;
        border-radius: 8px;
        padding: 8px;
        text-align: center;
    }

    .delivery-coordinates span {
        display: block;
        font-size: 12px;
        color: #777;
    }

    .delivery-coordinates strong {
        display: block;
        margin-top: 3px;
        direction: ltr;
        font-size: 14px;
    }


/* =========================================================
   أزرار النافذة
   ========================================================= */

.delivery-location-buttons {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

    .delivery-location-buttons button {
        flex: 1;
        min-height: 44px;
        border: none;
        border-radius: 8px;
        cursor: pointer;
        font-size: 16px;
    }


#delivery-location-cancel {
    background: #eee;
    color: #333;
}


#delivery-location-confirm {
    background: #198754;
    color: #fff;
}


/* =========================================================
   Leaflet
   ========================================================= */

#delivery-map .leaflet-container {
    width: 100%;
    height: 100%;
}