/**
 * WTMS Navbar 2.0
 * Sticky top navigation: slim dark topbar + white main bar.
 * Namespaced under .wtms-* so it does not collide with legacy .header/.topbar/.navbar rules.
 * Loaded after main.css.
 */

/* Tokens on :root so both .wtms-nav AND the (out-of-wrapper) mobile menu can read them */
:root {
  --w-red: var(--color-primary, #dc3545);
  --w-red-dark: var(--color-primary-dark, #c82333);
  --w-red-soft: rgba(220, 53, 69, 0.10);
  --w-ink: #16191d;
  --w-paper: #ffffff;
  --w-paper-2: #f6f7f9;
  --w-line: #e8eaee;
  --w-text: #1a1f24;
  --w-text-soft: #5b6672;
  --w-text-faint: #8b95a1;
  --w-topbar-h: 40px;
  --w-bar-h: 74px;
  --w-bar-h-compact: 60px;
  --w-ease: cubic-bezier(.22, .61, .36, 1);
  --w-shadow-bar: 0 8px 26px -16px rgba(20, 25, 30, 0.4);
}

/* Topbar scrolls away naturally; ONLY the header is sticky.
   (Sticking the whole nav + animating the topbar height caused a scroll-jitter
   feedback loop, so the topbar is now a normal in-flow block.) */
.wtms-topbar,
.wtms-header {
  font-family: var(--font-secondary, 'Poppins', sans-serif);
}
.wtms-header {
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* Base resets for the nav pieces and the fixed mobile overlay */
.wtms-topbar *, .wtms-topbar *::before, .wtms-topbar *::after,
.wtms-header *, .wtms-header *::before, .wtms-header *::after,
.wtms-mobile-menu *, .wtms-mobile-menu *::before, .wtms-mobile-menu *::after { box-sizing: border-box; }

.wtms-topbar a, .wtms-header a, .wtms-mobile-menu a { text-decoration: none; color: inherit; }
.wtms-topbar ul, .wtms-header ul, .wtms-mobile-menu ul { list-style: none; margin: 0; padding: 0; }

.wtms-wrap {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 28px;
}

/* ============ TOPBAR ============ */
.wtms-topbar {
  background: var(--w-ink);
  color: #d7dce2;
  height: var(--w-topbar-h);
  font-size: 13px;
  letter-spacing: .01em;
  overflow: hidden;
  transition: height .35s var(--w-ease), opacity .3s var(--w-ease);
}
.wtms-topbar .wtms-wrap {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wtms-topbar-trust { display: flex; align-items: center; gap: 20px; }
.wtms-topbar-trust .item { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.wtms-topbar-trust .item i { color: var(--w-red); font-size: 14px; line-height: 1; }
.wtms-topbar-trust .item.stars b { color: #fff; font-weight: 600; }
.wtms-topbar-trust .dot { width: 3px; height: 3px; border-radius: 50%; background: rgba(255, 255, 255, .3); }

.wtms-topbar-right { display: flex; align-items: center; gap: 18px; }
.wtms-tb-link { display: flex; align-items: center; gap: 7px; color: #cfd5dd; transition: color .2s; white-space: nowrap; }
.wtms-tb-link:hover { color: #fff; }
.wtms-tb-link i { color: var(--w-red); font-size: 13px; }
.wtms-topbar-social { display: flex; align-items: center; gap: 12px; padding-left: 16px; border-left: 1px solid rgba(255, 255, 255, .12); }
.wtms-topbar-social a { color: #aeb6c0; font-size: 15px; line-height: 1; transition: color .2s, transform .2s; }
.wtms-topbar-social a:hover { color: #fff; transform: translateY(-1px); }

/* ============ HEADER / MAIN BAR ============ */
.wtms-header {
  background: var(--w-paper);
  border-bottom: 1px solid var(--w-line);
  transition: box-shadow .35s var(--w-ease), background .35s var(--w-ease);
}
.wtms-bar {
  /* Height stays CONSTANT on scroll — no layout reflow, so nothing can jitter.
     The "compact" feel comes from shadow/blur + a transform-only logo shrink. */
  height: var(--w-bar-h);
  display: flex;
  align-items: center;
  gap: 26px;
}

/* Logo */
.wtms-logo { display: flex; align-items: center; flex: none; }
.wtms-logo img {
  height: 50px;
  width: auto;
  object-fit: contain;
  transform-origin: left center;
  transition: transform .35s var(--w-ease); /* transform doesn't affect layout */
}

/* Nav */
.wtms-menu { margin: 0 auto; }
.wtms-menu > ul { display: flex; align-items: center; gap: 2px; }
.wtms-menu > ul > li > a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 13px;
  font-size: 15px;
  font-weight: 600;
  color: var(--w-text-soft);
  border-radius: 9px;
  transition: color .2s;
}
.wtms-menu > ul > li > a:hover { color: var(--w-text); }
.wtms-menu > ul > li > a::after {
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: 4px;
  height: 2px;
  background: var(--w-red);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .28s var(--w-ease);
}
.wtms-menu > ul > li > a:hover::after,
.wtms-menu > ul > li > a.active::after { transform: scaleX(1); }
.wtms-menu > ul > li > a.active { color: var(--w-text); }
.wtms-menu .chev { font-size: 12px; transition: transform .25s; opacity: .8; }

/* Dropdown */
.wtms-has-dd { position: relative; }
.wtms-dd {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 250px;
  background: var(--w-paper);
  border: 1px solid var(--w-line);
  border-radius: 14px;
  box-shadow: 0 18px 44px -18px rgba(20, 25, 30, 0.28);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .24s var(--w-ease), transform .24s var(--w-ease), visibility .24s;
}
.wtms-has-dd:hover > .wtms-dd,
.wtms-has-dd:focus-within > .wtms-dd { opacity: 1; visibility: visible; transform: translateY(0); }
.wtms-has-dd:hover > a .chev { transform: rotate(180deg); }
.wtms-dd li { position: relative; }
.wtms-dd a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 10px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--w-text-soft);
  transition: background .18s, color .18s;
}
.wtms-dd a:hover,
.wtms-dd a.active { background: var(--w-red-soft); color: var(--w-red-dark); }
.wtms-dd a > i:first-child { color: var(--w-red); font-size: 17px; width: 20px; text-align: center; flex: none; }
.wtms-dd .sub-arrow { margin-left: auto; font-size: 12px; opacity: .5; }
.wtms-dd .wtms-dd { top: -8px; left: calc(100% + 6px); }

/* Right side actions */
.wtms-actions { display: flex; align-items: center; gap: 12px; flex: none; }
.wtms-btn-ghost {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  border-radius: 11px;
  border: 1.5px solid var(--w-red);
  color: var(--w-red-dark);
  font-weight: 700;
  font-size: 14.5px;
  line-height: 1.15;
  transition: background .2s, color .2s, transform .2s;
}
.wtms-btn-ghost i { font-size: 17px; }
.wtms-btn-ghost small { display: block; font-size: 10.5px; font-weight: 600; color: var(--w-text-faint); letter-spacing: .02em; }
.wtms-btn-ghost:hover { background: var(--w-red); color: #fff; transform: translateY(-1px); }
.wtms-btn-ghost:hover small { color: rgba(255, 255, 255, .82); }

.wtms-btn-primary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 22px;
  border-radius: 11px;
  background: var(--w-red);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 8px 20px -8px rgba(220, 53, 69, .55);
  transition: transform .2s, box-shadow .2s, background .2s;
}
.wtms-btn-primary i { font-size: 15px; transition: transform .25s; }
.wtms-btn-primary:hover { background: var(--w-red-dark); color: #fff; transform: translateY(-2px); box-shadow: 0 14px 26px -10px rgba(220, 53, 69, .65); }
.wtms-btn-primary:hover i { transform: translateX(4px); }

.wtms-burger { display: none; }

/* ============ COMPACT (scrolled) ============ */
/* Topbar is NOT collapsed here — it scrolls off the top on its own, which
   avoids the height-change reflow that made the bar jitter at the threshold. */
body.wtms-scrolled .wtms-header {
  box-shadow: var(--w-shadow-bar);
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  backdrop-filter: saturate(1.2) blur(10px);
}
/* Logo shrinks via transform only (no height/layout change → no reflow jitter) */
body.wtms-scrolled .wtms-logo img { transform: scale(0.86); }

/* ============ MOBILE MENU (hidden on desktop) ============ */
.wtms-mobile-menu { display: none; }

/* ============ RESPONSIVE ============ */

/* Mid range (small laptops / iPad landscape): tighten the desktop bar so it fits */
@media (min-width: 1200px) and (max-width: 1399px) {
  .wtms-bar { gap: 14px; }
  .wtms-menu > ul { gap: 0; }
  .wtms-menu > ul > li > a { padding: 10px 10px; font-size: 14.5px; }
  .wtms-menu > ul > li > a::after { left: 10px; right: 10px; }
  .wtms-btn-ghost small { display: none; }
  .wtms-btn-ghost { padding: 10px 13px; }
  .wtms-btn-primary { padding: 11px 18px; }
}

/* Tablets & down → clean hamburger layout (full desktop nav needs ~1200px+) */
@media (max-width: 1199px) {
  /* Topbar: keep only rating (left) + phone (right) */
  .wtms-topbar-trust .item:not(.stars),
  .wtms-topbar-trust .dot { display: none; }
  .wtms-topbar-right .wtms-tb-link.hours,
  .wtms-topbar-right .wtms-tb-link.mail,
  .wtms-topbar-social { display: none; }

  .wtms-menu { display: none; }
  /* Menu (centering spacer) is gone on mobile → pin actions to the right */
  .wtms-actions { margin-left: auto; }
  /* Phone lives in the topbar + sticky CTA on mobile → drop the header ghost button */
  .wtms-btn-ghost { display: none; }
  .wtms-btn-primary { padding: 11px 16px; }

  .wtms-burger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 46px;
    height: 46px;
    border-radius: 11px;
    border: 1px solid var(--w-line);
    background: var(--w-paper-2);
    cursor: pointer;
    flex: none;
    padding: 0;
  }
  .wtms-burger span { display: block; width: 20px; height: 2px; background: var(--w-text); margin: 0 auto; border-radius: 2px; transition: transform .3s var(--w-ease), opacity .2s; }
  body.wtms-menu-open .wtms-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  body.wtms-menu-open .wtms-burger span:nth-child(2) { opacity: 0; }
  body.wtms-menu-open .wtms-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  /* Fullscreen overlay menu */
  .wtms-mobile-menu {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 1090;
    background: var(--w-paper);
    flex-direction: column;
    padding: 22px 24px calc(32px + env(safe-area-inset-bottom));
    transform: translateX(100%);
    transition: transform .4s var(--w-ease);
    overflow-y: auto;
    font-family: var(--font-secondary, 'Poppins', sans-serif);
  }
  body.wtms-menu-open .wtms-mobile-menu { transform: translateX(0); }
  body.wtms-menu-open { overflow: hidden; }
  .wtms-mm-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
  .wtms-mm-head img { height: 46px; width: auto; }
  .wtms-mm-close { width: 46px; height: 46px; border: 1px solid var(--w-line); border-radius: 11px; background: var(--w-paper-2); font-size: 24px; line-height: 1; color: var(--w-text); cursor: pointer; }
  .wtms-mm-list { margin-top: 14px; }
  .wtms-mm-list > li > a { display: flex; align-items: center; justify-content: space-between; padding: 16px 4px; font-size: 19px; font-weight: 600; color: var(--w-text); border-bottom: 1px solid var(--w-line); }
  .wtms-mm-list > li > a.active { color: var(--w-red-dark); }
  .wtms-mm-list .chev { font-size: 16px; transition: transform .25s; }
  .wtms-mm-toggle.open .chev { transform: rotate(180deg); }
  .wtms-mm-sub { padding: 0 0 8px 14px; display: none; }
  .wtms-mm-toggle.open + .wtms-mm-sub { display: block; }
  .wtms-mm-sub a { display: block; padding: 12px 4px; font-size: 16px; color: var(--w-text-soft); }
  .wtms-mm-sub a::before { content: "\2014"; color: var(--w-red); margin-right: 10px; }
  .wtms-mm-sub a.active { color: var(--w-red-dark); font-weight: 600; }

  /* CTA at the end of the mobile menu */
  .wtms-mobile-menu a.wtms-mm-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin-top: 26px;
    padding: 15px;
    border-radius: 13px;
    background: var(--w-red);
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 10px 22px -10px rgba(220, 53, 69, .6);
  }
  .wtms-mobile-menu a.wtms-mm-cta i { font-size: 16px; }
}

@media (max-width: 480px) {
  .wtms-wrap { padding: 0 16px; }
  .wtms-bar { gap: 12px; }
  .wtms-logo img { height: 42px; }
  .wtms-topbar-trust .rev-count { display: none; }
  .wtms-topbar { font-size: 12.5px; }
  .wtms-btn-primary { padding: 11px 15px; font-size: 14px; }
}
@media (max-width: 360px) {
  .wtms-btn-primary .btn-text { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .wtms-nav *, .wtms-mobile-menu, .wtms-mobile-cta { transition: none !important; }
}
