/* === Reset === */
*, *::before, *::after {
  box-sizing: border-box;
}
/* === Base Grid Layout === */
.cpc-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr); /* ✅ Force 5 cards */
  gap: 16px;
  padding: 20px 0;
}
.cpc-grid-wrapper {
  max-width: 1350px;
  margin: 0 auto;
  background: #000;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}


.cpc-image {
  width: 100px;
  height: 100px;
  object-fit: contain;
  background: transparent;
  display: block;
  margin: 0 auto;
}

/* === Card Container === */
.cpc-card {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-width: 240px;
  scroll-snap-align: start;
  height: 320px;         /* Fixed height */
  flex: 0 0 auto;        /* Prevent stretching in grid or flex */
  padding: 1rem;
  background-color: #344257;
  border-radius: 10px;
  position: relative;
  overflow: hidden;
  color: white;
}

.cpc-flex-content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-grow: 1;
}


/* === Badge === */
.cpc-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: bold;
  color: #fff;
  background-color: #FCB900;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  z-index: 10;
}
.cpc-badge.sale { background-color: #e63946; }
.cpc-badge.stock { background-color: #3F4855; }
.cpc-badge.new { background-color: #3498db; }

/* === Product Image === */
.cpc-img-wrapper {
  text-align: center;
  margin-top: 4rem; /* ✅ Increase this slightly */
}

.cpc-img-wrapper img {
  height: 90px;
  width: auto;
  object-fit: contain;
  transition: transform 0.7s ease;
}

.cpc-img-wrapper:hover img {
  transform: scale(1.1);
}

/* === Quantity Controls === */
.cpc-card .cpc-qty-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1rem;
  gap: 4px;
}
.cpc-card .cpc-btn {
  background: transparent;
  border: none;
  color: #FCB900;
  font-size: 22px;
  padding: 0;
  width: 30px;
  height: 30px;
  text-align: center;
  cursor: default;
}
.cpc-card .cpc-btn:enabled {
  cursor: pointer;
}
.cpc-card .cpc-btn:disabled {
  opacity: 0.3;
  pointer-events: none;
}
.cpc-card .cpc-qty-input {
  width: 40px;
  height: 30px;
  text-align: center;
  background: #2A303C !important;
  color: white !important;
  border: 1px solid #444;
  border-radius: 6px;
  font-size: 16px;
  outline: none;
  -webkit-appearance: none;
  margin: 0;
  -moz-appearance: textfield;
}
.cpc-card .cpc-qty-input::-webkit-outer-spin-button,
.cpc-card .cpc-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.cpc-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* === Product Details === */
.cpc-details {
  display: flex;
  flex-direction: column;
  gap: 2px; /* Change this to control spacing between title and price */
  margin: 0 !important;
  padding: 0 !important;
}


.cpc-title {
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.2 !important;
}

.cpc-title a {
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  font-family: 'Inter', sans-serif;
  display: inline-block;
  text-decoration: none;
  color: #FCB900;
  margin: 0 !important;
  padding: 0 !important;

  white-space: nowrap;           /* ⛳ Force single line */
  overflow: hidden;              /* ⛳ Prevent spill */
  text-overflow: ellipsis;       /* ⛳ Add "..." at end if too long */
  max-width: 100%;               /* ⛳ Respect container width */
}


.cpc-price {
  font-size: 0.85rem !important;
  font-weight: bold !important;
  font-family: 'Inter', sans-serif;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.2 !important;
}

.cpc-meta {
  font-size: 0.8rem;
  color: #ccc;
  margin-top: 0.25rem;
}

/* === Footer Buttons === */
.cpc-footer {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}
.cpc-add-to-cart-btn {
  background: #FCB900;
  color: #000;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-family: "Roboto", "Helvetica", "Arial", sans-serif;
  font-size: 0.8125rem;    /* Same as MUI */
  font-weight: 500;
  min-height: 36px;
  line-height: 1.75;
  cursor: pointer;
  flex: 3;
  text-align: center;
  text-decoration: none;
  transition: all 0.3s ease;
}


.cpc-add-to-cart-btn:hover {
  color: #000;
  transform: translateY(-2px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}
.cpc-view-link {
  background: #2A313C;
  color: #000;
  padding: 8px;
  border: none;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  text-decoration: none;
  font-size: 20px;
  line-height: 1;
}

/* === Filter/Controls === */
.cpc-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
  align-items: center;
}
.cpc-controls label {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  color: white;
}
.cpc-controls input,
.cpc-controls select {
  padding: 5px;
  font-size: 1rem;
  background: #222;
  color: white;
  border: 1px solid #444;
  border-radius: 5px;
}
#cpc-filter-btn {
  background: #FCB900;
  color: black;
  padding: 6px 12px;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
}

/* === Pagination === */
.cpc-pagination {
  margin-top: 2rem;
  text-align: center;
}
.cpc-pagination .page-numbers {
  display: inline-block;
  margin: 0 5px;
  padding: 6px 12px;
  background: #f2f2f2;
  border-radius: 4px;
  text-decoration: none;
  color: #333;
}
.cpc-pagination .current {
  background: #333;
  color: #fff;
}

.cpc-game-select.open #cpc-game-options,
.cpc-controls.open #cpc-game-options {
  display: block;
}
/* === Game Dropdown === */
.dropdown-container {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 280px;
}
.dropdown-button {
  background-color: #000;
  color: #d4af37;
  border: 1px solid #333;
  padding: 1rem 1.25rem;
  width: 100%;
  text-align: left;
  font-size: 1rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: border 0.3s ease;
}
.dropdown-button:hover {
  border-color: #d4af37;
}
.dropdown-button svg {
  transition: transform 0.3s ease;
}
.dropdown-button.open svg {
  transform: rotate(180deg);
}
.dropdown-menu {
  position: absolute;
  top: 110%;
  left: 0;
  width: 100%;
  background: #000;
  border: 1px solid #333;
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 100;
}
.dropdown-menu div {
  padding: 0.75rem 1.25rem;
  cursor: pointer;
  transition: background 0.3s;
}
/* Game & Item Type dropdown hover effect */
#gameDropdownMenu div:hover,
#typeDropdownMenu div:hover {
  background-color: #222;
  color: #d4af37;
  cursor: pointer;
  border-radius: 4px;
}

/* Price Dropdown Styles */
.cpc-price-select {
  position: relative;
  display: inline-block;
  width: 320px;
}

.cpc-price-select .dropdown-button {
  background-color: #000;
  color: #d4af37;
  border: 1px solid #333;
  padding: 1rem 1.25rem;
  width: 100%;
  text-align: left;
  font-size: 1rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: none;
}

.cpc-price-select .dropdown-button:hover {
  border-color: #d4af37;
}

.cpc-price-select .dropdown-button svg {
  transition: transform 0.3s ease;
}

.cpc-price-select .dropdown-button.open svg {
  transform: rotate(180deg);
}

.cpc-price-select .dropdown-menu {
  position: absolute;
  top: 110%;
  left: 0;
  width: 100%;
  background: #000;
  border: 1px solid #333;
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 100;
  padding: 1rem;
}
/* === Price Input Container === */
.cpc-price-inputs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

/* === Price Field (Wrapper for $ icon + input) === */
.cpc-price-field {
  display: flex;
  align-items: center;
  background: #222222;              /* ✅ Full background */
  border: 1px solid #333;
  border-radius: 4px;
  padding: 0 0.5rem;
  flex: 1 1 0;
  min-width: 0;
  max-width: 140px;                 /* ✅ Keeps within dropdown */
  box-sizing: border-box;
}

/* === Dollar Icon === */
.cpc-price-icon {
  color: #d4af37;
  font-weight: bold;
  font-size: 1rem;
  margin-right: 4px;
}

/* === Input Field === */
.cpc-price-field input[type="text"] {
  background-color: transparent !important; /* ✅ No white */
  color: #d4af37;
  border: none;
  outline: none;
  font-size: 0.95rem;
  padding: 0.5rem 0;
  width: 100%;
  box-sizing: border-box;
}


/* === Price Range Container === */
.price-range {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

/* === Clickable Row === */
.cpc-price-option {
  display: flex;
  align-items: center;
  background: #222222;
  padding: 0.6rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease;
  width: 100%;
  box-sizing: border-box;
  user-select: none;
}

.cpc-price-option:hover {
  background: #2A2A2A;
}
.cpc-price-select:hover,
.cpc-price-select:focus-within,
.cpc-price-select .dropdown-menu:hover {
  background: #000 !important;  /* ✅ Keeps dropdown black on hover */
}
/* === Hidden Input But Visually Styled === */
.cpc-price-option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid #d4af37;
  background: transparent;
  border-radius: 2px;
  margin-right: 0.75rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease;
  pointer-events: none; /* Let parent div handle the click */
}

.cpc-price-option input[type="radio"]:checked {
  background-color: #d4af37;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23000'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px;
}

/* === Label Text (no pointer needed) === */
.cpc-price-option label {
  margin: 0;
  color: #d4af37;
  font-size: 0.95rem;
  flex: 1;
  pointer-events: none; /* So entire .cpc-price-option gets the click */
}


/* Actions */
.cpc-price-select .dropdown-actions {
  display: flex;
  gap: 0.5rem;
}

.cpc-price-select .dropdown-actions button {
  flex: 1;
  padding: 0.5rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-weight: bold;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.cpc-price-select .dropdown-actions .reset-btn {
  background: #222;
  color: #d4af37;
  border: 1px solid #d4af37;
}

.cpc-price-select .dropdown-actions .apply-btn {
  background: #d4af37;
  color: #000;
}

/* === Reset Filters === */

.cpc-reset-filters {
  background-color: #000;
  color: #d4af37;
  border: 1px solid #333;
  padding: 1.17rem 1.2rem; /* Match dropdowns */
  font-size: 1rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: border 0.3s ease;
  white-space: nowrap;
}
.cpc-reset-filters:hover {
  border-color: #d4af37;
  color: #d4af37; /* Prevent turning white on hover */
  background-color: #000; /* Ensure background stays black */
}

.cpc-reset-filters:hover svg {
  color: #d4af37; /* Ensure icon color stays gold */
  fill: #d4af37;
}

/* === Search Bar === */

.cpc-search-bar {
  display: inline-block;
  width: 100%;
  margin-top: 16px;
}

.cpc-search-bar .search-bar {
  background-color: #000;
  color: #d4af37;
  border: 1px solid #333;
  padding: 1.2rem 1.25rem;
  font-size: 1rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  transition: border 0.3s ease;
}

.cpc-search-bar .search-bar:hover,
.cpc-search-bar .search-bar:focus-within {
  border-color: #d4af37 !important;
}

}
.cpc-search-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #d4af37;
  font-size: 1rem;
  padding: 0;
}
.cpc-search-bar input::placeholder {
  color: #d4af37;
  opacity: 0.6; /* Slightly dimmed */
}
.cpc-search-bar svg {
  margin-right: 8px;
  flex-shrink: 0;
  color: #d4af37;
}
.cpc-search-bar .search-bar:hover,
.cpc-search-bar input:hover,
.cpc-search-bar input:focus {
  border-color: #d4af37;
}
/* === Hot Search === */

.cpc-hot-search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  font-family: 'Inter', sans-serif;
}

.cpc-chip {
  padding: 6px 14px;
  background-color: #000;
  border: 1px solid transparent; /* Invisible border to allow transition */
  border-radius: 999px;
  color: #d4af37;
  font-size: 11.5px;
  font-family: 'Inter', sans-serif;
  letter-spacing: normal; /* ✅ Fix extra spacing */
  cursor: pointer;
  text-transform: capitalize;
  transition: border 0.2s ease, background-color 0.2s ease, color 0.2s ease;
  user-select: none;
}

.cpc-chip:hover {
  border: 1px solid #d4af37; /* ✅ Now will show! */
}

.cpc-chip.active {
  background-color: #FCB900;
  color: #000;
  transform: scale(1.05); /* Slight size increase */
  font-weight: 500;
}

.cpc-chip.active::after {
  content: "✕"; /* Cross sign */
  font-size: 12px;
  margin-left: 4px;
  color: #000;
}

/* Target only inactive chips on hover */
.cpc-chip:not(.active):hover {
  border: 1px solid #d4af37;
  color: #d4af37; /* Ensure gold text on hover */
  background-color: #000; /* Keep background same */
}

/* Ensure inactive chip text stays gold */
.cpc-chip:not(.active) {
  color: #d4af37 !important;
  background-color: #000;
  transform: scale(1);
  border-color: transparent;
}


/* === Responsive Layout === */
@media (max-width: 1280px) {
  .cpc-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 1024px) {
  .cpc-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* === Tablet: 2 cards per row === */
@media (max-width: 768px) and (min-width: 481px) {
  .cpc-card {
    width: calc((100% - 20px) / 2);
  }
}

@media (max-width: 480px) {
  .cpc-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding: 1rem;
  }

  .cpc-card {
    min-width: unset;
    width: 100%;
    height: 300px; /* optional: slightly shorter to better fit mobile */
  }

  .cpc-footer {
    gap: 0.25rem;
  }

  .cpc-add-to-cart-btn {
    padding: 6px 10px;
    font-size: 0.5rem;
  }

  .cpc-view-link {
    padding: 6px;
    font-size: 18px;
    flex: 0 0 36px;
  }
}
/* === Mobile Quantity Controls === */
@media (max-width: 480px) {
  .cpc-card .cpc-qty-controls {
    position: absolute;
    top: 8px;
    right: 8px; /* ✅ Top-right corner */
    margin: 0;
    justify-content: flex-end;
    gap: 0;
  }

  .cpc-card .cpc-btn {
    display: none !important; /* ✅ Hide + and - on mobile */
  }

  .cpc-card .cpc-qty-input {
    width: 36px;
    height: 26px;
    font-size: 14px;
    border-radius: 4px;
  }
}
/* Show full text on desktop */
.cpc-add-to-cart-btn .desktop-text {
  display: inline;
}

@media (max-width: 480px) {
  .cpc-add-to-cart-btn {
    position: relative;
    font-size: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 14px;
    text-align: center;
  }

  .cpc-add-to-cart-btn .desktop-text {
    display: none; /* Hide full text on mobile */
  }

  .cpc-add-to-cart-btn::before {
    content: attr(data-label);
    font-size: 1rem;
    font-weight: bold;
    color: #000;
    line-height: 1;
    text-align: center;
    display: inline-block;
    width: 100%;
  }
}

.cpc-chip:not(.active):hover,
.cpc-chip:not(.active):focus,
.cpc-chip:not(.active):active {
  border: 1px solid #d4af37;
  background-color: #000;
  color: #d4af37;
}

/* Mobile override — force reset after blur */
@media (max-width: 480px) {
  .cpc-chip:not(.active):hover,
  .cpc-chip:not(.active):focus,
  .cpc-chip:not(.active):active {
    border-color: transparent !important;
    background-color: #000 !important;
    color: #d4af37 !important;
  }
}
