:root {
  --color-primary: #1e40af;
  --color-primary-dark: #1b3aa0;
  --color-accent: #ff7a00;
  --color-accent-dark: #e96d00;
  --color-success: #16a34a;
  --color-success-dark: #128a3e;
  --color-bg: #f5f7fb;
  --color-card: #ffffff;
  --color-text: #1f2430;
  --color-muted: #6b7280;
  --color-border: #e5e7eb;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-soft: 0 10px 30px rgba(17, 24, 39, 0.08);
  --shadow-strong: 0 18px 50px rgba(17, 24, 39, 0.14);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

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

.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 18px; }

/* ============ TOPBAR ============ */
.topbar {
  background: linear-gradient(90deg, var(--color-primary), #2657d6);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 9px 12px;
  letter-spacing: .2px;
}
.topbar span { opacity: .95; }

/* ============ HEADER ============ */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; }
.brand img { width: 34px; height: 34px; }
.brand b { color: var(--color-accent); }
.header-secure { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--color-muted); font-weight: 600; }
.header-secure svg { width: 16px; height: 16px; }

/* ============ PRODUCT ============ */
.product {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  padding: 36px 0 20px;
  align-items: start;
}
.gallery { position: sticky; top: 84px; }
.gallery-main {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  aspect-ratio: 1/1;
  display: flex; align-items: center; justify-content: center;
}
.gallery-main img { width: 100%; height: 100%; object-fit: cover; transition: opacity .25s ease; }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 12px; }
.thumb {
  width: 76px; height: 76px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-border);
  overflow: hidden; cursor: pointer;
  background: #fff;
  transition: border-color .2s ease, transform .15s ease;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb:hover { transform: translateY(-2px); }
.thumb.active { border-color: var(--color-primary); }

.product-info { padding-top: 4px; }
.badge-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.badge {
  font-size: 12px; font-weight: 700;
  padding: 5px 11px; border-radius: 999px;
  background: #eef2ff; color: var(--color-primary);
}
.badge.hot { background: #fff1e6; color: var(--color-accent-dark); }
.badge.green { background: #e7f6ec; color: var(--color-success-dark); }

.product-title { font-size: 30px; font-weight: 800; line-height: 1.2; margin-bottom: 10px; }
.rating { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; color: var(--color-muted); font-size: 14px; }
.stars { color: #fbbf24; letter-spacing: 1px; font-size: 16px; }

.price-box { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.price { font-size: 38px; font-weight: 800; color: var(--color-text); }
.price-old { font-size: 20px; color: var(--color-muted); text-decoration: line-through; }
.price-off { background: var(--color-accent); color: #fff; font-weight: 700; font-size: 13px; padding: 4px 9px; border-radius: 8px; }
.price-note { color: var(--color-success-dark); font-weight: 600; font-size: 14px; margin-bottom: 22px; }

.option-group { margin-bottom: 22px; }
.option-label { font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.option-label span { color: var(--color-muted); font-weight: 500; }
.color-options { display: flex; gap: 12px; }
.color-opt {
  display: flex; align-items: center; gap: 9px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 16px; cursor: pointer;
  font-weight: 600; font-size: 14px;
  transition: border-color .2s ease, background .2s ease;
}
.color-opt:hover { border-color: #c7cdd6; }
.color-opt.active { border-color: var(--color-primary); background: #eef2ff; }
.swatch { width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(0,0,0,.15); }
.swatch.white { background: #fff; }
.swatch.black { background: #1f2430; }

.qty-row { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.qty-control { display: flex; align-items: center; border: 2px solid var(--color-border); border-radius: var(--radius-sm); overflow: hidden; }
.qty-control button { width: 42px; height: 44px; border: none; background: #fff; font-size: 20px; cursor: pointer; color: var(--color-text); }
.qty-control button:hover { background: #f3f4f6; }
.qty-control input { width: 48px; height: 44px; text-align: center; border: none; font-size: 16px; font-weight: 700; }

.actions { display: flex; flex-direction: column; gap: 12px; margin-bottom: 22px; }
.btn {
  border: none; cursor: pointer;
  font-weight: 700; font-size: 16px;
  border-radius: var(--radius-md);
  padding: 16px 22px;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
  font-family: var(--font);
}
.btn:active { transform: scale(.985); }
.btn-buy {
  background: var(--color-accent); color: #fff;
  box-shadow: 0 8px 20px rgba(255,122,0,.32);
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.btn-buy:hover { background: var(--color-accent-dark); }
.btn-cart {
  background: #fff; color: var(--color-primary);
  border: 2px solid var(--color-primary);
}
.btn-cart:hover { background: #eef2ff; }
.btn-block { width: 100%; }

.trust-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 8px; }
.trust-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--color-muted); font-weight: 600; }
.trust-item svg { width: 22px; height: 22px; color: var(--color-success); flex-shrink: 0; }

/* ============ FEATURES ============ */
.section { padding: 36px 0; }
.section-title { font-size: 24px; font-weight: 800; text-align: center; margin-bottom: 26px; }
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.feature {
  background: #fff; border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: 22px 18px; text-align: center;
  box-shadow: var(--shadow-soft);
}
.feature .ico { font-size: 28px; margin-bottom: 10px; }
.feature h4 { font-size: 15px; margin-bottom: 6px; }
.feature p { font-size: 13px; color: var(--color-muted); }

.desc-block { background: #fff; border-radius: var(--radius-lg); border: 1px solid var(--color-border); padding: 30px; box-shadow: var(--shadow-soft); }
.desc-block img { border-radius: var(--radius-md); margin: 18px 0; }
.desc-block h3 { font-size: 20px; margin-bottom: 12px; }
.desc-block p { color: #374151; margin-bottom: 12px; }
.desc-block ul { margin: 12px 0 12px 20px; color: #374151; }
.desc-block li { margin-bottom: 6px; }

/* ============ FOOTER ============ */
.site-footer { background: #111827; color: #cbd5e1; padding: 34px 0; margin-top: 40px; font-size: 13.5px; }
.footer-inner { display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; }
.footer-pay { display: flex; gap: 10px; align-items: center; opacity: .85; }
.footer-pay span { background: #1f2937; padding: 5px 10px; border-radius: 6px; font-weight: 600; font-size: 12px; }

/* ============ CHECKOUT DRAWER ============ */
.overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .5);
  opacity: 0; visibility: hidden;
  transition: opacity .3s ease, visibility .3s ease;
  z-index: 100;
}
.overlay.open { opacity: 1; visibility: visible; }

.drawer {
  position: fixed; top: 0; right: 0;
  height: 100%; width: 100%; max-width: 460px;
  background: var(--color-bg);
  z-index: 110;
  transform: translateX(100%);
  transition: transform .38s cubic-bezier(.22,.61,.36,1);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-strong);
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  background: #fff;
  padding: 16px 18px;
  border-bottom: 1px solid var(--color-border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.drawer-head h3 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.drawer-close { background: #f3f4f6; border: none; width: 36px; height: 36px; border-radius: 50%; font-size: 20px; cursor: pointer; color: var(--color-text); line-height: 1; }
.drawer-close:hover { background: #e5e7eb; }

/* Progress steps */
.steps-bar { display: flex; padding: 16px 18px 6px; gap: 6px; background: #fff; flex-shrink: 0; }
.step-dot { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; }
.step-dot .num {
  width: 28px; height: 28px; border-radius: 50%;
  background: #e5e7eb; color: #9ca3af;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  transition: background .3s ease, color .3s ease;
  z-index: 2;
}
.step-dot .lbl { font-size: 10.5px; color: #9ca3af; font-weight: 600; transition: color .3s ease; }
.step-dot.active .num { background: var(--color-primary); color: #fff; }
.step-dot.done .num { background: var(--color-success); color: #fff; }
.step-dot.active .lbl, .step-dot.done .lbl { color: var(--color-text); }
.step-dot::before {
  content: ''; position: absolute; top: 14px; left: -50%; width: 100%; height: 3px;
  background: #e5e7eb; z-index: 1;
}
.step-dot:first-child::before { display: none; }
.step-dot.done::before, .step-dot.active::before { background: var(--color-success); }

.drawer-body { flex: 1; overflow-y: auto; padding: 18px; }

/* Mini cart summary */
.mini-cart {
  background: #fff; border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: 14px; display: flex; gap: 12px; align-items: center; margin-bottom: 18px;
}
.mini-cart img { width: 58px; height: 58px; border-radius: 10px; object-fit: cover; border: 1px solid var(--color-border); }
.mini-cart .mc-info { flex: 1; }
.mini-cart .mc-title { font-weight: 700; font-size: 14px; }
.mini-cart .mc-meta { font-size: 12.5px; color: var(--color-muted); }
.mini-cart .mc-price { font-weight: 800; font-size: 16px; }

/* Steps panels */
.step-panel { display: none; animation: fadeSlide .4s ease both; }
.step-panel.active { display: block; }
@keyframes fadeSlide {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.step-head { margin-bottom: 16px; }
.step-head h4 { font-size: 18px; margin-bottom: 4px; }
.step-head p { font-size: 13.5px; color: var(--color-muted); }

.field { margin-bottom: 14px; animation: fadeUp .45s ease both; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 13px 14px;
  border: 1.8px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 15px; font-family: var(--font);
  background: #fff; color: var(--color-text);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(30,64,175,.12);
}
.field textarea { resize: vertical; min-height: 80px; }
.field .hint { font-size: 11.5px; color: var(--color-muted); margin-top: 5px; }
.field.error input, .field.error select { border-color: #dc2626; }
.field .err-msg { color: #dc2626; font-size: 12px; margin-top: 5px; display: none; }
.field.error .err-msg { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.field-stagger { animation-delay: calc(var(--i) * .06s); }

/* Payment-date pills */
.pill-group { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 6px; }
.pill {
  border: 2px solid var(--color-border); border-radius: var(--radius-sm);
  padding: 13px 6px; text-align: center; cursor: pointer;
  font-weight: 700; font-size: 13.5px; background: #fff;
  transition: border-color .2s ease, background .2s ease, transform .12s ease;
}
.pill:hover { border-color: #c7cdd6; }
.pill.active { border-color: var(--color-primary); background: #eef2ff; color: var(--color-primary); }

/* Selectable option card (shipping & payment) */
.opt-card {
  border: 2px solid var(--color-border); border-radius: var(--radius-md);
  padding: 16px; margin-bottom: 12px; cursor: pointer; background: #fff;
  display: flex; gap: 14px; position: relative;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.opt-card:hover { border-color: #c7cdd6; }
.opt-card.active { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(30,64,175,.1); }
.opt-card .radio {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid #c7cdd6; flex-shrink: 0; margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .2s ease;
}
.opt-card.active .radio { border-color: var(--color-primary); }
.opt-card.active .radio::after { content: ''; width: 11px; height: 11px; border-radius: 50%; background: var(--color-primary); }
.opt-card .oc-body { flex: 1; }
.opt-card .oc-title { font-weight: 700; font-size: 14.5px; margin-bottom: 4px; line-height: 1.35; }
.opt-card .oc-desc { font-size: 12.8px; color: var(--color-muted); line-height: 1.45; }
.opt-card .oc-icon { width: 46px; height: 46px; border-radius: 10px; object-fit: contain; flex-shrink: 0; }
.tag {
  position: absolute; top: -10px; right: 14px;
  font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
}
.tag.free { background: var(--color-success); color: #fff; }
.tag.popular { background: var(--color-accent); color: #fff; }

/* Step footer button */
.step-foot { margin-top: 10px; }
.btn-continue {
  width: 100%; background: var(--color-primary); color: #fff;
  border: none; border-radius: var(--radius-md);
  padding: 16px; font-size: 16px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .2s ease, transform .12s ease;
  font-family: var(--font);
}
.btn-continue:hover { background: var(--color-primary-dark); }
.btn-continue:active { transform: scale(.99); }
.btn-continue:disabled { opacity: .6; cursor: not-allowed; }
.btn-order { background: var(--color-success); box-shadow: 0 8px 20px rgba(22,163,74,.28); }
.btn-order:hover { background: var(--color-success-dark); }

.btn-back {
  background: none; border: none; color: var(--color-muted);
  font-size: 13.5px; cursor: pointer; padding: 10px; margin-top: 4px;
  width: 100%; font-weight: 600; font-family: var(--font);
}
.btn-back:hover { color: var(--color-text); }

.spinner {
  width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite; display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.summary-line { display: flex; justify-content: space-between; font-size: 14px; padding: 6px 0; }
.summary-line.total { font-weight: 800; font-size: 17px; border-top: 1px solid var(--color-border); margin-top: 6px; padding-top: 12px; }
.summary-card { background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 16px; margin-bottom: 16px; }

/* ============ THANK YOU PAGE ============ */
.ty-wrap { max-width: 720px; margin: 0 auto; padding: 30px 18px 60px; }
.ty-hero {
  background: linear-gradient(135deg, var(--color-success), #0ea05a);
  color: #fff; border-radius: var(--radius-lg); padding: 36px 26px; text-align: center;
  box-shadow: var(--shadow-soft); margin-bottom: 24px;
}
.ty-check {
  width: 72px; height: 72px; border-radius: 50%; background: rgba(255,255,255,.2);
  display: flex; align-items: center; justify-content: center; margin: 0 auto 16px;
  animation: pop .5s cubic-bezier(.18,.89,.32,1.28) both;
}
.ty-check svg { width: 40px; height: 40px; }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.ty-hero h1 { font-size: 26px; margin-bottom: 8px; }
.ty-hero p { opacity: .95; font-size: 15px; }
.ty-order-id { display: inline-block; margin-top: 14px; background: rgba(255,255,255,.18); padding: 7px 16px; border-radius: 999px; font-weight: 700; font-size: 14px; }

.ty-card { background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 20px; box-shadow: var(--shadow-soft); }
.ty-card h2 { font-size: 18px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.ty-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--color-border); font-size: 14.5px; }
.ty-row:last-child { border-bottom: none; }
.ty-row .k { color: var(--color-muted); }
.ty-row .v { font-weight: 700; text-align: right; }
.ty-row.total .v { color: var(--color-success-dark); font-size: 18px; }

/* Payment instruction templates */
.pay-method {
  border: 2px solid var(--color-border); border-radius: var(--radius-md);
  overflow: hidden; margin-bottom: 18px;
}
.pay-method.highlight { border-color: var(--color-accent); }
.pay-method-head {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  background: #fafbfc; border-bottom: 1px solid var(--color-border);
}
.pay-method-head img { width: 54px; height: 40px; object-fit: cover; border-radius: 8px; }
.pay-method-head .pm-t { font-weight: 800; font-size: 16px; }
.pay-method-head .pm-s { font-size: 12.5px; color: var(--color-muted); }
.pay-method-body { padding: 18px; }
.pay-data {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--color-bg); border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm); padding: 13px 15px; margin-bottom: 10px;
}
.pay-data .pd-label { font-size: 12px; color: var(--color-muted); font-weight: 600; }
.pay-data .pd-value { font-size: 17px; font-weight: 800; letter-spacing: .5px; font-family: 'Courier New', monospace; }
.copy-btn {
  background: var(--color-primary); color: #fff; border: none;
  padding: 8px 13px; border-radius: 8px; font-size: 12.5px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; gap: 5px; flex-shrink: 0;
  transition: background .2s ease;
}
.copy-btn:hover { background: var(--color-primary-dark); }
.copy-btn.copied { background: var(--color-success); }
.pay-amount {
  text-align: center; background: #fff7ed; border: 1px solid #fed7aa; border-radius: var(--radius-sm);
  padding: 14px; margin-top: 6px;
}
.pay-amount .pa-label { font-size: 12.5px; color: var(--color-accent-dark); font-weight: 600; }
.pay-amount .pa-value { font-size: 26px; font-weight: 800; color: var(--color-accent-dark); }
.pay-steps { margin: 14px 0 4px; padding-left: 20px; font-size: 13.5px; color: #374151; }
.pay-steps li { margin-bottom: 7px; }

.ty-help { text-align: center; color: var(--color-muted); font-size: 13.5px; margin-top: 10px; }
.ty-help a { color: var(--color-primary); font-weight: 700; }

.alert {
  background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
  border-radius: var(--radius-sm); padding: 13px 16px; font-size: 13.5px; margin-bottom: 18px;
  display: flex; gap: 10px; align-items: flex-start;
}
.alert svg { width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }

/* Toast */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #111827; color: #fff; padding: 13px 22px; border-radius: 999px;
  font-size: 14px; font-weight: 600; z-index: 200; opacity: 0; visibility: hidden;
  transition: opacity .25s ease, transform .25s ease; box-shadow: var(--shadow-strong);
}
.toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* ============ RESPONSIVE ============ */
@media (max-width: 880px) {
  .product { grid-template-columns: 1fr; gap: 24px; }
  .gallery { position: static; }
  .features { grid-template-columns: repeat(2, 1fr); }
  .product-title { font-size: 25px; }
  .price { font-size: 32px; }
}
@media (max-width: 520px) {
  .trust-row { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr; }
  .drawer { max-width: 100%; }
  .header-secure span { display: none; }
}

/* ============ MOBILE FIX (description & footer overflow) ============ */
html, body { overflow-x: hidden; width: 100%; }
.topbar { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.site-header { overflow: hidden; }
.header-inner { overflow: hidden; }
main.container { overflow-x: hidden; }
.gallery-thumbs { overflow-x: auto; flex-wrap: nowrap; }
.desc-block { overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; overflow: hidden; }
.desc-block img { max-width: 100%; height: auto; }
.section { overflow: hidden; }
.site-footer { overflow: hidden; }
.footer-pay { flex-wrap: wrap; justify-content: center; }

@media (max-width: 520px) {
  .container { padding: 0 14px; overflow-x: hidden; }
  .topbar { font-size: 11.5px; padding: 8px 10px; }
  .brand { font-size: 16px; gap: 7px; }
  .brand img { width: 28px; height: 28px; }
  .header-inner { height: 54px; padding: 0 12px; }
  .product { gap: 18px; padding: 20px 0 14px; }
  .gallery-thumbs { gap: 8px; }
  .thumb { width: 60px; height: 60px; }
  .product-title { font-size: 22px; }
  .desc-block { padding: 18px; }
  .desc-block h3 { font-size: 17px; }
  .desc-block p, .desc-block li { font-size: 14px; }
  .section-title { font-size: 20px; }
  .site-footer { padding: 24px 0; }
  .footer-inner { padding: 0 14px; }
  .footer-pay span { font-size: 11px; padding: 4px 8px; }
  .product-info { overflow: hidden; }
  .gallery-main { aspect-ratio: 4/3; }
  .price-box { flex-wrap: wrap; gap: 8px; }
  .color-options { flex-wrap: wrap; }
}
