/* ============================================================
   BOTTOM NAV (فقط موبایل)
============================================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #ffffff;
    border-top: 1px solid #e8e8e8;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 999;
    padding: 4px 0 env(safe-area-inset-bottom);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: #888;
    font-size: 11px;
    transition: 0.2s;
    position: relative;
    padding: 4px 12px;
    min-width: 52px;
    border-radius: 8px;
}

.nav-item i {
    font-size: 22px;
    transition: 0.2s;
}

.nav-item span {
    font-size: 10px;
    font-weight: 500;
}

.nav-item.active {
    color: #ff5722;
}

.nav-item.active i {
    transform: translateY(-2px);
}

.nav-badge {
    position: absolute;
    top: 0px;
    right: 4px;
    background: #ff2d55;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   BOTTOM SHEET (دسته‌بندی افقی + فروشگاه‌ها)
============================================================ */

.sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    display: none;
}

.sheet-overlay.open {
    display: block;
}

.category-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 24px 24px 0 0;
    z-index: 1001;
    padding: 12px 0 30px;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
}

.category-sheet.open {
    transform: translateY(0);
}

/* ===== هدر شیت ===== */
.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px 12px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
    position: relative;
}

.sheet-handle {
    width: 40px;
    height: 4px;
    background: #ddd;
    border-radius: 4px;
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
}

.sheet-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #222;
}

.sheet-close {
    background: none;
    border: none;
    font-size: 22px;
    color: #999;
    cursor: pointer;
    padding: 4px;
}

/* ===== باکس جستجو ===== */
.sheet-search {
    display: flex;
    align-items: center;
    background: #f5f5f5;
    border-radius: 12px;
    padding: 0 14px;
    margin: 12px 20px;
    flex-shrink: 0;
    height: 44px;
}

.sheet-search i {
    color: #aaa;
    font-size: 16px;
}

.sheet-search input {
    flex: 1;
    border: none;
    background: none;
    outline: none;
    padding: 8px 12px;
    font-size: 15px;
    color: #333;
}

.sheet-search input::placeholder {
    color: #bbb;
}

/* ===== دسته‌بندی‌ها (افقی با اسکرول و درگ) ===== */
.sheet-categories-horizontal {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    padding: 12px 20px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-shrink: 0;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    cursor: grab;
    user-select: none;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    scroll-behavior: smooth;
    /* این خط رو اضافه کن تا اسکرول با درگ کار کنه */
    -webkit-user-drag: none;
}

.sheet-categories-horizontal:active {
    cursor: grabbing;
}

.sheet-categories-horizontal::-webkit-scrollbar {
    display: none;
}

/* ===== آیتم‌های دسته‌بندی ===== */
.sheet-category-item-horizontal {
    flex: 0 0 auto;
    min-width: 80px;
    padding: 8px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.25s;
    background: #f8f8f8;
    color: #666;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
}

.sheet-category-item-horizontal.active {
    background: #fff0ed;
    border-color: #ff5722;
    color: #ff5722;
}

.sheet-category-item-horizontal img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.sheet-category-item-horizontal i {
    font-size: 20px;
    color: #888;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border-radius: 50%;
}

.sheet-category-item-horizontal.active i {
    color: #ff5722;
    background: #fff0ed;
}

.sheet-category-item-horizontal span {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}


/* ===== فروشگاه‌ها (عمودی با اسکرول) ===== */
.sheet-restaurants-list {
    flex: 1;
    overflow-y: auto; /* اسکرول عمودی */
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 10px;
    max-height: 50vh; /* حداکثر ارتفاع */
}

/* ===== آیتم دسته‌بندی ===== */
.sheet-category-item-horizontal {
    flex: 0 0 auto; /*防止 shrink شدن */
    min-width: 70px;
    padding: 8px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: 0.25s;
    background: #f8f8f8;
    color: #666;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.sheet-category-item-horizontal.active {
    background: #fff0ed;
    border-color: #ff5722;
    color: #ff5722;
}

.sheet-category-item-horizontal img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.sheet-category-item-horizontal i {
    font-size: 20px;
    color: #888;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border-radius: 50%;
}

.sheet-category-item-horizontal.active i {
    color: #ff5722;
    background: #fff0ed;
}

.sheet-category-item-horizontal span {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

/* ===== فروشگاه‌ها ===== */
.sheet-restaurants {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 12px 20px 20px;
    overflow: hidden;
}

.sheet-restaurants-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.sheet-restaurants-header #selectedCategoryName {
    font-size: 16px;
    font-weight: 700;
    color: #222;
}

.sheet-restaurants-count {
    font-size: 13px;
    color: #999;
}

.sheet-restaurants-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
/* ===== آیتم فروشگاه ===== */
.sheet-restaurant-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    text-decoration: none;
    color: #333;
    transition: 0.2s;
    background: #fafafa;
    border: 1px solid #f0f0f0;
}

.sheet-restaurant-item:hover {
    background: #f5f5f5;
    border-color: #e0e0e0;
}

.sheet-restaurant-item img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
}

.sheet-restaurant-item .info {
    flex: 1;
}

.sheet-restaurant-item .name {
    font-size: 15px;
    font-weight: 600;
    color: #222;
}

.sheet-restaurant-item .address {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

.sheet-restaurant-item .rating {
    font-size: 13px;
    color: #ff5722;
    display: flex;
    align-items: center;
    gap: 4px;
}

.sheet-restaurant-item .rating i {
    font-size: 13px;
}

.sheet-loading {
    text-align: center;
    padding: 30px;
    color: #999;
}

.sheet-empty {
    text-align: center;
    padding: 30px;
    color: #999;
}

.sheet-empty i {
    font-size: 40px;
    display: block;
    margin-bottom: 10px;
    color: #ddd;
}

/* ============================================================
   ریسپانسیو
============================================================ */

@media (max-width: 768px) {
    .bottom-nav {
        display: flex !important;
    }

    /* فضای خالی برای محتوای زیر منو */
    body {
        padding-bottom: 70px !important;
    }
    
    /* مخفی کردن آیکون خروج و حساب کاربری در موبایل */
    .header-actions a[href="logout.php"],
    .header-actions a[href="profile.php"] {
        display: none !important;
    }
}

@media (min-width: 769px) {
    .bottom-nav {
        display: none !important;
    }
    .category-sheet {
        display: none !important;
    }
    .sheet-overlay {
        display: none !important;
    }
}