/* ======================
   CSS Variables & Fonts
   ====================== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');

:root {
  --primary-color: #893b8f;
  --secondary-color: #9ec34d;
  --accent-color: #90cfe1;
  --bg-color: #ffffff;
  --text-color: #1a1a1a;
  --text-light: #666666;
  --border-color: #eeeeee;
  --shadow-soft: 0 4px 15px rgba(0, 0, 0, 0.05);

  --transition: all 0.3s ease-in-out;
  --font-main: 'Cairo', sans-serif;
}

/* ======================
   Global Reset & Base
   ====================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-color);
  color: var(--text-color);
  direction: rtl;
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ======================
   Typography
   ====================== */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-weight: 700;
}

p {
  margin-bottom: 1rem;
  color: var(--text-light);
}

/* ======================
   Loading Overlay
   ====================== */
#page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.95);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition:
    opacity 0.5s ease,
    visibility 0.5s ease;
}

#page-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-logo {
  width: 150px;
  max-width: 80%;
  animation: pulse 2.5s infinite ease-in-out;
}

@keyframes pulse {
  0% {
    transform: scale(0.95);
    opacity: 0.2;
  }
  50% {
    transform: scale(1.05);
    opacity: 1;
  }
  100% {
    transform: scale(0.95);
    opacity: 0.2;
  }
}

/* ======================
   Buttons
   ====================== */
.btn {
  display: inline-block;
  padding: 10px 25px;
  border-radius: 5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  outline: none;
  text-align: center;
  transition: var(--transition);
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}
.btn-primary:hover {
  background-color: #722f78;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(137, 59, 143, 0.3);
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: white;
}
.btn-secondary:hover {
  background-color: #8bb33f;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(158, 195, 77, 0.3);
}

.btn-outline {
  background-color: transparent;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
}
.btn-outline:hover {
  background-color: var(--primary-color);
  color: white;
}

/* ======================
   Layout & Containers
   ====================== */
.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

section {
  padding: 60px 0;
}

/* ======================
   Carousel
   ====================== */
.carousel {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding: 0;
  margin: 0;
}
.carousel-inner {
  display: flex;
  transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
}
.carousel-item {
  min-width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f0f6;
  aspect-ratio: 16/9;
  overflow: hidden;
}
.carousel-item picture,
.carousel-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}
.carousel-caption {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: white;
  background: rgba(0, 0, 0, 0.55);
  padding: clamp(12px, 3vw, 25px) clamp(15px, 4vw, 30px);
  border-radius: 12px;
  width: min(92%, 650px);
  max-height: 80%;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: break-word;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.carousel-caption h1 {
  color: white;
  font-size: clamp(1.1rem, 3vw, 2.2rem);
  margin-bottom: clamp(6px, 1.5vw, 12px);
  line-height: 1.3;
}
.carousel-caption p {
  color: rgba(255, 255, 255, 0.95);
  font-size: clamp(0.85rem, 2vw, 1.1rem);
  margin-bottom: clamp(10px, 2vw, 20px);
  line-height: 1.5;
}
.carousel-indicators {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 10;
}
.indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: var(--transition);
}
.indicator.active {
  background-color: var(--primary-color);
  transform: scale(1.3);
}

/* ======================
   Navbar Component
   ====================== */
.navbar {
  background-color: var(--bg-color);
  box-shadow: var(--shadow-soft);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.navbar-brand {
  display: flex;
  align-items: center;
}
.navbar-brand img {
  height: 80px;
  width: auto;
  object-fit: contain;
  display: block;
}
.navbar-nav {
  display: flex;
  gap: 20px;
}
.nav-link {
  font-weight: 600;
  color: var(--text-color);
}
.nav-link:hover,
.nav-link.active {
  color: var(--primary-color);
}
.nav-icons {
  display: flex;
  gap: 15px;
  align-items: center;
}
.navbar-left {
  display: flex;
  align-items: center;
  gap: 15px;
}
.cart-icon {
  position: relative;
  font-size: 1.2rem;
  color: var(--primary-color);
}
.cart-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background-color: var(--secondary-color);
  color: white;
  font-size: 0.75rem;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.menu-toggle {
  display: none;
  font-size: 1.5rem;
  color: var(--primary-color);
  cursor: pointer;
}
.close-menu {
  display: none;
  position: absolute;
  top: 15px;
  left: 20px;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-color);
  border: none;
  padding: 0;
  margin: 0;
  line-height: 1;
}

/* ======================
   Footer Component
   ====================== */
footer {
  background-color: #fafafa;
  padding: 50px 0 20px;
  border-top: 1px solid var(--border-color);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}
.footer-col h4 {
  margin-bottom: 20px;
  color: var(--primary-color);
}
.footer-col ul li {
  margin-bottom: 10px;
}
.footer-col a:hover {
  color: var(--secondary-color);
}
.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  color: var(--text-light);
  font-size: 0.9rem;
}

/* ======================
   Toast Notifications
   ====================== */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background-color: var(--secondary-color);
  color: white;
  padding: 15px 25px;
  border-radius: 5px;
  box-shadow: var(--shadow-soft);
  font-weight: 600;
  opacity: 0;
  transform: translateY(-20px);
  transition: all 0.3s ease;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ======================
   Modal & Quick View
   ====================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 1;
  visibility: visible;
  transition: all 0.3s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  visibility: hidden;
}

.modal-content {
  background: #fff;
  border-radius: 12px;
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 30px;
  transform: translateY(0);
  transition: all 0.3s ease;
}

.modal-overlay.hidden .modal-content {
  transform: translateY(-50px);
}

.modal-close {
  position: absolute;
  top: 15px;
  left: 15px;
  background: #ff4d4f;
  border: none;
  font-size: 1.5rem;
  color: #fff;
  cursor: pointer;
  line-height: 1;
  z-index: 10;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(255, 77, 79, 0.4);
}

.modal-close:hover {
  background: #ff7875;
  transform: scale(1.1);
}

.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}

.quick-view-swiper {
  width: 100%;
  height: 350px;
  border-radius: 8px;
  overflow: hidden;
}

.quick-view-swiper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.qv-title-ar {
  margin: -4px 0 10px;
  color: var(--text-light);
  font-size: 0.95rem;
}

.quick-view-swiper.static-gallery .swiper-wrapper {
  display: block;
  height: 100%;
  transform: none !important;
}

.quick-view-swiper.static-gallery .swiper-button-next,
.quick-view-swiper.static-gallery .swiper-button-prev,
.quick-view-swiper.static-gallery .swiper-pagination {
  display: none;
}

.quick-view-gallery {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 9px;
  padding: 8px;
  background: #fff;
}

.quick-view-main-image {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 5px 18px rgba(74, 42, 68, 0.1);
}

.quick-view-thumbnails {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  height: 70px;
  overflow-x: auto;
}

.quick-view-thumb {
  min-width: 70px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(74, 42, 68, 0.1);
}

.quick-view-thumb.active {
  border-color: var(--primary-color);
}

.quick-view-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  margin: 0;
  background: rgba(255, 255, 255, 0.92);
  color: var(--primary-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-family: Arial, sans-serif;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(74, 42, 68, 0.18);
  transform: translateY(-50%);
}

.quick-view-next {
  left: 12px;
}
.quick-view-prev {
  right: 12px;
}

.quick-view-thumb img {
  object-fit: contain;
}

/* ======================
   Product Swiper in Card
   ====================== */
.product-card-swiper {
  width: 100%;
  height: 200px;
  margin-bottom: 15px;
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.product-card-swiper .swiper-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card-swiper .swiper-button-next,
.product-card-swiper .swiper-button-prev {
  color: var(--primary-color);
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  opacity: 0;
  transition: opacity 0.3s;
}

.product-card-swiper .swiper-button-next::after,
.product-card-swiper .swiper-button-prev::after {
  font-size: 14px;
}

.product-card:hover .product-card-swiper .swiper-button-next,
.product-card:hover .product-card-swiper .swiper-button-prev {
  opacity: 1;
}

.product-card-swiper .swiper-pagination-bullet-active {
  background: var(--primary-color);
}

/* ===== Quantity Stepper (Global) ===== */
.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 0;
  border: 2px solid var(--primary-color);
  border-radius: 50px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 10px rgba(137, 59, 143, 0.15);
  transition: box-shadow 0.3s ease;
}
.qty-stepper:hover {
  box-shadow: 0 4px 18px rgba(137, 59, 143, 0.28);
}
.qty-btn {
  background: transparent;
  border: none;
  color: var(--primary-color);
  font-size: 1.3rem;
  font-weight: 700;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.15s ease;
  line-height: 1;
  user-select: none;
}
.qty-btn:hover {
  background: var(--primary-color);
  color: #fff;
}
.qty-btn:active {
  transform: scale(0.88);
}
.qty-value {
  min-width: 36px;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  color: #333;
  padding: 0 4px;
  border-left: 1px solid rgba(137, 59, 143, 0.2);
  border-right: 1px solid rgba(137, 59, 143, 0.2);
}

/* ======================
   Packages & Reviews
   ====================== */
.reviews-section {
  padding: 60px 0 40px;
  background: #faf5fa;
  overflow: hidden; /* ← جديد: نمنع أي خروج برا السكشن */
}

.reviews-swiper.swiper {
  width: 100%;
  max-width: 100%; /* ← مهم: ميتعديش عرض الصفحة */
  padding: 10px 0 70px;
  position: relative;
  overflow: hidden; /* ← غيّرناه من visible لـ hidden */
}

.reviews-swiper .swiper-wrapper {
  align-items: stretch;
}

.reviews-swiper .swiper-slide {
  display: flex;
  align-items: center;
  justify-content: center;
  height: auto;
  width: auto; /* ← جديد: عشان Swiper يتحكم في العرض */
}

.reviews-swiper .swiper-slide img {
  width: 100%;
  max-width: 100%; /* ← مهم: الصورة متعديش حجم الـ slide */
  height: auto; /* ← جديد: responsive */
  max-height: 320px; /* ← نفس الارتفاع الأقصى بس مرن */
  object-fit: contain;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(72, 35, 62, 0.08);
  display: block;
}

/* ===== Arrows ===== */
.reviews-swiper .reviews-next,
.reviews-swiper .reviews-prev {
  position: absolute;
  top: 42%;
  transform: translateY(-50%);
  z-index: 20;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  color: var(--primary-color);
  box-shadow: 0 4px 15px rgba(72, 35, 62, 0.18);
  border: 2px solid #eee3eb;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.reviews-swiper .reviews-next::after,
.reviews-swiper .reviews-prev::after {
  display: none !important;
}

.reviews-swiper .reviews-next i,
.reviews-swiper .reviews-prev i {
  font-size: 16px;
  line-height: 1;
  pointer-events: none;
}

.reviews-swiper .reviews-next:hover,
.reviews-swiper .reviews-prev:hover {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
  transform: translateY(-50%) scale(1.1);
}

/* في RTL: next على الشمال، prev على اليمين */
.reviews-swiper .reviews-next {
  left: 5px;
  right: auto;
}
.reviews-swiper .reviews-prev {
  right: 5px;
  left: auto;
}

/* ===== Pagination ===== */
.reviews-swiper .reviews-pagination.swiper-pagination {
  position: absolute;
  bottom: 20px !important;
  left: 50% !important;
  right: auto !important;
  top: auto !important;
  transform: translateX(-50%);
  width: auto !important;
  z-index: 20;
}

.reviews-swiper .reviews-pagination .swiper-pagination-bullet {
  width: 10px;
  height: 10px;
  background: #d4c4d4;
  opacity: 1;
  margin: 0 6px !important;
  transition: all 0.3s ease;
}

.reviews-swiper .reviews-pagination .swiper-pagination-bullet-active {
  background: var(--primary-color);
  width: 24px;
  border-radius: 5px;
}

/* ======================
   Featured Products Grid
   ====================== */
#featured-products-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 20px;
  margin-top: 40px;
  width: 100%;
}

#featured-products-grid .product-card {
  width: 230px;
  flex-shrink: 0;
  height: 415px;
  min-width: 0;
}

/* ======================
   Responsive Styles
   ====================== */

@media (min-width: 769px) and (max-width: 1024px) {
  .reviews-swiper .swiper-slide img {
    height: 260px;
  }
}

@media (max-width: 768px) {
  /* Navbar Mobile */
  .navbar .container {
    flex-wrap: nowrap;
    padding: 10px 15px;
  }

  .navbar-brand img {
    height: 55px;
  }

  .navbar-left {
    gap: 20px;
  }

  .nav-icons {
    margin: 0;
  }

  .menu-toggle {
    display: block;
    font-size: 1.3rem;
  }

  .navbar-nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--bg-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    text-align: right;
    z-index: 1001;
  }

  .navbar-nav.show {
    display: flex;
  }

  .close-menu {
    display: block;
  }

  .navbar-nav li {
    margin-bottom: 15px;
  }

  /* Carousel Mobile */
  .carousel-item {
    aspect-ratio: 3/3.8;
    min-height: 420px;
  }

  .carousel-caption {
    padding: 14px 18px;
    width: min(94%, 500px);
  }

  .carousel-indicators {
    bottom: 15px;
  }

  /* Modal Mobile */
  .modal-grid {
    grid-template-columns: 1fr;
  }
  .quick-view-swiper {
    height: 250px;
  }

  section {
    padding: 40px 0;
  }

  /* Reviews Mobile */
  .reviews-swiper.swiper {
    padding: 10px 0 55px;
    overflow: hidden; /* مهم: نخفي اللي برا الشاشة */
    width: 100%;
    max-width: 100vw;
  }

  .reviews-swiper .swiper-slide {
    max-width: 100%;
    overflow: hidden;
  }

  .reviews-swiper .swiper-slide img {
    width: 100%; /* تملى عرض الـ slide */
    height: auto;
    max-height: 350px;
    object-fit: contain;
    margin: 0 auto;
  }

  .reviews-swiper .reviews-next,
  .reviews-swiper .reviews-prev {
    display: none;
  }

  .reviews-swiper .reviews-pagination.swiper-pagination {
    bottom: 12px !important;
  }

  #featured-products-grid .product-card {
    width: 200px;
    height: 360px;
  }
}

@media (max-width: 480px) {
  .carousel-item {
    min-height: 380px;
  }

  .carousel-caption h1 {
    font-size: 1.1rem;
  }

  .carousel-caption p {
    font-size: 0.85rem;
  }

  #featured-products-grid {
    gap: 12px;
  }

  #featured-products-grid .product-card {
    width: calc(50% - 6px);
    height: 340px;
  }
}
