/* =========================
   SHOP PAGE WRAPPER
========================= */

.shop-page h1 {
  font-size: 2.2rem;
  margin-bottom: 25px;
  padding: 20px 10px 10px;
  margin-top: 10px;
  border-bottom: 1px solid #555;
}

/* =========================
   SEARCH BAR
========================= */

.search-form {
  margin-bottom: 35px;
  padding: 0 10px;
  order: 1; /* Search bar comes after filters on mobile */
}

/* Desktop - search bar at top */
@media (min-width: 900px) {
  .search-form {
    order: 0; /* Normal order on desktop */
  }
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #2e2e46;
  padding: 14px 18px;
  border-radius: 10px;
  border: 1px solid #222;
}

.search img {
  width: 20px;
  opacity: 0.7;
}

.search-input {
  background: transparent;
  border: none;
  outline: none;
  color: white;
  width: 100%;
  font-size: 1rem;
}

.search-input::placeholder {
  color: #888;
}

/* =========================
   MAIN LAYOUT
========================= */

.shop-page .container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
}

/* Desktop layout with sidebar */
@media (min-width: 900px) {
  .shop-page .container {
    grid-template-columns: 260px 1fr;
  }
}

/* =========================
   LEFT FILTER PANEL
========================= */

.left {
  background: #141420;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #222;
  order: -1; /* Show filters above search on mobile */
}

/* Desktop - filters in sidebar */
@media (min-width: 900px) {
  .left {
    order: 0; /* Normal order on desktop */
  }
}

.filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.filters h2 {
  font-size: 1.2rem;
}

.filters img {
  width: 16px;
  opacity: 0.6;
}

/* CATEGORY */

.category h2 {
  font-size: 1rem;
  margin: 15px 0 8px;
}

.category ul {
  list-style: none;
}

.category .all {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1b1b2b;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.category .all a {
  color: white;
  text-decoration: none;
  font-size: 0.95rem;
}

.category .all img {
  width: 14px;
}

.dropdown {
  margin-top: 8px;
  padding-left: 10px;
}

.dropdown li {
  margin: 6px 0;
}

ul li ul.dropdown li {
  display: block;
}

ul li ul.dropdown {
  width: 100%;
  position: relative;
  z-index: 999;
  display: none;
  border-bottom: 1px solid #fff;
}

ul li:hover ul.dropdown {
  display: block;
}

.dropdown a {
  color: #aaa;
  font-size: 0.9rem;
  text-decoration: none;
}

.dropdown a:hover {
  color: #00ffd0;
}

/* SORT */

.sort {
  margin-top: 20px;
}

.sort-by-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sort-by-heading img {
  width: 14px;
}

.sort form {
  margin-top: 10px;
}

.sort-input {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

/* APPLY BUTTON */
.category button {
  width: 100%;
  margin-top: 15px;
}

/* =========================
   RIGHT PRODUCT GRID - RESPONSIVE
========================= */

.right {
  width: 100%;
}

.products {
  display: grid;
  gap: 25px;
  /* Default: auto-fit for flexibility */
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* 1400px+ screens - 6 cards per row */
@media (min-width: 1400px) {
  .products {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* Desktop 1200-1399px - 6 cards per row */
@media (min-width: 1200px) and (max-width: 1399px) {
  .products {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* Desktop 1100-1199px - 5 cards per row */
@media (min-width: 1100px) and (max-width: 1199px) {
  .products {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Desktop 900-1099px - 4 cards per row */
@media (min-width: 900px) and (max-width: 1099px) {
  .products {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* When filter sidebar is visible but stacked (mobile) */
@media (max-width: 899px) {
  /* 600-899px - 4 cards per row (filters on top) */
  .products {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
  
  .shop-page .container {
    gap: 20px;
  }
  
  .left {
    margin-bottom: 10px;
  }
}

/* Mobile - minimum 2 cards side-by-side */
@media (max-width: 599px) {
  .products {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }
}

/* Very small screens - still 2 cards */
@media (max-width: 400px) {
  .products {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

.products a {
  text-decoration: none;
}

/* =========================
   PRODUCT CARD
========================= */

.product-card {
  background: #141420;
  border-radius: 14px;
  padding: 14px;
  border: 1px solid #222;
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  min-width: 0; /* Prevents overflow */
}

.product-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

/* Image Container with Badges */
.product-card .image-container {
  position: relative;
  margin-bottom: 12px;
}

.product-card img {
  width: 100%;
  border-radius: 10px;
}

/* Out of Stock Badge */
.out-of-stock-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
}

/* Sale Badge */
.sale-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, #ff9800, #f57c00);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(255, 152, 0, 0.4);
  animation: salePulse 2s infinite;
}

@keyframes salePulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* Product Info */
.product-card h2 {
  font-size: 1.05rem;
  margin-bottom: 4px;
  color: rgb(255, 255, 255);
}

.product-card p {
  font-size: 0.85rem;
  color: #aaa;
  margin-bottom: 8px;
}

/* Price Container */
.price-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.original-price {
  font-size: 0.9rem;
  color: #888;
  text-decoration: line-through;
  margin: 0;
}

.sale-price {
  font-size: 1.2rem;
  color: #ff9800;
  font-weight: 700;
  margin: 0;
}

.product-card h3 {
  font-size: 1.1rem;
  margin-bottom: 12px;
  color: #00ffd0;
}

.product-card button {
  margin-top: auto;
}

/* Responsive adjustments for cards */
@media (max-width: 599px) {
  .product-card {
    padding: 12px;
  }
  
  .product-card h2 {
    font-size: 0.9rem;
  }
  
  .product-card p {
    font-size: 0.75rem;
  }
  
  .product-card h3 {
    font-size: 0.95rem;
  }
  
  .product-card button {
    font-size: 0.85rem;
    padding: 8px 15px;
  }
  
  .out-of-stock-badge,
  .sale-badge {
    font-size: 0.65rem;
    padding: 4px 8px;
  }
}

@media (max-width: 400px) {
  .product-card {
    padding: 10px;
  }
  
  .product-card h2 {
    font-size: 0.8rem;
  }
  
  .product-card h3 {
    font-size: 0.85rem;
  }
  
  .sale-price {
    font-size: 1rem;
  }
  
  .original-price {
    font-size: 0.8rem;
  }
}

/* =====================================
   DYNAMIC SHOP FEATURES
   ===================================== */

/* Loading & Error States */
.loading,
.error-message,
.no-products {
  text-align: center;
  padding: 60px 20px;
  font-size: 1.2rem;
  color: #aaa;
  grid-column: 1 / -1;
}

.error-message {
  color: #ff6b6b;
  background-color: rgba(255, 107, 107, 0.1);
  border-radius: 8px;
  padding: 30px;
  border: 1px solid #ff6b6b;
}

.no-products {
  color: #888;
  font-size: 1.1rem;
}

/* Add to Cart Button */
.add-to-cart {
  width: 100%;
  padding: 10px 20px;
  background: linear-gradient(135deg, #00ffd0, #00b894);
  color: #0a0a14;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.add-to-cart:hover {
  background: linear-gradient(135deg, #00b894, #00ffd0);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 255, 208, 0.3);
}

.add-to-cart:active {
  transform: translateY(0);
}

/* Cart Badge */
.cart-count {
  position: absolute;
  top: -8px;
  right: -8px;
  background-color: #00ffd0;
  color: #0a0a14;
  font-size: 0.75rem;
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 50%;
  min-width: 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 255, 208, 0.4);
}

/* Selected Category Highlight */
.dropdown a.selected {
  background-color: #00ffd0;
  color: #0a0a14;
  padding: 5px 10px;
  border-radius: 4px;
  font-weight: bold;
}

/* Disabled Add to Cart Button */
.add-to-cart:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #666 !important;
}

.add-to-cart:disabled:hover {
  transform: none !important;
  box-shadow: none !important;
}

/* =========================
   RESPONSIVE - SHOW FILTERS ON ALL SCREENS
========================= */

@media (max-width: 899px) {
  .shop-page .container {
    grid-template-columns: 1fr;
  }
  
  .left {
    display: block; /* Filters always visible */
  }
}