/* ===== Google Font ===== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;700;800&display=swap');

/* ===== Reset ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', Tahoma, Arial, sans-serif;
}

/* ===== General ===== */
body {
    background: #f7f8f6;
    color: #222;
    direction: rtl;
    padding-bottom: 90px;
}

/* ===== Header ===== */
.mobile-header {
    max-width: 1140px;
    margin: 0 auto;
    position: relative;
    background: #fff;
    padding: 20px 0 18px;
    border-bottom: 1px solid #e5e7eb;
    z-index: 1000;
}

.page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8px 24px 40px;
}

/* ===== Brand ===== */
.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
}

.brand-icon { font-size: 42px; }

.brand h1 {
    font-size: 38px;
    color: #2E7D32;
    line-height: 1.1;
    font-weight: 800;
}

.brand p {
    font-size: 14px;
    color: #666;
    margin-top: 4px;
}

/* ===== Menu ===== */
.menu-wrapper {
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
}

.menu-btn {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 12px;
    background: #f1f3f2;
    color: #222;
    font-size: 24px;
    cursor: pointer;
}

.menu-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 46px;
    width: 165px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
    overflow: hidden;
    z-index: 200;
}

.menu-dropdown a {
    display: block;
    padding: 13px 14px;
    color: #222;
    text-decoration: none;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
}

.menu-dropdown .menu-favorite-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-weight: 700;
}

.menu-heart { font-size: 17px; line-height: 1; }
.menu-dropdown a:last-child { border-bottom: none; }
.menu-dropdown a:hover { background: #f7f8f6; }
.menu-dropdown.show { display: block; }

.register-store-btn {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    background: #2E7D32;
    color: #fff;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: bold;
    z-index: 10;
}

/* ===== Search ===== */
.search-box {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 9px;
    margin-bottom: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
    display: flex;
    align-items: center;
}

.search-box input {
    flex: 1;
    min-width: 0;
    height: 52px;
    border: none;
    outline: none;
    background: #f7f8f6;
    border-radius: 0 15px 15px 0;
    padding: 0 16px;
    font-size: 15px;
}

.stores-search-btn {
    height: 52px;
    min-width: 115px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-decoration: none;
    color: #2E7D32;
    font-size: 14px;
    font-weight: bold;
    background: #f7fbf7;
    border-right: 1px solid #e5e7eb;
    border-radius: 15px 0 0 15px;
    white-space: nowrap;
}

.stores-search-btn:hover { background: #eef8ee; }
.stores-search-btn span { font-size: 13px; }

/* ===== Filters ===== */
.filters-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
}

.filters-card select {
    width: 100%;
    height: 42px;
    border: 1px solid #e5e7eb;
    background: #f7f8f6;
    border-radius: 15px;
    padding: 0 14px;
    font-size: 15px;
    outline: none;
}

/* ===== Status Filter ===== */
.status-filter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 38px;
    margin: 6px 0 14px;
}

.status-filter span {
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    color: #666;
    padding-bottom: 6px;
    line-height: 1.2;
    border-bottom: 3px solid transparent;
}

.status-filter span.active {
    color: #2E7D32;
    border-bottom-color: #2E7D32;
}

/* ===== Categories ===== */
.categories {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    padding: 4px 0 16px;
    margin-bottom: 6px;
    scrollbar-width: none;
}

.categories::-webkit-scrollbar { display: none; }

.categories button {
    flex: 0 0 auto;
    border: 1px solid #e5e7eb;
    background: #fff;
    color: #222;
    border-radius: 999px;
    padding: 11px 20px;
    font-size: 15px;
    white-space: nowrap;
    cursor: pointer;
}

.categories .active {
    background: #2E7D32;
    color: #fff;
    border-color: #2E7D32;
    font-weight: bold;
}

/* ===== Products Grid ===== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    align-items: stretch;
}

.no-results-message {
    grid-column: 1 / -1;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 35px 20px;
    text-align: center;
    color: #777;
    font-size: 17px;
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .05);
}

/* ===== Product Card ===== */
.product-card {
    height: 360px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    overflow: hidden;
    text-decoration: none;
    color: #222;
    box-shadow: 0 2px 12px rgba(0, 0, 0, .06);
    transition: .2s;
    display: flex;
    flex-direction: column;
}

.product-card:hover { transform: translateY(-3px); }

.image-wrap {
    position: relative;
    height: 200px;
    min-height: 200px;
    max-height: 200px;
    background: #ddd;
    overflow: hidden;
}

.image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: max-content;
    max-width: 100%;
    margin-bottom: 4px;
    padding: 2px 7px;
    border-radius: 14px;
    font-size: 9px;
    font-weight: bold;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.badge.ready { background: #2E7D32; }
.badge.order { background: #8B6F2A; }

.fav-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: #fff;
    color: #777;
    font-size: 23px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
}

.fav-btn.active { color: #e53935; }

.product-info {
    height: 160px;
    min-height: 160px;
    max-height: 160px;
    padding: 12px 14px 13px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.product-info h3 {
    font-size: 16px;
    margin-bottom: 4px;
    line-height: 1.35;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.store-link {
    display: block;
    color: #2E7D32;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 3px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: .2s;
    line-height: 1.4;
}

.store-link:hover {
    color: #256b2a;
    text-decoration: underline;
}

.location {
    color: #777;
    font-size: 12px;
    margin-bottom: 5px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.price {
    color: #2E7D32;
    font-size: 18px;
    font-weight: 800;
    text-align: left;
    width: 100%;
    margin-top: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

/* ===== Bottom Favorite ===== */
.bottom-favorite {
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    background: #2E7D32;
    color: #fff;
    text-decoration: none;
    padding: 13px 34px;
    border-radius: 999px;
    font-weight: bold;
    font-size: 15px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .18);
    z-index: 100;
}

/* ===== Smart Fields ===== */
.smart-field { position: relative; }

.smart-field input {
    width: 100%;
    height: 42px;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 0 12px;
    font-size: 14px;
    background: #f7f8f6;
}

.smart-field input:disabled {
    background: #f1f1f1;
    color: #999;
}

.smart-results {
    position: absolute;
    top: 48px;
    right: 0;
    left: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .08);
    z-index: 50;
    max-height: 220px;
    overflow-y: auto;
    display: none;
}

.smart-results button {
    width: 100%;
    border: none;
    background: #fff;
    padding: 12px;
    text-align: right;
    font-size: 14px;
    cursor: pointer;
}

.smart-results button:hover { background: #f7f8f6; }

.city-location-field { position: relative; }
.city-location-field input { padding-left: 45px !important; }

.location-btn {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    z-index: 5;
}

.location-btn span {
    font-size: 10px;
    color: #666;
    font-weight: 700;
    white-space: nowrap;
}

/* ===== Location Modal ===== */
.location-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 9999;
}

.location-modal.show { display: flex; }

.location-modal-box {
    width: 100%;
    max-width: 360px;
    background: #fff;
    border-radius: 22px;
    padding: 24px 20px;
    text-align: center;
    box-shadow: 0 12px 35px rgba(0, 0, 0, .18);
}

.location-modal-icon { font-size: 42px; margin-bottom: 10px; }
.location-modal-box h3 {
    font-size: 21px;
    color: #2E7D32;
    margin-bottom: 10px;
}

.location-modal-box p {
    font-size: 14px;
    color: #555;
    line-height: 1.8;
    margin-bottom: 18px;
}

#allowLocationBtn {
    width: 100%;
    height: 46px;
    border: none;
    border-radius: 14px;
    background: #2E7D32;
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    margin-bottom: 10px;
}

#cancelLocationBtn {
    width: 100%;
    height: 42px;
    border: none;
    background: #f1f3f2;
    color: #555;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

/* ============================================= */
/* ===== RESPONSIVE - MOBILE (max-width:768px) ===== */
/* ============================================= */

@media (max-width: 768px) {

    #categoryFilter { display: none; }

    .register-store-btn {
        left: 8px;
        padding: 7px 12px;
        font-size: 11px;
        border-radius: 10px;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    body { padding-bottom: 0; }

    .mobile-header,
    .page {
        max-width: 100%;
        width: 100%;
        margin: 0;
    }

    .mobile-header {
        padding: 12px 12px 8px;
    }

    .page {
        padding: 8px 0 40px;
    }

    .menu-wrapper {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        width: auto;
        padding: 0;
        display: flex;
        align-items: center;
        gap: 7px;
    }

    .brand-icon { font-size: 30px; }
    .brand h1 { font-size: 24px; }
    .brand p { font-size: 11px; }

    .search-box {
        padding: 6px;
        border-radius: 14px;
        margin-bottom: 10px;
    }

    .search-box input {
        height: 40px;
        font-size: 13px;
        border-radius: 0 10px 10px 0;
    }

    .stores-search-btn {
        height: 40px;
        min-width: 48px;
        padding: 0 10px;
        border-radius: 10px 0 0 10px;
        font-size: 20px;
    }

    .stores-search-btn span { display: none; }

    .filters-card {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 8px;
        border-radius: 14px;
        margin-bottom: 8px;
    }

    .filters-card select {
        height: 40px;
        font-size: 13px;
        border-radius: 10px;
    }

    .status-filter {
        gap: 28px;
        margin: 4px 0 10px;
    }

    .status-filter span {
        font-size: 13px;
        padding-bottom: 5px;
        border-bottom-width: 2px;
    }

    .categories {
        gap: 6px;
        padding-bottom: 10px;
        overflow-x: auto;
        scrollbar-width: none;
        cursor: grab;
    }

    .categories::-webkit-scrollbar { display: none; }
    .categories.dragging { cursor: grabbing; }

    .categories button {
        flex: 0 0 auto;
        padding: 6px 10px;
        font-size: 12px;
    }

    /* ===== Product Card - Mobile Only ===== */
    .product-card {
        height: 118px;
        display: grid;
        grid-template-columns: 42% 58%;
        width: 100%;
        border-radius: 14px;
        align-items: stretch;
        transform: none;
    }

    .product-card:hover { transform: none; }

    .image-wrap {
        order: 2;
        height: 118px;
        min-height: 118px;
        max-height: 118px;
    }

    .product-info {
        order: 1;
        height: 118px;
        min-height: 118px;
        max-height: 118px;
        padding: 8px 9px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        overflow: hidden;
    }

    .badge {
        margin-bottom: 2px;
        padding: 1px 6px;
        border-radius: 10px;
        font-size: 8px;
    }

    .fav-btn {
        top: 6px;
        left: 6px;
        width: 30px;
        height: 30px;
        font-size: 16px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
    }

    .product-info h3 {
        font-size: 14px;
        margin-bottom: 2px;
        line-height: 1.3;
        font-weight: 700;
    }

    .store-link {
        display: inline-block;
        width: auto;
        max-width: max-content;
        font-size: 11px;
        margin-bottom: 2px;
    }

    .store-name {
        font-size: 11px;
        margin-bottom: 2px;
    }

    .location {
        font-size: 10px;
        margin-bottom: 3px;
    }

    .price {
        font-size: 16px;
        margin-top: auto;
        text-align: right;
        line-height: 1.2;
    }

    .bottom-favorite {
        padding: 10px 22px;
        font-size: 13px;
    }
}