/**
 * Topbar & Header Styles
 *
 * @package BaitAlKaram
 */

.topbar {
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border-bottom: 2px solid var(--red);
  position: sticky;
  top: 0;
  background: rgba(245, 245, 247, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 50;
  padding: 0 4px;
}

.brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.brand-logo {
  display: block;
  height: 48px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}

.topbar nav {
  display: flex;
  gap: clamp(20px, 3vw, 44px);
  margin-inline: auto;
}

.topbar nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-light);
  transition: color 0.25s ease;
  position: relative;
  padding: 6px 0;
}

.topbar nav a::after {
  content: "";
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--red);
  transform: scaleX(0);
  transition: transform 0.25s ease;
}

.topbar nav a:hover, .topbar nav a.active {
  color: var(--ink);
}

.topbar nav a.active::after, .topbar nav a:hover::after {
  transform: scaleX(1);
}

.header-actions {
  display: flex;
  direction: ltr;
  gap: 10px;
}

.icon-button {
  border: 1px solid var(--line);
  background: #fff;
  width: 40px;
  height: 40px;
  padding: 8px;
  cursor: pointer;
  position: relative;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  color: var(--ink);
  transition: all 0.3s ease;
}

.icon-button svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.3s ease;
}

.icon-button:hover {
  background: linear-gradient(135deg, var(--red), var(--red-deep));
  border-color: transparent;
  transform: translateY(-2px);
}

.icon-button:hover svg {
  stroke: #fff;
}

.bag i {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--red);
  color: white;
  font-size: 9px;
  font-weight: 600;
  font-style: normal;
  border: 2px solid #fff;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.bag i[data-count="0"] { opacity: 0; transform: scale(0.4); }
.bag i.has-items { animation: bag-pop 0.45s ease; }
@keyframes bag-pop {
  0% { transform: scale(0.6); }
  60% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.icon-button.menu { display: none; }
.icon-button.menu svg path { transition: transform 0.3s ease; }
.icon-button:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

@media (max-width: 700px) {
  .topbar { height: 68px; gap: 12px; }
  .topbar nav { display: none; }
  .icon-button.menu { display: inline-flex; }
  .header-actions { gap: 6px; }
  .icon-button { width: 36px; height: 36px; padding: 7px; }
  .bag i { width: 15px; height: 15px; font-size: 8.5px; }
  .brand-logo { height: 38px; max-width: 168px; }
}
