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

:root {
  --brand: #7DA68E;
  --brand-light: #EFF4F1;
  --accent: #C9843A;
  --text: #1A1A1A;
  --text-2: #555;
  --text-3: #888;
  --border: #E2E2E2;
  --bg: #F7F6F3;
  --white: #FFFFFF;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── HEADER ── */
header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  position: sticky;
}

.header-top {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}

.logo-text {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--brand);
  letter-spacing: -0.5px;
}

.logo-au {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--accent);
  background: #FFF3E6;
  padding: 2px 5px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}

/* ── SEARCH BAR ── */
.search-wrap {
  flex: 1;
  max-width: 720px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-wrap input {
  width: 100%;
  height: 46px;
  border: 1.5px solid var(--border);
  border-radius: 24px;
  padding: 0 56px 0 18px;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.search-wrap input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(45,90,75,0.12);
  background: var(--white);
}

.search-wrap input::placeholder { color: var(--text-3); }

.search-btn {
  position: absolute;
  right: 6px;
  width: 34px;
  height: 34px;
  background: var(--brand);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.search-btn:hover { background: #5A7866; }
.search-btn svg { width: 16px; height: 16px; fill: white; }

/* ── UPLOAD BUTTON ── */
.upload-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  height: 46px;
  background: var(--white);
  border: 1.5px solid var(--brand);
  border-radius: 24px;
  color: var(--brand);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.upload-btn:hover { background: var(--brand-light); }
.upload-btn svg { width: 18px; height: 18px; }

/* ── CATEGORY CHIPS ── */
.chips-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}

.chips-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0;
  scrollbar-width: none;
}

.chips-inner::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  padding: 7px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }

.chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.chip .chip-icon { font-size: 1rem; }

/* Dropdown arrow on All chip */
.chip-all-arrow {
  font-size: 0.7rem;
  transition: transform 0.2s;
  display: inline-block;
}
.chip.dropdown-open .chip-all-arrow { transform: rotate(180deg); }

/* ── CATEGORY DROPDOWN ── */
.cat-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--border);
  border-bottom: 2px solid var(--brand);
  z-index: 99;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.cat-dropdown.open { display: block; }

/* cat-dropdown-inner defined below with section header styles */

.cat-dropdown-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
}

.cat-dropdown-item:hover {
  background: var(--brand-light);
  color: var(--brand);
}

.cat-dd-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 8px;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.cat-dd-text {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 500;
}

.cat-dd-arrow {
  color: var(--text-3);
  font-size: 0.8rem;
}

.dd-section-header {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  padding: 14px 16px 6px;
  grid-column: 1 / -1;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.dd-section-header:first-child {
  border-top: none;
  margin-top: 0;
}

.cat-dropdown-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px 24px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

/* ── MAIN LAYOUT ── */
.main-layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
  align-items: start;
}

/* ── FILTER SIDEBAR ── */
.sidebar {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  position: sticky;
  top: 16px;
  overflow-y: auto;
  max-height: calc(100vh - 130px);
  overscroll-behavior: contain;
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.clear-filters {
  font-size: 0.8rem;
  color: var(--brand);
  cursor: pointer;
  font-weight: 500;
  text-decoration: underline;
  background: none;
  border: none;
}

.filter-section { margin-bottom: 22px; }

.filter-section:last-child { margin-bottom: 0; }

.filter-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

/* Price range */
.price-inputs {
  display: flex;
  gap: 8px;
  align-items: center;
}

.price-inputs input {
  width: 100%;
  height: 36px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 0 10px;
  font-size: 0.875rem;
  color: var(--text);
  outline: none;
}

.price-inputs input:focus { border-color: var(--brand); }
.price-sep { color: var(--text-3); font-size: 0.875rem; flex-shrink: 0; }

/* Checkboxes */
.filter-list { display: flex; flex-direction: column; gap: 8px; }

.filter-item {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-2);
  transition: color 0.15s;
}

.filter-item:hover { color: var(--brand); }

.filter-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  cursor: pointer;
  flex-shrink: 0;
}

/* Color swatches */
.color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.15s;
  position: relative;
}

.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: var(--brand); }
.color-swatch[data-color="white"] { border-color: var(--border); }
.color-swatch[data-color="white"].active { border-color: var(--brand); }

/* Show more toggle */
.show-more {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--brand);
  cursor: pointer;
  background: none;
  border: none;
  font-weight: 500;
}

/* ── RESULTS AREA ── */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}

.results-count {
  font-size: 0.9rem;
  color: var(--text-2);
}

.results-count strong { color: var(--text); font-weight: 700; }

.sort-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-2);
}

.sort-wrap select {
  border: 1.5px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--white);
  outline: none;
  cursor: pointer;
}

/* ── PRODUCT GRID ── */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.product-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
}

.product-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.product-card.hidden { display: none; }

.card-img-wrap {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: #F0EFEC;
}

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.product-card:hover .card-img-wrap img { transform: scale(1.04); }

.card-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.card-save {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  background: white;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 6px rgba(0,0,0,0.12);
  transition: background 0.15s;
}

.card-save:hover { background: #fee2e2; }
.card-save svg { width: 16px; height: 16px; }

.card-body { padding: 14px; }

.card-retailer {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.card-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.card-style-tag {
  font-size: 0.72rem;
  color: var(--text-3);
  background: var(--bg);
  padding: 2px 7px;
  border-radius: 4px;
}

.card-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-price {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.card-price-old {
  font-size: 0.8rem;
  color: var(--text-3);
  text-decoration: line-through;
}

.card-shop-btn {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--brand);
  background: var(--brand-light);
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.card-shop-btn:hover { background: #d4e8df; }

/* ── NO RESULTS ── */
.no-results {
  grid-column: 1/-1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-3);
}

.no-results svg { width: 48px; height: 48px; margin-bottom: 16px; opacity: 0.4; }
.no-results h3 { font-size: 1.1rem; margin-bottom: 8px; color: var(--text-2); }

/* ── UPLOAD MODAL ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--white);
  border-radius: 16px;
  padding: 32px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.22s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-title { font-size: 1.15rem; font-weight: 700; }

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.modal-close:hover { background: var(--border); }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
  background: var(--bg);
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--brand);
  background: var(--brand-light);
}

.drop-zone svg {
  width: 40px;
  height: 40px;
  color: var(--brand);
  margin-bottom: 12px;
}

.drop-zone h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.drop-zone p {
  font-size: 0.85rem;
  color: var(--text-3);
  margin-bottom: 16px;
}

.drop-zone-btn {
  display: inline-block;
  padding: 10px 24px;
  background: var(--brand);
  color: white;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
}

.drop-zone-btn:hover { background: #5A7866; }

.modal-divider {
  text-align: center;
  color: var(--text-3);
  font-size: 0.85rem;
  margin: 20px 0;
  position: relative;
}

.modal-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}

.modal-divider span {
  background: var(--white);
  padding: 0 12px;
  position: relative;
}

.url-search-row {
  display: flex;
  gap: 10px;
}

.url-search-row input {
  flex: 1;
  height: 42px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
}

.url-search-row input:focus { border-color: var(--brand); }

.url-search-row button {
  height: 42px;
  padding: 0 18px;
  background: var(--brand);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.url-search-row button:hover { background: #5A7866; }

/* ── SIMILAR RESULTS ── */
.similar-section {
  display: none;
  margin-top: 24px;
}

.similar-section.show { display: block; }

.similar-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 12px;
}

.similar-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.similar-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.18s;
}

.similar-card:hover { box-shadow: var(--shadow); }

.similar-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--bg);
}

.similar-card-info { padding: 8px 10px; }
.similar-card-name { font-size: 0.78rem; font-weight: 600; color: var(--text); }
.similar-card-price { font-size: 0.78rem; color: var(--brand); font-weight: 700; }

/* Searching animation */
.searching-state {
  display: none;
  text-align: center;
  padding: 30px 20px;
}

.searching-state.show { display: block; }

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.searching-state p { font-size: 0.9rem; color: var(--text-2); }

/* Image preview */
.img-preview-wrap {
  display: none;
  position: relative;
  text-align: center;
}

.img-preview-wrap.show { display: block; }

.img-preview-wrap img {
  max-width: 100%;
  max-height: 180px;
  border-radius: 8px;
  object-fit: cover;
}

.img-preview-wrap button {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0,0,0,0.6);
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  color: white;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── PAGINATION ── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 40px;
}

.page-btn {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.page-btn:hover { border-color: var(--brand); color: var(--brand); }
.page-btn.active { background: var(--brand); border-color: var(--brand); color: white; }

/* ── PRODUCT DETAIL PAGE ── */
.breadcrumb {
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px 24px 0;
  font-size: 0.85rem;
  color: var(--text-3);
}

.breadcrumb a { color: var(--text-2); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand); }

.product-detail {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

.pd-img-wrap {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 1;
}

.pd-img-wrap img { width: 100%; height: 100%; object-fit: cover; }

.pd-retailer {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.pd-name {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 14px;
}

.pd-price-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 18px;
}

.pd-price { font-size: 1.8rem; font-weight: 700; color: var(--text); }
.pd-price-old { font-size: 1.1rem; color: var(--text-3); text-decoration: line-through; }

.pd-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }

.pd-tag {
  font-size: 0.78rem;
  color: var(--text-2);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 6px;
}

.pd-shop-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--brand);
  color: white;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s;
}

.pd-shop-btn:hover { background: #5A7866; }

.pd-desc {
  margin-top: 22px;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-2);
}

.pd-back {
  display: inline-block;
  margin-top: 28px;
  font-size: 0.85rem;
  color: var(--text-3);
  text-decoration: none;
}
.pd-back:hover { color: var(--brand); }

@media (max-width: 700px) {
  .product-detail { grid-template-columns: 1fr; gap: 20px; }
}

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .main-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-filter-btn {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    background: var(--white);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text);
  }
}

@media (min-width: 901px) {
  .mobile-filter-btn { display: none; }
}

@media (max-width: 600px) {
  .header-top { gap: 12px; }
  .logo-text { display: none; }
  .upload-btn span { display: none; }
  .upload-btn { padding: 0 12px; }
  .main-layout { padding: 16px; }
}
