/* ================================================================
   RESPONSIVE — Hoài Minh Home
   Tham khảo autobike-light.templaza.net (Templaza / Elementor breakpoints)

   Tiers:
     XL  Desktop wide   >= 1366px   (giữ nguyên CSS gốc)
     LG  Desktop        1200 - 1365 (giữ nguyên)
     MD  Tablet         768  - 1199 (compact)
     SM  Mobile         480  - 767  (1 col, hamburger)
     XS  Small mobile   <  480      (siết chữ + ảnh)
================================================================ */

/* ===== Reset global an toàn ===== */
img { max-width: 100%; }

/* ===== Hamburger button: ẩn mặc định ===== */
.btn-hamburger {
  display: none;
  width: 42px; height: 42px;
  border: 1px solid #e0e0e0;
  background: #fff;
  align-items: center; justify-content: center;
  font-size: 18px; cursor: pointer;
  border-radius: 4px;
  transition: color .2s ease, border-color .2s ease;
}
.btn-hamburger:hover { color: #ff2626; border-color: #ff2626; }

/* ===== TABLET (≤1045px): logo + top bar + hamburger CÙNG 1 DÒNG, ẨN mega menu ===== */
@media (max-width: 1045px) {
  /* Top bar HIỆN, mega menu chính ẨN (dùng hamburger thay thế) */
  header .header-container .div-menu .div-menu-top {
    display: flex !important;
  }
  header .header-container .div-menu .div-menu-bottom {
    display: none !important;
  }

  /* Hamburger HIỆN */
  .btn-hamburger {
    display: inline-flex !important;
    order: 3;          /* nằm phải cùng */
    flex-shrink: 0;
  }

  /* Layout header CÙNG 1 DÒNG: logo | top-bar | hamburger */
  header { height: auto !important; padding: 0; }
  header .header-container {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    width: 100%;
  }
  /* Logo trái */
  header .header-container .div-logo {
    order: 1;
    width: 160px !important;
    flex: 0 0 160px !important;
    border-right: 1px solid rgb(229, 229, 229);
    padding: 8px 0;
  }
  header .header-container .div-logo .a-logo img {
    width: 110px !important;
    height: auto !important;
  }
  /* Top bar giữa (chỉ chứa div-menu-top vì div-menu-bottom đã ẩn) */
  header .header-container .div-menu {
    order: 2;
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0;
    height: auto !important;
  }
  header .header-container .div-menu .div-menu-top {
    padding: 0 20px !important;
    gap: 20px !important;
    height: auto !important;
    min-height: 60px;
    border-bottom: none !important;
    justify-content: space-between !important;
    align-items: center !important;
  }
  header .header-container .div-menu .div-menu-top .div-menu-infor {
    gap: 18px !important;
    flex-wrap: wrap;
    align-items: center;
  }
  header .header-container .div-menu .div-menu-top .div-menu-infor span {
    font-size: 0.78rem !important;
    line-height: 1.4 !important;
  }
  header .header-container .div-menu .div-menu-top .div-menu-action {
    gap: 8px !important;
    flex-shrink: 0;
  }
}

/* Offcanvas width cho tablet rộng hơn (cùng range hamburger) */
@media (min-width: 768px) and (max-width: 1045px) {
  .mobile-nav.offcanvas { width: 60% !important; max-width: 360px !important; }
}

/* ===== Mobile offcanvas menu — style cho items bên trong ===== */
.mobile-nav .offcanvas-header { border-bottom: 1px solid #eee; }
.mobile-nav .offcanvas-title { font-size: 18px; }
.mobile-nav .mobile-menu-list { list-style: none; padding: 0; margin: 0; }
.mobile-nav .mobile-menu-item { border-bottom: 1px solid #eee; }
.mobile-nav .mobile-menu-item > a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 8px;
  color: #222 !important;
  text-transform: uppercase;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.mobile-nav .mobile-menu-item > a:hover { color: #ff2626 !important; }
.mobile-nav .mobile-menu-item > a i { transition: transform .2s ease; font-size: 12px; }
.mobile-nav .mobile-menu-item.open > a i { transform: rotate(180deg); }
.mobile-nav .submenu {
  list-style: none;
  padding: 0 0 0 14px;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  background: #fafafa;
  transition: max-height .3s ease;
}
.mobile-nav .mobile-menu-item.open .submenu {
  max-height: 1000px;
  padding: 4px 0 4px 14px;
}
.mobile-nav .submenu li a {
  display: block;
  padding: 10px 8px;
  color: #555 !important;
  border-bottom: 1px dashed #eee;
  text-decoration: none;
  font-size: .9em;
}
.mobile-nav .submenu li:last-child a { border-bottom: none; }

/* ================================================================
   TABLET — 768px → 1199px
   Compact 2-3 cột, giữ menu ngang (đến 1045 vẫn show — rule sẵn)
================================================================ */
@media (min-width: 768px) and (max-width: 1199px) {

  .container-fluid { padding-left: 24px !important; padding-right: 24px !important; }

  /* --- Section title --- */
  .section .section-title-container .section-title .section-title-main {
    font-size: 28px;
  }

  /* --- Banner: vẫn 7:2 --- */

  /* --- Category mega: thu nhỏ padding --- */
  .container-category {
    margin: 0 24px;
    width: calc(100% - 48px);
  }
  .container-category .category-list {
    padding: 24px;
    gap: 12px;
  }
  .container-category .category-list .list-item {
    width: calc((100% - 24px) / 3);
  }
  /* Tablet: chỉ hiện 3 xe trong submenu mega (ẩn từ card thứ 4) */
  .container-category .category-list .list-item:hover .item-support .support-card .card-col:nth-child(n+4) {
    display: none !important;
  }
  .container-category .category-list .list-item:hover .item-support .support-card .card-col {
    flex: 0 0 calc((100% - 20px) / 3);
    max-width: calc((100% - 20px) / 3);
  }

  /* --- Carousel sản phẩm nổi bật: 2 cards/slide --- */
  .section-product .card-wrapper {
    gap: 20px;
    flex-wrap: nowrap;
  }
  .section-product .card-wrapper .product-card-slider {
    flex: 0 0 calc(50% - 10px);
    max-width: calc(50% - 10px);
  }
  .section-product .card-wrapper .product-card-slider:nth-child(n+3) {
    display: none;
  }

  /* --- Type product 3 cols, giảm chiều cao --- */
  .section-type-product .bike-model .row .col {
    height: 380px !important;
    max-height: 380px !important;
  }
  .section-type-product .bike-model .row .col .model-title-group {
    padding: 20px !important;
    height: 100px !important;
  }
  .section-type-product .bike-model .row .col .model-title-group .model-title {
    font-size: 22px !important;
  }

  /* --- Services: 2 + 1 --- */
  .section-services .row .col-4 {
    flex: 0 0 50%;
    max-width: 50%;
    margin-bottom: 24px;
  }
  .section-services .row .col-4:nth-child(3) {
    flex: 0 0 100%;
    max-width: 100%;
  }

  /* --- About us tablet: bỏ height 700px, 2 ảnh stack dọc cho cân đối --- */
  .section-about-us {
    height: auto !important;
    max-height: none !important;
    padding: 40px 0;
    display: block !important;
  }
  .section-about-us .container-fluid .row .col-5 {
    flex: 0 0 41.66% !important;
    max-width: 41.66% !important;
    padding-top: 20px !important;
    padding-bottom: 20px !important;
  }
  .section-about-us .container-fluid .row .col-5 .section-title-main {
    font-size: 28px !important;
  }
  /* col-7 = 2 ảnh stack DỌC trên tablet (vì width hẹp 2 ảnh side-by-side bị nén) */
  .section-about-us .container-fluid .row .col-7 {
    flex: 0 0 58.33% !important;
    max-width: 58.33% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 12px;
    padding: 0 !important;
  }
  .section-about-us .container-fluid .row .col-7 > div {
    width: 100% !important;
    height: 280px !important;
    margin-top: 0 !important;
    text-align: center !important;
  }
  .section-about-us .container-fluid .row .col-7 > div img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
  }

  /* --- News: 2 cards/slide visible --- */
  .section-news .new-papper-content .new-tab-pane .scroll-articles .articles {
    width: calc((100% - 50px) / 2) !important;
    height: 420px !important;
    max-height: 420px !important;
  }

  /* --- Footer: 2x2 --- */
  footer .container-fluid .row .col-4,
  footer .container-fluid .row .col-3,
  footer .container-fluid .row .col-5 {
    flex: 0 0 50%;
    max-width: 50%;
    margin-bottom: 30px;
  }
}

/* ================================================================
   MOBILE — <= 767px
   1 cột stack, hamburger menu offcanvas
================================================================ */
@media (max-width: 767px) {

  .container-fluid { padding-left: 12px !important; padding-right: 12px !important; }

  /* ------------------ HEADER ------------------ */
  header {
    height: auto !important;
    padding: 10px 12px;
  }
  header .header-container {
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }
  header .header-container .div-logo {
    width: auto !important;
    border-right: none !important;
    padding: 0;
    flex: 0 0 auto;
  }
  header .header-container .div-logo .a-logo {
    width: auto;
  }
  header .header-container .div-logo .a-logo img {
    width: 80px !important;
    height: auto !important;
  }

  /* Ẩn toàn bộ menu desktop ở mobile (style.css gốc cover < 1045px, mobile chắc chắn ẩn) */
  header .header-container .div-menu {
    display: none !important;
  }

  /* Offcanvas mobile: width nhỏ hơn tablet */
  .mobile-nav.offcanvas { width: 82% !important; max-width: 320px !important; }

  /* ------------------ SECTION TITLE ------------------ */
  .section .section-title-container .section-title .section-title-main {
    font-size: 22px;
    line-height: 1.3em;
  }
  .section .section-title-container .section-title div {
    flex-wrap: wrap;
    gap: 8px;
  }
  .section .section-title-container .section-title div a {
    padding: 8px 0 5px !important;
    font-size: 12px;
  }

  /* Khoảng cách giữa các section trên mobile */
  .mt-10 { margin-top: 0.5em !important; }
  .section-category { margin-bottom: 2em; }
  .section-product { padding-top: 1em; }
  .section-product .carousel-inner { margin-top: 1em; }

  /* ------------------ BANNER ------------------ */
  .section-slide-banner .carousel-item {
    aspect-ratio: 16 / 9;
  }
  .section-slide-banner .carousel-control-prev,
  .section-slide-banner .carousel-control-next { width: 10%; }

  /* ------------------ CATEGORY ------------------ */
  .container-category {
    margin: 0 12px !important;
    width: calc(100% - 24px) !important;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
  }
  .container-category .category-list {
    flex-direction: column !important;
    padding: 12px !important;
    gap: 8px !important;
  }
  .container-category .category-list .list-item {
    width: 100% !important;
    height: auto !important;
    padding: 12px 15px !important;
  }
  /* Mặc định ẩn item-support; tắt hover (mobile dùng touch không có :hover);
     CHỈ hiện khi click thêm class .open qua JS */
  .container-category .category-list .list-item .item-support,
  .container-category .category-list .list-item:hover .item-support {
    display: none !important;
  }
  .container-category .category-list .list-item.open .item-support {
    display: block !important;
    position: static !important;
    margin: 12px 0 0 !important;
    width: 100% !important;
    padding: 14px !important;
    box-shadow: none !important;
    border-top: 1px solid #eee;
    inset: auto;
    top: auto;
  }
  .container-category .category-list .list-item.open .item-support .support-card {
    flex-wrap: wrap !important;
    gap: 10px;
  }
  /* Mobile: chỉ hiện 2 xe trong submenu mega (ẩn từ card thứ 3) */
  .container-category .category-list .list-item.open .item-support .support-card .card-col:nth-child(n+3) {
    display: none !important;
  }
  .container-category .category-list .list-item.open .item-support .support-card .card-col {
    flex: 0 0 calc(50% - 5px);
    max-width: calc(50% - 5px);
    padding: 0 !important;
  }

  /* ------------------ PRODUCT CAROUSEL: 1 card/slide ------------------ */
  .section-product .card-wrapper {
    flex-direction: column !important;
    gap: 15px !important;
  }
  .section-product .card-wrapper .product-card-slider {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
  }
  .section-product .card-wrapper .product-card-slider:nth-child(n+2) {
    display: none;
  }
  .section-product .carousel-control-prev,
  .section-product .carousel-control-next { width: 32px; }

  /* ------------------ TYPE PRODUCT (mobile) ------------------ */
  .section-type-product .row {
    flex-direction: column !important;
    margin: 0 !important;
  }
  .section-type-product .bike-model .row .col {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    margin-bottom: 16px !important;
    height: 220px !important;
    max-height: 220px !important;
    width: 100% !important;
  }
  .section-type-product .bike-model .row .col .model-image {
    width: 100%;
    height: 100%;
  }
  .section-type-product .bike-model .row .col .model-image img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
  }
  .section-type-product .bike-model .row .col .model-image[style] {
    justify-content: center !important;
  }
  .section-type-product .bike-model .row .col .model-title-group {
    padding: 12px 16px !important;
    height: 70px !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 6px;
  }
  .section-type-product .bike-model .row .col .model-title-group .model-title {
    font-size: 16px !important;
    line-height: 1.2 !important;
  }
  .section-type-product .bike-model .row .col .model-title-group .model-product {
    font-size: 11px !important;
    margin: 0 !important;
  }
  /* tắt hover scale làm vỡ trên mobile */
  .section-type-product .bike-model .row .col:hover .model-image img {
    transform: none !important;
  }
  .section-type-product .bike-model .row .col:hover .model-title-group {
    transform: none !important;
  }

  /* ------------------ SERVICES (mobile) ------------------ */
  .section-services .services .row {
    flex-direction: column !important;
    margin: 0 !important;
  }
  .section-services .services .row .col {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
    margin-bottom: 20px !important;
  }
  .section-services .services .row .col .services-item {
    padding: 15px !important;
  }
  .section-services .services .row .col .services-item .col-title .title a {
    font-size: 22px !important;
  }
  .section-services .services .row .col .services-item .col-title .description {
    font-size: 14px;
    -webkit-line-clamp: 4;
  }
  .section-services .services .row .col .services-item .col-image img {
    width: 100% !important;
    height: auto !important;
    max-height: 200px;
    object-fit: cover;
  }

  /* ------------------ ABOUT US (mobile) ------------------ */
  /* Bỏ height 100vh/700px cố định để content tự co theo nội dung */
  .section-about-us {
    height: auto !important;
    max-height: none !important;
    display: block !important;
    padding: 20px 0;
  }
  .section-about-us .container-fluid .row {
    flex-direction: column !important;
    margin: 0 !important;
  }
  .section-about-us .container-fluid .row .col-5,
  .section-about-us .container-fluid .row .col-7 {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 20px 12px !important;
  }
  .section-about-us .container-fluid .row .col-5 .section-title {
    font-size: 22px !important;
    margin-bottom: 16px !important;
  }
  .section-about-us .container-fluid .row .col-5 .description {
    font-size: 15px !important;
    margin-bottom: 20px !important;
  }
  .section-about-us .container-fluid .row .col-5 .short-description ul {
    gap: 14px !important;
  }
  .section-about-us .container-fluid .row .col-5 .short-description ul li span {
    font-size: 15px !important;
    margin-left: 14px !important;
  }
  /* 2 ảnh stack dọc thay vì ngang */
  .section-about-us .container-fluid .row .col-7 {
    flex-direction: column !important;
    display: flex !important;
    gap: 12px;
  }
  .section-about-us .container-fluid .row .col-7 > div {
    width: 100% !important;
    height: auto !important;
    margin-top: 0 !important;
    text-align: center !important;
  }
  .section-about-us .container-fluid .row .col-7 > div img {
    width: 100% !important;
    height: auto !important;
    max-height: 240px;
    object-fit: cover;
  }

  /* ------------------ NEWS ------------------ */
  .section-news .new-papper-content .new-tab-pane .scroll-articles {
    gap: 12px !important;
  }
  .section-news .new-papper-content .new-tab-pane .scroll-articles .articles {
    flex: 0 0 80% !important;
    width: 80% !important;
    height: 360px !important;
    max-height: 360px !important;
  }
  .section-news .new-papper-content .new-tab-pane .scroll-left,
  .section-news .new-papper-content .new-tab-pane .scroll-right {
    display: none !important;
  }

  /* ------------------ SOCIAL FLOAT ------------------ */
  .section-social-media #button-contact-vr {
    transform: scale(.65) !important;
    right: -8px !important;
    bottom: 5% !important;
  }

  /* ------------------ FOOTER STORES (mobile) — override 185px width ------------------ */
  footer .container-fluid .row .footer-col-stores .store-item {
    flex-direction: column !important;
    gap: 4px !important;
    align-items: flex-start !important;
  }
  footer .container-fluid .row .footer-col-stores .store-item .store-name {
    flex: none !important;
    min-width: 0 !important;
    width: auto !important;
    /* color + font-size giữ giống desktop: #b1b1b1 / 16px */
  }
  footer .container-fluid .row .footer-col-stores .store-item .store-address {
    flex: none !important;
    width: auto !important;
    /* color + font-size giữ giống desktop: #b1b1b1 / 16px */
  }
  footer .container-fluid .row .footer-col-stores .col-stores {
    gap: 16px !important;
  }

  /* ------------------ FOOTER (mobile) ------------------ */
  footer {
    padding: 30px 15px !important;
  }
  footer .container-fluid {
    padding: 0 !important;
    width: 100% !important;
  }
  footer .container-fluid .row {
    flex-direction: column !important;
    margin: 0 !important;
    width: 100%;
  }
  footer .container-fluid .row > [class*="col-"] {
    flex: 0 0 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 0 25px 0 !important;
    padding: 0 !important;
  }
  footer .container-fluid .row .col-12 {
    flex-direction: column !important;
    gap: 15px;
    text-align: center;
  }
  footer .container-fluid .row .col-12 .img img { width: 100px; }
  footer .container-fluid .row .col-12 .name { font-size: 20px; }
  footer .col-menu { padding-left: 0 !important; }

  /* Chi nhánh: stack tên trên, địa chỉ dưới (thay vì side-by-side) */
  footer .container-fluid .row .col-5 .col-location .menu-item {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 4px;
  }
  footer .container-fluid .row .col-5 .col-location .menu-item a {
    min-width: 0 !important;
  }

  /* Đảm bảo span/text giãn full width */
  footer .container-fluid .row .col-4 .col-contact .contact-content .content-item,
  footer .container-fluid .row .col-5 .col-contact .contact-content .content-item {
    width: 100%;
  }
}

/* ================================================================
   SMALL MOBILE — <= 480px
================================================================ */
@media (max-width: 480px) {
  .section .section-title-container .section-title .section-title-main {
    font-size: 18px;
  }
  .container-category .category-list .list-item.open .item-support .support-card .card-col {
    flex: 0 0 100% !important;
    max-width: 100% !important;
  }
  .section-news .new-papper-content .new-tab-pane .scroll-articles .articles {
    flex: 0 0 90% !important;
    width: 90% !important;
    height: 320px !important;
    max-height: 320px !important;
  }
}
