/* ====== القاعدة العامة ====== */
body {
  font-family: "Tajawal", Arial, sans-serif;
  margin: 0;
  padding: 0;
  background: #f9fafb;
  color: #333;
}

.container {
  max-width: 1200px;
  margin: auto;
  padding: 20px;
}

/* ====== الهيدر ====== */
.header {
  background: #ec4899;
  color: #fff;
  padding: 15px 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
}
.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo {
  font-size: 20px;
  font-weight: bold;
}
.nav-menu {
  list-style: none;
  display: flex;
  gap: 15px;
  margin: 0;
  padding: 0;
}
.nav-item {
  cursor: pointer;
  font-weight: 500;
  padding: 6px 10px;
}
.nav-item:hover,
.nav-item.active {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
}
.cart-icon {
  cursor: pointer;
  font-size: 20px;
  position: relative;
}
.cart-count {
  position: absolute;
  top: -8px;
  right: -10px;
  background: #10b981;
  color: #fff;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 50%;
}

/* ====== البطل (Hero) ====== */
.hero {
  text-align: center;
  padding: 40px 20px;
  background: linear-gradient(to right, #f9a8d4, #f472b6);
  color: #fff;
  border-radius: 10px;
  margin-bottom: 30px;
}
.hero h1 {
  margin: 0 0 10px;
}
.hero p {
  font-size: 18px;
  margin: 0;
}

/* ====== المنتجات ====== */
.section-title {
  text-align: center;
  font-size: 24px;
  margin: 20px 0;
  color: #111827;
}
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}
.product-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 15px;
  text-align: center;
  box-shadow: 0 4px 8px rgba(0,0,0,0.05);
  transition: transform 0.2s, box-shadow 0.2s;
}
.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}
.product-card img {
  max-width: 100%;
  height: 200px;
  object-fit: contain;
  margin-bottom: 12px;
}
.product-card h3 {
  margin: 10px 0;
  font-size: 18px;
  color: #111827;
}
.product-card .description {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 8px;
}
.product-card .price {
  font-size: 16px;
  font-weight: bold;
  color: #e91e63;
  margin-bottom: 10px;
}
.btn-add {
  background: #10b981;
  color: #fff;
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
}
.btn-add:hover {
  background: #059669;
}

/* ====== السلة ====== */
.cart-sidebar {
  position: fixed;
  top: 0;
  right: -400px;
  width: 350px;
  height: 100%;
  background: #fff;
  box-shadow: -2px 0 10px rgba(0,0,0,0.1);
  transition: right 0.3s;
  z-index: 2000;
  display: flex;
  flex-direction: column;
}
.cart-sidebar.open {
  right: 0;
}
.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: #f3f4f6;
  border-bottom: 1px solid #e5e7eb;
}
.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
}
.cart-total {
  font-weight: bold;
  padding: 15px;
  border-top: 1px solid #e5e7eb;
}
.cart-actions {
  padding: 15px;
}
.btn-primary {
  background: #2563eb;
  color: #fff;
  padding: 10px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.btn-primary:hover {
  background: #1d4ed8;
}

/* ====== الفوتر ====== */
.footer {
  background: #111827;
  color: #fff;
  padding: 40px 20px 20px;
  margin-top: 40px;
}
.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}
.footer-section h3 {
  margin-bottom: 10px;
}
.footer-section ul {
  list-style: none;
  padding: 0;
}
.footer-section li {
  margin: 6px 0;
}
.footer-bottom {
  text-align: center;
  border-top: 1px solid #374151;
  padding-top: 10px;
  font-size: 14px;
  color: #9ca3af;
}
/* إخفاء/إظهار سريع */
.hidden { display: none !important; }

/* إبراز العنصر النشط في القائمة */
.nav-item.active {
  background: rgba(255,255,255,0.25);
  border-radius: 6px;
}

/* السلة الجانبية */
.cart-sidebar {
  position: fixed;
  top: 0;
  right: -380px;
  width: 340px;
  height: 100%;
  background: #fff;
  box-shadow: -2px 0 12px rgba(0,0,0,0.1);
  transition: right 0.3s ease;
  z-index: 2000;
  display: flex;
  flex-direction: column;
}
.cart-sidebar.open { right: 0; }
.cart-header { display:flex; justify-content:space-between; align-items:center; padding:12px 14px; background:#f3f4f6; border-bottom:1px solid #e5e7eb; }
.close-btn { background:none; border:none; font-size:22px; cursor:pointer; }
.cart-items { flex:1; overflow:auto; padding:12px; }
.cart-item { display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid #eee; }
.cart-item img { width:50px; height:50px; object-fit:contain; border-radius:6px; }
.cart-item-meta { flex:1; }
.cart-item-actions { display:flex; align-items:center; gap:6px; }
.qty-btn, .remove-btn { background:#eee; border:none; padding:4px 8px; border-radius:6px; cursor:pointer; }
.qty-btn:hover { background:#e5e7eb; }
.remove-btn { background:#fecaca; }
.remove-btn:hover { background:#fca5a5; }
.cart-total { padding:12px; border-top:1px solid #e5e7eb; font-weight:700; }
.cart-actions { padding:12px; }
.btn.btn-primary { background:#2563eb; color:#fff; padding:10px 12px; border:none; border-radius:8px; cursor:pointer; width:100%; }
.btn.btn-primary:hover { background:#1d4ed8; }

/* Modal للـ Checkout */
.modal { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.45); z-index:3000; }
.modal-content { background:#fff; width:90%; max-width:520px; margin:60px auto; border-radius:12px; overflow:hidden; }
.modal-header { display:flex; justify-content:space-between; align-items:center; padding:12px 16px; background:#f3f4f6; border-bottom:1px solid #eee; }
.modal-body { padding:16px; }
.form-group { margin-bottom:10px; }
.form-group input, .form-group textarea { width:100%; padding:10px; border:1px solid #ddd; border-radius:8px; }
.form-actions { margin-top:12px; display:flex; gap:8px; }
.btn.btn-success { background:#10b981; color:#fff; border:none; border-radius:8px; padding:10px 12px; cursor:pointer; }
.btn.btn-success:hover { background:#059669; }
.btn.btn-secondary { background:#e5e7eb; color:#111; border:none; border-radius:8px; padding:10px 12px; cursor:pointer; }

/* رسالة نجاح */
.success-message {
  position: fixed; bottom: 20px; right: 20px;
  background: #10b981; color:#fff; padding: 12px 16px;
  border-radius: 10px; display: flex; align-items: center; gap: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15); z-index: 4000;
}
.success-message.hidden { display: none; }

/* === Checkout Modal === */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  justify-content: center;
  align-items: center;
  padding: 10px;
}

.modal-content {
  background: #fff;
  width: 100%;
  max-width: 400px;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.modal-content h3 {
  margin-bottom: 15px;
  font-size: 20px;
  text-align: center;
}

.modal-content form input,
.modal-content form textarea {
  width: 100%;
  padding: 10px;
  margin: 6px 0;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
}

.modal-content form button {
  width: 100%;
  padding: 12px;
  margin-top: 10px;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
}

.modal-content form button[type="submit"] {
  background: #28a745;
  color: #fff;
}

.modal-content form button[type="button"] {
  background: #ccc;
  color: #000;
}
/* === Responsive Design === */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: center;
  }

  .nav-menu {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
  }

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

  .product-card {
    padding: 10px;
    font-size: 14px;
  }

  .cart-sidebar {
    width: 100%;
    right: -100%;
  }

  .cart-sidebar.open {
    right: 0;
  }

  .modal-content {
    width: 95%;
    max-width: 360px;
  }
}

@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: 1fr;
  }

  .product-card img {
    width: 100px;
    height: 100px;
  }
}
/* ============ تحسين الموبايل ============ */
@media (max-width: 992px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .nav-menu {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

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

  .product-card {
    padding: 10px;
  }

  .cart-sidebar {
    width: 100%;
    right: -100%;
  }
  .cart-sidebar.open {
    right: 0;
  }
}

@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: 1fr;
  }

  .product-card img {
    height: 120px;
  }

  .modal-content {
    max-width: 95%;
    padding: 15px;
  }
}
/* منع تحريك الصفحة يمين/يسار في الموبايل */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

/* تأكد أن كل العناصر ما تتجاوز الشاشة */
img, table, .container, .products-grid, .header-content, .cart-sidebar, .modal-content {
  max-width: 100%;
  box-sizing: border-box;
}
