:root {
  --navy: #0b2f4a;
  --blue: #1e90ff;
  --teal: #2bb673;
  --bg: #f6fbfc;
  --card: #ffffff;
  --muted: #6b7c86;
  --accent-gradient: linear-gradient(135deg, var(--blue), var(--teal));
  --radius: 12px;
  --container-width: 1440px; 
  --shadow: 0 10px 30px rgba(9, 30, 45, 0.06);
  --carousel-gap: 18px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans Thai", sans-serif;
  --transition: 200ms cubic-bezier(.2, .9, .2, 1);
}

/* =========================================
   1. Reset & Base
   ========================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background-color: transparent; }
body {
  display: flex; flex-direction: column; min-height: 100vh;
  background: linear-gradient(180deg, #f6fbfc 0%, #ffffff 100%);
  color: var(--navy);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5; font-size: 15px;
}
.container { width: 94%; max-width: var(--container-width); margin: 0 auto; box-sizing: border-box; }
main, .page-main { flex: 1 0 auto; }
a:focus, button:focus, input:focus { outline: 3px solid rgba(30,144,255,0.12); outline-offset: 2px; }

/* =========================================
   2. Header & Navigation
   ========================================= */
.top-bar, .topbar {
  background: rgba(255, 255, 255, 0.98);
  border-bottom: 1px solid rgba(11, 47, 74, 0.04);
  box-shadow: 0 6px 18px rgba(9, 30, 45, 0.03);
  position: relative; z-index: 120;
}
.topbar .container, .top-bar .container, .top-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: nowrap; padding: 12px 0;
}
.logo { display: inline-block; }
.logo-img { height: 48px; width: auto; display: block; object-fit: contain; max-width: 180px; }

.search-form {
  flex: 1 1 560px; min-width: 240px; max-width: 720px;
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: #f6fbff; border-radius: 24px; border: 1px solid rgba(11, 47, 74, 0.06);
  box-shadow: 0 6px 20px rgba(9, 30, 45, 0.03);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.search-form input[type="search"] {
  flex: 1; border: 0; background: transparent; padding: 8px 12px;
  font-size: 0.95rem; color: var(--navy); outline: none; min-width: 80px;
}
.search-form button {
  width: 44px; height: 44px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(11, 47, 74, 0.06); background: #ffffff; cursor: pointer;
}
.search-form button svg { color: var(--navy); stroke: currentColor; }

.actions-box { display: flex; gap: 12px; align-items: center; white-space: nowrap; }
.action-item {
  background: #ffffff; padding: 10px 14px; border-radius: 12px; display: inline-flex; align-items: center; gap: 12px;
  min-width: 140px; height: 60px; box-shadow: 0 10px 30px rgba(9, 30, 45, 0.06); border: 0; cursor: pointer; position: relative;
}
.action-item .icon {
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; background: linear-gradient(180deg, #ffffff, #f7fbff); color: var(--navy); position: relative;
}
.action-item .meta { display: flex; flex-direction: column; line-height: 1; }
.action-item .meta .small { font-weight: 800; font-size: 0.92rem; color: var(--navy); }
.action-item .meta .price, .action-item .meta .muted { font-size: 0.78rem; color: #66797f; }

.actions-box .action-item .icon .count-badge,
.actions-box .action-item .icon .cart-count,
.actions-box .action-item .icon .wish-count {
  position: absolute !important; top: -6px !important; left: -6px !important; min-width: 20px !important;
  height: 20px !important; padding: 0 7px !important; border-radius: 12px !important; background: var(--navy) !important;
  color: #fff !important; font-size: 0.75rem !important; display: inline-flex !important; align-items: center !important;
  justify-content: center !important; box-shadow: 0 6px 16px rgba(9, 30, 45, 0.12) !important;
  border: 2px solid #fff !important; z-index: 200 !important; font-weight: 700; line-height: 1;
}

.nav-bar {
  position: relative; z-index: 30; background: var(--card); box-shadow: 0 6px 18px rgba(9, 30, 45, 0.06);
  border-top-left-radius: 10px; border-top-right-radius: 10px; margin-top: 10px;
}
.nav-inner { padding: 10px 0; display: flex; justify-content: center; }
.nav-list { list-style: none; display: flex; gap: 26px; align-items: center; margin: 0; padding: 0; }
.nav-list a { color: #000; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 700; transition: all var(--transition); }

/* =========================================
   3. Hero
   ========================================= */
.hero {
  min-height: 300px; display: flex; align-items: center; justify-content: center; padding: 48px 0; margin-top: 18px;
  border-radius: 12px; background: var(--accent-gradient); color: white; box-shadow: 0 12px 40px rgba(9, 30, 45, 0.06);
}
.hero-content { text-align: center; max-width: 920px; }
.hero h1 { font-size: 2rem; margin-bottom: 8px; font-weight: 800; }

/* =========================================
   4. Shop Page Layout
   ========================================= */
body .page-main { display: grid !important; grid-template-columns: 420px 1fr !important; gap: 32px !important; align-items: start !important; }
body .page-main .sidebar { width: 420px !important; max-width: 420px !important; padding: 24px !important; box-sizing: border-box !important; background: transparent; }
.page-main .product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important; gap: 32px !important; align-items: start; }

.page-main .sidebar .filter-section {
  background: #fff; border-radius: 12px; padding: 14px 18px; margin-bottom: 18px;
  border: 1px solid rgba(11, 47, 74, 0.06); box-shadow: 0 10px 30px rgba(9, 30, 45, 0.04);
}
.page-main .sidebar .filter-section h4 {
  font-size: 1rem; font-weight: 800; margin: 0 0 10px 0;
  display: flex; align-items: center; justify-content: space-between; cursor: pointer; color: var(--navy);
}
.page-main .sidebar .filter-section > h4::after {
  content: '\276F'; display: inline-block; transform: rotate(90deg); transition: transform 180ms ease;
  width: 28px; height: 28px; line-height: 28px; text-align: center; border-radius: 8px;
  border: 1px solid rgba(11, 47, 74, 0.06); background: rgba(255, 255, 255, 0.95); color: rgba(11, 47, 74, 0.6);
}
.page-main .sidebar .filter-section.collapsed > h4::after { transform: rotate(0deg); }
.page-main .sidebar .filter-section .filter-body { overflow: hidden; max-height: 900px; opacity: 1; transition: all 260ms ease; }
.page-main .sidebar .filter-section.collapsed .filter-body { max-height: 0; opacity: 0; padding-bottom: 0; }
.page-main .sidebar .filter-section .chev { display: none !important; }

/* Price Slider */
.page-main .sidebar .filter-section.price-section { position: relative !important; padding-bottom: 20px !important; overflow: visible !important; }
.price-range-labels { display: flex; justify-content: space-between; font-size: 0.95rem; color: rgba(11, 47, 74, 0.6); margin-bottom: 8px; }
.custom-price-slider { position: relative; width: 100%; height: 4px; background: rgba(0, 0, 0, 0.06); border-radius: 4px; margin: 20px 0 24px 0; }
.custom-price-slider .slider-track { position: absolute; height: 100%; background: #222; border-radius: 4px; z-index: 1; left: 0%; right: 0%; }
.custom-price-slider input[type="range"] { position: absolute; width: 100%; height: 4px; top: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; z-index: 2; margin: 0; outline: none; }
.custom-price-slider input[type="range"]::-webkit-slider-thumb { height: 18px; width: 18px; border-radius: 50%; background: #fff; border: 3px solid #222; pointer-events: auto; -webkit-appearance: none; box-shadow: 0 2px 4px rgba(0,0,0,0.1); cursor: grab; position: relative; z-index: 3; transition: transform 0.1s ease; }
.page-main .sidebar .price-inputs { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 12px 0 16px 0; width: 100%; }
.page-main .sidebar .price-inputs .price-input { flex: 1; padding: 10px 14px; border-radius: 8px; border: 1px solid rgba(0, 0, 0, 0.15); width: 100%; text-align: center; font-size: 1rem; font-weight: 700; color: var(--navy); outline: none; transition: border-color 0.2s ease; }
.page-main .sidebar .price-inputs .price-input:focus { border-color: var(--blue); }
.page-main .sidebar .price-inputs .dash { font-size: 1.2rem; font-weight: 700; color: rgba(11, 47, 74, 0.4); }

.filter-btn-row { display: flex; justify-content: flex-end; width: 100%; }
.page-main .sidebar .filter-section.price-section .btn-filter { position: static !important; height: 38px !important; min-width: 80px !important; padding: 6px 20px !important; font-size: 0.9rem !important; border-radius: 8px !important; background: linear-gradient(90deg, var(--blue), var(--teal)) !important; color: #fff !important; border: 0 !important; cursor: pointer !important; font-weight: 800 !important; box-shadow: 0 6px 16px rgba(9, 30, 45, 0.12) !important; transition: transform 0.15s ease, box-shadow 0.15s ease !important; }
.page-main .sidebar .filter-section.price-section .btn-filter:hover { transform: translateY(-2px) !important; box-shadow: 0 10px 24px rgba(9, 30, 45, 0.16) !important; }

/* Reset Button */
.page-main .btn-reset { display: inline-flex; width: 100%; align-items: center; justify-content: center; padding: 12px 16px; margin-top: 12px; border-radius: 12px; border: 0; background: linear-gradient(90deg, var(--blue), var(--teal)); color: #fff; font-weight: 800; cursor: pointer; box-shadow: 0 12px 30px rgba(9, 30, 45, 0.12); transition: all 140ms ease; }

.page-main .toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.page-main .toolbar .right { background: #fff; border-radius: 12px; padding: 8px 12px; border: 1px solid rgba(11, 47, 74, 0.06); box-shadow: 0 10px 30px rgba(9, 30, 45, 0.04); display: flex; align-items: center; gap: 10px; }
.page-main .toolbar .right select { padding: 6px 10px; border-radius: 8px; border: 1px solid rgba(11, 47, 74, 0.06); background: #fff; outline: none; font-weight: 700; color: var(--navy); }
.page-main .toolbar .right .view-btn { width: 36px; height: 36px; border-radius: 6px; padding: 0; border: 1px solid rgba(11, 47, 74, 0.06); background: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 6px 16px rgba(9, 30, 45, 0.04); }

.page-main .sidebar .filter-section.brand-section .brand-search-wrap { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.page-main .sidebar .filter-section.brand-section .brand-search-wrap input { flex: 1; padding: 8px 10px; border-radius: 8px; border: 1px solid rgba(11, 47, 74, 0.06); background: #fff; outline: none; font-size: 0.95rem; color: var(--navy); }
.page-main .sidebar .filter-section.brand-section .brand-search-wrap button { background: transparent; border: 0; color: rgba(11, 47, 74, 0.5); cursor: pointer; }
.page-main .sidebar .filter-section.brand-section .brand-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-height: 320px; overflow-y: auto; padding: 4px; border-top: 1px solid rgba(11, 47, 74, 0.03); margin-top: 6px; }
.brand-tile { background: #fff; border: 1px dashed rgba(11, 47, 74, 0.08); border-radius: 10px; height: 72px; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; color: rgba(11, 47, 74, 0.6); box-shadow: 0 6px 12px rgba(9, 30, 45, 0.03); }
.brand-tile img { max-width: 90%; max-height: 90%; display: block; }
.page-main .sidebar .filter-section.color-section .color-list { display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; padding-right: 6px; }

/* =========================================
   5. Product Cards
   ========================================= */
.product-card {
  background: #ffffff; border-radius: 12px; border: 1px solid rgba(11, 47, 74, 0.04);
  box-shadow: 0 12px 32px rgba(9, 30, 45, 0.05); padding: 14px;
  display: flex !important; flex-direction: column; gap: 10px; position: relative;
  transition: transform 180ms ease, box-shadow 180ms ease; min-height: 360px;
  width: 100%; box-sizing: border-box;
}
.product-card:hover { transform: translateY(-6px); box-shadow: 0 22px 46px rgba(9, 30, 45, 0.08); }
.product-thumb {
  height: 200px !important; min-height: 200px !important; border-radius: 10px; background: linear-gradient(180deg, #fff, #fbfeff);
  border: 1px solid rgba(11, 47, 74, 0.02); display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative !important; width: 100%;
}
.product-thumb img { max-width: 90%; max-height: 90%; object-fit: contain; display: block; margin: 0 auto; }
.product-meta { display: flex; flex-direction: column; flex: 1 1 auto; gap: 10px; width: 100%; }
.prod-title { font-weight: 800; color: var(--navy); font-size: 1.05rem; min-height: 44px; margin-top: 4px; }

/* เปลี่ยนราคาสินค้าเป็นสีแดง */
.product-price { font-weight: 900; color: #9B0F06; font-size: 1.12rem; margin-top: auto; }

.product-card .add-cart {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  padding: 10px 14px; border-radius: 10px; background: linear-gradient(90deg, var(--blue), var(--teal));
  color: #fff; border: 0; font-weight: 800; cursor: pointer; box-shadow: 0 12px 28px rgba(9, 30, 45, 0.10);
  transition: transform .14s ease; margin-top: 8px;
}
.product-card .add-cart:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(9, 30, 45, 0.14); }

.product-grid.list-view { grid-template-columns: 1fr !important; gap: 26px !important; }
.product-grid.list-view .product-card { flex-direction: row !important; gap: 24px !important; align-items: flex-start !important; padding: 18px !important; min-height: 160px !important; }
.product-grid.list-view .product-thumb { flex: 0 0 260px !important; width: 260px !important; height: auto !important; min-height: 140px !important; padding: 8px !important; border-radius: 8px !important; }

/* =========================================
   6. 🔴 HEART BUTTONS (STANDARD BUTTON MODE)
   ========================================= */

/* ซ่อนกล่อง Checkbox (ถ้ามีหลงเหลือใน HTML จะได้ไม่รก) */
.fav-btn-wrapper, .fav-checkbox { display: none !important; }

/* สไตล์กล่องปุ่มแบบปุ่มธรรมดา (Button) */
.product-card .fav-btn {
  position: absolute !important;
  top: 12px !important;
  right: 12px !important;
  width: 44px !important;
  height: 44px !important;
  background: #ffffff !important;
  border: 1px solid rgba(11, 47, 74, 0.06) !important;
  border-radius: 10px !important;
  box-shadow: 0 8px 20px rgba(9, 30, 45, 0.06) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  z-index: 60 !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease !important;
  user-select: none !important;
  -webkit-tap-highlight-color: transparent !important;
  outline: none !important;
  padding: 0 !important;
}
.product-card .fav-btn:hover { 
  transform: scale(1.08) !important; 
  box-shadow: 0 12px 28px rgba(9, 30, 45, 0.10) !important; 
}

/* เส้นรูปหัวใจตอนยังไม่กด (สีเทา ตรงกลางโปร่งใส) */
.product-card .fav-btn svg {
  width: 18px !important;
  height: 18px !important;
  display: block !important;
  pointer-events: none !important;
}
.product-card .fav-btn svg path {
  stroke: var(--navy) !important;
  fill: transparent !important; 
  transition: stroke 0.2s ease, fill 0.2s ease !important;
}

/* 🔴 เวทมนตร์: เมื่อโดนกดแล้ว Javascript เติมคำว่า .active เข้ามา ให้ถมสีแดงเต็มดวง! */
.product-card .fav-btn.active svg path {
  stroke: #ff4d4f !important;
  fill: #ff4d4f !important;
}

/* =========================================
   7. Carousel & Shop by Brands
   ========================================= */
.carousel-box {
  position: relative; border: 1px solid rgba(11, 47, 74, 0.04); border-radius: 12px; padding: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 252, 253, 0.98)); box-shadow: 0 10px 30px rgba(9, 30, 45, 0.04); margin: 26px 0;
}
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title { font-weight: 800; color: var(--navy); }

.see-more { font-size: 0.95rem !important; font-weight: 800 !important; color: var(--blue) !important; text-decoration: none !important; display: inline-flex !important; align-items: center !important; transition: color 0.2s ease !important; }
.see-more::after { content: '\2192'; margin-left: 6px; font-size: 1.1em; transition: transform 0.2s ease !important; }
.see-more:hover { color: var(--teal) !important; }
.see-more:hover::after { transform: translateX(5px) !important; }

.carousel-track {
  display: flex !important; gap: var(--carousel-gap) !important; padding: 6px 12px !important;
  align-items: stretch !important; overflow-x: auto !important; scroll-behavior: smooth; scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar { display: none; }

.carousel-item { 
  flex: 0 0 calc((100% - (var(--carousel-gap) * 3)) / 4) !important; 
  max-width: calc((100% - (var(--carousel-gap) * 3)) / 4) !important; 
  display: flex !important; align-items: stretch !important; 
}
.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%); background: rgba(11, 47, 74, 0.95); color: white;
  width: 46px; height: 46px; border-radius: 50%; border: 0; cursor: pointer; font-size: 20px; display: flex; align-items: center; justify-content: center; z-index: 120; box-shadow: 0 10px 26px rgba(9, 30, 45, 0.12);
}
.carousel-btn.prev { left: 12px; } .carousel-btn.next { right: 12px; }

/* แบรนด์ */
.shop-by-brands .carousel-btn { display: none !important; }
.shop-by-brands .carousel-track, .section-brands .carousel-track { gap: 24px !important; padding: 12px 18px !important; }
.shop-by-brands .carousel-item, .section-brands .carousel-item { flex: 0 0 calc((100% - (24px * 4)) / 5) !important; max-width: calc((100% - (24px * 4)) / 5) !important; }
.shop-by-brands .brand-card, .section-brands .brand-card { width: 100% !important; padding: 14px 12px !important; margin: 0 auto !important; background: #fff !important; border-radius: 12px !important; border: 1px solid rgba(11, 47, 74, 0.06) !important; box-shadow: 0 8px 22px rgba(9, 30, 45, 0.04) !important; display: flex !important; flex-direction: column !important; align-items: center !important; text-align: center !important; min-height: 200px !important; }
.shop-by-brands .brand-card:hover { transform: translateY(-6px) !important; box-shadow: 0 22px 46px rgba(9, 30, 45, 0.08) !important; }
.shop-by-brands .product-thumb { height: 88px !important; min-height: 88px !important; width: 100% !important; margin: 0 auto 8px auto !important; border-radius: 10px !important; background: #ffffff !important; border: 1px solid rgba(11, 47, 74, 0.04) !important; display: flex !important; align-items: center !important; justify-content: center !important; padding: 8px !important; }
.shop-by-brands .product-thumb img { max-height: 60px !important; max-width: 85% !important; object-fit: contain !important; }
.shop-by-brands .prod-title { font-weight: 800 !important; font-size: 0.95rem !important; color: var(--navy) !important; margin: 6px 0 0 0 !important; }

/* =========================================
   8. Footer & Mobile Responsive
   ========================================= */
.site-footer--dark {
  flex-shrink: 0; background: linear-gradient(180deg, #0f1316 0%, #15171a 100%); color: #dbe7ea;
  padding: 48px 0 28px; margin: 0; border-top: 1px solid rgba(255, 255, 255, 0.03);
}
.site-footer--dark .footer-top { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 32px; padding: 28px 0 24px; border-bottom: 1px solid rgba(255, 255, 255, 0.03); }

@media (max-width: 1100px) {
  body .page-main { grid-template-columns: 300px 1fr !important; }
  body .page-main .sidebar { width: 300px !important; max-width: 300px !important; padding: 18px !important; }
  .container { max-width: 1180px !important; }
  .carousel-item { flex: 0 0 calc((100% - (var(--carousel-gap) * 2)) / 3) !important; max-width: calc((100% - (var(--carousel-gap) * 2)) / 3) !important; }
  .shop-by-brands .carousel-item { flex: 0 0 calc((100% - (24px * 3)) / 4) !important; max-width: calc((100% - (24px * 3)) / 4) !important; }
}
@media (max-width: 900px) {
  .topbar .container { flex-wrap: wrap; gap: 12px; }
  .search-form { order: 2; width: 100%; max-width: 100%; }
  .actions-box { order: 3; } .logo { order: 1; }
  .carousel-item { flex: 0 0 calc((100% - (var(--carousel-gap) * 1)) / 2) !important; max-width: calc((100% - (var(--carousel-gap) * 1)) / 2) !important; }
  .shop-by-brands .carousel-item { flex: 0 0 calc((100% - (24px * 2)) / 3) !important; max-width: calc((100% - (24px * 2)) / 3) !important; }
}
@media (max-width: 760px) {
  body .page-main { grid-template-columns: 1fr !important; }
  body .page-main .sidebar { width: 100% !important; max-width: 100% !important; padding: 12px !important; }
  .product-thumb { height: 160px !important; min-height: 160px !important; }
  .nav-list { gap: 12px; font-size: 0.95rem; }
  .carousel-item { flex: 0 0 80% !important; max-width: 80% !important; }
  .shop-by-brands .carousel-item { flex: 0 0 70% !important; max-width: 70% !important; }
  
  .page-main .sidebar .filter-section.price-section { position: static !important; padding-bottom: 12px !important; }
  .page-main .sidebar .filter-section.price-section .btn-filter { width: 100% !important; }
  
  /* Mobile Heart Button */
  .product-card .fav-btn { top: 10px !important; right: 10px !important; width: 38px !important; height: 38px !important; border-radius: 9px !important; }
}