/* ==================== category_items.css ==================== */

:root {
  --primary-color: #35d6ff;
  --gold-dark: #071b3a;
  --gold-light: #35d6ff;

  --light-bg: #f4fcff;
  --light-text: #071b3a;
  --light-border: rgba(7, 27, 58, 0.12);

  --dark-bg: #02040a;
  --dark-text: #ffffff;
  --dark-card: #071b3a;
  --dark-border: rgba(53, 216, 255, 0.22);

  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: 'Tajawal', sans-serif;
  background: var(--light-bg);
  color: var(--light-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.dark-mode {
  background: var(--dark-bg);
  color: var(--dark-text);
}

/* ==================== البحث ==================== */

.search-container {
  padding: 18px 16px 12px;
  text-align: center;
}

.search-container input {
  width: 92%;
  max-width: 520px;
  padding: 14px 20px;
  font-size: 15px;
  border: 1px solid var(--light-border);
  border-radius: 999px;
  outline: none;
  background: #ffffff;
  color: #071b3a;
  box-shadow: 0 8px 20px rgba(7, 27, 58, 0.08);
  transition: 0.25s ease;
}

.search-container input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(53, 216, 255, 0.16);
}

body.dark-mode .search-container input {
  background: var(--dark-card);
  color: #ffffff;
  border-color: var(--dark-border);
}

body.dark-mode .search-container input::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

/* عنوان الصفحة / القسم بدون خلفية */
.category-title,
.section-title,
.items-title,
.page-title,
.category-name,
#categoryTitle,
.products-title,
.current-category-title {
  width: fit-content;
  max-width: calc(100% - 32px);
  margin: 0 auto 14px;
  padding: 0;
  text-align: center;
  font-size: 19px;
  font-weight: 900;
  color: #071b3a;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

body.dark-mode .category-title,
body.dark-mode .section-title,
body.dark-mode .items-title,
body.dark-mode .page-title,
body.dark-mode .category-name,
body.dark-mode #categoryTitle,
body.dark-mode .products-title,
body.dark-mode .current-category-title {
  color: #35d6ff;
}

/* ==================== الأقسام ==================== */

.sections-container {
  width: 100%;
  max-width: 100%;
  padding: 14px;
  margin: 0;
  overflow: hidden;

  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 15px;
  align-items: start;
}

.sections-container .section {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: auto;

  cursor: pointer;
  transition: transform .22s ease;
}

.sections-container .section-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;

  object-fit: contain;
  object-position: center;

  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;

  transition: transform .22s ease;
}

.sections-container .section:hover {
  transform: translateY(-4px);
}

.sections-container .section:hover .section-image {
  transform: scale(1.025);
}

.sections-container .section::before,
.sections-container .section::after {
  display: none !important;
  content: none !important;
}

.sections-container .section-details {
  width: 100%;
  min-width: 0;
  padding: 9px 2px 0;
  min-height: 27px;
  pointer-events: none;
}

.sections-container .section-details h3 {
  width: 100%;
  min-width: 0;
  margin: 0;

  color: var(--ice-text);
  font-size: 14px;
  font-weight: 900;
  text-align: center;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==================== المنتجات ==================== */

.items-grid {
  width: 100%;
  max-width: 100%;

  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 16px;
  padding: 2px 12px 20px;
  align-items: start;

  overflow: hidden;
}

.items-grid .item,
.items-grid .item-wrapper {
  position: relative;
  width: 100%;
  min-width: 0;
  height: fit-content;

  cursor: pointer;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;

  transition: transform .22s ease;
}

.items-grid .item:hover,
.items-grid .item-wrapper:hover {
  transform: translateY(-4px);
}

.items-grid .item-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 245px;

  object-fit: contain;
  object-position: center;

  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;

  transition: transform .22s ease;
}

.items-grid .item:hover .item-image,
.items-grid .item-wrapper:hover .item-image {
  transform: scale(1.025);
}

.items-grid .item::before,
.items-grid .item::after,
.items-grid .item-wrapper::before,
.items-grid .item-wrapper::after {
  display: none !important;
  content: none !important;
}

.items-grid .item-title {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  padding: 9px 2px 0;

  text-align: center;
  color: var(--ice-text);
  font-size: 14px;
  font-weight: 900;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  pointer-events: none;
}

.items-grid .item-overlay {
  display: none !important;
}

/* ==================== زر المفضلة ==================== */

.items-grid .favorite-btn {
  position: absolute;
  top: 11px;
  left: 11px;
  width: 38px;
  height: 38px;
  z-index: 5;

  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.60);
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  color: #fff;

  background:
    radial-gradient(
      circle at 30% 15%,
      rgba(255,255,255,.46),
      transparent 35%
    ),
    linear-gradient(135deg, #0a6f9b, #42dfff);

  box-shadow: 0 0 16px rgba(74,220,255,.35);
  transition: .2s ease;
}

.items-grid .favorite-btn:hover {
  transform: scale(1.08);
}

.items-grid .favorite-btn i {
  font-size: 15px;
}

/* ==================== غير متاح ==================== */

.items-grid .grayscale {
  filter: grayscale(100%);
  opacity: .58;
}

.items-grid .ribbon {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;

  padding: 7px 12px;
  border-radius: 999px;

  background: linear-gradient(135deg, #0a6f9b, #42dfff);
  color: #fff;

  font-weight: 900;
  font-size: 12px;

  box-shadow: 0 0 15px rgba(74,220,255,.40);
}

/* ==================== Toast ==================== */

.toast {
  position: fixed;
  top: 25px;
  right: 25px;
  z-index: 1000;

  padding: 16px 24px;
  border-radius: 18px;

  color: #fff;
  background: linear-gradient(135deg, #0a6f9b, #42dfff);

  box-shadow:
    0 14px 30px var(--ice-shadow),
    0 0 18px rgba(74,220,255,.28);

  transform: translateX(150%);
  transition: transform .4s;

  font-weight: 900;

  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.show {
  transform: translateX(0);
}

.toast.success {
  background: linear-gradient(135deg, #168f48, #28c76f);
}

.toast.error {
  background: linear-gradient(135deg, #bd2130, #ff5c75);
}

/* ==================== Loader ==================== */

.loader {
  display: inline-block;
  width: 32px;
  height: 32px;

  border: 4px solid rgba(186,245,255,.38);
  border-radius: 50%;
  border-top-color: #42dfff;

  animation: spin 1s ease-in-out infinite;
  filter: drop-shadow(0 0 10px rgba(74,220,255,.55));
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.item-details-link {
  color: #0aa6d4;
  text-decoration: none;
  font-weight: 900;
  display: block;
  word-break: break-word;
}

body.dark-mode .item-details-link {
  color: #42dfff;
}

.item-details-link:hover {
  text-decoration: underline;
}

#itemsContainer:empty {
  display: none;
}

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;
}

/* ==================== Responsive ==================== */

@media (max-width: 1024px) {
  .sections-container {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .sections-container {
    width: 100%;
    max-width: 100%;

    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 12px;

    overflow: hidden;
  }

  .sections-container .section {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .sections-container .section-image {
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;

    object-fit: contain;
    object-position: center;
  }

  .sections-container .section:hover {
    transform: none;
  }

  .sections-container .section-details h3 {
    font-size: 13px;
  }

  .items-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding: 10px;
  }

  .items-grid .item,
  .items-grid .item-wrapper {
    width: 100%;
    min-width: 0;
  }

  .items-grid .item-image {
    width: 100%;
    max-width: 100%;
    height: 136px;

    object-fit: contain;
    object-position: center;
  }

  .items-grid .item:hover,
  .items-grid .item-wrapper:hover {
    transform: none;
  }

  .items-grid .item-title {
    font-size: 11px;
    min-height: 24px;
    padding-top: 7px;
  }

  .items-grid .favorite-btn {
    top: 5px;
    left: 5px;
    width: 30px;
    height: 30px;
  }

  .items-grid .favorite-btn i {
    font-size: 12px;
  }

  .items-grid .ribbon {
    top: 5px;
    right: 5px;
    padding: 5px 8px;
    font-size: 10px;
  }

  .search-container input {
    max-width: 95%;
    font-size: 14px;
    padding: 13px 18px;
  }
}




/* ==================== بنرات الأقسام الفرعية ==================== */

.category-banner-wrapper {
    width: 100%;
    padding: 10px;
    margin: 0 0 4px;
    overflow: hidden;
    box-sizing: border-box;
}

.category-banner-swiper {
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-radius: 12px;
    background: transparent;
}

.category-banner-swiper .swiper-wrapper {
    height: 100%;
}

.category-banner-swiper .swiper-slide {
    width: 100%;
    height: 100%;
    display: block;
    overflow: hidden;
    border-radius: 12px;
    cursor: pointer;
}

.category-banner-swiper .category-banner-image {
    display: block;
    width: 100%;
    height: 200px;
    object-fit: contain;
    border-radius: 12px;
    background: transparent;
}

.category-banner-swiper .swiper-pagination {
    bottom: 7px !important;
}

.category-banner-swiper .swiper-pagination-bullet {
    width: 7px;
    height: 7px;
    opacity: .55;
    background: var(--gold-dark);
}

.category-banner-swiper .swiper-pagination-bullet-active {
    opacity: 1;
    background: var(--primary-color);
}

body.dark-mode .category-banner-swiper {
    background: rgba(43, 0, 59, .35);
}

body.dark-mode .category-banner-swiper .category-banner-image {
    border: 1px solid var(--dark-border);
}

/* الهاتف */
@media (max-width: 768px) {
    .category-banner-wrapper {
        padding: 8px 10px 5px;
    }

    .category-banner-swiper {
        height: 120px;
        border-radius: 10px;
    }

    .category-banner-swiper .swiper-slide {
        border-radius: 10px;
    }

    .category-banner-swiper .category-banner-image {
        height: 120px;
        object-fit: cover;
        border-radius: 10px;
    }
}








@media (max-width: 360px) {
  .items-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

/* ===== إصلاح SweetAlert ===== */

.swal2-popup,
.swal2-popup *{
    box-sizing:border-box;
}

.swal2-html-container{
    margin:1em 0 !important;
}

.swal2-popup input,
.swal2-popup select,
.swal2-popup textarea{
    padding:10px 12px !important;
}

.swal2-popup label{
    display:block;
    margin-bottom:6px;
}

.swal2-actions{
    margin-top:1.2em !important;
}