/* ==========================================================================
   BangKeo_VuGiaPhat - style.css

   Lớp tùy biến mỏng đặt TRÊN Bootstrap 5.3 (nạp qua CDN trước file này).
   Nguyên tắc: ưu tiên dùng lớp có sẵn của Bootstrap (grid, card, navbar,
   carousel, modal, toast, form). File này chỉ lo:
     1. Đổi màu thương hiệu theo logo (#017DC7)
     2. Vài thành phần Bootstrap không có sẵn (thẻ sản phẩm, thanh sao, bản đồ)
     3. Hiệu ứng riêng của website

   Tông màu lấy từ images/logo.png — màu thương hiệu VGP: #017DC7
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. ĐỔI MÀU THƯƠNG HIỆU CHO BOOTSTRAP
   Ghi đè biến CSS của Bootstrap để mọi lớp .btn-primary, .text-primary,
   .bg-primary, .link-primary... tự động dùng màu logo.
   -------------------------------------------------------------------------- */
:root,
[data-bs-theme="light"] {
  /* Màu thương hiệu — trích xuất trực tiếp từ logo.png */
  --brand: #017DC7;
  --brand-dark: #015E96;
  --brand-darker: #01476F;
  --brand-light: #E8F4FC;
  --brand-lighter: #F4FAFE;

  /* Ghi đè "primary" của Bootstrap thành màu logo */
  --bs-primary: #017DC7;
  --bs-primary-rgb: 1, 125, 199;
  --bs-primary-text-emphasis: #01476F;
  --bs-primary-bg-subtle: #E8F4FC;
  --bs-primary-border-subtle: #A9D6F0;

  --bs-link-color: #017DC7;
  --bs-link-color-rgb: 1, 125, 199;
  --bs-link-hover-color: #015E96;
  --bs-link-hover-color-rgb: 1, 94, 150;

  --bs-body-color: #1E2530;
  --bs-body-bg: #F5F7FA;
  --bs-secondary-color: #5A6674;
  --bs-border-color: #E3E8EF;

  --bs-border-radius: .75rem;
  --bs-border-radius-lg: 1.125rem;

  /* Dùng riêng trong file này */
  --star: #F5A524;
  --shadow-soft: 0 2px 12px rgba(1, 125, 199, .08);
  --shadow-hover: 0 .75rem 1.75rem rgba(1, 125, 199, .18);
  --header-h: 76px;
}

/* Bootstrap tô nút primary bằng --bs-btn-* riêng, phải ghi đè thêm */
.btn-primary {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-dark);
  --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-darker);
  --bs-btn-active-border-color: var(--brand-darker);
  --bs-btn-disabled-bg: var(--brand);
  --bs-btn-disabled-border-color: var(--brand);
}
.btn-outline-primary {
  --bs-btn-color: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand);
  --bs-btn-hover-border-color: var(--brand);
  --bs-btn-active-bg: var(--brand-dark);
  --bs-btn-active-border-color: var(--brand-dark);
}

/* Nền/chữ dùng chung */
.bg-brand { background-color: var(--brand) !important; }
.bg-brand-light { background-color: var(--brand-light) !important; }
.bg-brand-lighter { background-color: var(--brand-lighter) !important; }
.text-brand { color: var(--brand) !important; }

/* Dải gradient thương hiệu cho header trang trong và khối số liệu */
.bg-brand-gradient {
  background: linear-gradient(120deg, var(--brand-darker), var(--brand));
  color: #fff;
}

/* --------------------------------------------------------------------------
   2. NỀN TẢNG
   -------------------------------------------------------------------------- */
html {
  /* Trừ chiều cao navbar dính khi nhảy tới anchor */
  scroll-padding-top: calc(var(--header-h) + 1rem);
  scroll-behavior: smooth;
}

body {
  font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(1.75rem, 4.2vw, 2.9rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2.1rem); }

/* Link "bỏ qua" cho người dùng bàn phím */
.skip-link {
  position: absolute;
  top: -100px; left: 1rem;
  z-index: 2000;
  padding: .625rem 1.125rem;
  background: var(--brand);
  color: #fff;
  border-radius: 0 0 .5rem .5rem;
  transition: top .18s ease;
}
.skip-link:focus { top: 0; color: #fff; }

/* --------------------------------------------------------------------------
   3. NAVBAR
   -------------------------------------------------------------------------- */
.navbar {
  min-height: var(--header-h);
  transition: box-shadow .28s ease, padding .28s ease;
}
/* Lớp này do main.js gắn khi cuộn xuống */
.navbar.is-scrolled {
  box-shadow: 0 .375rem 1.25rem rgba(1, 125, 199, .12);
  padding-top: .375rem;
  padding-bottom: .375rem;
}

.navbar-brand img {
  width: 46px; height: 46px;
  object-fit: contain;
  transition: transform .28s ease;
}
.navbar-brand:hover img { transform: rotate(-8deg) scale(1.06); }

.brand-name {
  font-weight: 800;
  font-size: 1.08rem;
  color: var(--brand);
  line-height: 1.15;
  letter-spacing: -.02em;
}
.brand-tag {
  font-size: .68rem;
  color: #8A94A3;
  text-transform: uppercase;
  letter-spacing: .1em;
  line-height: 1.15;
}

/* Gạch chân trượt vào khi hover / đang ở trang đó */
.navbar-nav .nav-link {
  position: relative;
  font-weight: 500;
  color: var(--bs-body-color);
}
.navbar-nav .nav-link::after {
  content: "";
  position: absolute;
  left: .75rem; right: .75rem; bottom: .25rem;
  height: 2px;
  background: var(--brand);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .28s ease;
}
.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active { color: var(--brand); }
.navbar-nav .nav-link:hover::after,
.navbar-nav .nav-link.active::after { transform: scaleX(1); }
.navbar-nav .nav-link.active { font-weight: 700; }

/* Trong ngăn kéo offcanvas thì bỏ gạch chân, dùng nền thay thế */
.offcanvas .navbar-nav .nav-link::after { display: none; }
.offcanvas .navbar-nav .nav-link {
  padding: .75rem 1rem;
  border-radius: var(--bs-border-radius);
  font-size: 1.02rem;
}
.offcanvas .navbar-nav .nav-link.active { background: var(--brand-light); }

/* --------------------------------------------------------------------------
   4. CAROUSEL (dùng component .carousel của Bootstrap)
   -------------------------------------------------------------------------- */
.hero-carousel .carousel-item {
  height: clamp(300px, 46vw, 470px);
  background: var(--brand-darker);
}

.hero-slide {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  overflow: hidden;
}

/* Ảnh sản phẩm làm nền, mờ nhẹ để chữ nổi lên */
.hero-slide .slide-bg {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: .3;
  transform: scale(1.06);
  transition: transform 7s linear;
}
.carousel-item.active .hero-slide .slide-bg { transform: scale(1.16); }

/* Lớp phủ gradient màu thương hiệu */
.hero-slide::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg,
              rgba(1, 71, 111, .96) 0%,
              rgba(1, 125, 199, .88) 48%,
              rgba(1, 125, 199, .55) 100%);
}

/* KHONG dat max-width o day: phan tu nay dong thoi la .container cua Bootstrap,
   von co margin-inline:auto — thu hep no lai se lam ca khoi chu bi day vao
   giua man hinh thay vi bam le trai theo container. Gioi han be rong o cac
   phan tu con ben trong. */
.hero-slide .slide-content {
  position: relative;
  z-index: 2;
  color: #fff;
}
.hero-slide h2 {
  max-width: 620px;
  font-size: clamp(1.55rem, 4vw, 2.85rem);
  text-shadow: 0 2px 14px rgba(0, 0, 0, .25);
}

/* Chữ trượt lên khi slide được kích hoạt */
.carousel-item.active .slide-content > * {
  animation: slideUp .65s both;
}
.carousel-item.active .slide-content > *:nth-child(2) { animation-delay: .08s; }
.carousel-item.active .slide-content > *:nth-child(3) { animation-delay: .16s; }
.carousel-item.active .slide-content > *:nth-child(4) { animation-delay: .24s; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Nút prev/next của Bootstrap: bo tròn cho hợp giao diện */
.hero-carousel .carousel-control-prev,
.hero-carousel .carousel-control-next {
  width: 60px;
  opacity: .85;
}
.hero-carousel .carousel-control-prev-icon,
.hero-carousel .carousel-control-next-icon {
  width: 46px; height: 46px;
  padding: .75rem;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, .2);
  border: 1px solid rgba(255, 255, 255, .4);
  background-size: 45%;
}

/* --------------------------------------------------------------------------
   5. THẺ DANH MỤC
   -------------------------------------------------------------------------- */
.cat-card {
  position: relative;
  overflow: hidden;
  transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease;
}
.cat-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  border-color: var(--brand) !important;
}
/* Dải màu chạy ngang trên đỉnh thẻ khi hover */
.cat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand), var(--brand-light));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .28s ease;
}
.cat-card:hover::before { transform: scaleX(1); }

.cat-icon {
  width: 58px; height: 58px;
  display: grid; place-items: center;
  border-radius: var(--bs-border-radius);
  background: var(--brand-light);
  color: var(--brand);
  font-size: 1.6rem;
  transition: background .28s ease, color .28s ease, transform .28s ease;
}
.cat-card:hover .cat-icon {
  background: var(--brand);
  color: #fff;
  transform: scale(1.08) rotate(-6deg);
}
.cat-card:hover .cat-arrow { transform: translateX(5px); }
.cat-arrow { transition: transform .28s ease; display: inline-block; }

/* --------------------------------------------------------------------------
   6. THẺ SẢN PHẨM (dựng trên .card của Bootstrap)
   -------------------------------------------------------------------------- */
.product-card {
  transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease;
}
.product-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  border-color: var(--brand) !important;
}

.product-media {
  position: relative;
  /* Khung 4:3 chứ không phải 1:1 — toàn bộ 24 ảnh nguồn đều là ảnh ngang
     (~308px rộng, tỉ lệ 1.0–1.94; riêng 14 ảnh ở mức 1.25–1.26).
     Khung vuông sẽ để lại quá nhiều khoảng trắng trên/dưới. */
  aspect-ratio: 4 / 3;
  background: #fff;
  overflow: hidden;
  border-radius: var(--bs-border-radius) var(--bs-border-radius) 0 0;
}
.product-media img {
  /* Định vị tuyệt đối thay vì height:100%: phần tử cha chỉ có aspect-ratio
     (không có chiều cao tường minh) nên height:100% bị tính thành auto,
     khiến ảnh tràn ra ngoài khung. */
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  padding: .75rem;
  transition: transform .5s ease;
}
.product-card:hover .product-media img { transform: scale(1.08); }

/* Nút "Xem nhanh" trượt lên khi hover */
.quick-view {
  position: absolute;
  left: .75rem; right: .75rem; bottom: .75rem;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .28s ease, transform .28s ease;
}
.product-card:hover .quick-view,
.quick-view:focus-visible { opacity: 1; transform: translateY(0); }

.product-title {
  font-size: .93rem;
  font-weight: 600;
  line-height: 1.45;
  /* Cắt gọn còn 3 dòng cho đều thẻ */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 4.05em;
}

.product-price {
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--brand);
}

/* --------------------------------------------------------------------------
   7. THANH SAO ĐÁNH GIÁ
   Bootstrap không có sẵn; dựng bằng 2 lớp sao chồng lên nhau,
   lớp vàng bị cắt theo biến --pct.
   -------------------------------------------------------------------------- */
.stars {
  position: relative;
  display: inline-block;
  font-size: .95rem;
  line-height: 1;
  letter-spacing: 1px;
  color: var(--bs-border-color);
  /* Bắt buộc: nếu thiếu, chuỗi 5 sao bị ngắt dòng trong thẻ hẹp,
     làm lớp sao vàng phủ lên sai vị trí. */
  white-space: nowrap;
}
.stars::before { content: "★★★★★"; }
.stars i {
  position: absolute;
  top: 0; left: 0;
  overflow: hidden;
  width: var(--pct, 0%);
  color: var(--star);
  font-style: normal;
}

/* --------------------------------------------------------------------------
   8. TRANG SẢN PHẨM — chip lọc danh mục
   -------------------------------------------------------------------------- */
.chip {
  border-radius: 50rem;
  font-size: .89rem;
  font-weight: 600;
  transition: transform .18s ease;
}
.chip:hover { transform: translateY(-2px); }
/* aria-pressed do main.js đặt, dùng luôn làm trạng thái đang chọn */
.chip[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 .375rem 1.25rem rgba(1, 125, 199, .25);
}
.chip .n { opacity: .7; font-weight: 500; }

/* --------------------------------------------------------------------------
   9. KHUNG XƯƠNG CÁ (chờ dữ liệu)
   -------------------------------------------------------------------------- */
.skeleton {
  border-radius: var(--bs-border-radius-lg);
  /* Xấp xỉ chiều cao thật của .product-card (ảnh 4:3 + phần thân thẻ) */
  height: 320px;
  background: linear-gradient(100deg, #EDF1F6 30%, #F8FAFC 50%, #EDF1F6 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* --------------------------------------------------------------------------
   10. TRANG LIÊN HỆ
   -------------------------------------------------------------------------- */
.info-icon {
  flex-shrink: 0;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: var(--bs-border-radius);
  background: var(--brand-light);
  color: var(--brand);
  font-size: 1.15rem;
  transition: background .28s ease, color .28s ease;
}
.info-item:hover .info-icon { background: var(--brand); color: #fff; }

/* Bản đồ dựng bằng CSS — không nhúng iframe ngoài để trang chạy được offline */
.map-box {
  height: 190px;
  border-radius: var(--bs-border-radius);
  background: var(--brand-light);
  background-image:
    linear-gradient(rgba(1, 125, 199, .12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(1, 125, 199, .12) 1px, transparent 1px);
  background-size: 34px 34px;
  display: grid; place-items: center;
  text-align: center;
}
.map-pin {
  width: 42px; height: 42px;
  margin: 0 auto .5rem;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 1.15rem;
  animation: pinPulse 2s infinite;
}
@keyframes pinPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(1, 125, 199, .5); }
  60%      { box-shadow: 0 0 0 16px rgba(1, 125, 199, 0); }
}

/* --------------------------------------------------------------------------
   11. TIÊU ĐỀ SECTION
   -------------------------------------------------------------------------- */
.section-head { max-width: 620px; margin-inline: auto; }
/* Gạch chân trang trí dưới tiêu đề */
.section-head::after {
  content: "";
  display: block;
  width: 62px; height: 4px;
  margin: 1rem auto 0;
  background: linear-gradient(90deg, var(--brand), var(--brand-light));
  border-radius: 50rem;
}

.feature-icon {
  width: 54px; height: 54px;
  margin-inline: auto;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--brand-light);
  color: var(--brand);
  font-size: 1.5rem;
  transition: transform .28s ease;
}
.feature-card { transition: transform .28s ease, box-shadow .28s ease; }
.feature-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }
.feature-card:hover .feature-icon { transform: scale(1.12); }

/* --------------------------------------------------------------------------
   12. NÚT LÊN ĐẦU TRANG
   -------------------------------------------------------------------------- */
.to-top {
  position: fixed;
  right: 1.125rem; bottom: 1.125rem;
  z-index: 1030;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 50%;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity .28s ease, visibility .28s ease, transform .28s ease;
}
.to-top.is-shown { opacity: 1; visibility: visible; transform: translateY(0); }

/* --------------------------------------------------------------------------
   13. HIỆU ỨNG HIỆN DẦN KHI CUỘN
   Chỉ ẩn nội dung khi JS thật sự đang chạy (main.js gắn .js-ready lên <html>).
   Nếu JS lỗi hoặc bị chặn, các khối .reveal vẫn hiện bình thường thay vì
   kẹt ở trạng thái opacity:0 vĩnh viễn.
   -------------------------------------------------------------------------- */
.reveal { transition: opacity .6s ease, transform .6s ease; }

.js-ready .reveal {
  opacity: 0;
  transform: translateY(26px);
}
.js-ready .reveal.is-visible { opacity: 1; transform: translateY(0); }

/* Độ trễ dần cho hiệu ứng xếp tầng */
.reveal[data-delay="1"] { transition-delay: .08s; }
.reveal[data-delay="2"] { transition-delay: .16s; }
.reveal[data-delay="3"] { transition-delay: .24s; }

/* --------------------------------------------------------------------------
   14. FOOTER
   -------------------------------------------------------------------------- */
.site-footer { background: var(--brand-darker); }
.site-footer a {
  color: rgba(255, 255, 255, .82);
  text-decoration: none;
  transition: color .18s ease, padding-left .18s ease;
}
.site-footer a:hover { color: #fff; padding-left: 4px; }
.site-footer .footer-brand img {
  width: 50px; height: 50px;
  padding: 5px;
  object-fit: contain;
  background: #fff;
  border-radius: .5rem;
}

/* --------------------------------------------------------------------------
   15. RESPONSIVE — phần lớn đã do lưới Bootstrap lo, đây chỉ là tinh chỉnh
   -------------------------------------------------------------------------- */
@media (max-width: 575.98px) {
  :root { --header-h: 66px; }

  .navbar-brand img { width: 40px; height: 40px; }
  .brand-name { font-size: .98rem; }
  .brand-tag { font-size: .62rem; }

  /* Ẩn nút prev/next trên màn hẹp: chúng đè lên chữ mô tả của slide.
     Người dùng vẫn chuyển slide được bằng vuốt ngang hoặc bấm chấm chỉ số. */
  .hero-carousel .carousel-control-prev,
  .hero-carousel .carousel-control-next { display: none; }

  .product-title { font-size: .86rem; }
  .product-price { font-size: 1rem; }
  /* Màn hình cảm ứng không có hover -> luôn hiện nút xem nhanh */
  .quick-view { opacity: 1; transform: none; }

  .to-top { width: 42px; height: 42px; bottom: 4.75rem; }
}

/* --------------------------------------------------------------------------
   16. TÔN TRỌNG TÙY CHỌN GIẢM CHUYỂN ĐỘNG CỦA NGƯỜI DÙNG
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }

  /* Vẫn phải hiện nội dung, không để kẹt ở trạng thái ẩn */
  .js-ready .reveal { opacity: 1; transform: none; }
  .quick-view { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   17. IN ẤN
   -------------------------------------------------------------------------- */
@media print {
  .navbar, .site-footer, .hero-carousel, .toolbar,
  .to-top, .toast-container, .quick-view { display: none !important; }
  body { background: #fff; }
  .product-card { break-inside: avoid; }
}

/* ==========================================================================
   * B2B FLOATING WIDGET (Zalo & Hotline)
   * ========================================================================== */
.floating-widget {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.float-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  text-decoration: none;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  transition: transform 0.3s ease;
  position: relative;
}

.float-btn:hover {
  transform: scale(1.1);
  color: white;
}

.float-zalo {
  background-color: #0068ff; /* Zalo color */
  font-weight: bold;
  font-size: 14px;
}

.float-phone {
  background-color: #28a745;
  animation: phoneRing 1.5s infinite ease-in-out;
}

@keyframes phoneRing {
  0% { transform: rotate(0) scale(1) skew(1deg); }
  10% { transform: rotate(-25deg) scale(1) skew(1deg); }
  20% { transform: rotate(25deg) scale(1) skew(1deg); }
  30% { transform: rotate(-25deg) scale(1) skew(1deg); }
  40% { transform: rotate(25deg) scale(1) skew(1deg); }
  50% { transform: rotate(0) scale(1) skew(1deg); }
  100% { transform: rotate(0) scale(1) skew(1deg); }
}

.float-btn .tooltip-text {
  position: absolute;
  right: 65px;
  background-color: rgba(0,0,0,0.7);
  color: #fff;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s;
}

.float-btn:hover .tooltip-text {
  opacity: 1;
  visibility: visible;
}

