@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700;800&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Cairo', sans-serif;
}

body {
  font-family: 'Cairo', sans-serif;
  background: #f5f5f5;
  min-height: 100vh;
  font-size: 18px;
  line-height: 1.6;
}

.products-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 40px;
}

.back-btn {
  background: #d7cfc4;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 16px;
  text-decoration: none;
  color: #333;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.category-title {
  color: #333;
  font-size: 2rem;
  margin: 0;
  justify-self: center;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  padding: 20px 0;
  justify-items: center;
}

/* الكرت مع القلب */
.product-card {
  position: relative;
  width: 300px;
  background: #fff;
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

/* أيقونة القلب */
.heart-icon {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 38px;
  height: 38px;
  background-color: rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.heart-icon:hover {
  transform: scale(1.1);
  background-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.heart-icon:active {
  transform: scale(0.95);
}

.heart-icon svg {
  width: 20px;
  height: 20px;
  transition: all 0.3s ease;
}

.heart-icon.animating {
  animation: heartBeat 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.heart-icon.active svg {
  fill: #ff4757;
  stroke: #ff4757;
  filter: drop-shadow(0 2px 8px rgba(255, 71, 87, 0.4));
}

.heart-icon:not(.active) svg {
  fill: none;
  stroke: #666;
  stroke-width: 2;
}

@keyframes heartBeat {
  0% { transform: scale(1); }
  20% { transform: scale(1.3) rotate(-5deg); }
  40% { transform: scale(1.1) rotate(5deg); }
  60% { transform: scale(1.25) rotate(-3deg); }
  80% { transform: scale(1.05) rotate(2deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.image-gallery {
  position: relative;
  background: #f8f8f8;
}

.product-image {
  width: 100%;
  height: 300px;
  object-fit: contain;
  cursor: pointer;
  background: #f8f8f8;
  border-radius: 8px;
}

.product-info {
  padding: 15px;
  text-align: center;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.product-name {
  margin-bottom: 8px;
  color: #3d2f2f;
  font-weight: 600;
  font-size: 18px;
}

.product-description {
  font-size: 16px;
  color: #6f5b5b;
  line-height: 1.5;
  word-break: break-word;
  max-width: 100%;
}

.product-seller {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  justify-content: center;
  margin-top: 10px;
}

.seller-link {
  text-decoration: none;
  color: #3d2f2f;
  font-weight: 600;
  font-size: 16px;
}

.no-products {
  text-align: center;
  color: #666;
  font-size: 1.1rem;
  grid-column: 1 / -1;
  padding: 60px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* Lightbox */
.lightbox {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 85%;
  max-width: 750px;
  background: rgba(30, 30, 30, 0.95);
  border-radius: 25px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 25px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.5s cubic-bezier(0.25, 1.25, 0.5, 1), opacity 0.5s ease;
}

.lightbox.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.lightbox img,
.lightbox-img {
  max-width: 92%;
  max-height: 75vh;
  border-radius: 18px;
  object-fit: contain;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.4);
  animation: fadeSlide 0.4s ease;
}

@keyframes fadeSlide {
  0% {
    opacity: 0;
    transform: translateX(20px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeSlideReverse {
  0% {
    opacity: 0;
    transform: translateX(-20px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.close-lightbox,
.close-btn {
  position: absolute;
  top: 14px;
  right: 20px;
  background: none;
  border: none;
  font-size: 32px;
  color: #fff;
  cursor: pointer;
}

.lightbox-nav,
.prev-btn, 
.next-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(90, 67, 45, 0.85);
  border: none;
  color: #fff;
  font-size: 30px;
  cursor: pointer;
  padding: 12px 20px;
  border-radius: 50%;
  transition: background 0.3s;
}

.lightbox-nav:hover,
.prev-btn:hover, 
.next-btn:hover {
  background: #3b2a1a;
}

.lightbox-nav.prev-btn,
.prev-btn { 
  left: 20px; 
}

.lightbox-nav.next-btn,
.next-btn { 
  right: 10px; 
}

/* ====== TABLET: 481px - 768px ====== */
@media (max-width: 768px) and (min-width: 481px) {
  body {
    font-size: 17px;
  }

  .products-container {
    padding: 30px 15px;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    padding: 15px 0;
  }

  .product-card {
    width: 100%;
    max-width: 320px;
    position: relative !important;
  }

  .heart-icon {
    width: 36px;
    height: 36px;
    top: 8px;
    left: 8px;
  }

  .heart-icon svg {
    width: 19px;
    height: 19px;
  }

  .product-image {
    height: 220px;
    object-fit: contain !important;
  }

  .product-info {
    padding: 13px;
  }

  .product-name {
    font-size: 17px;
  }

  .product-description {
    font-size: 15px;
  }
}

/* ====== MOBILE: 360px - 480px ====== */
@media (max-width: 480px) and (min-width: 360px) {
  body {
    font-size: 16px;
  }

  .products-container {
    padding: 20px 12px;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    padding: 10px 0;
  }

  .product-card {
    width: 100%;
    max-width: 100%;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(31, 36, 73, 0.1);
    border: 1px solid #e2e8f0;
    margin-bottom: 10px;
    position: relative !important;
  }

  .heart-icon {
    width: 34px;
    height: 34px;
    top: 8px;
    left: 8px;
  }

  .heart-icon svg {
    width: 18px;
    height: 18px;
  }

  .product-image {
    height: 180px !important;
    object-fit: contain !important;
    background: #f8f8f8;
    border-radius: 8px;
  }

  .product-info {
    padding: 12px;
    padding-bottom: 14px;
  }

  .product-name {
    color: #1F2449;
    font-size: 16px;
    margin-bottom: 7px;
  }

  .product-description {
    font-size: 14px;
    color: #944C2E;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 5px;
  }

  .product-seller {
    padding: 8px;
  }

  .lightbox {
    width: 95%;
    max-width: 400px;
    background: rgba(0, 0, 0, 0.95);
    padding: 20px;
    transform: translate(-50%, -50%) scale(0.9);
    border-radius: 15px;
  }

  .lightbox.show {
    transform: translate(-50%, -50%) scale(1);
  }

  .lightbox img {
    max-height: 60vh;
    border-radius: 10px;
  }

  .close-btn,
  .close-lightbox {
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    font-size: 20px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .prev-btn, 
  .next-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .prev-btn { 
    left: 10px; 
  }
  
  .next-btn { 
    right: 10px; 
  }
}

/* ====== MOBILE SMALL: 320px - 359px ====== */
@media (max-width: 359px) {
  body {
    font-size: 15px;
  }

  .products-container {
    padding: 15px 10px;
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 8px 0;
  }

  .product-card {
    border-radius: 14px;
    position: relative !important;
  }

  .heart-icon {
    width: 32px;
    height: 32px;
    top: 6px;
    left: 6px;
  }

  .heart-icon svg {
    width: 16px;
    height: 16px;
  }

  .product-image {
    height: 160px !important;
    object-fit: contain !important;
  }

  .product-info {
    padding: 10px;
    padding-bottom: 12px;
  }

  .product-name {
    font-size: 15px;
    margin-bottom: 6px;
  }

  .product-description {
    font-size: 13px;
  }

  .lightbox {
    width: 98%;
    padding: 15px;
  }

  .lightbox img {
    max-height: 55vh;
  }

  .close-btn,
  .close-lightbox {
    width: 35px;
    height: 35px;
    font-size: 18px;
  }

  .prev-btn, 
  .next-btn {
    width: 35px;
    height: 35px;
    font-size: 16px;
  }
}

/* ====== DESKTOP: 769px+ ====== */
@media (min-width: 769px) and (max-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
  }

  .product-card {
    width: 100%;
    max-width: 280px;
  }
}

@media (min-width: 1440px) {
  .products-container {
    max-width: 1400px;
  }

  .products-grid {
    gap: 30px;
  }

  .product-card {
    max-width: 320px;
  }
}