/* ===== RESET ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --white: #ffffff;
  --bg: #ffffff;
  --bg-alt: #f4f6fa;
  --card: #ffffff;
  --card-hover: #eef2f7;
  --black: #1f2937;
  --gray-900: #111827;
  --gray-700: #374151;
  --gray-500: #6b7280;
  --gray-400: #9ca3af;
  --gray-300: #d1d5db;
  --gray-200: #e8ebf0;
  --gray-100: #f3f4f6;
  --border: #e5e7eb;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.16);
  --radius: 10px;
  --radius-lg: 14px;
  --header-h: 64px;
  --max-w: 1280px;
  --transition: 0.25s ease;
  --accent: #2563eb;
  --accent-hover: #3b82f6;
  --accent-bright: #3b82f6;
  --accent-glow: rgba(59,130,246,0.18);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Noto Sans Thai', 'Space Grotesk', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--black);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; font-family: inherit; background: none; }
input { font-family: inherit; }

/* ===== HEADER ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 28px;
}

.logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.logo-box {
  height: 48px;
  display: flex;
  align-items: center;
  overflow: hidden;
  flex-shrink: 0;
}
.logo-box img {
  height: 100%;
  width: auto;
  object-fit: contain;
  display: block;
}

.nav { display: flex; gap: 4px; }
.nav a {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--gray-500);
  border-radius: 6px;
  position: relative;
  transition: color var(--transition), background var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav a svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav a::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 50%;
  height: 2px;
  background: var(--accent-bright);
  border-radius: 2px;
  transition: transform 0.3s;
}
.nav a:hover { color: var(--accent-bright); }
.nav a.active { color: var(--accent-bright); font-weight: 600; }
.nav a.active::after { transform: translateX(-50%) scaleX(1); }

.search-bar {
  flex: 1;
  max-width: 420px;
  position: relative;
}
.search-bar input {
  width: 100%;
  height: 40px;
  padding: 0 42px 0 16px;
  background: var(--gray-200);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--black);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-bar input::placeholder { color: var(--gray-500); }
.search-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.search-bar button {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--gray-500);
  transition: color var(--transition), background var(--transition);
}
.search-bar button:hover { background: var(--gray-300); color: var(--accent-bright); }
.search-bar button svg { width: 18px; height: 18px; }

.header-icons { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--gray-700);
  transition: background var(--transition), color var(--transition);
}
.icon-btn:hover { background: var(--accent-glow); color: var(--accent-bright); }
.icon-btn svg { width: 22px; height: 22px; }
.cart-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #e53935;
  color: var(--white);
  border-radius: 9px;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 8px;
  border-radius: 8px;
  transition: background var(--transition);
}
.hamburger:hover { background: var(--gray-200); }
.hamburger span {
  display: block;
  height: 2px;
  background: var(--gray-700);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== MOBILE MENU ===== */
.mobile-menu {
  display: none;
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(16px);
  z-index: 999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.mobile-menu.open { opacity: 1; pointer-events: all; }
.mobile-menu a {
  font-size: 18px;
  font-weight: 500;
  padding: 14px 48px;
  border-radius: 8px;
  color: var(--gray-500);
  transition: color var(--transition), background var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.mobile-menu a svg { width: 20px; height: 20px; flex-shrink: 0; }
.mobile-menu a:hover, .mobile-menu a.active { color: var(--black); background: var(--gray-200); }

/* ===== BREADCRUMB ===== */
.breadcrumb {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 22px 24px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--gray-500);
}
.breadcrumb a { color: var(--gray-500); transition: color var(--transition); }
.breadcrumb a:hover { color: var(--black); }
.breadcrumb .sep { color: var(--gray-400); }
.breadcrumb .current { color: var(--gray-700); font-weight: 600; }

/* ===== SHOP LAYOUT ===== */
.shop {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 28px 24px 72px;
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 32px;
  align-items: start;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}
.filter-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--black);
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.filter-group { margin-bottom: 20px; }
.filter-heading {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.checkbox-group { display: flex; flex-direction: column; gap: 10px; }
.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--gray-700);
  cursor: pointer;
  transition: color var(--transition);
}
.checkbox-group label:hover { color: var(--accent-bright); }
.checkbox-group input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.checkbox-group .filter-ic {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--gray-100);
  border: 1px solid var(--border);
  color: var(--gray-500);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
}
.checkbox-group .filter-ic svg { width: 16px; height: 16px; }
.checkbox-group label:hover .filter-ic {
  color: var(--accent);
  background: var(--accent-glow);
  border-color: var(--accent);
  transform: scale(1.08);
}
.checkbox-group label:has(input:checked) .filter-ic {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.price-range { display: flex; flex-direction: column; gap: 10px; }
.price-range input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  cursor: pointer;
}
.price-value {
  font-size: 14px;
  color: var(--gray-500);
  font-family: 'Space Grotesk', 'Noto Sans Thai', sans-serif;
}
.price-value span { color: var(--accent-bright); font-weight: 600; }

.filter-btn {
  width: 100%;
  padding: 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
  background: var(--accent);
  border-radius: 8px;
  transition: background var(--transition), transform 0.2s, box-shadow var(--transition);
}
.filter-btn:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 8px 20px rgba(37,99,235,0.35); }

/* ===== PRODUCT GRID / CARDS ===== */
.shop-content { min-width: 0; }
.result-info {
  font-size: 14px;
  color: var(--gray-500);
  margin-bottom: 18px;
}
.result-info strong { color: var(--black); }

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.product-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.product-img {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}
.product-card:hover .product-img img { transform: scale(1.06); }
.product-img.placeholder {
  background: linear-gradient(135deg, var(--gray-200) 0%, var(--gray-100) 100%);
}
.product-img.placeholder .ph-icon {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-400);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.product-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}
.product-tag.sale { background: #e53935; color: var(--white); }
.product-tag.new { background: var(--accent); color: var(--white); }
.product-tag.hot { background: var(--accent-hover); color: var(--white); }

.product-info { padding: 16px; display: flex; flex-direction: column; flex: 1; }
.product-brand {
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.product-specs {
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 8px;
}
.product-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 10px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: auto;
}
.price-current {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--black);
}

.product-actions { padding: 0 16px 16px; }
.btn-add-cart {
  width: 100%;
  padding: 11px 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  background: var(--accent);
  border-radius: 8px;
  transition: background var(--transition), transform 0.2s;
}
.btn-add-cart:hover { background: var(--accent-hover); transform: translateY(-1px); }

/* ===== EMPTY STATE ===== */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-500);
  background: var(--card);
  border: 1px dashed var(--gray-300);
  border-radius: var(--radius-lg);
}
.empty-state svg { width: 40px; height: 40px; margin: 0 auto 12px; color: var(--gray-400); }
.empty-state p { font-size: 15px; }

/* ===== FOOTER ===== */
.footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 48px 24px 32px;
}
.footer-inner { max-width: var(--max-w); margin: 0 auto; }
.footer-top {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 36px;
  border-bottom: 1px solid var(--border);
}
.footer-brand .logo { margin-bottom: 12px; }
.footer-brand .logo-box { height: 64px; }
.footer-brand p {
  font-size: 13px;
  color: var(--gray-500);
  line-height: 1.7;
  max-width: 280px;
}
.footer-col h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--black);
  margin-bottom: 16px;
}
.footer-col a {
  display: block;
  font-size: 13px;
  color: var(--gray-500);
  padding: 4px 0;
  transition: color var(--transition);
}
.footer-col a:hover { color: var(--accent-bright); }
.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  font-size: 13px;
  color: var(--gray-400);
}
.footer-social { display: flex; gap: 12px; }
.footer-social a {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--gray-500);
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.footer-social a:hover { color: var(--accent-bright); border-color: var(--accent); background: var(--accent-glow); }
.footer-social a svg { width: 16px; height: 16px; }

/* ===== ANIMATIONS & PAGE TRANSITIONS ===== */
body {
  animation: pageIn 0.45s ease both;
}
body.page-exit {
  animation: pageOut 0.2s ease forwards;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes pageOut {
  to { opacity: 0; transform: translateY(-8px); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
.product-card {
  animation: fadeUp 0.5s ease backwards;
}

/* press feedback on tabs / buttons */
.nav a:active, .icon-btn:active, .search-bar button:active,
.btn-add-cart:active, .filter-btn:active, .footer-social a:active,
.product-card:active, .checkbox-group label:active {
  transform: scale(0.94);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .nav { display: none; }
  .search-bar { display: none; }
  .hamburger { display: flex; }
  .mobile-menu { display: flex; }

  .footer-top { grid-template-columns: 1fr 1fr; }
}

/* 768px and below: sidebar moves to top, grid 2 -> 1 columns */
@media (max-width: 768px) {
  .shop {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 20px 24px 56px;
  }
  .sidebar {
    position: static;
  }
  .product-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .product-grid { grid-template-columns: 1fr; max-width: 380px; margin-left: auto; margin-right: auto; }
  .breadcrumb { padding: 16px 24px 0; font-size: 12px; }
  .footer-top { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: 16px; text-align: center; }
}
