/* ShopX - Responsive Product Grid & Card Styles */
:root {
  --deep-forest: #0f2f24;
  --forest-green: #1b4332;
  --emerald: #2d6a4f;
  --sage: #40916c;
  --mint: #52b788;
  --light-mint: #95d5b2;
  --ash-dark: #2c3e50;
  --ash-gray: #7f8c8d;
  --ash-light: #bdc3c7;
  --ash-bg: #d9d9d9;
  --pure-white: #ffffff;
  --gold: #f1c40f;
  --shadow-sm: rgba(15, 47, 36, 0.08);
  --shadow-md: rgba(15, 47, 36, 0.15);
  --shadow-lg: rgba(15, 47, 36, 0.25);
  --transition: all 0.3s ease;
}

body {
  background: var(--ash-bg);
}

.page-title {
  font-size: 2.2rem;
  color: var(--forest-green);
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--light-mint);
  font-weight: 300;
  text-align: center;
}

/* Products Grid Layout */
.products-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 20px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
  width: 100%;
  box-sizing: border-box;
}

/* Card Structure */
.product-card {
  width: 100%;
  height: 350px;
  background: var(--pure-white);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 5px 15px var(--shadow-sm);
  transition: var(--transition);
  position: relative;
  border: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px var(--shadow-lg);
  border-color: var(--light-mint);
}

.product-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: auto;
  flex: 1;
  overflow: hidden;
}

.product-badges-container {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 10;
  opacity: 0;
  transform: translateY(-5px);
  transition: var(--transition);
  pointer-events: none;
}

.product-card:hover .product-badges-container {
  opacity: 1;
  transform: translateY(0);
}

.product-condition-badge {
  opacity: 0;
  transform: translateY(-5px);
  transition: var(--transition);
  pointer-events: none;
}

.product-card:hover .product-condition-badge {
  opacity: 1;
  transform: translateY(0);
}

.product-tag-badge {
  padding: 4px 8px;
  border-radius: 4px;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 4px;
}

.product-img {
  width: 100%;
  height: 180px;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

.pro-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
}

.product-card:hover .pro-img {
  transform: scale(1.05);
}

.product-info {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pro-category {
  color: var(--ash-gray);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-title {
  font-size: 0.9rem;
  color: var(--forest-green);
  margin-bottom: 4px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pro-description {
  color: var(--ash-gray);
  font-size: 0.75rem;
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 32px;
}

.stock-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 6px;
  width: fit-content;
}

.stock-in {
  background: rgba(45, 106, 79, 0.1);
  color: #1b4332;
}

.stock-low {
  background: rgba(241, 196, 15, 0.15);
  color: #856404;
}

.stock-out {
  background: rgba(220, 53, 69, 0.1);
  color: #c0392b;
}

.product-rating {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 8px;
  font-size: 0.7rem;
  white-space: nowrap;
}

.product-rating i {
  color: var(--gold);
}

.product-rating i.far {
  color: var(--ash-light);
}

.product-rating span {
  margin-left: 4px !important;
  font-size: 0.7rem !important;
  color: var(--ash-gray);
}

.product-price {
  font-size: 1rem;
  color: var(--emerald);
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.old-price {
  font-size: 0.8rem;
  color: var(--ash-light);
  text-decoration: line-through;
  font-weight: 400;
}

.btn-card-row {
  padding: 0 12px 12px;
  display: flex;
  gap: 8px;
  margin-top: auto;
  align-items: center;
}

.btn-add-cart {
  flex: 1;
  padding: 8px 15px;
  background: linear-gradient(135deg, var(--emerald) 0%, var(--sage) 100%);
  color: var(--pure-white);
  border: none;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  min-height: 38px;
  text-decoration: none;
}

.btn-add-cart:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 15px rgba(64, 145, 108, 0.3);
}

.btn-add-cart:disabled {
  background: #ccc !important;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  opacity: 0.7;
}

.btn-add-cart i {
  font-size: 0.9rem;
}

.btn-wishlist-card {
  width: 38px;
  height: 38px;
  min-width: 38px;
  min-height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid #bdc3c7;
  background: #f8f9fa;
  color: #7f8c8d;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  z-index: 5;
  position: relative;
}

.btn-wishlist-card .like-count {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%) scale(1);
  background: linear-gradient(135deg, #2e5bff, #1a3fcc);
  color: #fff !important;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 24px;
  height: 18px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border: 2px solid #fff;
  box-shadow: 0 3px 8px rgba(46, 91, 255, 0.3);
  z-index: 10;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-wishlist-card:hover .like-count {
  transform: translateX(-50%) scale(1.1);
  box-shadow: 0 4px 12px rgba(46, 91, 255, 0.4);
}

.btn-wishlist-card:hover,
.btn-wishlist-card.wl-active {
  color: #ff3b30;
  border-color: #ff3b30;
  background: rgba(255, 59, 48, 0.08);
}

.btn-wishlist-card.wl-active {
  background: rgba(255, 59, 48, 0.12) !important;
  border-color: #ff3b30 !important;
  animation: heartPop 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes heartPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  grid-column: 1 / -1;
}

.empty-state i {
  font-size: 4rem;
  color: var(--ash-light);
  margin-bottom: 20px;
}

.empty-state h3 {
  color: var(--ash-gray);
  margin-bottom: 10px;
}

.empty-state p {
  color: var(--ash-gray);
  margin-bottom: 25px;
}

/* ══════════════ RESPONSIVE BREAKPOINTS ══════════════ */

/* Standard Desktop / 1200px - 1400px: 5 columns */
@media (max-width: 1400px) {
  .products-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
  }
}

/* Tablet Landscape / 993px - 1200px: 4 columns */
@media (max-width: 1200px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }
}

/* Tablet Portrait / 769px - 992px: 3-4 columns */
@media (max-width: 992px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
  }
  .page-title {
    font-size: 2rem;
  }
}

/* Large Mobile / 577px - 768px: 3 columns */
@media (max-width: 768px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 12px;
  }
  .product-card {
    height: 340px;
  }
  .product-img {
    height: 170px;
  }
  .page-title {
    font-size: 1.8rem;
  }
}

/* Standard Mobile / 361px - 576px: 2 columns */
@media (max-width: 576px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
    padding: 10px;
  }
  .product-card {
    height: 340px;
  }
  .product-img {
    height: 170px;
  }
  .product-info {
    padding: 8px;
  }
  .pro-category {
    font-size: 0.65rem;
    height: 14px;
    line-height: 14px;
  }
  .product-title {
    font-size: 0.82rem;
    height: 18px;
  }
  .pro-description {
    font-size: 0.7rem;
    height: 26px;
  }
  .stock-badge {
    height: 22px;
    line-height: 22px;
    font-size: 0.65rem;
  }
  .product-rating {
    height: 14px;
    margin-bottom: 6px;
  }
  .product-price {
    font-size: 0.88rem;
    height: auto;
    line-height: 1.2;
    margin-bottom: 6px;
  }
  .btn-card-row {
    padding: 0 8px 10px;
    gap: 6px;
  }
  .btn-add-cart {
    height: 34px;
    font-size: 0.72rem;
    padding: 6px 8px;
  }
  .btn-add-cart i {
    font-size: 0.8rem;
  }
  .btn-wishlist-card {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
  }
  .page-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
  }
}

/* Small Mobile / 320px - 360px: 2 tight, safe columns */
@media (max-width: 360px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px;
    padding: 6px;
  }
  .product-card {
    height: 310px;
  }
  .product-img {
    height: 140px;
  }
  .product-info {
    padding: 6px;
  }
  .product-title {
    font-size: 0.78rem;
  }
  .product-price {
    font-size: 0.8rem;
  }
  .btn-card-row {
    padding: 0 6px 8px;
    gap: 4px;
  }
  .btn-add-cart {
    height: 32px;
    font-size: 0.68rem;
    padding: 4px 6px;
  }
  .btn-wishlist-card {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
  }
  .btn-wishlist-card .like-count {
    display: none;
  }
}

/* Toast and Animated Elements */
.cart-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  background: var(--emerald);
  color: white;
  padding: 14px 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  max-width: min(320px, calc(100vw - 32px));
  animation: slideIn 0.3s ease;
}

.cart-toast.success { background: var(--emerald); }
.cart-toast.warning { background: #856404; }
.cart-toast.error { background: #c0392b; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes flashPriceAttentionPulse {
  0% { transform: scale(1); opacity: 0.94; filter: drop-shadow(0 0 0px rgba(230, 57, 70, 0)); }
  50% { transform: scale(1.18); opacity: 1; filter: drop-shadow(0 4px 12px rgba(230, 57, 70, 0.55)); }
  100% { transform: scale(1); opacity: 0.94; filter: drop-shadow(0 0 0px rgba(230, 57, 70, 0)); }
}

.flash-price-animated {
  display: inline-block !important;
  color: #e63946 !important;
  font-weight: 800 !important;
  transform-origin: center center !important;
  animation: flashPriceAttentionPulse 2.6s cubic-bezier(0.4, 0, 0.2, 1) infinite !important;
  will-change: transform, opacity, filter;
  transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1), filter 0.3s ease;
}

.product-card:hover .flash-price-animated,
.pd-flash-deal-hero:hover .flash-price-animated,
.flash-price-animated:hover {
  transform: scale(1.22) !important;
  filter: drop-shadow(0 6px 18px rgba(230, 57, 70, 0.75)) !important;
}

@media (prefers-reduced-motion: reduce) {
  .flash-price-animated {
    animation: none !important;
    transform: none !important;
    filter: none !important;
    will-change: auto !important;
  }
}
