:root {
  --bg: #f6f4f1;
  --surface: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #e5e2dc;
  --accent: #c45c26;
  --accent-hover: #a34a1c;
  --accent-soft: #fdf0e8;
  --success: #15803d;
  --shadow: 0 8px 30px rgba(26, 26, 26, 0.08);
  --radius: 14px;
}

* { box-sizing: border-box; }

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

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

.container {
  width: min(1200px, 100% - 32px);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(246, 244, 241, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
}

.logo {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.logo span { color: var(--accent); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-input {
  width: min(280px, 42vw);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font: inherit;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

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

.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
}

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

.cart-btn {
  position: relative;
}

.cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.hero {
  padding: 28px 0 8px;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.03em;
}

.hero p {
  margin: 0;
  color: var(--muted);
  max-width: 620px;
}

.suppliers {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 20px 0;
}

.supplier-tab {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.supplier-tab.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  color: var(--muted);
  font-size: 0.95rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  padding-bottom: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.card-image {
  aspect-ratio: 1;
  background: #eee;
  object-fit: cover;
  width: 100%;
}

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

.card-supplier {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.card-title {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.35;
  min-height: 2.7em;
}

.card-price {
  font-size: 1.15rem;
  font-weight: 800;
}

.card-price .old {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: line-through;
  margin-left: 8px;
}

.card .btn { width: 100%; margin-top: auto; }

.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px 0 40px;
}

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

.empty, .loading {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: 0.25s ease;
  z-index: 90;
}

.overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100%);
  height: 100%;
  background: var(--surface);
  box-shadow: -10px 0 40px rgba(0, 0, 0, 0.12);
  transform: translateX(100%);
  transition: 0.25s ease;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

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

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

.panel-body {
  padding: 16px 20px;
  overflow: auto;
  flex: 1;
}

.panel-footer {
  padding: 16px 20px 24px;
  border-top: 1px solid var(--border);
}

.cart-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.cart-item img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 10px;
}

.cart-item-title { font-weight: 600; font-size: 0.92rem; }
.cart-item-meta { color: var(--muted); font-size: 0.85rem; }

.qty-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.qty-controls button {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
}

.cart-total {
  display: flex;
  justify-content: space-between;
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 14px;
}

.form-group { margin-bottom: 12px; }
.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: var(--bg);
}

.form-group textarea { min-height: 72px; resize: vertical; }

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s ease;
  z-index: 110;
}

.modal.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  width: min(760px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--surface);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
}

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

.modal-image {
  background: #eee;
  min-height: 320px;
}

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

.modal-content { padding: 24px; }

.modal-content h2 {
  margin: 0 0 8px;
  font-size: 1.35rem;
}

.modal-price {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 12px 0;
}

.modal-desc {
  color: var(--muted);
  white-space: pre-wrap;
  font-size: 0.95rem;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.btn-tryon {
  width: 100%;
  background: #6366f1;
  color: #fff;
}

.btn-tryon:hover {
  background: #4f46e5;
}

.modal-actions .btn-primary {
  width: 100%;
}

.size-select {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.size-btn {
  min-width: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font: inherit;
}

.size-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.success-box {
  text-align: center;
  padding: 40px 24px;
}

.success-box h2 { color: var(--success); margin-bottom: 8px; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0 40px;
  color: var(--muted);
  font-size: 0.9rem;
}

.api-note {
  margin-top: 8px;
  font-size: 0.82rem;
}

@media (max-width: 760px) {
  .header-inner { flex-wrap: wrap; }
  .search-input { width: 100%; order: 3; }
  .modal-grid { grid-template-columns: 1fr; }
  .modal-image { min-height: 240px; }
}
