/* ============================================================================
   Footer — #3b1f11, 4 USP blocks, 4 link columns, payment bar, copyright
   Measured: footer 791px + payment 129px + copyright bar #0a0a0a
   ========================================================================= */

.site-footer {
  background: var(--primary);
  color: #fff;
  margin-top: 40px;
}

/* The source wraps the USP + link columns in a section with 30px vertical
   padding (measured: footer section 791.5px = 30 + 731.5 + 30), and the inner
   rows are 1163px wide — wider than the 1140 body row — so they carry the same
   negative side margins as the product grids. */
.site-footer > .container { padding: 30px 10px; }
.site-footer .footer-usp,
.site-footer .footer-main { margin-left: -10px; margin-right: -10px; }

/* Below the 850px breakpoint the footer rows stack and the -10px margins are
   no longer needed — without this the rows sit 20px wider than the viewport
   and the page gains a horizontal scrollbar. */
@media (max-width: 849px) {
  .site-footer > .container { padding: 20px 10px 24px; }
  .site-footer .footer-usp,
  .site-footer .footer-main { margin-left: 0; margin-right: 0; }
}

/* --------------------------------------------------------------- USP row - */

.footer-usp {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 0;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.footer-usp > .usp { padding: 0 9.8px 19.6px; }
/* Measured on the source: a plain 60x63 amber icon (no circle or border),
   then a 16px/700 white title with a 16px sub-line. */
.usp {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.usp-icon {
  flex-shrink: 0;
  padding-top: 3.2px;
  line-height: 0;
}
.usp-icon img { width: 60px; height: 60px; object-fit: contain; }
.usp-text { display: flex; flex-direction: column; line-height: 25.6px; }
.usp-title { font-size: 16px; font-weight: 700; color: #fff; }
.usp-sub { font-size: 16px; color: var(--footer-ink); }

/* ------------------------------------------------------------ link columns */

/* Measured on the source: large-5 / large-3 / large-4. */
.footer-main {
  display: grid;
  grid-template-columns: 5fr 3fr 4fr;
  gap: 0;
  padding: 30px 0 20px;   /* source: 30px above the columns, 20px below */
}
.footer-main > .footer-col { padding: 0 15px; }

.footer-col h5 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 10px;
  color: #fff;
}
.footer-h-gap { margin-top: 20px !important; }
/* Source footer type: 16px / 25.6px line-height. */
.footer-col p, .footer-col li {
  font-size: 16px;
  line-height: 25.6px;
  color: var(--footer-ink);
}
.footer-col ul li { margin-bottom: 10px; }
.footer-col a {
  color: var(--footer-ink);
  transition: color var(--t-fast), padding-left var(--t-fast);
}
.footer-col a:hover { color: var(--header-from); }
.footer-col ul li a { display: inline-block; }
.footer-col ul li a:hover { padding-left: 3px; }

.footer-contact { display: block; }
.footer-contact .row-line {
  display: flex;
  gap: 8px;
  font-size: 16px;
  color: var(--footer-ink);
  line-height: 25.6px;
  padding-left: 16px;
  position: relative;
}
.footer-contact .row-line::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 11px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--footer-ink);
}
.footer-contact .row-line .k { color: #fff; font-weight: 700; flex-shrink: 0; }
.footer-contact .row-line a { color: var(--footer-ink); }
.footer-contact .row-line a:hover { color: var(--header-from); }

.footer-map {
  margin-top: 22px;
}

/* "Đã thông báo Bộ Công Thương" badge under the policy links (real artwork). */
.bct-badge { margin-top: 26px; }
.bct-badge img { display: block; width: 200px; height: auto; }
.footer-map h5 { margin-bottom: 10px; }
.footer-map iframe {
  width: 400px;
  max-width: 100%;
  height: 250px;
  border: 0;
  display: block;
}

/* Facebook page plugin iframe (340x130, as on the source site) */
.fb-frame {
  width: 340px;
  height: 130px;
  max-width: 100%;
  display: block;
  background: rgba(255, 255, 255, .08);
  color-scheme: dark;
}

/* ---------------------------------------------------------- payment bar -- */

.footer-payment {
  background: var(--primary);
  padding: 28px 0 36px;
  border-top: 1px solid rgba(255, 255, 255, .12);
}
.footer-payment h5 {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 12px;
}
.pay-logos {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pay-logos img {
  height: 34px;
  width: auto;
  display: block;
}

/* ------------------------------------------------------------- copyright - */

.copyright {
  background: var(--copyright-bg);
  color: var(--footer-ink);
  font-size: 14.4px;
  padding: 10px 0 15px;
  text-align: center;
}
.copyright a { color: rgba(255, 255, 255, .8); }
.copyright a:hover { color: var(--header-from); }

/* ------------------------------------------------------------ back to top */

.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity var(--t), transform var(--t), visibility var(--t);
  box-shadow: var(--shadow-md);
}
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: #2b160c; }

/* ------------------------------------------------------------- float CTA - */

.float-cta {
  position: fixed;
  right: 20px;
  bottom: 76px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 90;
}
.float-cta a {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: var(--shadow-md);
  transition: transform var(--t-fast);
}
.float-cta a:hover { transform: scale(1.08); }
.float-cta .messenger { background: #ffe14d; color: #1a1a1a; }
.float-cta .zalo { background: #2196f3; }
.float-cta .call { background: #e53935; }
.float-cta .zalo span { font-size: 12px; font-weight: 700; }

@media (max-width: 849px) {
  /* A vertical rail on the right edge sat on top of the product card's
     "add to cart" button. On phones the contacts become a horizontal bar
     pinned to the bottom edge, which never covers card content. */
  /* A compact horizontal pill in the bottom-right corner. A full-width bar
     still covered card prices; the pill only occupies the corner where a card
     has no content (the card padding), and the extra bottom padding below
     keeps the last row reachable. */
  .float-cta {
    left: auto;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    flex-direction: row;
    gap: 8px;
  }
  .float-cta a {
    width: 40px;
    height: 40px;
  }
  .float-cta .zalo span { font-size: 10px; }
  .back-to-top { display: none; }
  .page-main { padding-bottom: 62px; }
  .site-footer { padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }

  /* A fixed rail always sits over whatever is under it, so it hides while the
     visitor scrolls down and returns when they stop or scroll back up —
     see initFloatCta() in public/js/app.js. */
  .float-cta {
    transition: transform .22s ease, opacity .22s ease;
  }
  .float-cta.is-hidden {
    transform: translateY(160%);
    opacity: 0;
    pointer-events: none;
  }
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 1100px) {
  .footer-main { grid-template-columns: 1fr 1fr; }
  .footer-main > .footer-col { padding: 0 12px 22px; }
}
@media (max-width: 849px) {
  .footer-usp { grid-template-columns: 1fr 1fr; gap: 16px; padding: 20px 0; }
  .usp-title { font-size: 12px; }
  .usp-sub { font-size: 11px; }
  .footer-main { grid-template-columns: 1fr; gap: 22px; padding: 26px 0 30px; }
  .footer-map iframe { height: 180px; }
}
@media (max-width: 520px) {
  .footer-usp { grid-template-columns: 1fr; }
}
