/* ===== KNA Omni Trading - Product Catalog Styles =====
 * Catalog-specific styles ONLY. Shared styles (variables, body, header,
 * nav, hero, container, footer, cookie banner) live in /css/site.css,
 * which MUST be loaded before this file.
 *
 * Used by: catalog.html, product.html (detail page)
 */

/* Catalog-specific variables (shared ones are in site.css) */
:root {
  --card-bg: #ffffff;
  --shopee: #ee4d2d;
  --tiktok: #000000;
  --carousell: #d31334;
  --direct: var(--maroon);
  --tag-bestseller: #c0392b;
  --tag-new: #27ae60;
  --overlay: rgba(0,0,0,0.6);
}

body.modal-open { overflow: hidden; }

/* ===== BREADCRUMB (product.html only) ===== */
.breadcrumb {
  margin-bottom: 1.5rem;
}

.breadcrumb a {
  color: var(--maroon);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.breadcrumb a:hover { text-decoration: underline; }

/* ===== FILTERS ===== */
.filters-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 2rem;
  padding: 1rem;
  background: #fafafa;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 0.6rem 1rem 0.6rem 2.2rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  outline: none;
}

.search-box input:focus { border-color: var(--maroon); }

.search-box::before {
  content: "\1F50D";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
}

.brand-filter select {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  background: white;
  cursor: pointer;
  outline: none;
}

.result-count {
  color: var(--text-light);
  font-size: 0.85rem;
  margin-left: auto;
}

/* ===== PRODUCT GRID ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

@media (max-width: 768px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
}

@media (max-width: 480px) {
  .product-grid { grid-template-columns: 1fr; }
}

/* ===== PRODUCT CARD ===== */
.product-card {
  background: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
}

.product-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.product-tags {
  position: absolute;
  top: 390px;
  right: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 5;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: white;
}

.tag.bestseller { background: var(--tag-bestseller); }
.tag.new { background: var(--tag-new); }

.product-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

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

.product-image .placeholder {
  color: #bbb;
  font-size: 2.5rem;
}

.brand-badge {
  position: absolute;
  top: 350px;
  right: 8px;
  background: rgba(255,255,255,0.95);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--maroon);
  border: 1px solid var(--border);
  z-index: 5;
}

.product-info {
  padding: 0.875rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-sku {
  font-size: 0.65rem;
  color: #999;
  margin-bottom: 1px;
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 1px;
  line-height: 1.3;
}

.product-variant {
  font-size: 0.78rem;
  color: var(--text-light);
  margin-bottom: 0.4rem;
}

.product-price-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}

.price {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--maroon);
}

.original-price {
  font-size: 0.8rem;
  color: #999;
  text-decoration: line-through;
}

.stock-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 8px;
  font-size: 0.65rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  width: fit-content;
}

.stock-badge.in-stock { background: #e8f5e9; color: #2e7d32; }
.stock-badge.low-stock { background: #fff8e1; color: #f57f17; }

/* ===== INLINE BUY BUTTONS (Card) ===== */
.buy-buttons {
  display: flex;
  gap: 0.35rem;
  margin-top: auto;
}

.buy-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.35rem 0.2rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.65rem;
  transition: opacity 0.2s;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.buy-btn:hover { opacity: 0.85; }
.buy-btn.shopee { background: var(--shopee); color: white; }
.buy-btn.tiktok { background: var(--tiktok); color: white; }
.buy-btn.carousell { background: var(--carousell); color: white; }
.buy-btn.direct { background: var(--direct); color: white; }
.buy-btn.view { background: var(--carousell); color: white; }

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.3rem;
  margin-top: 2rem;
  padding: 1rem;
}

.pagination button {
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  background: white;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text);
  transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
  background: var(--maroon);
  color: white;
  border-color: var(--maroon);
}

.pagination button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pagination button.active {
  background: var(--maroon);
  color: white;
  border-color: var(--maroon);
}

.pagination .page-info {
  color: var(--text-light);
  font-size: 0.8rem;
  margin: 0 0.2rem;
}

/* ===== PRODUCT MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.show {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: white;
  border-radius: 12px;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.show .modal-content {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.5);
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s;
}

.modal-close:hover { background: rgba(0,0,0,0.7); }

.modal-body {
  display: flex;
  flex-direction: row;
}

@media (max-width: 600px) {
  .modal-body { flex-direction: column; }
}

/* ===== MODAL CAROUSEL ===== */
.modal-image-section {
  flex: 0 0 280px;
  background: #f5f5f5;
  min-height: 280px;
  position: relative;
  overflow: hidden;
}

@media (max-width: 600px) {
  .modal-image-section { flex: 0 0 auto; min-height: 250px; }
}

.modal-carousel-viewport {
  position: relative;
  overflow: hidden;
}

.modal-carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.4s ease;
}

.modal-carousel-slide {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  position: relative;
}

.modal-carousel-slide img {
  width: 95%;
  height: 95%;
  object-fit: contain;
  margin: auto;
  border-radius: 8px;
}

@media (max-width: 600px) {
  .modal-carousel-slide img { border-radius: 12px 12px 0 0; }
}

.modal-carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.5);
  color: white;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s;
}

.modal-carousel-arrow:hover { background: rgba(0,0,0,0.7); }
.modal-carousel-arrow.prev { left: 8px; }
.modal-carousel-arrow.next { right: 8px; }

.modal-carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 4px 0;
}

.modal-carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  background: #ccc;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.modal-carousel-dot:hover { background: #999; }
.modal-carousel-dot.active {
  background: var(--maroon);
  transform: scale(1.2);
}

/* ===== MODAL THUMBNAILS ===== */
.modal-carousel-thumbs {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  background: white;
  border-top: 1px solid var(--border);
  overflow-x: auto;
  justify-content: center;
}

.modal-carousel-thumb {
  flex: 0 0 50px;
  height: 50px;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-carousel-thumb:hover { border-color: var(--border); }
.modal-carousel-thumb.active { border-color: var(--maroon); }

.modal-carousel-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-tags-overlay {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-tags-overlay .tag {
  font-size: 0.7rem;
  padding: 3px 10px;
}

.modal-details {
  flex: 1;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.modal-sku {
  font-size: 0.75rem;
  color: #999;
  font-family: 'Courier New', monospace;
  margin-bottom: 0.25rem;
}

.modal-brand {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--maroon);
  border: 1px solid var(--border);
  margin-bottom: 0.5rem;
  width: fit-content;
}

.modal-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.25rem;
  line-height: 1.2;
}

.modal-variant {
  font-size: 1rem;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.modal-price-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.modal-price {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--maroon);
}

.modal-original {
  font-size: 1rem;
  color: #999;
  text-decoration: line-through;
}

.modal-stock {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  width: fit-content;
}

.modal-stock.in-stock { background: #e8f5e9; color: #2e7d32; }
.modal-stock.low-stock { background: #fff8e1; color: #f57f17; }

.modal-divider {
  height: 1px;
  background: var(--border);
  margin: 0.75rem 0;
}

.modal-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.75rem;
}

/* ===== INLINE BUY BUTTONS (Modal) ===== */
.modal-buy-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.modal-buy-btn {
  flex: 1;
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 0.5rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.85rem;
  transition: opacity 0.2s, transform 0.2s;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.modal-buy-btn:hover { opacity: 0.9; transform: scale(1.02); }
.modal-buy-btn.shopee { background: var(--shopee); color: white; }
.modal-buy-btn.tiktok { background: var(--tiktok); color: white; }
.modal-buy-btn.carousell { background: var(--carousell); color: white; }
.modal-buy-btn.direct { background: var(--direct); color: white; }

.modal-description {
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.6;
  margin-top: 0.5rem;
}

/* ===== PRODUCT DETAIL PAGE (product.html) ===== */
.product-detail {
  display: flex;
  gap: 2rem;
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}

@media (max-width: 768px) {
  .product-detail { flex-direction: column; }
}

.detail-image-section {
  flex: 0 0 400px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  position: relative;
}

.detail-image-section img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-image-section .placeholder {
  font-size: 6rem;
  color: #ccc;
}

.detail-tags-overlay {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-tags-overlay .tag {
  font-size: 0.75rem;
  padding: 4px 12px;
}

.detail-info {
  flex: 1;
  padding: 2rem;
  display: flex;
  flex-direction: column;
}

.detail-sku {
  font-size: 0.8rem;
  color: #999;
  font-family: 'Courier New', monospace;
  margin-bottom: 0.25rem;
}

.detail-brand {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--maroon);
  border: 1px solid var(--border);
  margin-bottom: 0.75rem;
  width: fit-content;
}

.detail-name {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.25rem;
  line-height: 1.2;
}

.detail-variant {
  font-size: 1.1rem;
  color: var(--text-light);
  margin-bottom: 1.25rem;
}

.detail-price-row {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.detail-price {
  font-size: 2rem;
  font-weight: 800;
  color: var(--maroon);
}

.detail-original {
  font-size: 1.1rem;
  color: #999;
  text-decoration: line-through;
}

.detail-stock {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  width: fit-content;
}

.detail-stock.in-stock { background: #e8f5e9; color: #2e7d32; }
.detail-stock.low-stock { background: #fff8e1; color: #f57f17; }

.detail-divider {
  height: 1px;
  background: var(--border);
  margin: 1rem 0;
}

.detail-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1rem;
}

.detail-buy-buttons {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.detail-buy-btn {
  flex: 1;
  min-width: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  transition: opacity 0.2s, transform 0.2s;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}

.detail-buy-btn:hover { opacity: 0.9; transform: scale(1.01); }
.detail-buy-btn.shopee { background: var(--shopee); color: white; }
.detail-buy-btn.tiktok { background: var(--tiktok); color: white; }
.detail-buy-btn.carousell { background: var(--carousell); color: white; }
.detail-buy-btn.direct { background: var(--direct); color: white; }

.detail-description {
  font-size: 1rem;
  color: var(--text-light);
  line-height: 1.7;
}

/* ===== PHOTO CAROUSEL (product.html) ===== */
.photo-carousel {
  flex: 0 0 400px;
  background: #f5f5f5;
  min-height: 400px;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

@media (max-width: 768px) {
  .photo-carousel { flex: 0 0 auto; min-height: 300px; }
}

.carousel-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.carousel-track {
  display: flex;
  height: 100%;
  transition: transform 0.4s ease;
}

.carousel-slide {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  position: relative;
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.carousel-slide .placeholder {
  font-size: 5rem;
  color: #ccc;
}

/* Carousel arrows */
.carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.5);
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s;
}

.carousel-arrow:hover { background: rgba(0,0,0,0.7); }
.carousel-arrow.prev { left: 10px; }
.carousel-arrow.next { right: 10px; }

/* Carousel dots */
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: rgba(0,0,0,0.03);
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: none;
  background: #ccc;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.carousel-dot:hover { background: #999; }
.carousel-dot.active {
  background: var(--maroon);
  transform: scale(1.2);
}

/* Thumbnail strip */
.carousel-thumbs {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  background: white;
  border-top: 1px solid var(--border);
  overflow-x: auto;
}

.carousel-thumb {
  flex: 0 0 60px;
  height: 60px;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-thumb:hover { border-color: var(--border); }
.carousel-thumb.active { border-color: var(--maroon); }

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

.carousel-thumb .placeholder {
  font-size: 1.2rem;
  color: #ccc;
}

/* ===== STICKY BADGE ===== */
.sticky-badge {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--maroon);
  color: white;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 5;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  display:none;
}

.product-card.sticky {
  border: 2px solid var(--maroon);
  box-shadow: 0 4px 16px rgba(128,0,0,0.15);
}
