:root {
  --blue: #2BB7F0;
  --blue-soft: #D6EEFB;
  --blue-line: #2BB7F0;
  --red: #E63946;
  --red-soft: #FFE6E8;
  --ink: #1B2733;
  --muted: #6C7884;
  --bg: #F6F8FB;
}

#bg-widget {
  background: #fff;
  border: 2px solid var(--blue-line);
  border-radius: 4px;
  overflow: hidden;
  font-family: -apple-system, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  max-width: 100%;
}

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

/* ---------- Row layout (label | content) ---------- */
#bg-widget .bg-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  border-bottom: 2px solid var(--blue-line);
  margin: 0;
  padding: 0;
  background: transparent;
}
#bg-widget .bg-row:last-of-type { border-bottom: 0; }

#bg-widget .bg-row > .label {
  padding: 18px 16px;
  border-right: 2px solid var(--blue-line);
  color: var(--blue);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 4px;
  margin: 0;
  background: transparent;
  line-height: 1.4;
}
#bg-widget .bg-row > .label .sub {
  font-size: 12px;
  color: var(--muted);
  text-transform: none;
  font-weight: 500;
  margin: 0;
  line-height: 1.4;
}

#bg-widget .bg-row > .content {
  padding: 16px 18px;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  min-height: 64px;
  justify-content: center;
  margin: 0;
}

/* ---------- Header (Sản phẩm in) ---------- */
#bg-widget .bg-header .content {
  flex-direction: column !important; /* Stack select and note */
  align-items: stretch !important;
  font-weight: 700;
  font-size: 18px;
}
#bg-widget .bg-header select {
  font: inherit;
  font-weight: 700;
  border: 1px solid #c8d3df;
  background: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  width: 100%;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
  margin: 0;
  height: auto;
  line-height: normal;
  box-shadow: none;
  appearance: auto;
}
#bg-widget .bg-header select:focus { outline: 2px solid var(--blue); outline-offset: 1px; }

#bg-widget .spec-note {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-transform: none;
  margin: 0;
  margin-top: 4px;
  font-style: italic;
  line-height: 1.4;
}

/* ---------- Option pills (radio) ---------- */
#bg-widget label.opt {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  padding: 6px 0;
  margin: 0 !important;
  line-height: 1;
}
#bg-widget label.opt input[type="radio"] { 
  accent-color: var(--blue); 
  width: 16px; 
  height: 16px; 
  margin: 0 !important;
  box-shadow: none !important;
}
#bg-widget label.opt.disabled { opacity: 0.35; cursor: not-allowed; }

/* ---------- Quantity dropdown ---------- */
#bg-widget .qty-select {
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  padding: 8px 12px;
  border: 1.5px solid var(--blue-line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  cursor: pointer;
  width: 100%;
  max-width: 300px;
  margin: 0;
  height: auto;
  line-height: normal;
  box-shadow: none;
  appearance: auto;
}
#bg-widget .qty-select:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
#bg-widget .qty-select option[data-contact="1"] { color: #888; font-style: italic; }

/* ---------- Total row ---------- */
#bg-widget .bg-total {
  background: var(--blue-soft);
  display: grid;
  grid-template-columns: 200px 1fr;
  border-top: 2px solid var(--blue-line);
  margin: 0;
  padding: 0;
}
#bg-widget .bg-total .label {
  padding: 16px;
  border-right: 2px solid var(--blue-line);
  margin: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
#bg-widget .bg-total .label strong {
  color: var(--red);
  font-weight: 800;
  font-size: 18px;
  text-transform: uppercase;
  display: block;
  margin: 0;
  line-height: 1.2;
}
#bg-widget .bg-total .label .sub {
  display: block;
  font-size: 13px;
  color: #2c3e50;
  margin: 2px 0 0 0;
  line-height: 1.2;
  font-weight: normal;
}
#bg-widget .bg-total .total-value {
  padding: 18px;
  font-size: 20px;
  font-weight: 800;
  display: flex !important;
  align-items: center !important;
  margin: 0;
  line-height: 1.4;
}
#bg-widget .total-value .amt { text-decoration: underline; }
#bg-widget .total-value.muted { color: var(--muted); font-weight: 600; font-size: 15px; }
#bg-widget .total-value .calc-line {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  display: block;
  margin: 2px 0 0 0;
  text-decoration: none;
}
#bg-widget .total-value .stack { display: flex !important; flex-direction: column !important; margin: 0; }

/* ---------- CTA ---------- */
#bg-widget .cta-wrap { padding: 12px; background: #fff; margin: 0; }
#bg-widget .cta-btn {
  width: 100%;
  background: var(--red);
  color: #fff;
  border: 2px dashed #fff;
  outline: 2px solid var(--red);
  outline-offset: -6px;
  padding: 16px;
  font-size: 18px;
  font-weight: 800;
  text-transform: none;
  cursor: pointer;
  border-radius: 2px;
  letter-spacing: 0.2px;
  margin: 0;
  line-height: 1.2;
  display: block;
  box-shadow: none;
}
#bg-widget .cta-btn:hover { background: #c92a36; color: #fff; }

/* ---------- Footer note ---------- */
#bg-widget .bg-footnote {
  padding: 14px 16px;
  color: var(--red);
  font-weight: 700;
  font-size: 14px;
  line-height: 1.45;
  margin: 0;
  background: #fff;
  border-top: 1px dotted var(--blue-line);
}

/* ---------- Modal ---------- */
#cta-modal {
  border: none;
  border-radius: 8px;
  padding: 0;
  width: min(440px, 92vw);
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  font-family: -apple-system, "Segoe UI", system-ui, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}
#cta-modal * { box-sizing: border-box; }
#cta-modal::backdrop { background: rgba(20,30,45,0.5); }
#cta-modal form { padding: 22px 22px 18px; display: flex; flex-direction: column; gap: 12px; margin: 0; }
#cta-modal h3 { margin: 0; color: var(--blue); font-size: 20px; font-weight: 700; line-height: 1.3; }
#cta-modal .muted { color: var(--muted); font-size: 14px; margin: 0; line-height: 1.4; }
#cta-modal label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink); margin: 0; padding: 0; }
#cta-modal input, #cta-modal textarea {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid #c8d3df;
  border-radius: 6px;
  font-weight: 500;
  margin: 0;
  width: 100%;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
}
#cta-modal textarea { resize: vertical; }
#cta-modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
#cta-modal .btn-cancel, #cta-modal .btn-submit {
  font: inherit;
  border-radius: 6px;
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  line-height: normal;
  margin: 0;
}
#cta-modal .btn-cancel { background: #eef1f5; color: var(--ink); }
#cta-modal .btn-submit { background: var(--red); color: #fff; }
#cta-modal .btn-submit:hover { background: #c92a36; }

@media (max-width: 560px) {
  #bg-widget .bg-row, #bg-widget .bg-total { grid-template-columns: 120px 1fr; }
  #bg-widget .bg-row > .label, #bg-widget .bg-total .label { font-size: 13px; padding: 12px 10px; }
  #bg-widget .bg-total .label strong { font-size: 16px; }
  #bg-widget .bg-total .total-value { font-size: 17px; padding: 12px; }
}
