/* Product Grid Styles */
.grid { 
  display: grid; 
  grid-template-columns: repeat(4, minmax(0, 1fr)); 
  gap: 16px; 
}

.card { 
  background: var(--panel); 
  border: 1px solid #1d2534; 
  border-radius: 18px; 
  overflow: hidden; 
  display: flex; 
  flex-direction: column; 
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .2s ease, border-color .2s ease; 
}

/* Light mode card styles */
[data-theme="light"] .card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card:hover { 
  transform: translateY(-3px); 
  border-color: #2a3346; 
  box-shadow: 0 12px 34px rgba(0,0,0,.45);
}

/* Light mode card hover */
[data-theme="light"] .card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.15);
}    

.thumb { 
  position: relative; 
  aspect-ratio: 16/11; 
  background: #0f1420; 
  display: grid; 
  place-items: center; 
}

/* Light mode thumb */
[data-theme="light"] .thumb {
  background: #f8fafc;
}

.thumb img { 
  width: 100%; 
  height: 100%; 
  object-fit: cover; 
  display: block; 
}

.discount-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--error);
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  z-index: 2;
}

.discount-badge.large {
  padding: 6px 12px;
  font-size: 12px;
}

.fav { 
  position: absolute; 
  top: 10px; 
  right: 10px; 
  padding: 8px; 
  border-radius: 12px; 
  background: #0f1218; 
  border: 1px solid #232a3a; 
  cursor: pointer; 
  transition: all 0.2s ease;
  z-index: 2;
  color: #ffffff;
}

/* Light mode fav button */
[data-theme="light"] .fav {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e2e8f0;
  color: #64748b;
  backdrop-filter: blur(4px);
}

.fav:hover { 
  background: #1a2332; 
  transform: scale(1.1);
}

/* Light mode fav button hover */
[data-theme="light"] .fav:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: #cbd5e1;
  color: #475569;
}

.fav.favorited { 
  background: #ffd700; 
  color: #000; 
  border-color: #ffd700;
}

/* Light mode favorited button */
[data-theme="light"] .fav.favorited {
  background: #fbbf24;
  color: #92400e;
  border-color: #fbbf24;
}

.fav.favorited:hover { 
  background: #ffed4e; 
}

/* Light mode favorited button hover */
[data-theme="light"] .fav.favorited:hover {
  background: #fcd34d;
  color: #78350f;
}

.meta { 
  padding: 14px; 
  display: flex; 
  flex-direction: column; 
  gap: 8px; 
}

.title { 
  font-weight: 700; 
  letter-spacing: .2px; 
  margin-bottom: 4px;
}

.description {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price-container {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.price { 
  font-weight: 800; 
  font-size: 18px; 
}

.original-price {
  color: var(--muted);
  font-size: 14px;
  text-decoration: line-through;
}

.original-price.large {
  font-size: 16px;
}

.current-price.large {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
}

.colors {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #2a3346;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.color-dot:hover {
  transform: scale(1.2);
}

.more-colors {
  font-size: 11px;
  color: var(--muted);
  margin-left: 4px;
}

.sizes {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.size-label {
  font-size: 12px;
  color: var(--muted);
}

.size-option {
  padding: 2px 6px;
  background: #232730;
  border: 1px solid #2b3140;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text);
}

.size-option.out-of-stock {
  opacity: 0.5;
  text-decoration: line-through;
}

.actions { 
  display: flex; 
  gap: 8px; 
  margin-top: 8px;
}

/* Product Preview Modal */
.product-preview-modal {
  max-width: 800px;
  width: calc(100% - 32px);
  border: 0;
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
}

.product-preview-modal::backdrop {
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(3px);
}

.preview-content {
  padding: 0;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #2a3346;
}

.preview-header h3 {
  margin: 0;
  font-size: 24px;
}

.close-preview {
  font-size: 24px;
  padding: 8px;
  line-height: 1;
}

.preview-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 20px;
}

.preview-image {
  position: relative;
}

.preview-image img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: 12px;
}

.preview-details {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.preview-description {
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

.preview-specs h4 {
  margin: 0 0 8px 0;
  color: var(--text);
}

.preview-specs ul {
  margin: 0;
  padding-left: 16px;
  color: var(--muted);
}

.preview-specs li {
  margin-bottom: 4px;
}

.preview-price {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
}

/* Loading state */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  grid-column: 1 / -1;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-state p {
  color: var(--muted);
  margin: 0;
  font-size: 14px;
}

/* Error toast styles */
.toast.error {
  background-color: #dc3545;
  color: white;
}

.toast.success {
  background-color: var(--primary);
  color: white;
}

@media (max-width: 768px) {
  .preview-body {
    grid-template-columns: 1fr;
  }
  
  .preview-image img {
    height: 250px;
  }
}
