/* ===================================================================
   ديوان الأصالة — Style Sheet الرئيسي
   نظام الهوية البصرية (Design Tokens) مُعرَّف بالكامل في :root أدناه.
   أي تعديل مستقبلي على الألوان/الظلال/الانحناءات يجب أن يمر من هنا فقط.
   =================================================================== */

:root {
  /* ---------- Design Tokens: الألوان ---------- */
  --color-bg: #241B12;               /* الخلفية الرئيسية — بني إسبريسو دافئ بدل الأسود الفاحم */
  --color-surface: #2E2318;          /* خلفية ثانوية (هيدر، أقسام مرتفعة قليلًا) */
  --color-surface-elevated: #3A2C1D; /* بطاقات المنتجات والعناصر "العائمة" فوق السطح */
  --color-primary: #C6A15B;         /* الذهبي الأساسي — لون العلامة والتمييز */
  --color-primary-hover: #DFC47C;   /* الذهبي الفاتح — حالة Hover */
  --color-text: #F7F2EA;            /* النص الرئيسي (عاجي/كريمي فاتح) */
  --color-text-muted: #B9AC9A;      /* نص ثانوي/وصفي أقل تباينًا */
  --color-border: #2E2620;          /* حدود وفواصل خفيفة على الخلفية الداكنة */
  --color-success: #4CAF6D;
  --color-danger: #E0645A;

  /* ---------- Typography ---------- */
  --font-display: 'Aref Ruqaa', 'Amiri', serif; /* العناوين فقط */
  --font-body: 'Tajawal', 'Cairo', sans-serif;  /* كل ما عدا العناوين */

  /* ---------- Radius / Shadow / Motion ---------- */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;

  --shadow-sm: 0 2px 10px rgba(0, 0, 0, .28);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, .38);
  --shadow-lg: 0 20px 55px rgba(0, 0, 0, .5);

  --transition-fast: .15s ease;
  --transition-normal: .28s ease;

  --container-max: 1200px;

  /* ---------- توافق مع الكود القديم (Legacy aliases) ----------
     صفحات لم تُعدَّل بعد في هذه المرحلة (تفاصيل المنتج، السلة، الدفع)
     ما زالت تستخدم أسماء المتغيرات القديمة (--primary, --gold, --cream...).
     بإبقائها هنا كأسماء بديلة تشير لنفس الألوان الجديدة، تحصل تلك الصفحات
     تلقائيًا على الهوية الجديدة دون أي احتمال لكسرها، إلى حين تحديثها
     مباشرة لاستخدام أسماء المتغيرات الجديدة في مرحلة لاحقة. */
  --primary: var(--color-text);
  --secondary: var(--color-text-muted);
  --gold: var(--color-primary);
  --gold-light: var(--color-primary-hover);
  --cream: var(--color-surface-elevated);
  --white: var(--color-surface-elevated);
  --dark: var(--color-text);
  --success: var(--color-success);
  --danger: var(--color-danger);
  --warning: var(--color-primary);
  --muted: var(--color-text-muted);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  direction: rtl;
  text-align: right;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; }

/* focus-visible موحّد لإمكانية الوصول عبر لوحة المفاتيح (Accessibility) */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* رابط "تخطَّ إلى المحتوى": مخفي حتى يصل إليه مستخدم لوحة المفاتيح */
.skip-link {
  position: absolute;
  top: -100px;
  right: 16px;
  z-index: 1000;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--color-primary);
  color: var(--color-bg);
  font-weight: 700;
}
.skip-link:focus { top: 12px; }
#main-content:focus { outline: none; }

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}

.header-top {
  background: var(--color-bg);
  color: var(--color-primary-hover);
  font-size: 13px;
  text-align: center;
  padding: 6px 12px;
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--color-primary);
  white-space: nowrap;
}
.logo span { font-size: 12px; display: block; color: var(--color-text-muted); font-family: var(--font-body); }
.logo img { height: 52px; width: auto; border-radius: 10px; box-shadow: 0 0 0 1px rgba(198, 161, 91, .35); } /* الشعار بخلفيته الكريمية كشارة على الهيدر الداكن */

.main-nav { display: flex; gap: 28px; }
.main-nav a {
  font-weight: 600;
  font-size: 15px;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}
.main-nav a:hover, .main-nav a.active { color: var(--color-primary); border-color: var(--color-primary); }

/* زر إخفاء/إظهار القائمة — يظهر فقط على شاشات الكمبيوتر (المتصفح يستخدم
   الهامبرغر ☰ الموجود أصلاً بدلًا منه على الشاشات الصغيرة). */

.header-actions { display: flex; align-items: center; gap: 16px; }
.icon-btn {
  position: relative;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .06);
  color: var(--color-text);
  font-size: 18px;
  transition: background var(--transition-fast);
}
.icon-btn:hover { background: rgba(255, 255, 255, .14); }

.cart-count {
  position: absolute;
  top: -4px; left: -4px;
  background: var(--color-primary);
  color: var(--color-bg);
  font-size: 11px;
  font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

.hamburger {
  display: none;
  width: 40px; height: 40px;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}
.hamburger span { width: 22px; height: 2px; background: var(--color-text); margin: 0 auto; }

.search-bar {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  gap: 8px;
  max-width: 320px;
  flex: 1;
}
.search-bar input {
  background: none; border: none; color: var(--color-text); font-size: 14px; width: 100%; outline: none;
}
.search-bar input::placeholder { color: var(--color-text-muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 26px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 15px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}
/* Primary: زر الشراء/الإضافة للسلة — الأقوى بصريًا دائمًا */
.btn-primary { background: var(--color-primary); color: var(--color-bg); }
.btn-primary:hover { background: var(--color-primary-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(0); }

/* Secondary/Outline */
.btn-outline { background: transparent; border: 1.5px solid var(--color-primary); color: var(--color-primary); }
.btn-outline:hover { background: var(--color-primary); color: var(--color-bg); }

.btn-whatsapp { background: #25D366; color: #fff; }
.btn-whatsapp:hover { background: #1ebd5a; }

.btn-dark { background: var(--color-surface-elevated); color: var(--color-text); border: 1px solid var(--color-border); }
.btn-dark:hover { background: var(--color-surface); }

.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-bg) 100%);
  color: var(--color-text);
  padding: 90px 0;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 80% 30%, rgba(198, 161, 91, .16), transparent 60%);
}
.hero-content { position: relative; max-width: 620px; }
.hero-eyebrow {
  color: var(--color-primary);
  letter-spacing: 2px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 14px;
  display: block;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: 52px;
  color: var(--color-primary);
  margin-bottom: 14px;
  line-height: 1.3;
}
.hero p { font-size: 19px; color: var(--color-text-muted); margin-bottom: 32px; max-width: 480px; }
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; }

/* ---------- Section titles ---------- */
.section { padding: 64px 0; }
.section-title {
  text-align: center;
  margin-bottom: 44px;
}
.section-title .eyebrow {
  color: var(--color-primary);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 2px;
}
.section-title h2 {
  font-family: var(--font-display);
  font-size: 36px;
  color: var(--color-text);
  margin-top: 8px;
}
.section-title p { color: var(--color-text-muted); margin-top: 10px; }

/* ---------- Categories ---------- */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 22px;
}
.category-card {
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  text-align: center;
}
.category-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); }
.category-card .cat-img {
  height: 140px;
  background: linear-gradient(145deg, var(--color-surface), var(--color-bg));
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; color: var(--color-primary);
}
.category-card h3 { padding: 16px 12px 4px; font-size: 18px; color: var(--color-text); font-family: var(--font-display); }
.category-card a.view-link { display: block; padding: 4px 12px 18px; color: var(--color-primary); font-weight: 600; font-size: 14px; }

/* ---------- Product grid & card ---------- */
.products-grid {
  display: grid;
  /* 4 منتجات في الصف على الكمبيوتر، 3 على التابلت، 2 على الجوال (راجع responsive.css).
     minmax(0, 1fr) يمنع الأسماء الطويلة من توسيع العمود وكسر التخطيط */
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
}
.product-card {
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal), transform var(--transition-normal);
  display: flex;
  flex-direction: column;
  position: relative;
}
.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-4px); }

/* حاوية صورة المنتج — نسبة عرض/ارتفاع ثابتة (1:1) حتى لا تختلف أحجام
   البطاقات مهما اختلفت أبعاد الصور الأصلية، ولا تتشوّه أي صورة إطلاقًا
   بفضل object-fit: cover على .product-thumb-img أدناه. */
.product-thumb {
  display: block;
  aspect-ratio: 1 / 1;
  background: var(--color-surface);
  position: relative;
  overflow: hidden;
}
.product-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-normal);
}
.product-card:hover .product-thumb-img { transform: scale(1.04); }

/* Placeholder أنيق عند عدم وجود صورة حقيقية للمنتج */
.product-thumb-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--color-surface), var(--color-bg));
}
.product-thumb-placeholder svg { width: 38%; height: 38%; color: var(--color-primary); opacity: .55; }

.badge {
  position: absolute; top: 10px; right: 10px;
  background: var(--color-danger); color: #fff;
  font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 20px;
  z-index: 2;
}
.badge-out {
  position: absolute; top: 10px; left: 10px;
  background: var(--color-bg); color: var(--color-text);
  border: 1px solid var(--color-border);
  font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 20px;
  z-index: 2;
}
.fav-btn {
  position: absolute; bottom: 10px; left: 10px;
  width: 34px; height: 34px;
  background: rgba(15, 13, 10, .75);
  backdrop-filter: blur(2px);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--color-primary-hover);
  z-index: 2;
  transition: background var(--transition-fast);
}
.fav-btn:hover { background: rgba(15, 13, 10, .92); }

.product-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.product-cat { color: var(--color-text-muted); font-size: 12px; font-weight: 700; }
.product-name { font-size: 16px; font-weight: 700; color: var(--color-text); font-family: var(--font-display); }
.product-rating { color: var(--color-primary); font-size: 13px; }
.product-price { display: flex; align-items: baseline; gap: 8px; margin-top: auto; }
.price-now { font-size: 18px; font-weight: 800; color: var(--color-primary); }
.price-old { font-size: 13px; color: var(--color-text-muted); text-decoration: line-through; }
.stock-note { font-size: 12px; color: var(--color-success); font-weight: 600; }
.stock-note.out { color: var(--color-danger); }
.product-actions { display: flex; gap: 8px; padding: 0 16px 16px; }
.product-actions .btn { flex: 1; padding: 10px; font-size: 13px; }
.product-actions .btn-wa-inquire svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ---------- Footer ---------- */
.site-footer { background: var(--color-bg); color: var(--color-text-muted); padding-top: 56px; border-top: 1px solid var(--color-border); }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
  gap: 32px;
  padding-bottom: 40px;
}
.footer-col h4 { color: var(--color-primary); font-family: var(--font-display); font-size: 18px; margin-bottom: 16px; }
.footer-col p, .footer-col a { color: var(--color-text-muted); font-size: 14px; display: block; margin-bottom: 10px; }
.footer-col a:hover { color: var(--color-primary-hover); }
.social-icons { display: flex; gap: 12px; margin-top: 10px; }
.social-icons a {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition-fast);
}
.social-icons a:hover { background: rgba(255, 255, 255, .12); }
.footer-bottom {
  border-top: 1px solid var(--color-border);
  text-align: center; padding: 18px 0; font-size: 13px; color: var(--color-text-muted);
}

/* ---------- WhatsApp Floating ---------- */
.whatsapp-float {
  position: fixed; bottom: 24px; left: 24px; z-index: 200;
  width: 58px; height: 58px; border-radius: 50%;
  background: #25D366; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; box-shadow: var(--shadow-lg);
  transition: transform var(--transition-fast);
}
.whatsapp-float:hover { transform: scale(1.08); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--color-surface-elevated); color: var(--color-text);
  border: 1px solid var(--color-border);
  padding: 12px 22px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); font-size: 14px; font-weight: 600;
  display: flex; align-items: center; gap: 10px;
  animation: toast-in .25s ease;
}
.toast.success { border-right: 4px solid var(--color-success); }
.toast.error { border-right: 4px solid var(--color-danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Breadcrumb / page header ---------- */
.page-header { background: var(--color-surface); color: var(--color-text); padding: 30px 0; border-bottom: 1px solid var(--color-border); }
.page-header h1, .page-header .page-title { font-family: var(--font-display); color: var(--color-primary); font-size: 28px; }
.page-header .page-title { font-weight: bold; }
.breadcrumb { font-size: 13px; color: var(--color-text-muted); margin-top: 6px; }
.breadcrumb a:hover { color: var(--color-primary); }

/* ---------- Utility ---------- */
.empty-state { text-align: center; padding: 70px 20px; color: var(--color-text-muted); }
.empty-state .icon { font-size: 54px; margin-bottom: 16px; }
.skeleton {
  background: linear-gradient(90deg, var(--color-surface) 25%, var(--color-surface-elevated) 50%, var(--color-surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ===== قسم البخور المتصاعد (Hero Visual) ===== */
.hero-inner {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 48px;
  align-items: center;
}
.hero-visual { display: flex; justify-content: center; }
.mabkhara-illustration { width: 100%; max-width: 260px; height: auto; overflow: visible; }
.smoke-wisp {
  fill: none;
  stroke: var(--color-primary);
  stroke-width: 3;
  stroke-linecap: round;
  opacity: 0;
  animation: smoke-rise 7s ease-in-out infinite;
}
.smoke-wisp.w2 { stroke: var(--color-primary-hover); stroke-width: 2.2; animation-delay: 2.3s; }
.smoke-wisp.w3 { stroke: var(--color-text-muted); stroke-width: 1.6; animation-delay: 4.6s; }
@keyframes smoke-rise {
  0%   { opacity: 0; transform: translateY(14px) scale(0.94); }
  18%  { opacity: .55; }
  55%  { opacity: .32; }
  100% { opacity: 0; transform: translateY(-70px) scale(1.1); }
}
@media (prefers-reduced-motion: reduce) {
  .smoke-wisp { animation: none; opacity: .3; }
}
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero-visual { order: -1; margin-bottom: 8px; }
  .mabkhara-illustration { max-width: 190px; }
}
