/* ============================================================
   AUTOSHOP — header.css
   Topbar | Sticky header | Logo | Nav | Mobile drawer
   ============================================================ */

/* --- Variables cục bộ (extend style.css) ------------------- */
:root {
  --au-red: #cc0000;
  --au-red-dark: #a30000;
  --au-dark: #111111;
  --au-header-bg: #ffffff;
  --au-header-height: 80px;
  --au-header-height-m: 64px;
  --au-topbar-height: 36px;
  --au-chrome-height: calc(var(--au-topbar-height) + var(--au-header-height));
  --au-nav-gap: 28px;
  --au-drawer-width: 300px;
  --au-transition: 0.28s ease;
}

/* ============================================================
   TOPBAR
============================================================ */
.au-topbar {
  /* CSS vars — overridden inline from PHP (Customizer colors) */
  --topbar-bg: #111111;
  --topbar-text: #dddddd;
  /* --topbar-social-bg intentionally absent: platform classes provide brand colors */
  --topbar-social-color: #ffffff;
  --topbar-social-hover-bg: #cc0000;

  height: var(--au-topbar-height);
  background: var(--topbar-bg);
  color: var(--topbar-text);
  font-size: 14px;
}

/* Tất cả nội dung sang phải, khoảng cách rộng */
.au-topbar__inner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 16px;
}

.au-topbar__hotline {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--topbar-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.01em;
  transition: color var(--au-transition);
}

.au-topbar__hotline i {
  font-size: 13px;
  opacity: 0.85;
}

.au-topbar__hotline:hover {
  color: var(--au-red);
}

/* Chi duong */
.au-topbar__directions {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--topbar-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: color var(--au-transition);
}

.au-topbar__directions i {
  font-size: 15px;
  opacity: 0.9;
}

.au-topbar__directions:hover {
  color: var(--au-red);
}

/* Thanh phân cách giữa hotline và social icons */
.au-topbar__divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
  /* gap đã lo khoảng cách 2 bên */
}

/* Social icon — brand-color box mặc định, override qua --topbar-social-bg */

/* Brand colors (fallback khi chưa set Customizer) */
.au-topbar__social--fb {
  --_social-bg: #1877f2;
}
.au-topbar__social--zalo {
  --_social-bg: #006af5;
}
.au-topbar__social--telegram {
  --_social-bg: #26a5e4;
}
.au-topbar__social--youtube {
  --_social-bg: #ff0000;
}

.au-topbar__social {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 5px;
  /* --topbar-social-bg (từ Customizer) ghi đè màu brand */
  background: var(--topbar-social-bg, var(--_social-bg, #444));
  color: var(--topbar-social-color);
  text-decoration: none;
  font-size: 14px;
  flex-shrink: 0;
  transition:
    background var(--au-transition),
    color var(--au-transition),
    opacity var(--au-transition);
}

.au-topbar__social:hover {
  background: var(--topbar-social-hover-bg);
  color: #fff;
  opacity: 1;
}

.au-topbar__social-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Tablet: an text label, chi giu icon — giam tai khong gian */
@media (max-width: 900px) {
  .au-topbar__link-label {
    display: none;
  }

  .au-topbar__inner {
    gap: 10px;
  }
}

/* Mobile: an toan bo topbar */
@media (max-width: 768px) {
  .au-topbar {
    display: none;
  }
}

/* ============================================================
   HEADER BASE
============================================================ */
.au-header {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-header, 900);
  background: var(--au-header-bg);
  border-bottom: 4px solid var(--au-red);
  box-shadow: none;
  transition: box-shadow var(--au-transition);
}

/* Variant: not sticky */
.au-header--static {
  position: relative;
}

.au-header.is-scrolled {
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.12);
}

.au-header__wrap {
  height: var(--au-header-height);
  display: flex;
  align-items: center;
}

.au-header__inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 100%;
  width: 100%;
}

/* ============================================================
   CONTAINER — định nghĩa tại đây để LUÔN apply
   (header.css guaranteed load; style.css dùng CSS vars là fallback)
============================================================ */
.au-container {
  box-sizing: border-box;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 60px;
  width: 100%;
}

/* ============================================================
   LOGO
============================================================ */
.au-header__logo {
  flex-shrink: 0;
  margin-right: auto;
}

.au-header__logo a,
.au-header__logo .custom-logo-link {
  display: flex;
  align-items: center;
}

.au-header__logo img,
.au-header__logo .custom-logo {
  height: 64px;
  width: auto;
  max-width: 260px;
  object-fit: contain;
  display: block;
}

/* ============================================================
   DESKTOP NAVIGATION
============================================================ */
.au-nav__list {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.au-nav__list li {
  position: relative;
}

/* .au-nav__list li a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-family: var(--font-sub);
  font-size: 15px;
  font-weight: 800;
  color: var(--au-dark);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  text-decoration: none;
  transition: color var(--au-transition);
} */

.au-nav__list li a {
  font-family: var(--font-sub); /* Plus Jakarta Sans thay Be Vietnam Pro */
  font-size: 20px;
  font-weight: 800;
  color: var(--au-dark);
  text-transform: none; /* bỏ ALL CAPS */
  letter-spacing: 0.01em; /* 0.05em → 0.01em */
  white-space: nowrap;
  text-decoration: none;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color var(--au-transition);
}

.au-nav__list li a:hover,
.au-nav__list li a:focus,
.au-nav__list li.current-menu-item > a,
.au-nav__list li.current-menu-ancestor > a {
  color: var(--au-red);
}

.au-nav__list li a i,
.au-nav__list li a .fa {
  font-size: 13px;
  color: var(--au-red);
}

.au-nav__list .menu-highlight > a,
.au-nav__list li.menu-item-highlight > a {
  color: var(--au-red);
}

/* Submenu (Dropdown) */
.au-nav__list li ul.sub-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 220px;
  background: #fff;
  border-top: 2px solid var(--au-red);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  list-style: none;
  padding: 6px 0;
  margin: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition:
    opacity var(--au-transition),
    visibility var(--au-transition),
    transform var(--au-transition);
  z-index: 200;
}

.au-nav__list li:hover > ul.sub-menu,
.au-nav__list li:focus-within > ul.sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.au-nav__list li ul.sub-menu li a {
  padding: 9px 18px;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  border-left: 3px solid transparent;
}

.au-nav__list li ul.sub-menu li a:hover {
  border-left-color: var(--au-red);
  background: #fafafa;
}

.au-nav__list li ul.sub-menu li a::after {
  display: none;
}

/* ============================================================
   HAMBURGER TOGGLE (mobile)
============================================================ */
.au-header__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
  margin-left: auto;
  border-radius: 4px;
  transition: background var(--au-transition);
}

.au-header__toggle:hover {
  background: #f5f5f5;
}

.au-toggle__bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--au-dark);
  border-radius: 2px;
  transition:
    transform var(--au-transition),
    opacity var(--au-transition),
    width var(--au-transition);
  transform-origin: center;
}

.au-header__toggle.is-active .au-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.au-header__toggle.is-active .au-toggle__bar:nth-child(2) {
  opacity: 0;
  width: 0;
}
.au-header__toggle.is-active .au-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ============================================================
   RESPONSIVE HELPERS
============================================================ */
.au-hide-mobile {
  display: flex;
}
.au-show-mobile {
  display: none;
}

/* ============================================================
   OVERLAY (mobile)
============================================================ */
.au-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  z-index: 940;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--au-transition),
    visibility var(--au-transition);
}

.au-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}

/* ============================================================
   MOBILE DRAWER
============================================================ */
.au-mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--au-drawer-width);
  max-width: 85vw;
  background: #fff;
  z-index: 950;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.au-mobile-drawer.is-open {
  transform: translateX(0);
}

.au-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
  flex-shrink: 0;
}

.au-drawer__header img,
.au-drawer__header .custom-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
}

.au-drawer__close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 4px;
  font-size: 20px;
  color: #555;
  cursor: pointer;
  transition:
    background var(--au-transition),
    color var(--au-transition);
}

.au-drawer__close:hover {
  background: #f5f5f5;
  color: var(--au-red);
}

.au-drawer__nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0;
}

.au-drawer__list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.au-drawer__list li a {
  font-family: var(--font-sub); /* đồng bộ với desktop */
  font-size: 14px;
  font-weight: 600;
  text-transform: none; /* bỏ uppercase */
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 20px;

  color: var(--au-dark);
  text-transform: uppercase;

  border-left: 3px solid transparent;
  transition:
    background var(--au-transition),
    color var(--au-transition),
    border-color var(--au-transition);
}

.au-drawer__list li a:hover,
.au-drawer__list li.current-menu-item > a {
  background: #fafafa;
  color: var(--au-red);
  border-left-color: var(--au-red);
}

.au-drawer__list li a i {
  color: var(--au-red);
  font-size: 13px;
  width: 16px;
  text-align: center;
}

.au-drawer__list li ul.sub-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  background: #f9f9f9;
  display: none;
}

.au-drawer__list li.is-open > ul.sub-menu {
  display: block;
}

.au-drawer__list li ul.sub-menu li a {
  padding-left: 40px;
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
}

.au-drawer__footer {
  flex-shrink: 0;
  padding: 16px 20px;
  border-top: 1px solid #eee;
  background: #fafafa;
}

.au-drawer__hotline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: var(--au-red);
  text-decoration: none;
}

.au-drawer__hotline i {
  width: 36px;
  height: 36px;
  background: var(--au-red);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

/* ============================================================
   RESPONSIVE — TABLET (<= 1024px)
============================================================ */
@media (max-width: 1024px) {
  .au-container {
    padding: 0 32px;
  }

  .au-nav__list li a {
    padding: 8px 10px;
    font-size: 14px;
    letter-spacing: 0.04em;
  }

  .au-header__logo img,
  .au-header__logo .custom-logo {
    height: 56px;
  }
}

/* ============================================================
   RESPONSIVE — MOBILE (<= 768px)
============================================================ */
@media (max-width: 768px) {
  .au-container {
    padding: 0 20px;
  }

  .au-hide-mobile {
    display: none !important;
  }
  .au-show-mobile {
    display: flex !important;
  }

  .au-header__wrap {
    height: var(--au-header-height-m);
  }

  .au-header__logo img,
  .au-header__logo .custom-logo {
    height: 48px;
  }

  .au-header__toggle {
    display: flex;
  }
}

/* ============================================================
   RESPONSIVE — SMALL MOBILE (<= 480px)
============================================================ */
@media (max-width: 480px) {
  .au-container {
    padding: 0 16px;
  }
}

/* ============================================================
   BODY LOCK khi drawer mo
============================================================ */
body.au-drawer-open {
  overflow: hidden;
}

/* ============================================================
   COMPENSATE admin bar
============================================================ */
.admin-bar .au-header {
  top: 32px;
}

@media screen and (max-width: 782px) {
  .admin-bar .au-header {
    top: 46px;
  }
}

/* ============================================================
   BREADCRUMB — Global reset trong header.css
   Load trên mọi trang, đảm bảo luôn thắng user agent
   ============================================================ */
body .au-breadcrumb a,
body .au-breadcrumb a:link,
body .au-breadcrumb a:visited,
body .au-breadcrumb a:-webkit-any-link,
body [class*="breadcrumb"] a,
body [class*="breadcrumb"] a:link,
body [class*="breadcrumb"] a:visited,
body [class*="breadcrumb"] a:-webkit-any-link {
  text-decoration: none !important;
  text-decoration-line: none !important;
  color: var(--color-dark, #1a1a1a);
}

body .au-breadcrumb a:hover,
body [class*="breadcrumb"] a:hover {
  color: var(--color-red, #eb0a1e);
  text-decoration: none !important;
}

body .au-breadcrumb--light a,
body .au-breadcrumb--light a:link,
body .au-breadcrumb--light a:visited,
body .au-breadcrumb--light a:-webkit-any-link {
  color: #ffffff !important;
  text-decoration: none !important;
}

body .au-breadcrumb--light a:hover {
  color: rgba(255, 255, 255, 0.75) !important;
  text-decoration: none !important;
}
