/* Custom Checkout Shopee-standard Style */
#ach-checkout {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #f5f5f5;
  display: none;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #222;
}
#ach-checkout.is-open { display: flex; }

/* Top Header Bar */
.ach-top {
  flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.ach-top-row {
  display: flex;
  align-items: center;
  padding: 14px 16px;
}
.ach-back {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #ee4d2d;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ach-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 500;
  margin: 0;
  color: #222;
}
.ach-ssl {
  font-size: 11px;
  color: #00bfa5;
  font-weight: 700;
  width: 40px;
  text-align: right;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}
.ach-progress {
  height: 3px;
  background: #f0f0f0;
}
.ach-progress > span {
  display: block;
  height: 100%;
  background: #ee4d2d;
  width: 50%;
  transition: width 0.3s ease;
}
.ach-progress.step2 > span { width: 100%; }

/* Content Body */
.ach-body {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 80px; /* space for sticky bar */
  -webkit-overflow-scrolling: touch;
}

/* Cards & Sections */
.ach-card {
  background: #fff;
  margin-top: 8px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.ach-card h2 {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 500;
  color: #222;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Shopee Address Stripe & Card */
.shopee-address-stripe {
  height: 3px;
  background-image: repeating-linear-gradient(-45deg, #ee4d2d, #ee4d2d 10px, #fff 10px, #fff 20px, #4268b3 20px, #4268b3 30px, #fff 30px, #fff 40px);
  width: 100%;
  margin: -16px -16px 12px;
}
.shopee-address-title {
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: bold;
  color: #ee4d2d;
  gap: 6px;
  margin-bottom: 8px;
}
.shopee-pin-icon {
  width: 16px;
  height: 16px;
  fill: #ee4d2d;
}
.shopee-address-details {
  font-size: 13px;
  color: #555;
  line-height: 1.5;
}
.shopee-address-details strong {
  color: #222;
  font-size: 14px;
}
.shopee-address-edit-btn {
  background: transparent;
  border: 1px solid #ee4d2d;
  color: #ee4d2d;
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 10px;
}

/* Form Styles */
.ach-field { margin-bottom: 12px; }
.ach-field label {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 6px;
  font-weight: 500;
}
.ach-field input, .ach-field select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  background: #fafafa;
}
.ach-field input:focus, .ach-field select:focus {
  border-color: #ee4d2d;
  background: #fff;
}
.ach-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ach-row-3 { display: grid; grid-template-columns: 1.5fr 0.8fr 0.7fr; gap: 10px; }

/* Product Section Styles (Shopee Shop-Grouped) */
.shopee-shop-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f2f2f2;
  margin-bottom: 12px;
}
.shopee-shop-badge {
  background: #ee4d2d;
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 4px;
  border-radius: 2px;
  text-transform: uppercase;
}
.shopee-shop-name {
  font-size: 13px;
  font-weight: bold;
  color: #222;
}
.ach-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #fafafa;
}
.ach-item:last-child { border-bottom: 0; }
.ach-item img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #e8e8e8;
  background: #fdfdfd;
}
.ach-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.ach-item-name {
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
  color: #333;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ach-variant-badge {
  display: inline-block;
  background: #f5f5f5;
  color: #888;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 2px;
  margin-top: 4px;
  width: fit-content;
}
.ach-item-price-qty {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}
.ach-price { color: #ee4d2d; font-weight: bold; font-size: 14px; }
.ach-qty { color: #888; font-size: 12px; }

/* Shipping Option Card */
.shopee-shipping-section {
  background: #fdfdfd;
  border-top: 1px solid #f2f2f2;
  border-bottom: 1px solid #f2f2f2;
  margin: 8px -16px -16px;
  padding: 12px 16px;
  font-size: 13px;
}
.shopee-shipping-header {
  color: #00bfa5;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.shopee-shipping-title {
  display: flex;
  align-items: center;
  gap: 4px;
}
.shopee-shipping-details {
  color: #888;
  font-size: 11px;
}
.shopee-message-input {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid #fafafa;
  margin-top: 10px;
  padding-top: 10px;
}
.shopee-message-input label {
  font-size: 12px;
  color: #555;
  white-space: nowrap;
}
.shopee-message-input input {
  flex: 1;
  border: 0;
  font-size: 12px;
  outline: none;
  background: transparent;
  color: #222;
  text-align: right;
}
.shopee-message-input input::placeholder { color: #bbb; }

/* Coupons & Coins */
.shopee-coupon-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
}
.shopee-coupon-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #222;
}
.shopee-coupon-icon { color: #ee4d2d; font-size: 16px; }
.shopee-coupon-status {
  color: #ee4d2d;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}
.shopee-coupon-status::after { content: "›"; font-size: 16px; color: #888; }

.shopee-coins-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid #f2f2f2;
  margin-top: 12px;
  font-size: 13px;
}
.shopee-coins-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #222;
}
.shopee-coin-icon {
  background: #f1c40f;
  color: #fff;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 12px;
}
.shopee-coins-avail { color: #888; font-size: 11px; margin-left: 2px; }

/* Switch Style */
.shopee-switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}
.shopee-switch input { opacity: 0; width: 0; height: 0; }
.shopee-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #ccc;
  border-radius: 20px;
  transition: .2s;
}
.shopee-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: .2s;
}
.shopee-switch input:checked + .shopee-slider { background-color: #ee4d2d; }
.shopee-switch input:checked + .shopee-slider:before { transform: translateX(18px); }

/* Bumps */
.ach-bump-head {
  background: linear-gradient(90deg, #fff5f0, #ffeee5);
  border-bottom: 1px solid rgba(238, 77, 45, 0.15);
  margin: -16px -16px 12px;
  padding: 10px 16px;
  color: #ee4d2d;
  font-size: 12px;
  font-weight: bold;
}
.ach-bump {
  border: 1px solid #f2f2f2;
  border-radius: 8px;
  padding: 12px;
  background: #fafafa;
}
.ach-bump.on {
  background: #fffdfb;
  border-color: #ee4d2d;
}
.ach-bump-btn {
  width: 100%;
  margin-top: 10px;
  border-radius: 4px;
  padding: 10px;
  font-weight: bold;
  font-size: 12px;
  cursor: pointer;
  border: 1px dashed #ee4d2d;
  background: #fff;
  color: #ee4d2d;
  transition: all 0.2s;
}
.ach-bump.on .ach-bump-btn {
  border: 1px solid #ee4d2d;
  background: #ee4d2d;
  color: #fff;
}

/* Payment Method Row */
.shopee-payment-method {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 4px 0;
}
.shopee-payment-details {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #222;
  font-weight: 500;
}
.shopee-pix-badge {
  background: #e6f9f6;
  color: #00bfa5;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 2px;
  font-weight: bold;
}

/* Sum Summary */
.ach-sum { display: flex; justify-content: space-between; font-size: 13px; margin: 8px 0; color: #555; }
.ach-sum.total { font-weight: bold; font-size: 14px; color: #222; border-top: 1px solid #f9f9f9; padding-top: 8px; margin-top: 8px; }
.ach-sum.total span:last-child { color: #ee4d2d; font-size: 17px; }

/* Bottom Place-Order Sticky Bar */
.ach-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid #e8e8e8;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  height: 60px;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.04);
}
.shopee-bar-total {
  padding-right: 16px;
  text-align: right;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.shopee-bar-total-label {
  font-size: 11px;
  color: #666;
}
.shopee-bar-total-val {
  color: #ee4d2d;
  font-size: 16px;
  font-weight: bold;
}
.ach-cta {
  height: 100%;
  width: 140px;
  border: 0;
  background: #ee4d2d;
  color: #fff;
  font-weight: bold;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ach-cta:hover { background: #d04327; }
.ach-cta:disabled { background: #ffc4b7; cursor: not-allowed; color: #fff; }

/* Errors & Loaders */
.ach-err {
  color: #ee4d2d;
  font-size: 12px;
  padding: 0 16px;
  margin-top: 10px;
  text-align: center;
}

/* Step 2 - PIX Payment Screen */
.ach-pix {
  text-align: center;
  padding: 24px 16px;
}
.ach-pix img {
  width: 180px;
  height: 180px;
  background: #fff;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
  padding: 8px;
  margin: 12px auto;
}
.ach-timer {
  font-size: 13px;
  color: #222;
  margin: 8px 0 16px;
  background: #fff5f1;
  padding: 8px 12px;
  border-radius: 4px;
  display: inline-block;
}
.ach-timer b { color: #ee4d2d; font-size: 14px; }
.ach-copy {
  background: #fafafa;
  border: 1px solid #f0f0f0;
  border-radius: 6px;
  padding: 14px;
  text-align: left;
  margin: 16px 0;
}
.ach-copy strong {
  display: block;
  font-size: 13px;
  color: #222;
  margin-bottom: 6px;
}
.ach-copy p {
  font-size: 11px;
  color: #666;
  word-break: break-all;
  margin: 0 0 12px;
  line-height: 1.4;
  background: #fff;
  padding: 8px;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
}
.ach-copy-btn, .ach-paid-btn {
  width: 100%;
  border-radius: 4px;
  padding: 12px;
  font-weight: bold;
  font-size: 14px;
  cursor: pointer;
  margin-top: 10px;
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}
.ach-copy-btn {
  background: #fff;
  border: 1px solid #ee4d2d;
  color: #ee4d2d;
}
.ach-paid-btn {
  background: #ee4d2d;
  color: #fff;
}
.ach-copy-btn:active, .ach-paid-btn:active { opacity: 0.8; }

.ach-ok {
  text-align: center;
  padding: 60px 20px;
}
.ach-ok h2 { color: #00bfa5; margin: 0 0 8px; font-size: 20px; }
.ach-ok p { color: #666; font-size: 14px; }

/* Coupon Pop-up Panel (Shopee Style) */
.shopee-modal {
  position: fixed;
  bottom: -100%;
  left: 0;
  right: 0;
  background: #fff;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  z-index: 100000;
  box-shadow: 0 -4px 15px rgba(0,0,0,0.15);
  transition: bottom 0.3s ease;
  max-height: 70%;
  display: flex;
  flex-direction: column;
}
.shopee-modal.is-open { bottom: 0; }
.shopee-modal-header {
  padding: 16px;
  border-bottom: 1px solid #f2f2f2;
  text-align: center;
  font-weight: bold;
  font-size: 15px;
  position: relative;
}
.shopee-modal-close {
  position: absolute;
  right: 16px;
  top: 14px;
  font-size: 20px;
  color: #888;
  cursor: pointer;
  background: none;
  border: 0;
}
.shopee-modal-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
}
.shopee-coupon-item {
  display: flex;
  border: 1px solid #fcd5d0;
  background: #fffefb;
  border-radius: 6px;
  margin-bottom: 12px;
  height: 80px;
  overflow: hidden;
  cursor: pointer;
}
.shopee-coupon-left {
  background: #ee4d2d;
  color: #fff;
  width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 11px;
}
.shopee-coupon-left span { font-size: 16px; }
.shopee-coupon-right {
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.shopee-coupon-name { font-size: 13px; font-weight: bold; color: #222; }
.shopee-coupon-desc { font-size: 10px; color: #888; }
.shopee-coupon-apply {
  background: #ee4d2d;
  color: #fff;
  border: 0;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 2px;
  font-weight: bold;
  cursor: pointer;
  align-self: flex-end;
}
.shopee-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99999;
  display: none;
}
.shopee-modal-overlay.is-open { display: block; }
