:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --navy: #0f172a;
  --navy-soft: #1e293b;
  --accent: #ea580c;
  --accent-hover: #c2410c;
  --accent-soft: #fff7ed;
  --green: #059669;
  --green-hover: #047857;
  --danger: #dc2626;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.1);
}

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 16px;
}

.topbar {
  background: var(--navy);
  color: #e2e8f0;
  font-size: 12px;
  padding: 6px 0;
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topbar-cs {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #059669;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.topbar-cs:hover,
.topbar-cs:visited {
  color: #ffffff;
}

.topbar-cs:hover {
  background: #047857;
}

.footer-wa-link,
.footer-wa-link:visited {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 6px;
  background: #059669;
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
}

.footer-wa-link:hover {
  background: #047857;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--navy);
  color: #fb923c;
  display: grid;
  place-items: center;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-text strong {
  font-size: 16px;
  line-height: 1.2;
}

.brand-text small {
  font-size: 11px;
  color: var(--text-muted);
}

.search-box {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 10px 36px 10px 38px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.search-box input:focus {
  border-color: var(--accent);
  background: var(--surface);
}

.search-clear {
  position: absolute;
  right: 8px;
  border: none;
  background: transparent;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.btn-cart {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  border: none;
  background: var(--navy);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
}

.btn-cart:hover {
  background: var(--navy-soft);
}

.cart-badge {
  background: var(--accent);
  color: #ffffff;
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 12px;
  font-weight: 700;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.btn-outline:hover {
  background: var(--surface-alt);
}

.btn-primary {
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.hero-strip {
  background: linear-gradient(125deg, #0f172a 0%, #1e293b 65%, #334155 100%);
  color: #ffffff;
  padding: 22px 0;
}

.hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.hero-copy {
  max-width: 680px;
}

.hero-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(249, 115, 22, 0.2);
  color: #fdba74;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.hero-copy h1 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.2;
}

.hero-copy p {
  margin: 0;
  color: #cbd5e1;
  font-size: 14px;
}

.hero-stats {
  display: flex;
  gap: 10px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  padding: 10px 16px;
  min-width: 96px;
  text-align: center;
}

.stat-card strong {
  display: block;
  font-size: 20px;
  color: #fb923c;
}

.stat-card span {
  font-size: 11px;
  color: #cbd5e1;
}

.category-strip {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.category-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-top: 10px;
  padding-bottom: 10px;
  scrollbar-width: thin;
}

.cat-pill {
  flex-shrink: 0;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}

.cat-pill:hover {
  border-color: var(--accent);
}

.cat-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 600;
}

.cat-pill span {
  opacity: 0.75;
  font-size: 11px;
  margin-left: 4px;
}

.workspace {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  padding-top: 20px;
  padding-bottom: 40px;
  align-items: start;
}

.sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
  margin: 0;
  font-size: 15px;
}

.filter-group {
  margin-bottom: 18px;
}

.filter-group h3 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.filter-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
}

.filter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6px 8px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
}

.filter-item:hover {
  background: var(--surface-alt);
}

.filter-item.active {
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-weight: 600;
}

.filter-item small {
  color: var(--text-muted);
  font-size: 11px;
}

.price-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.price-inputs input {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
}

.price-presets {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.preset-btn {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  font-size: 11px;
  color: var(--text);
}

.preset-btn:hover {
  border-color: var(--accent);
}

.btn-reset-all {
  width: 100%;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.btn-reset-all:hover {
  background: #e2e8f0;
}

.catalog-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
}

.result-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#result-count {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.active-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  border: 1px solid #fed7aa;
  font-size: 12px;
  font-weight: 600;
}

.sort-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.sort-wrap select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
  color: var(--text);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.product-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.card-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--surface-alt);
  overflow: hidden;
  cursor: pointer;
}

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

.card-badges {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.badge-cond {
  background: rgba(15, 23, 42, 0.8);
  color: #ffffff;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
}

.badge-disc {
  background: #dc2626;
  color: #ffffff;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 12px;
  gap: 6px;
}

.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tag-brand {
  font-size: 10px;
  font-weight: 700;
  color: #0369a1;
  background: #e0f2fe;
  padding: 2px 6px;
  border-radius: 4px;
}

.tag-cat {
  font-size: 10px;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
}

.card-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 35px;
  cursor: pointer;
}

.card-title:hover {
  color: var(--accent);
}

.card-price-row {
  margin-top: auto;
  padding-top: 4px;
}

.card-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
}

.card-rating {
  color: #d97706;
  font-weight: 600;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  margin-top: 6px;
}

.btn-add {
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: var(--navy);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
}

.btn-add:hover {
  background: var(--accent);
}

.btn-detail {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.btn-detail:hover {
  background: var(--surface-alt);
}

.empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--accent);
}

.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.page-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.page-jump input {
  width: 58px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
}

.site-footer {
  background: var(--navy);
  color: #cbd5e1;
  padding: 24px 0;
  font-size: 13px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.site-footer strong {
  color: #ffffff;
  font-size: 16px;
}

.site-footer p {
  margin: 4px 0;
}

.footer-note {
  text-align: right;
}

.close-btn {
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--text-muted);
}

/* Modal */
.modal[hidden],
.cart-drawer[hidden],
.sidebar-backdrop[hidden],
.toast[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal-backdrop,
.cart-backdrop,
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow-md);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: none;
  background: var(--surface-alt);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  font-size: 22px;
  color: var(--text);
}

.modal-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
}

.modal-img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
}

.modal-info h2 {
  margin: 8px 0 10px;
  font-size: 19px;
  line-height: 1.35;
}

.modal-price {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
  margin: 8px 0 12px;
}

.modal-specs {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Cart Drawer */
.cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  justify-content: flex-end;
}

.cart-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  height: 100%;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 28px rgba(15, 23, 42, 0.2);
}

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.cart-header h2 {
  margin: 0;
  font-size: 17px;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 16px;
  font-size: 14px;
}

.cart-item {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-alt);
}

.cart-item img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 8px;
  background: #ffffff;
}

.cart-item-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 4px;
}

.cart-item-price {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

.cart-qty-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.qty-ctrl {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #ffffff;
}

.qty-ctrl button {
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  font-weight: 700;
}

.qty-ctrl span {
  padding: 0 8px;
  font-size: 13px;
  font-weight: 600;
}

.btn-remove {
  border: none;
  background: transparent;
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
}

.cart-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.cart-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 15px;
}

.cart-summary strong {
  font-size: 18px;
  color: var(--accent);
}

.checkout-fields {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.checkout-fields input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}

.cart-actions {
  display: grid;
  gap: 8px;
}

.btn-whatsapp {
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: 9px;
  background: var(--green);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
}

.btn-whatsapp:hover {
  background: var(--green-hover);
}

.cart-secondary-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-danger-outline {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  background: var(--navy);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-md);
}

.mobile-only {
  display: none;
}

@media (max-width: 1100px) {
  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

  .mobile-only {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(310px, 85vw);
    z-index: 65;
    border-radius: 0;
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop.open {
    display: block !important;
    z-index: 64;
  }

  .modal-grid {
    grid-template-columns: 1fr;
  }

  .footer-note {
    text-align: left;
  }
}

@media (max-width: 640px) {
  .topbar-inner {
    gap: 6px;
  }

  .topbar-right span[aria-hidden] {
    display: none;
  }

  .header-inner {
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
  }

  .brand-icon {
    width: 34px;
    height: 34px;
  }

  .brand-text strong {
    font-size: 14px;
  }

  .brand-text small {
    display: none;
  }

  .search-box {
    order: 3;
    flex-basis: 100%;
  }

  .search-box input {
    font-size: 16px;
  }

  .cart-btn-label {
    display: none;
  }

  .hero-strip {
    padding: 16px 0;
  }

  .hero-copy h1 {
    font-size: 20px;
  }

  .hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .stat-card {
    min-width: 0;
    padding: 8px 6px;
  }

  .stat-card strong {
    font-size: 17px;
  }

  .sort-wrap {
    width: 100%;
    justify-content: space-between;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .card-body {
    padding: 9px;
    gap: 5px;
  }

  .card-price {
    font-size: 14px;
  }

  .card-actions {
    grid-template-columns: 1fr;
  }

  .btn-detail {
    display: none;
  }

  .page-jump {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }

  .modal-card {
    padding: 16px;
  }
}
