/* ==================== category_items.css ==================== */

/* === 1. المتغيرات (Variables) === */
:root {
  --primary-color: #0b1f3a;      /* أزرق غامق */
  --secondary-color: #102f55;
  --accent-color: #c0c7d1;       /* فضي */
  --silver: #d8dee8;
  --silver-dark: #8f9baa;

  --glass-bg: rgba(11, 31, 58, 0.82);
  --border-color: rgba(216, 222, 232, 0.28);

  --neon-blue: #6fb7ff;
  --neon-purple: #c0c7d1;

  --text-color: #eef3f8;
  --heading-color: #ffffff;

  --light-bg: #eef3f8;
  --light-item-bg: #ffffff;
  --light-border: #c0c7d1;
  --light-text: #0b1f3a;

  --dark-bg: #071526;
  --dark-item-bg: #0b1f3a;
  --dark-border: #506070;
  --dark-text: #ffffff;

  --white: #ffffff;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
}


/* === 2. القواعد العامة === */
* {
    /* الشرح: إزالة الهوامش والبادينغ */
    margin: 0;
    padding: 0;
    /* الشرح: يجعل الحدود جزءًا من العرض */
    box-sizing: border-box;
}

/* === 3. تنسيق الجسم === */
body {
    /* الشرح: خط عربي */
    font-family: 'Tajawal', sans-serif;
    /* الشرح: خلفية فاتحة */
    background: var(--light-bg);
    /* الشرح: لون النص */
    color: var(--text-color-light);
    /* الشرح: انتقال ناعم عند التغيير */
    transition: all 0.3s;
    /* الشرح: ارتفاع كامل الشاشة */
    min-height: 100vh;
    /* الشرح: ترتيب عمودي */
    display: flex;
    flex-direction: column;
}

/* === 4. الوضع الليلي === */
body.dark-mode {
    /* الشرح: تغيير الخلفية إلى داكنة */
    background: var(--dark-bg);
    /* الشرح: تغيير لون النص */
    color: var(--text-color-dark);
}

/* === 5. شريط البحث === */
.search-container {
    /* الشرح: هامش داخلي */
    padding: 20px;
    /* الشرح: توسيط النص */
    text-align: center;
    /* الشرح: تأثير ظهور */
    animation: fadeIn 0.6s ease-in-out;
}

/* الشرح: مربع إدخال البحث */
.search-container input {
    /* الشرح: عرض 90% من الحاوية */
    width: 90%;
    /* الشرح: أقصى عرض 500 بكسل */
    max-width: 500px;
    /* الشرح: هامش داخلي */
    padding: 14px 20px;
    /* الشرح: حجم الخط */
    font-size: 15px;
    /* الشرح: حد فاتح */
    border: 1px solid var(--light-border);
    /* الشرح: زوايا مستديرة */
    border-radius: 50px;
    /* الشرح: لا حدود عند التركيز */
    outline: none;
    /* الشرح: خلفية بيضاء */
    background-color: #fff;
    /* الشرح: لون النص */
    color: var(--text-color-light);
    /* الشرح: ظل خفيف */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    /* الشرح: انتقال ناعم */
    transition: all 0.3s ease;
}

/* الشرح: عند التركيز على مربع البحث */
.search-container input:focus {
    /* الشرح: تغيير لون الحد */
    border-color: var(--primary-color);
    /* الشرح: تأثير ظل داخلي */
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.2);
    /* الشرح: تكبير طفيف */
    transform: scale(1.02);
}

/* === 6. تأثير الظهور التدريجي === */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* شريط البحث في الوضع الليلي */
body.dark-mode .search-container input {
    background-color: var(--dark-item-bg);
    border: 1px solid var(--dark-border);
    color: var(--dark-text);
}
body.dark-mode .search-container input::placeholder {
    color: rgba(255, 255, 255, 0.7); /* لون نص البحث */
}


/* الشرح: شبكة العناصر داخل القسم */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  padding: 10px 14px 16px;
  min-height: 0;
}

.item,
.section {
  position: relative;
  overflow: hidden;
  cursor: pointer;

  border-radius: 8px 22px 8px 22px;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.20), rgba(255,255,255,0.04)),
    linear-gradient(135deg, #0b1f3a, #102f55 60%, #071526);

  border: 1px solid rgba(216,222,232,0.38);
  border-bottom: 3px solid rgba(216,222,232,0.55);

  box-shadow:
    0 12px 26px rgba(0,0,0,0.22),
    inset 0 1px 0 rgba(255,255,255,0.20);

  transition: .25s ease;
  color: #ffffff;
}

.item:hover,
.section:hover {
  transform: translateY(-4px);
  box-shadow:
    0 16px 30px rgba(0,0,0,0.32),
    inset 0 1px 0 rgba(255,255,255,0.24);
}

.item-image,
.section-image {
  width: 100%;
  height: 250px;
  object-fit: cover;
  display: block;
}

.item-title,
.section-details {
  min-height: 36px;
  padding: 8px 10px;
  text-align: center;

  background:
    linear-gradient(145deg, rgba(216,222,232,0.26), rgba(255,255,255,0.07));

  border-top: 1px solid rgba(216,222,232,0.35);
}

.item-title,
.section-details h3 {
  color: #ffffff;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.25;
  margin: 0;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sections-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  padding: 12px 14px 16px;
  flex-grow: 0;
}

body.dark-mode .item,
body.dark-mode .section {
  background:
    linear-gradient(145deg, rgba(255,255,255,0.13), rgba(255,255,255,0.03)),
    linear-gradient(135deg, #071526, #0b1f3a 65%, #030914);

  border-color: rgba(216,222,232,0.28);
}

.item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: .25s;
}

.item:hover .item-overlay {
  opacity: 1;
}

.item-overlay i {
  font-size: 3rem;
  color: #d8dee8;
}
/* === 12. زر المفضلة (إذا أردت إضافته لاحقًا) === */
.favorite-btn {
    /* الشرح: موقع مطلق */
    position: absolute;
    /* الشرح: 10 بكسل من الأعلى */
    top: 10px;
    /* الشرح: 10 بكسل من اليسار */
    left: 10px;
    /* الشرح: خلفية شفافة سماوية */
    background: rgba(0, 188, 212, 0.8);
    /* الشرح: لا حدود */
    border: none;
    /* الشرح: لون النص أبيض */
    color: white;
    /* الشرح: عرض 32 بكسل */
    width: 32px;
    /* الشرح: ارتفاع 32 بكسل */
    height: 32px;
    /* الشرح: دائري */
    border-radius: 50%;
    /* الشرح: مؤشر يد */
    cursor: pointer;
    /* الشرح: محاذاة داخلية */
    display: flex;
    align-items: center;
    justify-content: center;
    /* الشرح: مستوى عالٍ */
    z-index: 2;
    /* الشرح: انتقال ناعم */
    transition: all 0.3s ease;
    /* الشرح: ظل خفيف */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* الشرح: عند التحويم على زر المفضلة */
.favorite-btn:hover {
    /* الشرح: لون أكثر تشبعًا */
    background: rgba(0, 188, 212, 1);
    /* الشرح: تكبير طفيف */
    transform: scale(1.1);
}

/* الشرح: أيقونة النجمة */
.favorite-btn i {
    /* الشرح: حجم الخط */
    font-size: 16px;
}

/* الشرح: حاوية العنصر (لدعم الزر) */
.item-wrapper {
    /* الشرح: موقع نسبي */
    position: relative;
}

/* === 18. تأثير الرمادي عند عدم التوفر === */
.grayscale {
    /* الشرح: تحويل الصورة إلى رمادي */
    filter: grayscale(100%);
    /* الشرح: تقليل الشفافية */
    opacity: 0.6;
}



/* 🌑 شارة غير متاح بتصميم أنيق وواضح */
.ribbon {
  position: absolute;
  top: 8px;
  right: 19px;
  padding: 6px 14px;
  background: linear-gradient(135deg, #ff5c8d, #b4004e);
  color: white;
  font-weight: 700;
  font-size: 14px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(180, 0, 78, 0.4);
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  animation: pulse-glow 2s infinite ease-in-out;
  z-index: 3;
}

/* 💡 تأثير وميض ناعم */
@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 8px rgba(255, 92, 141, 0.7);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 92, 141, 1);
    transform: scale(1.05);
  }
}

/* 🌓 الوضع الليلي */
body.dark-mode .ribbon {
  background: linear-gradient(135deg, #8e24aa, #5e35b1);
  box-shadow: 0 4px 10px rgba(94, 53, 177, 0.5);
}








/* === 14. رسائل الإشعار (Toast) === */
.toast {
  position: fixed;
  top: 25px;
  right: 25px;
  background: var(--primary-color);
  color: var(--black);
  padding: 18px 30px;
  border-radius: 8px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  transform: translateX(150%);
  transition: transform 0.4s;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast.show {
  transform: translateX(0);
}
.toast.success {
  background: var(--success);
  color: #fff;
}
.toast.error {
  background: var(--danger);
  color: #fff;
}
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}
.loader {
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: 1s ease-in-out infinite spin;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
  appearance: none;
}

#itemsContainer:empty {
    display: none;
}

* {
    -webkit-tap-highlight-color: transparent; /* Chrome / Safari */
    -webkit-user-select: none; /* منع تحديد النص باللمس */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE10+ */
    user-select: none; /* البقية */
}


/* === 13. التكيف مع الشاشات الصغيرة === */
@media (max-width: 720px) {
  /* أقسام صفحة index تبقى كبيرة */
  .sections-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 14px;
  }

  .section-image {
    height: 165px;
  }

  .section-details {
    min-height: 38px;
    padding: 7px 6px;
  }

  .section-details h3 {
    font-size: 13px;
  }

  /* العناصر داخل القسم تكون صغيرة 3 بالصف */
  .items-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 8px 10px 12px;
  }

  .item-image {
    height: 150px;
  }

  .item-title {
    min-height: 32px;
    padding: 6px 5px;
    font-size: 11px;
  }

  .search-container {
    padding: 10px;
  }

  .search-container input {
    max-width: 95%;
    font-size: 14px;
  }
}

@media (max-width: 420px) {
  /* index */
  .sections-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .section-image {
    height: 155px;
  }

  /* category items */
  .items-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    padding: 7px 8px 10px;
  }

  .item-image {
    height: 150px;
  }
}

@media (max-width: 340px) {
  .sections-container,
  .items-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .section-image {
    height: 135px;
  }

  .item-image {
    height: 150px;
  }
}