.product-card {
  position: relative;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  overflow: hidden;
  background-color: var(--primary-white);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
}

.clickable-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary-blue);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.product-card .card-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  justify-content: space-between;
  padding-bottom: 1.5rem;
}

.card-img-container {
  position: relative;
  overflow: hidden;
  height: 200px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  padding: 0;
  margin: 0;
  width: 100%;
}

.card-title {
  color: var(--gray-800);
  font-weight: 800;
  transition: color 0.3s ease;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  font-family: 'Cairo', sans-serif;
  letter-spacing: -0.3px;
}

.product-card:hover .card-title {
  color: var(--primary-blue);
}

.product-card .card-text {
  font-size: 0.85rem;
  color: var(--gray-600);
  line-height: 1.5;
  margin-bottom: 1rem;
  overflow: hidden;
  min-height: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  height: calc(1.5 * 3em);
}

.price {
  color: var(--gray-900);
  font-weight: 700;
  font-size: 1.2rem;
}

.original-price {
  color: var(--gray-500);
  text-decoration: line-through;
  font-size: 0.9rem;
  margin-left: 0.5rem;
}

.product-card .price-container {
  margin-bottom: 0.75rem;
}

.discount-ribbon {
  position: absolute;
  top: 12px;
  left: -8px;
  background: var(--primary-blue);
  color: white;
  padding: 0.4rem 1.5rem;
  transform: rotate(-45deg) translateX(-25%) translateY(-25%);
  transform-origin: center;
  z-index: 3;
  font-weight: 700;
  font-size: 0.75rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  border-radius: 4px 0 4px 0;
}

.stock-status {
  display: block;
  text-align: center;
  align-items: center;
  gap: 6px;
  padding: 0.3rem 0.75rem;
  border-radius: 8px;
  font-weight: 500;
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

.in-stock-status {
  background-color: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
}

.out-of-stock-status {
  background-color: var(--gray-100);
  color: var(--gray-500);
  border: 1px solid var(--gray-300);
}

.limited-quantity {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: var(--primary-blue);
  color: white;
  padding: 0.3rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  z-index: 3;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Product Image */
.card-img-top {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.3s ease;
}

/* Product Description */
.product-description {
  color: #666;
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.read-more {
  display: inline-block;
  font-size: 0.85rem;
  text-decoration: none;
  margin-right: 0.25rem;
  transition: color 0.2s;
  color: #ffd7be;
}

.read-more:hover {
  text-decoration: underline;
  color: #ffc5c5 !important;
}

/* Clickable card styles */
.clickable-card {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.clickable-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 0.5rem 1.5rem rgba(255, 182, 193, 0.2) !important;
}

/* Ensure clickable area doesn't cover buttons */
.stretched-link {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  pointer-events: auto;
  content: "";
  background-color: rgba(0,0,0,0);
}

/* Hover effect for product images */
.product-card:hover .card-img-top {
  transform: scale(1.05);
  filter: brightness(1.05);
}

/* Main product image on product detail page */
.product-image-container {
  width: 100%;
  height: 400px;
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.product-image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}


.card-img-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.02) 0%, rgba(0,0,0,0.05) 100%);
  z-index: 1;
  pointer-events: none;
}


@media (max-width: 767px) {
  .card-img-container {
    height: 160px;
  }
}

@media (max-width: 575px) {
  .card-img-container {
    height: 140px;
  }
}


.card-img-top {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.5s ease, filter 0.3s ease;
  z-index: 0;
}


.clickable-card:hover .card-img-top {
  transform: scale(1.05);
  filter: brightness(1.03);
}


.card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  position: relative;
  background: linear-gradient(to bottom, rgba(255,255,255,0.8) 0%, rgba(255,255,255,1) 15%);
  border-top: 1px solid rgba(212, 175, 55, 0.05);
}


.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: #333;
  line-height: 1.4;
  height: 2.8em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  transition: color 0.2s ease;
  font-family: 'Playfair Display', serif;
}


.clickable-card:hover .card-title {
  color: var(--primary-blue);
}


.price-container {
  margin-top: auto;
  padding-top: 0.75rem;
  position: relative;
}


.price-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(to right, rgba(0,0,0,0.03), rgba(0,0,0,0.06), rgba(0,0,0,0.03));
}


.price {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--gray-900);
  display: inline-block;
  text-shadow: none;
  transition: all 0.2s ease;
}

.clickable-card:hover .price {
  color: #ff6b9d; 
  transform: scale(1.02);
}


.original-price {
  text-decoration: line-through;
  color: var(--gray-500);
  font-size: 0.9rem;
  margin-right: 0.5rem;
  position: relative;
  opacity: 0.8;
}


.discount-ribbon {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 8px;
  background: linear-gradient(135deg, #3f4449 0%, #000 100%);
  color: white;
  animation: pulseSoft 3s infinite;
  transform-origin: center;
  border: 1px solid rgba(255, 255, 255, 0.3);
}


.limited-quantity {
  position: absolute;
  top: 50px;
  right: 10px;
  z-index: 10;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 8px;
  box-shadow: var(--limited-badge-shadow);
  background: var(--primary-blue);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

@keyframes pulseSoft {
  0% {
    transform: scale(1);
    box-shadow: var(--discount-badge-shadow);
  }
  50% {
    transform: scale(1.03);
    box-shadow: 0 3px 12px rgba(255, 106, 224, 0.3);
  }
  100% {
    transform: scale(1);
    box-shadow: var(--discount-badge-shadow);
  }
}


.stock-status {
  font-size: 0.8rem;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.in-stock-status {
  color: var(--gray-700);
  background-color: var(--gray-100);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--gray-200);
}

.out-of-stock-status {
  color: var(--gray-500);
  background-color: rgba(100, 116, 139, 0.05);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px solid rgba(100, 116, 139, 0.1);
}


.product-card-button {
  border-radius: 8px;
  font-weight: 600;
  padding: 0.5rem 1rem;
  color: #ffffff;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  border: none;
  background: var(--gray-800);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  width: 100%;
}

.product-card-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  background: var(--primary-blue);
}

.product-card-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 5px rgba(212, 175, 55, 0.2);
}


.product-card-button::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0) 100%);
  transform: rotate(30deg);
  transition: transform 0.6s;
  opacity: 0;
}

.product-card-button:hover::after {
  opacity: 1;
  transform: rotate(30deg) translate(10%, 10%);
}


.out-of-stock-card {
  opacity: 0.9;
  filter: grayscale(20%);
  position: relative;
}


.out-of-stock-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(245, 247, 250, 0.3);
  z-index: 5;
  pointer-events: none;
}


.out-of-stock-card::after {
  content: 'نفذ من المخزون';
  position: absolute;
  top: 30px;
  right: -35px;
  background: linear-gradient(135deg, rgba(100, 116, 139, 0.9) 0%, rgba(30, 41, 59, 0.9) 100%);
  color: white;
  padding: 5px 40px;
  font-size: 0.8rem;
  transform: rotate(45deg);
  z-index: 10;
  font-weight: 600;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
}


@media (max-width: 767px) {
  .card-body {
    padding: 1rem;
  }
  
  .card-title {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    height: 2.6em;
  }
  
  .price {
    font-size: 1rem;
  }
  
  .original-price {
    font-size: 0.8rem;
  }
  
  .discount-ribbon {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    top: 8px;
    right: 8px;
    border-radius: 6px;
  }
  
  .limited-quantity {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    top: 45px;
    right: 8px;
    border-radius: 6px;
  }
  
  .product-card-button {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
  }
  
  .stock-status {
    font-size: 0.75rem;
  }
  
  
  .out-of-stock-card::after {
    font-size: 0.7rem;
    top: 25px;
    right: -40px;
    padding: 3px 40px;
  }
}


@media (max-width: 575px) {
  .product-card {
    border-radius: 10px;
    margin-bottom: 0.75rem;
  }
  
  .card-body {
    padding: 0.75rem;
  }
  
  .card-title {
    font-size: 0.9rem;
    height: 2.5em;
    margin-bottom: 0.5rem;
  }
  
  .price {
    font-size: 0.95rem;
  }
  
  .price-container {
    padding-top: 0.5rem;
  }
  
  .discount-ribbon {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    top: 5px;
    right: 5px;
    border-radius: 5px;
  }
  
  .limited-quantity {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    top: 40px;
    right: 5px;
    border-radius: 5px;
  }
  
  .product-card-button {
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
  }
  
  .stock-status {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
  }
  
  
  .out-of-stock-card::after {
    font-size: 0.65rem;
    top: 20px;
    right: -45px;
    padding: 2px 40px;
  }
  
  
  .card-img-container {
    height: 130px;
  }
}


.row.g-4.g-lg-5 {
  margin-left: -0.75rem;
  margin-right: -0.75rem;
}

.row.g-4.g-lg-5 > .col-6,
.row.g-4.g-lg-5 > .col-md-4,
.row.g-4.g-lg-5 > .col-lg-3 {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  margin-bottom: 1.5rem;
}


@media (min-width: 992px) {
  .row.g-4.g-lg-5 {
    margin-left: -1rem;
    margin-right: -1rem;
  }
  
  .row.g-4.g-lg-5 > .col-6,
  .row.g-4.g-lg-5 > .col-md-4,
  .row.g-4.g-lg-5 > .col-lg-3 {
    padding-left: 1rem;
    padding-right: 1rem;
    margin-bottom: 2rem;
  }
}

@media (max-width: 767px) {
  .row.g-4.g-lg-5 {
    margin-left: -0.5rem;
    margin-right: -0.5rem;
  }
  
  .row.g-4.g-lg-5 > .col-6,
  .row.g-4.g-lg-5 > .col-md-4,
  .row.g-4.g-lg-5 > .col-lg-3 {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    margin-bottom: 1rem;
  }
}

@media (max-width: 575px) {
  .row.g-4.g-lg-5 > .col-6,
  .row.g-4.g-lg-5 > .col-md-4,
  .row.g-4.g-lg-5 > .col-lg-3 {
    margin-bottom: 0.75rem;
  }
}