/* === Reset & Base === */
/* إزالة الهوامش والحشو وتوحيد حجم الصندوق */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: 'Rubik', sans-serif;
  background: #f4f4f6;
  color: #333;
}

/* === متغيرات الألوان === */
:root {
  --bg: #fff;
  --accent1: #c4e85a;
  --accent2: #ffb370;
  --accent3: #d65ae8;
  --accent4: #63c8ff;
  --text-dark: #111;
  --shadow: rgba(0, 0, 0, 0.1);
}

/* === الحاوية الرئيسية === */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* === العنوان === */
.header .title {
  font-family: 'Dancing Script', cursive;
  font-size: 3rem;
  text-align: center;
  margin-bottom: 30px;
  color: var(--text-dark);
}

/* === شريط التنقل الديناميكي === */
.menu-nav {
  position: relative;      /* لتحديد مواضع الأسهم واليد */
  overflow: visible;       /* لا يقطع محتوى الأسهم أو اليد */
  margin-bottom: 20px;
  padding-bottom: 40px;    /* مساحة لإظهار الأسهم واليد أسفل */
}

/* قائمة التصنيفات القابلة للتمرير */
.navi {
  display: flex;
  gap: 10px;
  padding-bottom: 5px;
  overflow-x: auto;        /* تمرير أفقي */
  scroll-behavior: smooth;  /* تمرير سلس */
}

/* === أزرار التصنيفات === */
.nav-button {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: none;
  border-radius: 8px;
  padding: 10px 15px;
  box-shadow: 0 4px 6px var(--shadow);
  font-weight: 700;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
}
.nav-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 10px var(--shadow);
}
.nav-button.active {
  background: linear-gradient(145deg, #e6e4da, #ffffff);
  box-shadow: inset 2px 2px 5px var(--shadow), inset -2px -2px 5px #fff;
}

/* === الأسهم للتمرير === */
.scroll-left,
.scroll-right {
  position: absolute;
  bottom: 8px;             /* يخفضان قليلاً لأسفل */
  background: none;        /* إزالة الخلفية البيضوية */
  padding: 0;
  cursor: pointer;
  z-index: 10;             /* فوق شريط التصنيفات */
}
.scroll-left { left: 8px; }
.scroll-right { right: 8px; }

/* حجم ولون أيقونات الأسهم */
.scroll-left i,
.scroll-right i {
  font-size: 1.5rem;
  color: #555;
}

/* === مؤشر اليد المتحركة === */
.scroll-indicator {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;            /* أعلى طبقة */
  pointer-events: none;    /* لا يعيق التفاعل */
}
.scroll-indicator i {
  font-size: 3.6rem;       /* حجم ثلاثي مميز */
  color: #777;
  opacity: 0;
  animation: swipe 2s ease-in-out 1 forwards;  /* غيّر swipe إلى swipe-reverse إذا سمّيتها هكذا */
  animation-delay: 0.5s;
}

/* حركة اليد الأفقية لمرة واحدة عند التحميل */
@keyframes swipe {
  0%   { transform: translateX(20px); opacity: 0; }
  10%  { opacity: 1; }
  50%  { transform: translateX(-20px); opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateX(-20px); opacity: 0; }
}


/* === شبكة عرض الأصناف === */
.menu-items {
  padding: 10px 0;
}
.menu {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

/* === بطاقة الصنف === */
.menu-item {
  background: var(--bg);
  border-radius: 10px;
  box-shadow: 0 4px 8px var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 15px;
  transition: transform .2s;
}
.menu-item:hover {
  transform: translateY(-3px);
}

/* حالة الصنف غير المتاح */
.menu-item--disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* تفاصيل الاسم */
.menu-item-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

/* تفاصيل الوصف */
.menu-item-description {
  flex: 1;
  font-size: 0.95rem;
  margin-bottom: 12px;
  color: #555;
}

/* تفاصيل السعر */
.menu-item-price {
  font-size: 1rem;
  font-weight: 700;
  text-align: right;
  color: var(--text-dark);
    margin-top: 12px;
}

.menu-item-price-line {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
}
.menu-item-price--disabled {
  font-style: italic;
  color: #a00;
}

/* تنسيق السعر عند عدم التوفر */
.menu-item--disabled .menu-item-price {
  font-style: italic;
  color: #a00;
}

/* تنسيق هيدر البطاقة (الرقم + الاسم) */
.menu-item-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
}

/* رقم الصنف */
.menu-item-number {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent2); /* لون مميز للرقم */
}

/* === بطاقة الصورة المصغرة === */
.menu-item-image {
  position: relative;
  margin: 12px 0;
}
.thumbnail {
  width: 100%;
  border-radius: 8px;
  cursor: pointer;
}
.magnifier-icon {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 1.2rem;
  color: var(--accent2);
  cursor: pointer;
}

/* === مودال الصورة === */
.modal-image {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.8);
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-image img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 8px;
}
.close-modal {
  position: absolute;
  top: 20px; right: 30px;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
}

/* زر “In den Warenkorb” */
.menu-item-add-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 8px;
  font-size: 0.9rem;
  background-color: var(--accent1);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.2s ease-in-out;
}
.menu-item-add-btn:hover {
  opacity: 0.9;
}


/* ======================================== */
/* إضافات خاصة بمؤثرات السحب          */
/* ======================================== */

/* أولاً، نضيف خاصية overflow: hidden; للحاوية الرئيسية للأصناف.
  هذا يضمن أن المحتوى الذي ينزلق للخارج يختفي ولا يسبب ظهور شريط تمرير أفقي.
*/
.menu-items {
  position: relative; /* ضروري لضبط السياق */
  overflow: hidden;
}

/* تعريفات الحركة (Keyframes)
  هنا نصف شكل الحركة خطوة بخطوة.
*/

/* حركة الخروج لليسار */
@keyframes slide-out-to-left {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(-100%); opacity: 0; }
}

/* حركة الدخول من اليمين */
@keyframes slide-in-from-right {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* حركة الخروج لليمين */
@keyframes slide-out-to-right {
  from { transform: translateX(0); opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}

/* حركة الدخول من اليسار */
@keyframes slide-in-from-left {
  from { transform: translateX(-100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* فئات CSS لتطبيق الحركات
  سنقوم بإضافة هذه الفئات وإزالتها عبر JavaScript.
*/
.slide-out-left {
  animation: slide-out-to-left 0.3s forwards;
}
.slide-in-right {
  animation: slide-in-from-right 0.3s forwards;
}
.slide-out-right {
  animation: slide-out-to-right 0.3s forwards;
}
.slide-in-left {
  animation: slide-in-from-left 0.3s forwards;
}