/* ===================================================
   style.css - متجر عاصي (Assi Store)
   التصميم: عربي RTL، موبايل أولاً
   الألوان: أصفر (#FFD700)، أسود (#000)، أبيض (#FFF)
   الخطوط: Cairo، Tajawal
   =================================================== */

/* ===== استيراد الخطوط ===== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;900&family=Tajawal:wght@300;400;500;700;800&display=swap');

/* ===== متغيرات CSS ===== */
:root {
  --yellow: #FFD700;
  --yellow-dark: #E6C200;
  --yellow-light: #FFF3B0;
  --black: #000000;
  --black-soft: #111111;
  --black-card: #1A1A1A;
  --black-border: #2A2A2A;
  --white: #FFFFFF;
  --gray-100: #F5F5F5;
  --gray-200: #E8E8E8;
  --gray-400: #999999;
  --gray-600: #666666;
  --success: #22C55E;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;

  --font-main: 'Cairo', 'Tajawal', sans-serif;
  --font-body: 'Tajawal', 'Cairo', sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.15);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.25);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.35);
  --shadow-yellow: 0 4px 20px rgba(255,215,0,0.3);

  --transition: 0.25s ease;
  --transition-slow: 0.4s ease;

  --header-height: 60px;
  --bottom-nav-height: 65px;
}
/* ===== الوضع الفاتح (Light Mode) ===== */
body.light-mode {
  --black: #F0F0F0;
  --black-soft: #E8E8E8;
  --black-card: #FFFFFF;
  --black-border: #D0D0D0;
  --white: #111111;
  --gray-400: #555555;
  --gray-600: #888888;
  background: #F0F0F0;
  color: #111111;
}
body.light-mode .header-btn { color: #111111 !important; }
body.light-mode .nav-item { color: #888888; }
body.light-mode .form-input { color: #111111; background: #fff; border-color: #D0D0D0; }
body.light-mode .product-name,
body.light-mode .modal-product-name,
body.light-mode .cart-item-name,
body.light-mode .order-modal-title,
body.light-mode .section-title,
body.light-mode .cart-page-title,
body.light-mode .account-name { color: #111111; }
body.light-mode .product-modal-desc,
body.light-mode .modal-product-desc { color: #555555; }
body.light-mode .product-card,
body.light-mode .cart-item-card,
body.light-mode .account-hero,
body.light-mode .account-menu-item,
body.light-mode .cart-summary { box-shadow: 0 2px 10px rgba(0,0,0,0.07); }
body.light-mode #main-header { box-shadow: 0 1px 6px rgba(0,0,0,0.1); }
body.light-mode .product-fav-btn { background: rgba(255,255,255,0.9); color: #111; }
body.light-mode .search-overlay { background: rgba(240,240,240,0.97); }
body.light-mode .search-input-field { color: #111111; background: #fff; border-color: #D0D0D0; }
body.light-mode .filter-chip { color: #555555; }
body.light-mode .cat-label { color: #555555; }
body.light-mode .carousel-subtitle { color: #ddd; }
body.light-mode .order-modal,
body.light-mode .product-modal { background: #FFFFFF; }
body.light-mode .order-modal-subtitle { color: #555555; }
body.light-mode .summary-row { color: #555555; }
body.light-mode .menu-text { color: #111111; }
body.light-mode .menu-arrow { color: #888888; }
body.light-mode .account-email { color: #555555; }
body.light-mode .user-orders-title { color: #111111; }
body.light-mode .order-user-card { background: #fff; }
body.light-mode .order-user-items { color: #555555; }
body.light-mode .order-user-total { color: #111111; }

/* زر تبديل الوضع */
.theme-toggle-btn {
  width: 40px;
  height: 40px;
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  color: var(--white);
  transition: all 0.25s ease;
  cursor: pointer;
}
.theme-toggle-btn:hover,
.theme-toggle-btn:active {
  background: var(--yellow);
  color: var(--black);
  border-color: var(--yellow);
}



/* ===== إعادة الضبط العام ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--black);
  color: var(--white);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
  padding-top: var(--header-height);
  padding-bottom: var(--bottom-nav-height);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: var(--font-main);
  border: none;
  outline: none;
}

img {
  max-width: 100%;
  display: block;
}

ul {
  list-style: none;
}

/* ===== شريط التحميل ===== */
#page-loader {
  position: fixed;
  inset: 0;
  background: var(--black);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#page-loader.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-logo {
  font-family: var(--font-main);
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--yellow);
  letter-spacing: -1px;
}

.loader-logo span {
  color: var(--white);
}

.loader-bar {
  width: 180px;
  height: 3px;
  background: var(--black-border);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.loader-bar::after {
  content: '';
  display: block;
  height: 100%;
  width: 40%;
  background: var(--yellow);
  border-radius: var(--radius-full);
  animation: loadingBar 1.2s ease infinite;
}

@keyframes loadingBar {
  0% { transform: translateX(260%); }
  100% { transform: translateX(-100%); }
}

/* ===== الهيدر العلوي ===== */
#main-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  height: var(--header-height);
  background: var(--black);
  border-bottom: 1px solid var(--black-border);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 10px;
}

.header-logo {
  font-family: var(--font-main);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--yellow);
  flex: 1;
  letter-spacing: -0.5px;
}

.header-logo span {
  color: var(--white);
  font-weight: 400;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-btn {
  width: 40px;
  height: 40px;
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--white);
  transition: all var(--transition);
  position: relative;
}

.header-btn:hover, .header-btn:active {
  background: var(--yellow);
  color: var(--black);
  border-color: var(--yellow);
}

.header-btn .badge {
  position: absolute;
  top: -4px;
  left: -4px;
  min-width: 18px;
  height: 18px;
  background: var(--yellow);
  color: var(--black);
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
}

/* ===== شريط التنقل السفلي ===== */
#bottom-nav {
  position: fixed;
  bottom: 0;
  right: 0;
  left: 0;
  height: var(--bottom-nav-height);
  background: var(--black-soft);
  border-top: 1px solid var(--black-border);
  z-index: 100;
  display: flex;
  align-items: center;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  color: var(--gray-600);
  font-size: 0.65rem;
  font-family: var(--font-main);
  font-weight: 500;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
}

.nav-item .nav-icon {
  font-size: 1.3rem;
  transition: transform var(--transition);
}

.nav-item.active {
  color: var(--yellow);
}

.nav-item.active .nav-icon {
  transform: scale(1.15);
}

.nav-item:hover {
  color: var(--yellow);
}

.nav-item .nav-badge {
  position: absolute;
  top: 6px;
  right: calc(50% - 16px);
  min-width: 16px;
  height: 16px;
  background: var(--yellow);
  color: var(--black);
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* ===== الصفحات / الأقسام ===== */
.page-section {
  display: none;
  animation: fadeInPage 0.3s ease;
  min-height: calc(100vh - var(--header-height) - var(--bottom-nav-height));
}

.page-section.active {
  display: block;
}

@keyframes fadeInPage {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== عرض الشرائح (Carousel) ===== */
#home-carousel {
  position: relative;
  overflow: hidden;
  background: var(--black-card);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.carousel-track {
  display: flex;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-slide {
  min-width: 100%;
  height: 200px;
  position: relative;
  overflow: hidden;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px 16px;
}

.carousel-title {
  font-family: var(--font-main);
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--yellow);
  margin-bottom: 4px;
}

.carousel-subtitle {
  font-size: 0.85rem;
  color: var(--white);
  opacity: 0.85;
}

.carousel-cta {
  display: inline-block;
  margin-top: 10px;
  padding: 6px 16px;
  background: var(--yellow);
  color: var(--black);
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 0.8rem;
  font-weight: 700;
}

.carousel-dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}

.carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.4);
  transition: all var(--transition);
  cursor: pointer;
}

.carousel-dot.active {
  width: 20px;
  background: var(--yellow);
}

/* ===== أيقونات الفئات الدائرية ===== */
#categories-row {
  padding: 20px 16px 10px;
}

.categories-row-title {
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-400);
  margin-bottom: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.categories-scroll {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.categories-scroll::-webkit-scrollbar {
  display: none;
}

.cat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform var(--transition);
}

.cat-item:active {
  transform: scale(0.95);
}

.cat-icon-wrap {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--black-card);
  border: 2px solid var(--black-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

/* صورة الصنف */
.cat-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  position: absolute;
  inset: 0;
  z-index: 1;
  transition: transform var(--transition);
}

.cat-item:hover .cat-img,
.cat-item.active .cat-img {
  transform: scale(1.08);
}

.cat-icon-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--yellow);
  border-radius: 50%;
  transform: scale(0);
  transition: transform var(--transition);
}

.cat-item.active .cat-icon-wrap,
.cat-item:hover .cat-icon-wrap {
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(255,215,0,0.2);
}

.cat-item.active .cat-icon-wrap::before {
  transform: scale(1);
}

.cat-icon-wrap .cat-emoji {
  position: relative;
  z-index: 1;
  transition: transform var(--transition);
}

.cat-item.active .cat-icon-wrap .cat-emoji {
  transform: scale(1.1);
}

.cat-label {
  font-family: var(--font-main);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--gray-400);
  text-align: center;
  white-space: nowrap;
  transition: color var(--transition);
}

.cat-item.active .cat-label {
  color: var(--yellow);
}

/* ===== أزرار الفرز والتصفية ===== */
#filter-sort-bar {
  padding: 12px 16px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

#filter-sort-bar::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex-shrink: 0;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  background: var(--black-card);
  border: 1px solid var(--black-border);
  color: var(--gray-400);
  font-family: var(--font-main);
  font-size: 0.78rem;
  font-weight: 600;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 5px;
}

.filter-chip:hover, .filter-chip.active {
  background: var(--yellow);
  border-color: var(--yellow);
  color: var(--black);
}

/* ===== شبكة المنتجات ===== */
#products-section {
  padding: 0 12px 16px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px 16px;
}

.section-title {
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 900;
  color: var(--white);
}

.section-title span {
  color: var(--yellow);
}

.see-all-btn {
  font-family: var(--font-main);
  font-size: 0.78rem;
  color: var(--yellow);
  font-weight: 600;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

/* ===== بطاقة المنتج ===== */
.product-card {
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all var(--transition);
  position: relative;
  cursor: pointer;
}

.product-card:active {
  transform: scale(0.98);
}

.product-card:hover {
  border-color: var(--yellow);
  box-shadow: 0 0 0 1px var(--yellow), var(--shadow-yellow);
}

.product-img-wrap {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--black-border);
}

.product-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.product-card:hover .product-img-wrap img {
  transform: scale(1.05);
}

.product-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 8px;
  background: var(--yellow);
  color: var(--black);
  font-family: var(--font-main);
  font-size: 0.62rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  z-index: 2;
}

.product-fav-btn {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 32px;
  height: 32px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all var(--transition);
  z-index: 2;
  border: 1px solid rgba(255,255,255,0.1);
}

.product-fav-btn:hover,
.product-fav-btn.active {
  background: rgba(255,215,0,0.15);
  border-color: var(--yellow);
  color: var(--yellow);
}

.product-fav-btn.active {
  color: #ff4d6d;
}

.product-info {
  padding: 10px;
}

.product-name {
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.product-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

.rating-stars {
  font-size: 0.65rem;
  color: var(--yellow);
}

.rating-value {
  font-size: 0.65rem;
  color: var(--gray-400);
  font-family: var(--font-main);
}

.product-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.product-price {
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 900;
  color: var(--yellow);
}

.add-to-cart-btn {
  width: 32px;
  height: 32px;
  background: var(--yellow);
  color: var(--black);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  transition: all var(--transition);
  flex-shrink: 0;
}

.add-to-cart-btn:hover {
  background: var(--yellow-dark);
  transform: scale(1.1);
}

.add-to-cart-btn.added {
  background: var(--success);
  color: white;
}

/* ===== نافذة تفاصيل المنتج ===== */
.product-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.product-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.product-modal {
  width: 100%;
  max-height: 85vh;
  background: var(--black-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-modal-overlay.open .product-modal {
  transform: translateY(0);
}

.product-modal-img {
  width: 100%;
  height: 260px;
  object-fit: cover;
}

.product-modal-body {
  padding: 20px 16px 30px;
}

.modal-drag-handle {
  width: 40px;
  height: 4px;
  background: var(--black-border);
  border-radius: var(--radius-full);
  margin: 0 auto 16px;
}

.modal-product-name {
  font-family: var(--font-main);
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--white);
  margin-bottom: 8px;
}

.modal-product-category {
  display: inline-block;
  padding: 3px 10px;
  background: rgba(255,215,0,0.1);
  border: 1px solid rgba(255,215,0,0.3);
  color: var(--yellow);
  font-size: 0.72rem;
  font-family: var(--font-main);
  font-weight: 600;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}

.modal-product-desc {
  font-size: 0.88rem;
  color: var(--gray-400);
  line-height: 1.7;
  margin-bottom: 20px;
}

.modal-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-price {
  font-family: var(--font-main);
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--yellow);
}

.modal-qty {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--black-soft);
  border: 1px solid var(--black-border);
  border-radius: var(--radius-full);
  padding: 6px 8px;
}

.modal-qty-btn {
  width: 28px;
  height: 28px;
  background: var(--yellow);
  color: var(--black);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
}

.modal-qty-value {
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  min-width: 24px;
  text-align: center;
}

.modal-add-btn {
  width: 100%;
  padding: 14px;
  background: var(--yellow);
  color: var(--black);
  border-radius: var(--radius-lg);
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.modal-add-btn:active {
  transform: scale(0.98);
  background: var(--yellow-dark);
}

/* ===== صفحة الفئات ===== */
#categories-page {
  padding: 16px;
}

.categories-page-title {
  font-family: var(--font-main);
  font-size: 1.3rem;
  font-weight: 900;
  margin-bottom: 20px;
  color: var(--white);
}

.categories-page-title span {
  color: var(--yellow);
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.cat-page-card {
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all var(--transition);
}

.cat-page-card:active {
  transform: scale(0.97);
}

.cat-page-card:hover {
  border-color: var(--yellow);
  box-shadow: var(--shadow-yellow);
}

.cat-page-icon {
  font-size: 2.5rem;
}

.cat-page-img-wrap {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--black-border);
  flex-shrink: 0;
}

.cat-page-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition);
}

.cat-page-card:hover .cat-page-img {
  transform: scale(1.08);
}

.cat-page-icon-fb {
  font-size: 2rem;
}

.cat-page-name {
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  color: var(--white);
}

.cat-page-count {
  font-size: 0.72rem;
  color: var(--gray-400);
  font-family: var(--font-main);
}

/* ===== صفحة السلة ===== */
#cart-page {
  padding: 16px;
}

.cart-page-title {
  font-family: var(--font-main);
  font-size: 1.3rem;
  font-weight: 900;
  margin-bottom: 20px;
}

.cart-page-title span {
  color: var(--yellow);
}

.cart-empty {
  text-align: center;
  padding: 60px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.cart-empty-icon {
  font-size: 4rem;
  opacity: 0.3;
}

.cart-empty-text {
  font-family: var(--font-main);
  font-size: 1rem;
  color: var(--gray-400);
}

.cart-empty-btn {
  padding: 12px 28px;
  background: var(--yellow);
  color: var(--black);
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 700;
}

.cart-items-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.cart-item-card {
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.cart-item-img {
  width: 70px;
  height: 70px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.cart-item-info {
  flex: 1;
  min-width: 0;
}

.cart-item-name {
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cart-item-price {
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 900;
  color: var(--yellow);
  margin-bottom: 10px;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--black-soft);
  border: 1px solid var(--black-border);
  border-radius: var(--radius-full);
  padding: 4px 8px;
}

.qty-btn {
  width: 22px;
  height: 22px;
  background: var(--yellow);
  color: var(--black);
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.qty-btn:hover {
  background: var(--yellow-dark);
}

.qty-value {
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

.remove-item-btn {
  width: 30px;
  height: 30px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--danger);
  transition: all var(--transition);
}

.remove-item-btn:hover {
  background: var(--danger);
  color: white;
}

.cart-summary {
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-family: var(--font-main);
  font-size: 0.85rem;
  color: var(--gray-400);
}

.summary-row.total {
  border-top: 1px solid var(--black-border);
  margin-top: 8px;
  padding-top: 12px;
  font-size: 1rem;
  font-weight: 900;
  color: var(--white);
}

.summary-row.total .summary-amount {
  color: var(--yellow);
  font-size: 1.1rem;
}

.checkout-btn {
  width: 100%;
  padding: 16px;
  background: var(--yellow);
  color: var(--black);
  border-radius: var(--radius-lg);
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition);
}

.checkout-btn:active {
  transform: scale(0.98);
  background: var(--yellow-dark);
}

/* ===== نموذج الطلب (WhatsApp) ===== */
.order-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.order-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.order-modal {
  width: 100%;
  max-height: 90vh;
  background: var(--black-card);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 20px 16px 40px;
}

.order-modal-overlay.open .order-modal {
  transform: translateY(0);
}

.order-modal-title {
  font-family: var(--font-main);
  font-size: 1.2rem;
  font-weight: 900;
  margin-bottom: 6px;
  color: var(--white);
}

.order-modal-subtitle {
  font-size: 0.82rem;
  color: var(--gray-400);
  margin-bottom: 20px;
  font-family: var(--font-body);
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-400);
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--yellow);
  margin-right: 2px;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  background: var(--black-soft);
  border: 1px solid var(--black-border);
  border-radius: var(--radius-md);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: border-color var(--transition);
  outline: none;
  direction: rtl;
}

.form-input:focus {
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(255,215,0,0.1);
}

.form-input::placeholder {
  color: var(--gray-600);
}

textarea.form-input {
  resize: vertical;
  min-height: 80px;
}

.submit-order-btn {
  width: 100%;
  padding: 16px;
  background: #25D366;
  color: white;
  border-radius: var(--radius-lg);
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  transition: all var(--transition);
}

.submit-order-btn:active {
  transform: scale(0.98);
  background: #1fb855;
}

/* ===== صفحة الحساب ===== */
#account-page {
  padding: 16px;
}

.account-hero {
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: var(--radius-lg);
  padding: 24px 16px;
  text-align: center;
  margin-bottom: 20px;
}

.account-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--black-border);
  border: 3px solid var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 12px;
  overflow: hidden;
}

.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-name {
  font-family: var(--font-main);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 4px;
}

.account-email {
  font-size: 0.8rem;
  color: var(--gray-400);
  margin-bottom: 16px;
}

.google-signin-btn {
  width: 100%;
  max-width: 280px;
  padding: 12px 20px;
  background: var(--white);
  color: #333;
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.google-signin-btn:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.google-icon {
  width: 20px;
  height: 20px;
}

.signout-btn {
  width: 100%;
  max-width: 280px;
  padding: 12px 20px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--danger);
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto;
  transition: all var(--transition);
}

.signout-btn:hover {
  background: var(--danger);
  color: white;
}

.admin-link-btn {
  width: 100%;
  max-width: 280px;
  padding: 12px 20px;
  background: var(--yellow);
  color: var(--black);
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto 12px;
  transition: all var(--transition);
}

.account-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.account-menu-item {
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all var(--transition);
}

.account-menu-item:hover {
  border-color: var(--yellow);
}

.account-menu-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-icon {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
}

.menu-text {
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--white);
}

.menu-arrow {
  color: var(--gray-400);
  font-size: 0.75rem;
}

/* ===== طلبات المستخدم ===== */
.user-orders-section {
  margin-top: 20px;
}

.user-orders-title {
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 900;
  color: var(--white);
  margin-bottom: 14px;
}

.user-orders-title span {
  color: var(--yellow);
}

.order-user-card {
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-bottom: 10px;
}

.order-user-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.order-id {
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--yellow);
}

.order-status-badge {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 0.7rem;
  font-weight: 700;
}

.status-pending { background: rgba(245,158,11,0.2); color: var(--warning); }
.status-processing { background: rgba(59,130,246,0.2); color: var(--info); }
.status-delivered { background: rgba(34,197,94,0.2); color: var(--success); }

.order-user-items {
  font-size: 0.8rem;
  color: var(--gray-400);
  margin-bottom: 8px;
  line-height: 1.5;
}

.order-user-total {
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--white);
}

.order-user-total span {
  color: var(--yellow);
}

/* ===== شريط البحث ===== */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  z-index: 200;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition);
}

.search-overlay.open {
  opacity: 1;
  visibility: visible;
}

.search-input-wrap {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: var(--header-height);
  margin-bottom: 20px;
}

.search-input-field {
  flex: 1;
  padding: 12px 16px;
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: var(--radius-full);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  direction: rtl;
  transition: border-color var(--transition);
}

.search-input-field:focus {
  border-color: var(--yellow);
}

.search-close-btn {
  padding: 10px 16px;
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: var(--radius-full);
  color: var(--white);
  font-family: var(--font-main);
  font-size: 0.85rem;
}

.search-results {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

/* ===== PWA Install Banner ===== */
#install-banner {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + 12px);
  left: 12px;
  right: 12px;
  background: var(--black-card);
  border: 1px solid var(--yellow);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 150;
  box-shadow: var(--shadow-yellow);
  display: none;
  animation: slideUpBanner 0.4s ease;
}

@keyframes slideUpBanner {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.install-banner-text {
  flex: 1;
}

.install-banner-title {
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 2px;
}

.install-banner-sub {
  font-size: 0.72rem;
  color: var(--gray-400);
}

.install-btn {
  padding: 8px 16px;
  background: var(--yellow);
  color: var(--black);
  border-radius: var(--radius-full);
  font-family: var(--font-main);
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}

.install-close-btn {
  width: 28px;
  height: 28px;
  background: var(--black-border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--gray-400);
  flex-shrink: 0;
}

/* ===== Toast / إشعار ===== */
#toast-container {
  position: fixed;
  top: calc(var(--header-height) + 10px);
  right: 12px;
  left: 12px;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--black-card);
  border: 1px solid var(--black-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toastIn 0.3s ease;
  box-shadow: var(--shadow-md);
}

.toast.success { border-right: 3px solid var(--success); }
.toast.error { border-right: 3px solid var(--danger); }
.toast.info { border-right: 3px solid var(--yellow); }

@keyframes toastIn {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(20px); opacity: 0; }
}

.toast.removing {
  animation: toastOut 0.3s ease forwards;
}

.toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.toast-text {
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--white);
}

/* ===== الفضلة / المفضلة ===== */
.favorites-page-content {
  padding: 16px;
}

.favorites-empty {
  text-align: center;
  padding: 60px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  color: var(--gray-400);
}

.favorites-empty-icon {
  font-size: 3.5rem;
  opacity: 0.3;
}

/* ===== Utilities ===== */
.hidden { display: none !important; }
.text-yellow { color: var(--yellow); }
.text-gray { color: var(--gray-400); }
.font-bold { font-weight: 700; }
.font-main { font-family: var(--font-main); }

/* ===================================================
   RESPONSIVE — DESKTOP FIRST REDESIGN
   =================================================== */

/* ── Tablet 640px ── */
@media (min-width: 640px) {
  .products-grid,
  .search-results {
    grid-template-columns: repeat(3, 1fr);
  }
  .carousel-slide { height: 260px; }
  .categories-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Desktop 1024px+ — Layout كامل ── */
@media (min-width: 1024px) {
  :root {
    --header-height: 68px;
    --sidebar-width: 260px;
    --bottom-nav-height: 0px;
  }

  /* إخفاء التنقل السفلي على الكمبيوتر */
  #bottom-nav { display: none !important; }

  /* body لا تحد بعرض */
  body {
    padding-bottom: 0;
    background: var(--black-soft);
  }

  /* ── HEADER ── */
  #main-header {
    padding: 0 32px;
    height: var(--header-height);
  }

  .header-logo { font-size: 1.7rem; }

  .header-actions { gap: 10px; }

  .header-btn { width: 42px; height: 42px; }

  /* ── DESKTOP WRAPPER ── */
  #desktop-layout {
    display: flex;
    min-height: calc(100vh - var(--header-height));
    margin-top: var(--header-height);
  }

  /* ── SIDEBAR ── */
  #desktop-sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: var(--black-card);
    border-left: 1px solid var(--black-border);
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    overflow-y: auto;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  #desktop-sidebar::-webkit-scrollbar { width: 4px; }
  #desktop-sidebar::-webkit-scrollbar-thumb { background: var(--black-border); border-radius: 4px; }

  .sidebar-section-title {
    font-family: var(--font-main);
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 4px 10px 8px;
    margin-top: 8px;
  }

  .sidebar-cat-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-main);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-400);
    background: transparent;
    border: none;
    width: 100%;
    text-align: right;
  }

  .sidebar-cat-btn:hover {
    background: rgba(255,215,0,0.06);
    color: var(--white);
  }

  .sidebar-cat-btn.active {
    background: rgba(255,215,0,0.1);
    color: var(--yellow);
    border: 1px solid rgba(255,215,0,0.15);
  }

  .sidebar-cat-icon {
    font-size: 1.1rem;
    width: 26px;
    text-align: center;
    flex-shrink: 0;
  }

  .sidebar-cat-count {
    margin-right: auto;
    font-size: 0.7rem;
    color: var(--gray-600);
    background: var(--black-border);
    padding: 1px 7px;
    border-radius: 9999px;
  }

  .sidebar-cat-btn.active .sidebar-cat-count {
    background: rgba(255,215,0,0.15);
    color: var(--yellow);
  }

  /* ── MAIN CONTENT ── */
  #desktop-main {
    flex: 1;
    min-width: 0;
    padding: 24px 28px;
  }

  /* إخفاء العناصر الموبايل على الكمبيوتر */
  #categories-row { display: none; }

  /* ── CAROUSEL أكبر على الكمبيوتر ── */
  #home-carousel {
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
  }

  .carousel-slide { height: 340px; }
  .carousel-title  { font-size: 2rem; }
  .carousel-subtitle { font-size: 1rem; }

  /* ── شريط الفرز أجمل ── */
  #filter-sort-bar {
    padding: 0 0 16px 0;
    gap: 10px;
  }

  .filter-chip {
    padding: 8px 18px;
    font-size: 0.82rem;
  }

  /* ── شبكة المنتجات ── */
  #products-section { padding: 0; }

  .products-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }

  .product-img-wrap { aspect-ratio: 1; }

  /* ── الصفحات الداخلية ── */
  #cart-page,
  #account-page,
  #favorites-page > div {
    padding: 0;
    max-width: 780px;
  }

  /* ── السلة: layout عمودين ── */
  #cart-filled {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
  }

  #cart-filled .cart-items-list { margin-bottom: 0; }
  #cart-filled .cart-summary    { grid-row: 1; grid-column: 2; }
  #cart-filled .checkout-btn    { grid-column: 2; }
  #cart-filled > button:last-child { grid-column: 2; }

  /* ── الحساب: layout ── */
  #account-page {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    align-items: start;
  }

  .account-hero { grid-column: 1; position: sticky; top: calc(var(--header-height) + 24px); }
  .account-menu { grid-column: 2; grid-row: 1; }
  .user-orders-section { grid-column: 2; grid-row: 2; }

  /* ── Modal أكبر ── */
  .product-modal-overlay { align-items: center; }
  .product-modal {
    max-width: 560px;
    border-radius: var(--radius-xl);
    margin: auto;
  }
  .product-modal-img { height: 300px; }

  .order-modal-overlay { align-items: center; }
  .order-modal {
    max-width: 520px;
    border-radius: var(--radius-xl);
    margin: auto;
  }

  /* ── Search overlay ── */
  .search-overlay { padding: 100px 32px 32px; }
  .search-input-wrap { margin-top: 0; max-width: 700px; margin: 0 auto 24px; }
  .search-results { max-width: 700px; margin: 0 auto; grid-template-columns: repeat(4, 1fr); }

  /* ── PWA Banner ── */
  #install-banner {
    left: auto;
    right: 24px;
    bottom: 24px;
    max-width: 340px;
    border-radius: var(--radius-lg);
  }

  /* ── Toast ── */
  #toast-container {
    right: 24px;
    left: auto;
    max-width: 360px;
  }
}

/* ── Large Desktop 1280px+ ── */
@media (min-width: 1280px) {
  :root { --sidebar-width: 280px; }

  #desktop-main { padding: 28px 36px; }

  .products-grid { grid-template-columns: repeat(5, 1fr); }

  .carousel-slide { height: 380px; }
}

/* ── Extra Large 1536px+ ── */
@media (min-width: 1536px) {
  .products-grid { grid-template-columns: repeat(6, 1fr); }
  #desktop-main { padding: 32px 48px; }
}
