.sidebar { height: 100vh !important; padding-bottom: 70px; }
.sidebar-menu { padding-bottom: 100px !important; overflow-y: auto !important; }

:root {
    --primary: #5A1E20; 
    --primary-light: #7A2E31;
    --gold: #C69C6D;
    --gold-light: #E2C296;
    --bg: #FFFDF9;
    --text: #3A261D;
    --danger: #C0392B;
    --success: #27AE60;
    --shadow: rgba(90, 30, 32, 0.12);
}

html, body { 
    margin: 0; padding: 0; box-sizing: border-box; 
    font-family: 'Cairo', sans-serif; 
    background: var(--bg); color: var(--text); 
    display: flex; flex-direction: column; min-height: 100vh;
    padding-bottom: 70px;
}

*, *::before, *::after { box-sizing: inherit; -webkit-tap-highlight-color: transparent;}

.header { background: var(--primary); padding: 10px 15px; position: sticky; top: 0; z-index: 1000; box-shadow: 0 4px 10px rgba(0,0,0,0.1); display: flex; justify-content: space-between; align-items: center; gap: 5px; }
.header-side { display: flex; gap: 10px; align-items: center; flex: 1; }

.logo-container { display: flex; flex-direction: column; align-items: center; text-align: center; flex: 2; }
.logo-img { width: 55px; height: 55px; border-radius: 50%; border: 2px solid var(--gold); object-fit: cover; background: white; }
.logo-text { color: var(--gold-light); font-size: 0.75rem; font-weight: 700; margin-top: 3px; line-height: 1.2; }

.icon-btn { background: var(--gold); color: var(--primary); width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; border: none; cursor: pointer; position: relative; transition: transform 0.2s; }
.icon-btn:active { transform: scale(0.9); }
.cart-count { position: absolute; top: -5px; right: -5px; background: var(--danger); color: white; width: 20px; height: 20px; border-radius: 50%; font-size: 0.75rem; display: flex; align-items: center; justify-content: center; font-weight: bold; }
.points-btn { background: #f1c40f; color: var(--primary); }

.install-btn { background: var(--gold); color: var(--primary); border: none; border-radius: 20px; padding: 6px 12px; font-family: inherit; font-size: 0.75rem; font-weight: 800; cursor: pointer; display: none; align-items: center; gap: 6px; box-shadow: 0 2px 5px rgba(0,0,0,0.15); transition: transform 0.2s, background 0.2s; }
.install-btn:active { transform: scale(0.95); }

.delivery-notice { background: var(--gold-light); color: var(--primary); padding: 6px; text-align: center; font-weight: 700; font-size: 0.85rem; }

.search-container { padding: 10px 15px; background: var(--bg); border-bottom: 1px solid #eee; }
.search-input { width: 100%; padding: 10px; border: 2px solid var(--primary); border-radius: 20px; text-align: center; font-family: inherit; font-size: 0.95rem; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.search-input:focus { outline: none; border-color: var(--gold); }

.sidebar-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1500; display: none; opacity: 0; transition: opacity 0.3s; }
.sidebar-overlay.active { display: block; opacity: 1; }
.sidebar { position: fixed; top: 0; right: -280px; width: 260px; height: 100%; background: white; z-index: 2000; box-shadow: -2px 0 10px rgba(0,0,0,0.1); transition: right 0.3s ease; display: flex; flex-direction: column; }
.sidebar.active { right: 0; }
.sidebar-header { background: var(--primary); color: var(--gold-light); padding: 15px; display: flex; justify-content: space-between; align-items: center; font-size: 1.2rem; font-weight: bold; }
.sidebar-header button { background: none; border: none; color: var(--gold-light); font-size: 1.5rem; cursor: pointer; }
.sidebar-menu { flex: 1; overflow-y: auto; padding: 15px 10px; display: flex; flex-direction: column; gap: 8px; }
.sidebar-btn { background: #f9f9f9; border: 1px solid #eee; padding: 12px 15px; border-radius: 10px; text-align: right; font-family: inherit; font-size: 1rem; font-weight: 700; color: var(--primary); cursor: pointer; transition: 0.2s; display: flex; align-items: center; gap: 10px; }
.sidebar-btn i { color: var(--gold); width: 20px; text-align: center; }
.sidebar-btn.active, .sidebar-btn:hover { background: var(--primary-light); color: white; border-color: var(--primary); }
.sidebar-btn.active i, .sidebar-btn:hover i { color: var(--gold-light); }
.special-offer-btn-side { background: var(--danger) !important; color: white !important; }
.special-offer-btn-side i { color: #f1c40f !important; }

.container { max-width: 1200px; margin: 0 auto; padding: 10px 15px 20px; flex: 1; width: 100%; }

.sub-tabs-wrapper { position: sticky; top: 75px; background: var(--bg); z-index: 990; padding: 10px 0; border-bottom: 1px solid #eee; margin-bottom: 15px; }
.sub-tabs { display: none; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; width: 100%; }
.sub-tabs.show-tabs { display: grid; }
.sub-tab-btn { background: white; border: 1px solid var(--gold); color: var(--primary); padding: 8px 5px; border-radius: 20px; font-size: 0.85rem; font-weight: bold; cursor: pointer; transition: 0.3s; text-align: center; line-height: 1.2; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.sub-tab-btn.active { background: var(--primary); color: white; border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 6px rgba(0,0,0,0.1); }

.products-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.product-card { background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 5px rgba(0,0,0,0.06); border: 1px solid #eee; display: flex; flex-direction: column; transition: all 0.3s ease; }
.product-card:hover { transform: translateY(-3px); box-shadow: 0 5px 15px var(--shadow); border-color: var(--gold-light); }
.product-img { width: 100%; height: 150px; object-fit: contain; padding: 5px; border-bottom: 1px solid #f5f5f5; background: #fff; }

.product-info { padding: 10px; text-align: center; display: flex; flex-direction: column; height: 100%; justify-content: space-between; }
.product-name { font-weight: 700; color: var(--primary); margin-bottom: 5px; font-size: 0.85rem; line-height: 1.3; }
.product-price { color: var(--danger); font-weight: 800; font-size: 0.95rem; margin-bottom: 5px; }

.qty-controls-container { display:flex; align-items:center; justify-content:space-between; background:#f9f9f9; border-radius:8px; padding:5px; border: 1px solid #eee; }
.qty-btn-grid { background: var(--gold-light); color: var(--primary); border: none; width: 30px; height: 30px; border-radius: 5px; font-weight: bold; font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.qty-display-grid { font-weight: bold; color: var(--primary); font-size: 0.9rem; min-width: 40px; }

.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 2500; align-items: center; justify-content: center; padding: 15px; }
.modal.active { display: flex; }
.modal-content { background: white; width: 100%; max-width: 500px; border-radius: 15px; padding: 20px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--gold-light); padding-bottom: 10px; margin-bottom: 15px; }
.close-btn { background: none; border: none; font-size: 1.5rem; color: var(--danger); cursor: pointer; }

.cart-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #eee; }
.qty-btn { background: var(--gold-light); border: none; width: 25px; height: 25px; border-radius: 5px; font-weight: bold; cursor: pointer; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: bold; color: var(--primary); font-size: 0.9rem; }
.form-control { width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 8px; font-family: inherit; }
.delivery-options { display: flex; flex-direction: column; gap: 10px; margin-top: 5px; }
.del-btn { width: 100%; padding: 12px; border: 2px solid #ccc; background: white; border-radius: 8px; cursor: pointer; font-weight: bold; text-align: center; font-size: 0.9rem; transition: 0.2s; }
.del-btn.selected { border-color: var(--success); background: #e8f5e9; color: var(--success); }
.map-link-btn { display: block; text-align: center; background: #e8f0fe; color: #1a73e8; border: 1px solid #aecbfa; padding: 10px; border-radius: 8px; text-decoration: none; font-weight: bold; font-size: 0.9rem; margin-top: 10px; transition: 0.2s; }

.add-btn { background: var(--primary); color: white; border: none; padding: 12px; border-radius: 8px; font-weight: bold; width: 100%; cursor: pointer; font-family: inherit; font-size: 1rem; }

.sticky-cart { position: fixed; top: 75px; left: 15px; z-index: 900; background: linear-gradient(135deg, var(--primary), var(--gold)); color: white; border: none; border-radius: 50%; width: 50px; height: 50px; font-size: 1.2rem; cursor: pointer; box-shadow: 0 4px 15px var(--shadow); transition: all 0.3s ease; display: none; align-items: center; justify-content: center; }
.sticky-cart-badge { position: absolute; top: -5px; right: -5px; background: var(--danger); color: white; font-size: 0.75rem; font-weight: 900; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid white; }

.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: white; display: flex; justify-content: space-around; padding: 8px 0; box-shadow: 0 -2px 15px var(--shadow); z-index: 2000; border-radius: 20px 20px 0 0; }
.bottom-nav-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 5px 15px; border: none; background: none; cursor: pointer; font-family: 'Cairo', sans-serif; color: var(--gold); font-size: 0.75rem; font-weight: 700; transition: all 0.2s ease; }
.bottom-nav-item i { font-size: 1.3rem; }
.bottom-nav-item.active, .bottom-nav-item:hover { color: var(--primary); }

.toast { position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-100px); background: var(--primary); color: white; padding: 12px 25px; border-radius: 12px; font-weight: 700; z-index: 3000; transition: all 0.4s ease; opacity: 0; box-shadow: 0 4px 15px rgba(0,0,0,0.2); display: flex; align-items: center; gap: 10px; font-size: 0.95rem; width: max-content; }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

.offers-banner { background: #fff; padding: 10px; text-align: center; border-bottom: 2px solid var(--gold-light); }
.offers-scroll { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 5px; }
@keyframes glowEffect { 0% { box-shadow: 0 0 5px rgba(198, 156, 109, 0.4); border-color: var(--gold-light); } 100% { box-shadow: 0 0 10px rgba(198, 156, 109, 0.8); border-color: var(--gold); } }
.offer-card { background: var(--bg); border-radius: 8px; border: 2px solid var(--gold); overflow: hidden; display: flex; flex-direction: column; animation: glowEffect 1.5s infinite alternate; }
.offer-card img { width: 100%; height: 75px; object-fit: cover; border-bottom: 1px solid var(--gold-light); }
.offer-details { padding: 5px; font-size: 0.65rem; font-weight: bold; color: var(--primary); line-height: 1.3; text-align: center; }
.offer-price { color: var(--danger); font-size: 0.7rem; display: block; margin-top: 2px; }

.reviews-section { background: linear-gradient(135deg, #FFFDF9 0%, #F8EBE6 100%); padding: 25px 15px; margin-top: 20px; border-top: 3px solid var(--gold); border-bottom: 3px solid var(--gold); }
.reviews-title { text-align: center; color: var(--primary); font-size: 1.2rem; font-weight: 800; margin-bottom: 15px; }
.reviews-scroll { display: flex; flex-direction: column; gap: 10px; max-height: 300px; overflow-y: auto; padding: 5px; }
.review-card { width: 100%; padding: 12px; border-radius: 12px; display: flex; flex-direction: column; background: white; box-shadow: 0 2px 5px rgba(0,0,0,0.05); border: 1px solid var(--gold-light); }
.review-header { display: flex; align-items: center; gap: 12px; margin-bottom: 5px; }
.review-avatar { width: 35px; height: 35px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--gold)); display: flex; align-items: center; justify-content: center; color: white; font-weight: bold; font-size: 1rem; }
.review-name { font-weight: 700; color: var(--primary); font-size: 0.9rem; }
.review-stars { color: #F1C40F; font-size: 0.8rem; margin-bottom: 5px; }
.review-text { font-size: 0.85rem; color: #444; margin-bottom: 8px; }
.review-product { background: var(--bg); border: 1px solid var(--gold); padding: 3px 8px; border-radius: 10px; font-size: 0.75rem; color: var(--primary); }

.edit-data-btn { background: none; border: none; color: var(--primary); text-decoration: underline; cursor: pointer; font-weight: bold; font-family: 'Cairo'; margin-top: 10px; font-size: 0.9rem; }

.footer { background: var(--primary); color: var(--gold-light); text-align: center; padding: 30px 15px 15px; margin-top: 30px; border-top: 5px solid var(--gold); }
.footer h3 { color: white; margin-bottom: 10px; font-size: 1.2rem; }
.footer p { margin-bottom: 5px; font-size: 0.85rem; color: #f5f5f5; }
.footer .copyright { margin-top: 20px; font-size: 0.7rem; color: var(--gold-light); opacity: 0.8; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 15px; direction: ltr; }

.home-categories-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 15px; margin-bottom: 20px; padding: 5px; }
.home-cat-card { background: white; border: 2px solid var(--gold-light); border-radius: 15px; padding: 25px 10px; text-align: center; cursor: pointer; transition: all 0.3s ease; box-shadow: 0 4px 8px rgba(0,0,0,0.05); }
.home-cat-card:hover { transform: translateY(-5px); border-color: var(--gold); box-shadow: 0 8px 15px var(--shadow); }
.home-cat-card i { font-size: 2.8rem; color: var(--primary); margin-bottom: 12px; }

.home-cat-card img { width: 100%; height: 120px; object-fit: cover; border-radius: 10px; margin-bottom: 10px; border: 1px solid var(--gold-light); }
.home-cat-card { padding: 15px 10px; }

.social-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; text-decoration: none; font-size: 1rem; transition: transform 0.2s; box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.social-icon:active { transform: scale(0.9); }
.whatsapp { background: #25D366; }
.facebook { background: #1877F2; }
/* --- التنظيف الجديد لملف الـ HTML --- */
.hidden-view { display: none !important; }
.header-side-end { justify-content: flex-end; }
.icon-gold { color: var(--gold); margin-left: 8px; }
.ml-5 { margin-left: 5px; }
.text-center { text-align: center; }
.mt-15 { margin-top: 15px; }

/* شاشة الحساب */
.profile-card { background: #f9f9f9; padding: 20px; border-radius: 15px; border: 1px solid #eee; text-align: right; margin-bottom: 15px; }
.profile-item-primary { margin: 0 0 10px; color: var(--primary); font-weight: bold; font-size: 1.1rem; }
.profile-item-text { margin: 0 0 10px; color: var(--text); font-family: sans-serif; }
.profile-item-desc { margin: 0; color: var(--text); }
.btn-outline { background: white; color: var(--primary); border: 2px solid var(--primary); }
.btn-cancel { background: #ccc; color: #333; margin-top: 10px; }
.edit-hint { font-size: 0.85rem; color: #666; margin-bottom: 15px; text-align: center; }
.success-msg { color: var(--success); font-weight: bold; text-align: center; margin-bottom: 10px; }

/* شاشة النقاط والعروض */
.modal-sm { max-width: 350px; text-align: center; }
.points-icon-lg { font-size: 3rem; color: #f1c40f; margin-bottom: 10px; }
.reward-box { font-size: 1.1rem; color: var(--danger); font-weight: bold; margin: 15px 0; background: #fff8e1; border: 2px dashed var(--gold); padding: 10px; border-radius: 10px; }
.points-val-lg { font-size: 1.4rem; }
.vip-box { font-size: 0.95rem; color: white; font-weight: bold; margin: 10px 0; background: var(--primary); padding: 8px; border-radius: 8px; }
.points-title { color: var(--primary); font-size: 1rem; }
.points-desc { color: var(--text); font-size: 0.85rem; line-height: 1.5; }
.offers-section-title { color: var(--danger); font-weight: 800; font-size: 1rem; margin: 5px 0 10px; }
.section-title { text-align: center; color: var(--primary); margin: 0 0 10px; font-size: 1.1rem; }
.btn-auto { width: auto; padding: 8px 20px; }

/* سلة المشتريات */
.cart-summary-box { background: #f9f9f9; padding: 15px; border-radius: 10px; margin: 15px 0; }
.summary-row { display: flex; justify-content: space-between; margin-bottom: 5px; }
.summary-val-primary { color: var(--primary); }
.delivery-row { border-bottom: 1px solid #ddd; padding-bottom: 5px; }
.summary-val-danger { color: var(--danger); }
.summary-total { margin-top: 5px; font-weight: bold; }
.summary-val-lg { color: var(--danger); font-size: 1.1rem; }
.cart-points-alert { background: #fff8e1; border: 1px dashed var(--gold); padding: 10px; text-align: center; border-radius: 8px; margin-top: 15px; font-weight: bold; color: var(--primary); }
.points-val-md { color: var(--danger); font-size: 1.2rem; }
.section-subtitle { color: var(--primary); margin: 15px 0 10px; border-top: 1px solid #eee; padding-top: 15px; font-size: 1.1rem; }
.customer-info-box { background: #f0f8ff; padding: 15px; border-radius: 8px; margin-bottom: 15px; border: 1px solid #bce8f1; }
.delivery-area-box { background: #f0f8ff; padding: 10px; border-radius: 8px; border: 1px solid #bce8f1; }
.area-label { color: #31708f; }
.btn-whatsapp { background: #25D366; font-size: 1.1rem; margin-top: 10px; }
/* ضبط مكان زرار النجمة في الهيدر */
.header .points-btn {
    margin-right: auto;
}