/* =========================================================
   style.css — تنسيق صفحة المتجر jooomi.store
   ========================================================= */

/* ---------- 1) الألوان والمتغيرات (غيّرها هنا لتغيير لون الموقع كله) ---------- */
:root {
  --bg: #f7f5f2;           /* خلفية الصفحة */
  --surface: #ffffff;      /* خلفية البطاقات */
  --ink: #1d2433;          /* لون النص الرئيسي */
  --muted: #6b7280;        /* نص ثانوي */
  --line: #e9e4dc;         /* الحدود الخفيفة */
  --primary: #0f766e;      /* اللون الرئيسي (أخضر مزرق) */
  --primary-dark: #0b5d57;
  --primary-soft: #e3f3f0;
  --promo: #e5484d;        /* لون شارة Promotion */
  --new: #6e56cf;          /* لون شارة Nouveauté */
  --radius: 16px;
  --shadow: 0 6px 24px rgba(29, 36, 51, 0.08);
  --header-h: 72px;
}

/* ---------- 2) إعدادات عامة ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; } /* يمنع تمرير الصفحة عند فتح السلة */
/* حماية: الصفحة لا تصير أبداً أعرض من الشاشة (مهم للهاتف وللعربية) */
html, body { overflow-x: clip; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ---------- 3) الأزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: 0.95rem;
  transition: background 0.2s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: wait; }
.btn-block { width: 100%; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; font-size: 1rem;
  background: var(--bg);
}
.icon-btn:hover { background: var(--line); }

/* ---------- 4) الرأس (Header) ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;  /* شعار | تنقل | سلة */
  align-items: center; gap: 16px;
  min-height: var(--header-h);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), #14b8a6);
  color: #fff; font-weight: 700; font-size: 1.25rem;
}
.brand-logo { height: 40px; width: auto; }
.brand-name { font-weight: 700; font-size: 1.25rem; letter-spacing: -0.02em; white-space: nowrap; }
/* إذا ضاقت الشاشة جداً: اسم المتجر ينتهي بـ "…" بدل أن يخرج من الشاشة */
.brand { min-width: 0; }
.brand-name { overflow: hidden; text-overflow: ellipsis; }
.brand-mark { flex-shrink: 0; }
.brand-name span { color: var(--primary); }

.nav { display: flex; justify-content: center; gap: 6px; }
.nav-link {
  padding: 8px 16px; border-radius: 999px;
  font-weight: 500; color: var(--muted);
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}
.nav-link:hover { color: var(--ink); background: var(--bg); }
.nav-link.active { background: var(--ink); color: #fff; }

/* مجموعة الأزرار على يمين الرأس: اللغة + السلة */
.header-actions { display: flex; align-items: center; gap: 10px; }

/* 🌍 زر اختيار اللغة (FR / ع / EN) */
.lang-switch { display: flex; background: var(--bg); border-radius: 999px; padding: 3px; }
.lang-switch button {
  min-width: 34px; height: 30px; padding: 0 8px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600; color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.lang-switch button:hover { color: var(--ink); }
.lang-switch button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); }

.cart-btn {
  position: relative; display: flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 999px;
  background: var(--primary); color: #fff; font-weight: 600;
}
.cart-btn:hover { background: var(--primary-dark); }
.cart-count {
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  background: #fff; color: var(--primary);
  font-size: 0.8rem; font-weight: 700;
  display: grid; place-items: center;
}
.cart-count.bump { animation: bump 0.35s ease; }
@keyframes bump { 50% { transform: scale(1.35); } }

/* ---------- 5) الشريط الترحيبي ---------- */
.hero { padding: 40px 0 24px; }
.hero-kicker { color: var(--primary); font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.6rem); line-height: 1.15; letter-spacing: -0.02em; max-width: 680px; }
.hero h1 .accent { color: var(--primary); }
.hero-text { color: var(--muted); margin-top: 10px; max-width: 560px; }

.demo-notice {
  background: #fff7e6; border: 1px solid #f5d48a; color: #7a5300;
  padding: 10px 14px; border-radius: 12px; font-size: 0.9rem; margin-bottom: 16px;
}
.demo-notice code { background: #fdebc1; padding: 1px 6px; border-radius: 6px; }

/* ---------- 6) شبكة المنتجات ---------- */
.products-section { padding-bottom: 48px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 8px 0 16px; }
.section-head h2 { font-size: 1.3rem; }
.section-count { color: var(--muted); font-size: 0.9rem; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}
.card {
  background: var(--surface); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(29, 36, 51, 0.12); }
.card-media { position: relative; aspect-ratio: 1 / 1; background: #efebe5; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.img-placeholder {
  width: 100%; height: 100%; display: grid; place-items: center;
  font-size: 3rem; font-weight: 700; color: rgba(15, 118, 110, 0.35);
  background: linear-gradient(135deg, var(--primary-soft), #f3eee7);
}
.badges { position: absolute; top: 10px; left: 10px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.badge {
  padding: 4px 10px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; color: #fff;
  letter-spacing: 0.02em; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.badge-promo { background: var(--promo); }
.badge-new { background: var(--new); }

.card-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-category {
  font-size: 0.72rem; font-weight: 600; color: var(--primary);
  text-transform: uppercase; letter-spacing: 0.04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-actions { display: flex; flex-direction: column; gap: 6px; }

/* زر واتساب (أخضر واتساب الرسمي) */
.btn-wa {
  width: 100%; padding: 9px 10px; font-size: 0.88rem;
  background: #25d366; color: #fff; text-decoration: none;
}
.btn-wa:hover { background: #1ebe5a; }
.btn-wa svg { flex-shrink: 0; }

/* ---------- شريط البحث والأقسام ---------- */
.toolbar { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.search-box {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 0 14px; max-width: 520px; color: var(--muted);
}
.search-box:focus-within { outline: 2px solid var(--primary); border-color: transparent; }
.search-box input {
  flex: 1; border: none; outline: none; background: transparent;
  padding: 12px 0; font-size: 1rem; min-width: 0;
}
.category-bar { display: flex; gap: 8px; flex-wrap: wrap; }
.cat-chip {
  padding: 7px 14px; border-radius: 999px; font-size: 0.85rem; font-weight: 500;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  white-space: nowrap; transition: background 0.2s, border-color 0.2s;
}
.cat-chip:hover { border-color: var(--primary); }
.cat-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-light { background: var(--bg); color: var(--ink); margin-top: 12px; }
.btn-light:hover { background: var(--line); }
.card-title { font-size: 0.98rem; font-weight: 600; line-height: 1.35; }
.price-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.price { font-size: 1.15rem; font-weight: 700; color: var(--primary); }
/* الأسعار تُكتب دائماً من اليسار لليمين: "32 000 FCFA" (حتى في العربية، فلا تنقلب إلى "FCFA 32 000") */
.price, .old-price, .cart-total strong, .cart-item-price { direction: ltr; unicode-bidi: isolate; }
.old-price { color: var(--muted); text-decoration: line-through; font-size: 0.88rem; }
.btn-add { width: 100%; padding: 10px; font-size: 0.9rem; }

/* بطاقات "هيكلية" أثناء التحميل */
.skeleton { background: var(--surface); border-radius: var(--radius); height: 330px; position: relative; overflow: hidden; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.04), transparent);
  animation: shimmer 1.2s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.empty-state { text-align: center; color: var(--muted); padding: 48px 16px; background: var(--surface); border-radius: var(--radius); }

.site-footer { border-top: 1px solid var(--line); padding: 24px 0; color: var(--muted); font-size: 0.85rem; text-align: center; }

/* ---------- 7) السلة الجانبية ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(17, 24, 39, 0.45);
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.overlay.open { opacity: 1; pointer-events: auto; }

.cart {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
  width: min(420px, 100%);
  background: var(--surface);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.3s ease;
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.12);
}
.cart.open { transform: translateX(0); }
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--line); }
.cart-head h2 { font-size: 1.15rem; }
.cart-body { flex: 1; overflow-y: auto; padding: 16px; }
.cart-empty { color: var(--muted); text-align: center; padding: 32px 0; }

.cart-item { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--primary-soft); }
.cart-thumb.ph { display: grid; place-items: center; font-weight: 700; color: var(--primary); }
.cart-item-name { font-weight: 600; font-size: 0.92rem; line-height: 1.3; }
.cart-item-price { color: var(--muted); font-size: 0.85rem; }
.qty { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.qty button { width: 28px; height: 28px; border-radius: 8px; background: var(--bg); font-weight: 700; }
.qty button:hover { background: var(--line); }
.qty span { min-width: 20px; text-align: center; font-weight: 600; }
.remove-btn { color: var(--muted); font-size: 0.8rem; text-decoration: underline; }
.remove-btn:hover { color: var(--promo); }

.cart-total { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; font-size: 1.05rem; }
.cart-total strong { font-size: 1.3rem; color: var(--primary); }

.order-form { display: flex; flex-direction: column; gap: 12px; background: var(--bg); padding: 16px; border-radius: var(--radius); }
.order-form h3 { font-size: 1rem; }
.order-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; font-weight: 500; }
.order-form input, .order-form textarea {
  padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 1rem; /* 16px يمنع الآيفون من تكبير الشاشة تلقائياً */
}
.order-form input:focus, .order-form textarea:focus { outline: 2px solid var(--primary); border-color: transparent; }
.order-form textarea { resize: vertical; }
.form-error { color: var(--promo); font-size: 0.85rem; }

.order-success { text-align: center; padding: 40px 8px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.success-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-size: 2rem; font-weight: 700; }
.order-success p { color: var(--muted); }

/* ---------- 7-ب) عرض الصورة مكبّرة (Lightbox) ---------- */
/* مؤشر "عدسة تكبير" على الصور القابلة للتكبير */
.card-media[data-zoom] { cursor: zoom-in; }
.card-media[data-zoom]:focus-visible { outline: 3px solid var(--primary); outline-offset: -3px; }

.lightbox {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(10, 12, 16, 0.92);
  display: grid; place-items: center;
  padding: 56px 12px 12px;          /* مساحة لزر الإغلاق في الأعلى */
  animation: lightbox-in 0.2s ease;
}
@keyframes lightbox-in { from { opacity: 0; } to { opacity: 1; } }
.lightbox-img {
  /* الصورة كبيرة على قد الشاشة تقريباً، بدون أن تخرج منها */
  max-width: min(100%, 900px);      /* 900px حد أقصى حتى لا تصير ضبابية على الشاشات الكبيرة */
  max-height: calc(100vh - 80px);
  max-height: calc(100dvh - 80px);  /* للهاتف: يحسب شريط المتصفح */
  width: auto; height: auto;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.lightbox-close {
  position: absolute; top: 10px; right: 10px;
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.15); color: #fff;
  font-size: 1.2rem; display: grid; place-items: center;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.3); }

/* سهما التقليب بين الزوايا */
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.18); color: #fff;
  font-size: 2rem; line-height: 1; display: grid; place-items: center;
}
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.32); }
.lightbox-nav.prev { left: 12px; }
.lightbox-nav.next { right: 12px; }
/* النقاط تحت الصورة: ● ○ ○ (أي زاوية يشاهد الزبون الآن) */
.lightbox-dots {
  position: absolute; left: 0; right: 0; bottom: 14px;
  display: flex; justify-content: center; gap: 8px;
}
.lightbox-dots button {
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
}
.lightbox-dots button.active { background: #fff; }

/* الصور الصغيرة تحت صورة البطاقة (تظهر فقط إذا كان للمنتج أكثر من صورة) */
.card-thumbs { display: flex; gap: 6px; padding: 10px 14px 0; flex-wrap: wrap; }
.card-thumb {
  width: 44px; height: 44px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line); background: #fff; padding: 0;
  transition: border-color 0.2s, transform 0.1s;
}
.card-thumb:hover { border-color: var(--primary); }
.card-thumb:active { transform: scale(0.94); }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- 8) رسالة Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60;
  transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 999px; font-size: 0.9rem;
  transition: opacity 0.25s, transform 0.25s; pointer-events: none;
  max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 9) الهاتف (شاشات أصغر من 720px) ---------- */
@media (max-width: 720px) {
  :root { --header-h: 60px; }
  /* الشعار والسلة في السطر الأول، والتنقل في سطر ثانٍ */
  /* minmax(0, 1fr): الشعار يتقلّص إذا لزم، بدل أن يدفع الصفحة خارج الشاشة */
  .header-inner { grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; row-gap: 0; }
  .nav { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .brand-name { font-size: 1.1rem; }
  .brand-mark { width: 34px; height: 34px; font-size: 1.05rem; }
  .cart-label { display: none; }
  .header-actions { gap: 6px; }
  .lang-switch button { min-width: 30px; height: 28px; padding: 0 6px; }
  .cart-btn { padding: 8px 12px; }
  .hero { padding: 24px 0 16px; }
  /* منتجان في كل سطر على الهاتف */
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .card-body { padding: 10px; }
  .card-title { font-size: 0.88rem; }
  .price { font-size: 1rem; }
  .btn-add { font-size: 0.8rem; padding: 9px 6px; }
  .badge { font-size: 0.65rem; padding: 3px 8px; }
  /* الهواتف الضيقة (أقل من 400 بكسل، أغلب هواتف أندرويد): رأس أصغر قليلاً */
  @media (max-width: 400px) {
    .brand { gap: 6px; }
    .brand-mark { width: 30px; height: 30px; font-size: 0.95rem; border-radius: 9px; }
    .brand-name { font-size: 1rem; }
    .header-actions { gap: 4px; }
    .lang-switch { padding: 2px; }
    .lang-switch button { min-width: 26px; height: 26px; padding: 0 4px; font-size: 0.75rem; }
    .cart-btn { padding: 7px 10px; gap: 6px; }
  }

  /* الصور الصغيرة أصغر قليلاً على الهاتف */
  .card-thumbs { padding: 8px 10px 0; gap: 4px; }
  .card-thumb { width: 32px; height: 32px; border-radius: 6px; }
  /* السهمان أصغر على الهاتف (الزبون يقلّب بالسحب غالباً) */
  .lightbox-nav { width: 40px; height: 40px; font-size: 1.6rem; }
  .lightbox-nav.prev { left: 6px; }
  .lightbox-nav.next { right: 6px; }
  /* زر واتساب مختصر على الهاتف: "WhatsApp" فقط */
  .wa-long { display: none; }
  .btn-wa { font-size: 0.8rem; padding: 8px 6px; gap: 6px; }
  /* الأقسام تتمرر أفقياً على الهاتف بدل أن تأخذ عدة أسطر */
  .category-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
  .category-bar::-webkit-scrollbar { display: none; }
  .search-box { max-width: none; }
}
