/* ===================================================
   core.css — Style dùng chung cho mọi layout
   Reset, app shell, bottom bar, modal, form, cart,
   toast, thank modal, lightbox, searchable dropdown,
   variant popup
=================================================== */

:root {
  --primary:        #EE4D2D;
  --primary-dark:   #D73211;
  --primary-light:  #FFF3F0;
  --primary-border: #FFCCC7;
  --primary-mid:    #F05025;
  --blue:           #1565C0;
  --blue-dark:      #0D47A1;
  --blue-light:     #E3F2FD;
  --blue-border:    #BBDEFB;
  --blue-mid:       #1976D2;
  --text:           #1a1a1a;
  --text-sub:       #555;
  --text-meta:      #888;
  --border:         #e8e8e8;
  --bg:             #f5f7fa;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Be Vietnam Pro', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  scroll-behavior: smooth;
}

img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; }

.app {
  max-width: 500px;
  margin: 0 auto;
  background: #fff;
  min-height: 100vh;
  padding-bottom: 90px;
}

/* ===================================================
   BOTTOM BAR
=================================================== */
.bottom-bar {
  position: fixed;
  bottom: 0; left: 0;
  width: 100%;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  z-index: 100;
}

.bottom-inner {
  max-width: 500px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
}

.btn-bar-ghost {
  flex: 1;
  border: 1.5px solid var(--primary);
  background: #fff;
  color: var(--primary);
  border-radius: 10px;
  padding: 14px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
}

.btn-ghost {
  position: relative;
}


.btn-bar-solid {
  flex: 1;
  border: none;
  background: var(--primary);
  color: #fff;
  border-radius: 10px;
  padding: 14px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

/* ===================================================
   CART BADGE
=================================================== */
.cart-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 18px;
  height: 18px;
  background: var(--primary);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  border: 2px solid #fff;
  pointer-events: none;
}

.cart-badge.show {
  display: flex;
}

/* ===================================================
   MODAL — ORDER
=================================================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 999;
}

.modal.show { display: flex; }

.modal-content {
  width: 100%;
  max-width: 500px;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 18px 16px 28px;
  max-height: 92vh;
  overflow-y: auto;
  animation: slideUp 0.22s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-title { font-size: 18px; font-weight: 800; }

.close-btn {
  background: none;
  border: none;
  font-size: 26px;
  cursor: pointer;
  color: #aaa;
  line-height: 1;
}

/* ===================================================
   ORDER SUMMARY / CART
=================================================== */
.order-summary {
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}

.order-summary-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--primary-dark);
}

.cart-item {
  padding: 10px 0;
  border-bottom: 1px dashed var(--primary-border);
  font-size: 14px;
}

.cart-item:last-child { border-bottom: none; }
.cart-item-top { font-weight: 700; margin-bottom: 6px; color: var(--text); line-height: 1.45; }
.cart-item-price { font-size: 14px; font-weight: 700; color: var(--primary); }

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.cart-qty-btn {
  width: 28px; height: 28px;
  border: 1px solid var(--primary-border);
  border-radius: 6px;
  background: #fff;
  color: var(--primary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.cart-qty-display {
  min-width: 26px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
}

.cart-remove-btn {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 12.5px;
  color: #bbb;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 5px;
}

.cart-remove-btn:hover { color: var(--primary); background: var(--primary-light); }

.order-totals {
  padding-top: 10px;
  border-top: 1px dashed var(--primary-border);
  font-size: 14px;
  display: grid;
  gap: 6px;
}

.order-totals-row { display: flex; justify-content: space-between; }

.order-totals-row.grand {
  font-size: 15px;
  font-weight: 800;
  color: var(--primary);
  margin-top: 4px;
}

.order-totals-row.freeship { color: #2e7d32; font-weight: 700; }

/* ===================================================
   TRUST STRIP
=================================================== */
.trust-strip {
  display: flex;
  margin-bottom: 16px;
  border: 1px solid var(--blue-border);
  border-radius: 10px;
  overflow: hidden;
}

.trust-strip-item {
  flex: 1;
  text-align: center;
  padding: 9px 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--blue-dark);
  background: var(--blue-light);
  line-height: 1.5;
  border-right: 1px solid var(--blue-border);
}

.trust-strip-item:last-child { border-right: none; }
.trust-strip-item span { display: block; font-size: 16px; margin-bottom: 3px; }

/* ===================================================
   FORM
=================================================== */
.reassurance {
  background: #f0faf4;
  border: 1px solid #c8ead6;
  border-radius: 10px;
  padding: 11px 13px;
  margin-bottom: 12px;
  font-size: 13px;
  color: #2e7d32;
  font-weight: 600;
  line-height: 1.6;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.submit-trust {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.submit-trust-item {
  font-size: 12px;
  color: #888;
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-group { margin-bottom: 12px; position: relative; }

.form-group label {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 7px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 14px;
  font-size: 14.5px;
  outline: none;
  background: #fff;
}

.form-group input:focus,
.form-group textarea:focus { border-color: var(--primary); }

#orderNote { resize: vertical; min-height: 60px; }

.form-group select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 14px;
  font-size: 14.5px;
  outline: none;
  background: #fff;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%23999' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

.form-group select:focus { border-color: var(--primary); }
.form-group select:disabled { background-color: #f7f9fc; color: #bbb; cursor: not-allowed; }

/* ===================================================
   SEARCHABLE DROPDOWN (Province)
=================================================== */
.searchable-select { position: relative; }

.searchable-select-display {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 36px 13px 14px;
  font-size: 14.5px;
  background: #fff;
  cursor: pointer;
  color: #333;
  user-select: none;
  display: flex;
  align-items: center;
  min-height: 50px;
}

.searchable-select-display.placeholder { color: #aaa; }
.searchable-select-display.open { border-color: var(--primary); border-radius: 10px 10px 0 0; }

.searchable-select-arrow {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #aaa;
  font-size: 12px;
  pointer-events: none;
  transition: transform 0.2s;
}

.searchable-select-arrow.open { transform: translateY(-50%) rotate(180deg); }

.searchable-dropdown {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--primary);
  border-top: none;
  border-radius: 0 0 10px 10px;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  display: none;
}

.searchable-dropdown.open { display: block; }

.searchable-input-wrap {
  padding: 8px 10px;
  border-bottom: 1px solid #e8eef5;
}

.searchable-input {
  width: 100%;
  border: 1px solid var(--primary-border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13.5px;
  outline: none;
  background: #fff;
}

.searchable-input:focus { border-color: var(--primary); }

.searchable-list {
  max-height: 200px;
  overflow-y: auto;
}

.searchable-list::-webkit-scrollbar { width: 4px; }
.searchable-list::-webkit-scrollbar-thumb { background: var(--primary-border); border-radius: 4px; }

.searchable-option {
  padding: 11px 14px;
  font-size: 14px;
  cursor: pointer;
  color: #333;
  border-bottom: 1px solid #f0f4f8;
}

.searchable-option:last-child { border-bottom: none; }
.searchable-option:hover { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.searchable-option.no-result { color: #aaa; cursor: default; font-size: 13px; }
.searchable-option.no-result:hover { background: none; font-weight: 400; color: #aaa; }

.district-ward-wrap { display: none; }
.district-ward-wrap.show { display: block; }

/* ===================================================
   SUBMIT BUTTON
=================================================== */
.submit-btn {
  width: 100%;
  border: none;
  background: var(--primary);
  color: #fff;
  border-radius: 12px;
  padding: 16px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 8px;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.submit-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.mini-note { font-size: 12.5px; color: #aaa; margin-top: 8px; text-align: center; }
.status-message { margin-top: 10px; font-size: 13.5px; font-weight: 700; }

/* ===================================================
   FIELD ERROR
=================================================== */
.field-error {
  font-size: 12px;
  color: var(--primary);
  margin-top: 4px;
  display: none;
}

.field-error.show { display: block; }

.form-group input.input-error,
.form-group select.input-error,
.form-group textarea.input-error {
  border-color: var(--primary);
}

.searchable-select-display.input-error {
  border-color: var(--primary);
}

/* ===================================================
   TOAST
=================================================== */
.toast {
  position: fixed;
  bottom: 106px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #1a2a4a;
  color: #fff;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 9999;
  white-space: nowrap;
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===================================================
   THANK MODAL
=================================================== */
.thank-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: 20px;
}

.thank-modal.show { display: flex; }

.thank-modal-content {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 20px;
  padding: 36px 24px 28px;
  text-align: center;
  animation: slideUp 0.25s ease;
}

.thank-icon { font-size: 54px; margin-bottom: 14px; line-height: 1; }
.thank-title { font-size: 20px; font-weight: 800; margin-bottom: 12px; color: var(--primary-dark); }
.thank-body { font-size: 14px; line-height: 1.75; color: #555; margin-bottom: 22px; }

.thank-close-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px 36px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}

/* ===================================================
   MEDIA LIGHTBOX
=================================================== */
.media-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.media-lightbox.show { display: flex; }

.media-lightbox-content {
  position: relative;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-lightbox-content img,
.media-lightbox-content video {
  width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 12px;
}

.media-lightbox-close {
  position: absolute;
  top: -10px; right: -4px;
  width: 38px; height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  z-index: 2;
}

/* ===================================================
   VARIANT POPUP
=================================================== */
.variant-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
}

.variant-popup-overlay.show {
  display: flex;
}

.variant-popup {
  width: 100%;
  max-width: 500px;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 18px 16px 28px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.22s ease;
}

.variant-popup-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.variant-popup-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
}

.variant-popup-close {
  background: none;
  border: none;
  font-size: 26px;
  cursor: pointer;
  color: #aaa;
  line-height: 1;
}

.variant-popup-gallery {
  margin-bottom: 16px;
}

.variant-popup-slider {
  width: 100%;
  overflow: hidden;
  position: relative;
  border-radius: 12px;
  background: #f5f7fa;
  touch-action: pan-y;
}

.variant-popup-slides {
  display: flex;
  transition: transform 0.3s ease;
  width: 100%;
  will-change: transform;
}

.variant-popup-slide {
  min-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-drag: none;
}

.variant-popup-slide img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
}

.variant-popup-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}

.variant-popup-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #d0d5dd;
  cursor: pointer;
  transition: 0.2s;
}

.variant-popup-dot.active {
  width: 18px;
  background: var(--primary);
}

.variant-popup-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.variant-popup-thumbs::-webkit-scrollbar {
  height: 3px;
}

.variant-popup-thumbs::-webkit-scrollbar-thumb {
  background: var(--primary-border);
  border-radius: 3px;
}

.variant-popup-thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  flex: 0 0 auto;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}

.variant-popup-thumb.active {
  border-color: var(--primary);
}

.variant-popup-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.variant-popup-section {
  margin-bottom: 14px;
}

.variant-popup-label {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.variant-popup-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.variant-popup-option {
  padding: 8px 16px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: 0.15s;
}

.variant-popup-option:active {
  transform: scale(0.97);
}

.variant-popup-option.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
}

.variant-popup-cta {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

/* ===================================================
   VARIANT POPUP — NÚT THÊM VÀO GIỎ (dưới size)
=================================================== */
.vp-add-to-cart-btn {
  display: block;
  width: fit-content;
  margin: 0 16px 8px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #e53e3e;
  background: #fff5f5;
  border: 1.5px solid #e53e3e;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
}

.vp-add-to-cart-btn.added {
  background: #f0fff4;
  border-color: #2e7d32;
  color: #2e7d32;
}

.variant-popup-price {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 14px;
  padding: 0 2px;
}

/* ===================================================
   ANIMATION — Mua ngay button wiggle
=================================================== */
@keyframes wiggle-pulse {
  0%, 85%, 100% { transform: translateX(0); }
  88%            { transform: translateX(-3px); }
  91%            { transform: translateX(3px); }
  94%            { transform: translateX(-3px); }
  97%            { transform: translateX(3px); }
}

.btn-bar-solid {
  animation: wiggle-pulse 4s ease-in-out 2s infinite;
}

.slide img {
  aspect-ratio: 16/9;
  width: 100%;
  height: auto;
  object-fit: cover;
}

