/* =========================================================
   TAHM — HEADER: topbar, nav, cart, burger, search
   ========================================================= */

/* --- Topbar (desktop only) --- */
.tahm-topbar {
  background: #f6f8fb;
  border-bottom: 1px solid #e9eef3;
  font-size: 13px; color: #5f6b76;
}
.tahm-topbar__inner {
  min-height: 38px; display: flex; align-items: center;
  justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.tahm-topbar__item { display: inline-flex; align-items: center; position: relative; }
.tahm-topbar__item + .tahm-topbar__item::before {
  content: ""; position: absolute; left: -14px; top: 50%;
  transform: translateY(-50%); width: 1px; height: 14px; background: #ccc;
}
.tahm-topbar a { color: inherit; }
.tahm-topbar a:hover { color: var(--tahm-blue-dark); }

/* --- Header --- */
.tahm-header {
  position: sticky; top: 0; z-index: 120;
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.admin-bar .tahm-header { top: 32px; }

.tahm-header__inner {
  min-height: 82px; display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center; gap: 28px;
}

/* --- Logo --- */
.tahm-header__brand { display: flex; align-items: center; }
.tahm-header__brand-link { display: inline-flex; align-items: center; }
.tahm-header__brand .custom-logo-link,
.tahm-header__brand .custom-logo { display: block; }
.tahm-header__brand .custom-logo { max-height: 56px !important; width: auto !important; }
.tahm-header__brand-text { font-size: 24px; font-weight: 800; color: #000; }

/* --- Nav --- */
.tahm-header__nav { display: flex; justify-content: center; align-items: center; }

.tahm-header__nav .tahm-header__menu,
.tahm-header__nav .tahm-header__menu ul { list-style: none; margin: 0; padding: 0; }

.tahm-header__nav .tahm-header__menu {
  display: flex; align-items: center; gap: 30px;
}
.tahm-header__nav .tahm-header__menu > li { position: relative; }

.tahm-header__nav .tahm-header__menu > li > a {
  position: relative; display: inline-flex; align-items: center; min-height: 40px;
  color: #111; font-size: 15px; font-weight: 600; transition: color 0.2s ease;
}
.tahm-header__nav .tahm-header__menu > li > a:hover { color: var(--tahm-blue); }

.tahm-header__nav .tahm-header__menu > li > a::after {
  content: ""; position: absolute; left: 0; bottom: -8px;
  width: 100%; height: 2px; background: var(--tahm-blue);
  transform: scaleX(0); transform-origin: center; transition: transform 0.2s ease;
}
.tahm-header__nav .tahm-header__menu > li > a:hover::after { transform: scaleX(1); }

/* Dropdown */
.tahm-header__nav .tahm-header__menu .sub-menu {
  position: absolute; top: calc(100% + 14px); left: 0;
  min-width: 260px; padding: 12px 0;
  background: #fff; border: 1px solid #e9e9e9; border-radius: 16px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.08);
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: all 0.2s ease; z-index: 200; list-style: none;
}
.tahm-header__nav .tahm-header__menu li:hover > .sub-menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.tahm-header__nav .tahm-header__menu .sub-menu a {
  display: block; padding: 10px 16px;
  color: #111; font-size: 14px; font-weight: 500;
}
.tahm-header__nav .tahm-header__menu .sub-menu a:hover {
  background: #f6fbff; color: var(--tahm-blue-dark);
}

.tahm-header__nav .tahm-header__menu > .current-menu-item > a,
.tahm-header__nav .tahm-header__menu > .current-menu-ancestor > a { color: var(--tahm-blue); }

/* --- Actions --- */
.tahm-header__actions { display: flex; align-items: center; gap: 16px; }

.tahm-header__cart {
  position: relative; display: inline-flex; align-items: center;
  justify-content: center; color: #111; padding: 6px; transition: color 0.15s ease;
}
.tahm-header__cart:hover { color: var(--tahm-blue); }
.tahm-header__cart-icon { display: block; }

.tahm-header__cart-count {
  position: absolute; top: -2px; right: -6px;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; background: var(--tahm-blue); color: #fff;
  font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

.tahm-header__login, .tahm-header__logout, .tahm-header__account {
  font-size: 14px; font-weight: 600; color: #111; transition: color 0.15s ease;
}
.tahm-header__login:hover, .tahm-header__logout:hover,
.tahm-header__account:hover { color: var(--tahm-blue); }

/* --- Search toggle (lupa) --- */
.tahm-header__search-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; border: none;
  background: transparent; color: #111; cursor: pointer;
  border-radius: 10px; transition: all 0.2s ease;
}
.tahm-header__search-toggle:hover { background: var(--tahm-blue-soft); color: var(--tahm-blue); }

/* --- Mobile phone (visible only on mobile, hidden on desktop) --- */
.tahm-header__mobile-phone { display: none; }

/* --- Header search panel --- */
.tahm-header-search {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  background: #fff; border-bottom: 1px solid var(--tahm-line);
  box-shadow: 0 12px 30px rgba(0,0,0,0.08); z-index: 200;
  padding: 16px 0;
}
.tahm-header-search.is-open { display: block; }
.tahm-header-search .tahm-search { max-width: 700px; margin: 0 auto; }

/* --- Burger --- */
.tahm-burger {
  display: none;
  align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; border: none;
  background: transparent; cursor: pointer; border-radius: 10px;
  transition: background 0.2s ease;
}
.tahm-burger:hover { background: #f0f4f8; }

.tahm-burger__line {
  display: block; width: 22px; height: 2px;
  background: #111; border-radius: 2px;
  position: relative; transition: all 0.3s ease;
}
.tahm-burger__line::before,
.tahm-burger__line::after {
  content: ""; position: absolute; left: 0;
  width: 22px; height: 2px; background: #111;
  border-radius: 2px; transition: all 0.3s ease;
}
.tahm-burger__line::before { top: -7px; }
.tahm-burger__line::after { top: 7px; }

.tahm-burger.is-active .tahm-burger__line { background: transparent; }
.tahm-burger.is-active .tahm-burger__line::before { top: 0; transform: rotate(45deg); }
.tahm-burger.is-active .tahm-burger__line::after { top: 0; transform: rotate(-45deg); }

/* --- Off-canvas mobile menu --- */
.tahm-offcanvas {
  position: fixed; top: 0; right: 0;
  width: 320px; max-width: 85vw; height: 100vh;
  background: #fff; z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  box-shadow: -6px 0 30px rgba(0,0,0,0.12);
}
.tahm-offcanvas.is-open { transform: translateX(0); }

.tahm-offcanvas__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--tahm-line);
}
.tahm-offcanvas__close {
  width: 40px; height: 40px; border: none; background: transparent;
  font-size: 26px; cursor: pointer; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.tahm-offcanvas__close:hover { background: #f0f4f8; }

.tahm-offcanvas__body { padding: 20px; }

.tahm-offcanvas__contacts {
  margin: 0 0 20px;
  padding: 14px 16px;
  background: #f6f8fb;
  border-radius: 12px;
  font-size: 13px;
  color: #5f6b76;
  line-height: 1.7;
}
.tahm-offcanvas__contacts a {
  color: var(--tahm-blue-dark);
  font-weight: 600;
}
.tahm-offcanvas__contacts strong {
  color: #111;
  display: block;
  margin-bottom: 4px;
  font-size: 14px;
}

.tahm-offcanvas__menu { list-style: none; margin: 0; padding: 0; }
.tahm-offcanvas__menu li { border-bottom: 1px solid #f0f2f5; }
.tahm-offcanvas__menu li a {
  display: block; padding: 14px 0; color: #111;
  font-size: 16px; font-weight: 600;
}
.tahm-offcanvas__menu li a:hover { color: var(--tahm-blue); }

.tahm-offcanvas__menu .sub-menu {
  list-style: none; margin: 0; padding: 0 0 0 16px;
}
.tahm-offcanvas__menu .sub-menu a {
  font-size: 15px; font-weight: 500; color: #555; padding: 10px 0;
}

.tahm-offcanvas__actions {
  margin-top: 24px; padding-top: 20px;
  border-top: 1px solid var(--tahm-line);
  display: flex; flex-direction: column; gap: 10px;
}
.tahm-offcanvas__actions a {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0; color: #111; font-size: 15px; font-weight: 600;
}
.tahm-offcanvas__actions a:hover { color: var(--tahm-blue); }

/* Backdrop */
.tahm-backdrop {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.4); z-index: 999;
  opacity: 0; visibility: hidden;
  transition: all 0.3s ease;
}
.tahm-backdrop.is-visible { opacity: 1; visibility: visible; }

body.tahm-menu-open { overflow: hidden; }

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

@media (max-width: 1100px) {
  .tahm-header__nav .tahm-header__menu {
    flex-wrap: wrap; justify-content: center; gap: 18px 24px;
  }
  .tahm-header__nav .tahm-header__menu .sub-menu {
    left: 50%; transform: translateX(-50%) translateY(8px);
  }
  .tahm-header__nav .tahm-header__menu li:hover > .sub-menu {
    transform: translateX(-50%) translateY(0);
  }
}

@media (max-width: 768px) {
  /* Kill topbar on mobile — contacts go to off-canvas */
  .tahm-topbar { display: none; }

  .admin-bar .tahm-header { top: 46px; }

  /* Compact header: logo | phone | actions */
  .tahm-header__inner {
    grid-template-columns: auto 1fr auto;
    min-height: 60px;
    gap: 10px;
  }

  .tahm-header__brand .custom-logo { max-height: 42px !important; }
  .tahm-header__brand-text { font-size: 20px; }

  /* Desktop nav hidden */
  .tahm-header__nav { display: none; }

  /* Show phone in center column */
  .tahm-header__mobile-phone {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 10px;
    color: #111;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    border-radius: 10px;
    transition: all 0.2s ease;
  }
  .tahm-header__mobile-phone:hover {
    background: var(--tahm-blue-soft);
    color: var(--tahm-blue);
  }
  .tahm-header__mobile-phone svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
  }

  /* Actions: compact */
  .tahm-header__actions {
    gap: 4px;
    justify-content: flex-end;
  }

  /* Hide login on mobile — moves to off-canvas */
  .tahm-header__actions .tahm-header__login,
  .tahm-header__actions .tahm-header__logout,
  .tahm-header__actions .tahm-header__account { display: none; }

  /* Keep search toggle visible */
  .tahm-header__search-toggle {
    display: inline-flex;
    width: 42px; height: 42px;
  }

  .tahm-header__cart {
    width: 42px; height: 42px;
    padding: 0;
  }

  .tahm-burger { display: flex; }
}

@media (max-width: 420px) {
  /* Very narrow: hide phone text, show only icon button */
  .tahm-header__mobile-phone {
    width: 42px;
    height: 42px;
    padding: 0;
    justify-content: center;
  }
  .tahm-header__mobile-phone span { display: none; }
  .tahm-header__inner { gap: 4px; }
}
