/* ========================================================= */
/* 1. Global Styles & Reset */
/* ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #001a2e;
  --primary-light: #0f446f;
  --accent: #d4af37;
  --accent-soft: rgba(212, 175, 55, 0.18);
  --bg: radial-gradient(circle at top, #001321 0%, #000814 55%, #000000 100%);
  --card-glass: rgba(15, 23, 42, 0.65);
  --card-border: rgba(148, 163, 184, 0.45);
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --border-soft: rgba(148, 163, 184, 0.35);
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.85);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Cairo", system-ui, -apple-system, sans-serif;
  background: #001321;
  color: #e5e7eb;
  direction: rtl;
  line-height: 1.6;
}

body.no-scroll {
  overflow: hidden;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ========================================================= */
/* 2. Header & Navigation */
/* ========================================================= */
.main-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(135deg, rgba(0, 19, 33, 0.98), rgba(0, 26, 46, 0.96));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 5vw;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

.brand-text h1 {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fefce8;
}

.brand-text p {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-soft);
}

.search-wrapper input {
  border: none;
  outline: none;
  background: transparent;
  color: #e5e7eb;
  font-size: 0.85rem;
  width: 150px;
  transition: width 0.3s ease;
}

.cart-toggle {
  position: relative;
  background: rgba(15, 23, 42, 0.8);
  color: #fefce8;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
}

.cart-count {
  position: absolute;
  top: -5px;
  left: -5px;
  font-size: 0.7rem;
  background: var(--accent);
  color: #111827;
  padding: 2px 6px;
  border-radius: 999px;
  font-weight: 700;
}

/* ========================================================= */
/* 3. Hero Section */
/* ========================================================= */
.hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2rem;
  align-items: center;
  padding: 4rem 5vw;
  background: var(--bg);
  min-height: 60vh;
}

.hero-content h2 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  color: var(--accent);
  margin-bottom: 1rem;
}

.ramadan-pill {
  display: inline-block;
  padding: 0.4rem 1.2rem;
  background: var(--accent);
  color: #000;
  border-radius: 999px;
  font-weight: 700;
  margin-bottom: 1rem;
}

.hero-description {
  color: var(--text-muted);
  max-width: 500px;
  margin-bottom: 2rem;
}

.hero-cta {
  padding: 0.8rem 2rem;
  background: var(--accent);
  color: #000;
  border-radius: 999px;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(212, 175, 55, 0.3);
}

.hero-main-image {
  border-radius: 24px;
  box-shadow: var(--shadow-soft);
}

/* ========================================================= */
/* 4. Products & Categories */
/* ========================================================= */
.categories {
  position: sticky;
  top: 75px;
  z-index: 90;
  background: rgba(0, 19, 33, 0.9);
  backdrop-filter: blur(10px);
  padding: 1rem 5vw;
}

.categories-buttons {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.category-btn {
  padding: 0.5rem 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--card-glass);
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
}

.category-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.products {
  padding: 2rem 5vw;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.5rem;
}

.product-card {
  background: var(--card-glass);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 1rem;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
}

.product-image-wrapper {
  width: 100%;
  aspect-ratio: 1/1;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.product-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-name {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.product-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.product-price {
  color: var(--accent);
  font-weight: 700;
}

.product-add-btn {
  background: var(--accent);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
}

/* ========================================================= */
/* 5. Cart Sidebar */
/* ========================================================= */
.cart-sidebar {
  position: fixed;
  top: 0;
  right: -100%;
  width: min(400px, 90vw);
  height: 100%;
  background: #001321;
  z-index: 1000;
  transition: right 0.4s ease;
  padding: 2rem;
  box-shadow: -10px 0 30px rgba(0,0,0,0.5);
}

.cart-sidebar.open {
  right: 0;
}

/* ========================================================= */
/* 6. Responsive Media Queries (The Core Fixes) */
/* ========================================================= */

/* --- الشاشات المتوسطة (Laptops / Tablets) --- */
@media (max-width: 1024px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 2rem 5vw;
  }
  
  .hero-content {
    order: 2;
  }
  
  .hero-image {
    order: 1;
    display: flex;
    justify-content: center;
  }
  
  .hero-main-image {
    max-width: 300px;
  }
  
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* --- الموبايل (Mobile Landscape & Large Phones) --- */
@media (max-width: 768px) {
  .main-header {
    padding: 0.8rem 4vw;
  }
  
  .search-wrapper {
    display: none; /* إخفاء شريط البحث لتوفير مساحة للهيدر */
  }
  
  .brand-text h1 {
    font-size: 1rem;
  }

  .categories {
    top: 65px;
    padding: 0.8rem 4vw;
  }
  
  /* جعل التصنيفات سكرول بالعرض في الموبايل */
  .categories-buttons {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5px;
  }
  
  .category-btn {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr); /* منتجين في كل صف */
    gap: 0.8rem;
  }
  
  .product-card {
    padding: 0.8rem;
  }
  
  .product-name {
    font-size: 0.95rem;
  }
}

/* --- الموبايلات الصغيرة جداً (Small Phones) --- */
@media (max-width: 480px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr); /* نبقي على منتجين لسهولة التصفح */
    gap: 0.6rem;
  }

  .hero-content h2 {
    font-size: 1.6rem;
  }
  
  .product-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
  }
  
  .product-add-btn {
    width: 100%;
    text-align: center;
  }
}
/* ========================================================= */
/* 7. Product Tags Styling - مربعات ذهبية جذابة */
/* ========================================================= */
.product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.product-tag {
  background: rgba(212, 175, 55, 0.12);        /* ذهبي شفاف */
  border: 1px solid rgba(212, 175, 55, 0.5);    /* حدود ذهبية */
  color: #f5e7b2;                               /* لون نص ذهبي فاتح */
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 50px;                          /* زوايا دائرية */
  letter-spacing: 0.3px;
  backdrop-filter: blur(2px);
  transition: all 0.2s ease;
}

.product-tag:hover {
  background: rgba(212, 175, 55, 0.25);
  border-color: #d4af37;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
/* ========================================================= */
/* 7. Product Card Redesign - مثل الصورة المطلوبة */
/* ========================================================= */

.product-card {
  background: var(--card-glass);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  overflow: hidden;
  transition: transform 0.3s ease, border-color 0.3s;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
}

.product-image-wrapper {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.product-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}

.product-card:hover .product-image-wrapper img {
  transform: scale(1.05);
}

.product-details {
  padding: 1.2rem 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.product-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: #f5e7b2;
  margin-bottom: 0.35rem;
  line-height: 1.3;
}

.product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.product-tag {
  background: rgba(212, 175, 55, 0.1);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 30px;
  padding: 0.2rem 0.8rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: #d4af37;
  backdrop-filter: blur(2px);
}

.product-price-row {
  margin-bottom: 0.75rem;
  border-bottom: 1px dashed rgba(212, 175, 55, 0.3);
  padding-bottom: 0.75rem;
}

.product-price {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
}

.product-weight,
.product-ingredients {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: #e5e7eb;
  display: flex;
  align-items: baseline;
}

.label {
  color: #9ca3af;
  font-weight: 600;
  min-width: 65px;
  font-size: 0.85rem;
}

.product-whatsapp-btn {
  width: 100%;
  background: #25D366;
  color: white;
  border: none;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  margin-top: 1rem;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.product-whatsapp-btn i {
  font-size: 1.2rem;
}

.product-whatsapp-btn:hover {
  background: #128C7E;
  transform: scale(1.02);
}

.product-whatsapp-btn:active {
  transform: scale(0.98);
}

/* تحسينات للهاتف */
@media (max-width: 768px) {
  .product-details {
    padding: 1rem 0.8rem 1.2rem;
  }
  .product-name {
    font-size: 1.1rem;
  }
  .product-price {
    font-size: 1.4rem;
  }
  .product-weight,
  .product-ingredients {
    font-size: 0.8rem;
  }
  .label {
    min-width: 55px;
  }
  .product-whatsapp-btn {
    padding: 0.7rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .product-card {
    border-radius: 18px;
  }
  .product-details {
    padding: 0.8rem 0.6rem 1rem;
  }
  .product-tag {
    font-size: 0.65rem;
    padding: 0.15rem 0.6rem;
  }
}
