:root {
  --primary: #E11B22;
  --primary-alt: #FF1F1F;
  --text: #222;
  --muted: #727272;
  --line: #e8e8e8;
  --bg: #fff;
  --bg-soft: #f8f8f8;
  --radius: 12px;
  --header-h: 56px;
  --promo-h: 36px;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

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

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

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

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

.promo-bar {
  background: var(--primary);
  color: #fff;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 8px 16px;
  min-height: var(--promo-h);
  display: flex;
  align-items: center;
  justify-content: center;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.header-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: var(--header-h);
}

.header-row .logo img { height: 28px; width: auto; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: 50%;
}

.icon-btn svg { width: 22px; height: 22px; }

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

.cart-badge {
  position: relative;
}

.cart-badge .badge {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.search-panel {
  display: none;
  padding: 0 16px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.search-panel.is-open { display: block; }

.search-form {
  display: flex;
  gap: 8px;
}

.search-form input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: inherit;
}

.search-form button {
  padding: 10px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.mobile-nav {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.45);
}

.mobile-nav.is-open { display: block; }

.mobile-nav__panel {
  width: min(280px, 85vw);
  height: 100%;
  background: var(--bg);
  padding: 20px 16px;
  overflow-y: auto;
}

.mobile-nav__panel a {
  display: block;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}

.category-nav {
  position: relative;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: stretch;
}

.category-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 8px;
  scrollbar-width: none;
  scroll-behavior: smooth;
  flex: 1;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
}

.category-scroll::-webkit-scrollbar { display: none; }

.cat-arrow {
  flex: 0 0 36px;
  width: 36px;
  border: 0;
  background: var(--bg);
  color: var(--primary);
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
  padding: 0;
  box-shadow: none;
}
.cat-arrow:hover { background: #fff5f5; }
.cat-arrow[hidden] { display: none !important; }
.cat-arrow--prev { border-right: 1px solid var(--line); }
.cat-arrow--next { border-left: 1px solid var(--line); }

/* Soft fade hint when more content exists */
.category-nav.has-left .category-scroll {
  mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 100%);
}
.category-nav.has-right .category-scroll {
  mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 28px), transparent 100%);
}
.category-nav.has-left.has-right .category-scroll {
  mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
}

.category-chip {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

.category-chip.is-active,
.category-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.hero-slider {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  margin: 16px 0;
  background: #ddd;
}

.hero-slide {
  display: none;
  position: relative;
}

.hero-slide.is-active { display: block; }

.hero-slide img {
  width: 100%;
  aspect-ratio: 2.5 / 1;
  object-fit: cover;
}

.hero-caption {
  position: absolute;
  left: 20px;
  bottom: 20px;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.hero-caption h2 { margin: 0 0 4px; font-size: 1.25rem; }
.hero-caption p { margin: 0; font-size: 0.875rem; }

.section { padding: 8px 0 24px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 1.125rem;
}

.section-head a {
  color: var(--muted);
  font-size: 0.875rem;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 768px) {
  .product-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
}

.product-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.product-card__img {
  aspect-ratio: 1;
  background: var(--bg-soft);
  overflow: hidden;
}

.product-card__img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.product-card__name {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.price-sale {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
}

.price-cust {
  font-size: 0.8125rem;
  color: var(--muted);
  text-decoration: line-through;
}

.discount-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
}

.btn-add {
  margin-top: auto;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

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

.site-footer {
  margin-top: 32px;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 32px 0 40px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.site-footer h3 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 0.9375rem;
}

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

.footer-grid {
  display: grid;
  gap: 24px;
}

@media (min-width: 768px) {
  .footer-grid { grid-template-columns: 2fr 1fr 1.2fr; }
}

.page-title {
  margin: 20px 0 16px;
  font-size: 1.375rem;
}

.form-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  max-width: 480px;
  margin: 0 auto;
}

.form-card label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
  font-weight: 600;
}

.form-card input,
.form-card textarea,
.form-card select {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.phone-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: stretch;
}
.phone-row input {
  flex: 1;
  margin-bottom: 0;
}
.phone-row .btn-secondary {
  white-space: nowrap;
  padding: 10px 12px;
  flex-shrink: 0;
}
.phone-status {
  min-height: 1.2em;
  margin: 0 0 14px;
  font-size: 0.8125rem;
  font-weight: 600;
}
.agree-block {
  margin: 14px 0 4px;
  padding: 14px 14px 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafafa;
}
.agree-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-weight: 600;
  margin-bottom: 12px;
  font-size: 0.875rem;
  line-height: 1.45;
}
.agree-row .terms-link,
.terms-link {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 700;
}
#btnSubmit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  display: inline-block;
  padding: 12px 20px;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn-secondary {
  display: inline-block;
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.product-detail {
  display: grid;
  gap: 24px;
  padding: 16px 0 32px;
}

@media (min-width: 768px) {
  .product-detail { grid-template-columns: 1fr 1fr; }
}

.product-detail__img {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--line);
}

.product-detail__img img { width: 100%; aspect-ratio: 1; object-fit: cover; }

.product-detail__price {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}

.cart-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
}

.cart-table th,
.cart-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.875rem;
}

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

.alert-error {
  padding: 12px 14px;
  margin-bottom: 16px;
  border-radius: 8px;
  background: #fff2f2;
  color: var(--primary);
  font-size: 0.875rem;
}

.lang-toggle {
  font-size: 0.75rem;
  color: var(--muted);
  margin-left: 8px;
}

/* Closed mall — locked prices */
.price-lock {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0 0;
}
.price-lock__label {
  font-size: 0.8125rem;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.35;
}
.price-lock__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff !important;
  font-size: 0.8125rem;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 8px;
  width: fit-content;
}
.price-lock--detail {
  margin: 16px 0;
  padding: 16px;
  background: #fff5f5;
  border: 1px solid #ffd0d0;
  border-radius: var(--radius);
}
.price-lock--detail .price-lock__label { font-size: 0.9375rem; color: var(--text); }
.price-lock--detail .price-lock__cta { padding: 12px 18px; font-size: 0.9375rem; }

.members-banner {
  background: linear-gradient(135deg, #1a1d24, #3a1014);
  color: #fff;
  border-radius: var(--radius);
  padding: 20px 18px;
  margin: 16px 0 8px;
}
.members-banner h2 { margin: 0 0 8px; font-size: 1.125rem; }
.members-banner p { margin: 0 0 14px; opacity: 0.9; font-size: 0.875rem; }
.members-banner .btn-primary { background: var(--primary); border: 0; color: #fff; }

.steps {
  display: grid;
  gap: 10px;
  margin: 16px 0 24px;
}
.step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.step__num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 0.8125rem; flex-shrink: 0;
}
.step.is-done { border-color: #b8e0c8; background: #f3fff7; }
.step.is-done .step__num { background: #1a7f4b; }
.step.is-current { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(225,27,34,0.12); }

.pay-box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin: 16px 0;
}
.pay-box dl { margin: 0; display: grid; gap: 8px; }
.pay-box dt { font-size: 0.75rem; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.pay-box dd { margin: 0 0 8px; font-weight: 700; font-size: 1rem; }
.status-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #eee;
}
.status-pill.pending_payment { background: #ffe8cc; color: #8a4b00; }
.status-pill.pending_approval { background: #e0ecff; color: #1a3f8a; }
.status-pill.approved { background: #d8f5e3; color: #146c3c; }
.status-pill.rejected, .status-pill.suspended { background: #ffd6d6; color: #8a1212; }
