/* ============================================================
   E-TRAIL BANGLADESH — MODERN E-COMMERCE HEADER
   Architectural Swiss Design with E-trail brand tokens,
   Infinite looping marquee, clean DB categories, centered
   mobile logo, left sliding nav drawer, and right slide cart.
   ============================================================ */

:root {
  --color-ink:          #09090b;       /* Deep space slate / dark charcoal */
  --color-paper:        #ffffff;       /* Pure white canvas */
  --color-canvas-alt:   #f4f4f5;       /* Light neutral surface */
  --color-accent:       #059669;       /* Signature Emerald Green */
  --color-accent-hover: #047857;       /* Darker green hover */
  --color-line:         #e4e4e7;       /* Subtle line */
  --color-muted:        #71717a;       /* Supporting text */

  --radius: 4px;                       /* Strict 4px border radius rule */
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: "Nohemi", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
}

/* Ensure body does not have artificial fixed header padding gap */
body {
  padding-top: 0 !important;
}

/* ── SKIP LINK ───────────────────────────────────────────── */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -48px;
  z-index: 200;
  padding: var(--space-2) var(--space-4);
  background: var(--color-ink);
  color: var(--color-paper);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: var(--space-2); }

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── PAGE CONTAINER & GUTTERS ────────────────────────────── */
.topbar__inner,
.header-main__inner,
.primary-nav__inner {
  width: 100%;
  padding-left: var(--pad-mobile, 20px);
  padding-right: var(--pad-mobile, 20px);
  margin-left: auto;
  margin-right: auto;
}

@media (min-width: 768px) {
  .topbar__inner,
  .header-main__inner,
  .primary-nav__inner {
    padding-left: var(--pad-tablet, 40px);
    padding-right: var(--pad-tablet, 40px);
    max-width: calc(var(--content-max, 1280px) + var(--pad-tablet, 40px) * 2);
  }
}

@media (min-width: 1440px) {
  .topbar__inner,
  .header-main__inner,
  .primary-nav__inner {
    padding-left: var(--pad-desktop, 80px);
    padding-right: var(--pad-desktop, 80px);
    max-width: calc(var(--content-max, 1280px) + var(--pad-desktop, 80px) * 2);
  }
}

/* ── TOPBAR: INFINITE LOOPING MARQUEE ────────────────────── */
.topbar {
  background: var(--color-ink);
  color: var(--color-paper);
  overflow: hidden;
  height: 36px;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 101;
}

.topbar__marquee {
  width: 100%;
  overflow: hidden;
  display: flex;
  user-select: none;
}

.topbar__track {
  display: flex;
  align-items: center;
  gap: 32px;
  white-space: nowrap;
  animation: topbarMarquee 26s linear infinite;
  will-change: transform;
}

.topbar__track:hover {
  animation-play-state: paused;
}

@keyframes topbarMarquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.topbar__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #ffffff;
}

.topbar__sep {
  color: var(--color-accent);
  font-size: 12px;
  display: inline-block;
}

/* ── STICKY HEADER SHELL ─────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-paper);
  border-bottom: 1px solid var(--color-line);
}

.header-main {
  background: var(--color-paper);
}

.header-main__inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "logo search actions";
  align-items: center;
  gap: var(--space-5);
  padding-block: var(--space-3);
}

/* ── LOGO ────────────────────────────────────────────────── */
.site-header .logo {
  grid-area: logo;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
}

.site-header .etaril_logo {
  height: 38px;
  width: auto;
  display: block;
}

/* ── SEARCH BAR (Minimal, No Category Selection) ─────────── */
.search {
  grid-area: search;
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: 680px;
  justify-self: center;
  background: var(--color-paper);
  border: 1.5px solid var(--color-ink);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search:focus-within {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.15);
}

.search input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 var(--space-4);
  font: inherit;
  font-size: 14px;
  color: var(--color-ink);
  background: transparent;
  border: 0;
  outline: none;
}
.search input::placeholder {
  color: var(--color-muted);
}

.search button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 42px;
  padding: 0;
  color: var(--color-paper);
  background: var(--color-ink);
  border: 0;
  cursor: pointer;
  transition: background 0.15s ease;
}
.search button:hover {
  background: var(--color-accent);
}
.search button .icon {
  width: 18px;
  height: 18px;
}

/* ── ACTIONS (Account & Cart) ────────────────────────────── */
.actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.action {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 52px;
  padding: var(--space-2) var(--space-3);
  font-size: 12px;
  font-weight: 500;
  color: var(--color-ink);
  background: none;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
  font-family: inherit;
  line-height: 1;
}
.action:hover {
  background: var(--color-canvas-alt);
  color: var(--color-accent);
}
.action .icon {
  width: 20px;
  height: 20px;
}
.action__label {
  font-size: 11px;
  font-weight: 600;
  margin-top: 2px;
  letter-spacing: 0.02em;
}

.action .badge {
  position: absolute;
  top: 2px;
  right: 6px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1em;
  color: #ffffff;
  background: var(--color-accent);
  border-radius: var(--radius);
}

/* Mobile hamburger button (hidden on desktop) */
.menu-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--color-ink);
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius);
  transition: background 0.15s ease, color 0.15s ease;
}
.menu-btn:hover {
  background: var(--color-canvas-alt);
  color: var(--color-accent);
}
.menu-btn .icon {
  width: 22px;
  height: 22px;
}

/* ── PRIMARY NAV (Desktop) ───────────────────────────────── */
.primary-nav {
  border-top: 1px solid var(--color-line);
  background: var(--color-paper);
}

.primary-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
}

.nav-list {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-list::-webkit-scrollbar { display: none; }

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 12px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink);
  text-decoration: none;
  white-space: nowrap;
  border-radius: var(--radius);
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 6px;
  height: 2px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}
.nav-link:hover::after {
  transform: scaleX(1);
}
.nav-link:hover {
  color: var(--color-accent);
}

.nav-link--sale {
  color: var(--color-accent);
  font-weight: 700;
}

.nav-aside {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  font-size: 13px;
  font-weight: 600;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-aside a {
  color: var(--color-ink);
  text-decoration: none;
  transition: color 0.15s ease;
}
.nav-aside a:hover {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── TABLET / MOBILE LAYOUT ──────────────────────────────── */
@media (max-width: 900px) {
  .header-main__inner {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    grid-template-areas:
      "menu  logo   actions"
      "search search search";
    align-items: center;
    gap: 8px 12px;
    padding-block: 8px;
  }

  .menu-btn {
    grid-area: menu;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
  }

  .site-header .logo {
    grid-area: logo;
    justify-self: center;
    text-align: center;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
  }
  .site-header .etaril_logo {
    height: 32px;
    width: auto;
  }

  .actions {
    grid-area: actions;
    justify-self: end;
    gap: 4px;
  }

  .action {
    min-width: 38px;
    padding: 6px 8px;
  }
  .action__label {
    display: none;
  }
  .action .badge {
    top: 2px;
    right: 2px;
  }

  .search {
    grid-area: search;
    max-width: 100%;
    margin-top: 4px;
  }
  .search input {
    height: 38px;
    font-size: 13px;
  }
  .search button {
    width: 40px;
    height: 38px;
  }

  /* Desktop nav bar is hidden on mobile; mobile nav slides from left */
  .primary-nav {
    display: none;
  }
}

/* ── MOBILE NAVIGATION DRAWER (Slides in from LEFT) ──────── */
.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
  z-index: 998;
}
.mobile-nav-overlay.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease;
}

.mobile-nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 320px;
  max-width: 85vw;
  background: var(--color-paper);
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0.3s;
  z-index: 999;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
}
.mobile-nav-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-nav-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-line);
  flex-shrink: 0;
}
.mobile-nav-drawer__logo {
  display: inline-flex;
  align-items: center;
}
.mobile-nav-drawer__img {
  height: 32px;
  width: auto;
  display: block;
}
.mobile-nav-drawer__close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-ink);
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.15s ease;
}
.mobile-nav-drawer__close:hover {
  background: var(--color-canvas-alt);
}
.mobile-nav-drawer__close .icon {
  width: 20px;
  height: 20px;
}

.mobile-nav-drawer__body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.mobile-nav-group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 10px;
}

.mobile-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mobile-nav-item {
  display: block;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-ink);
  text-decoration: none;
  border-radius: var(--radius);
  transition: background 0.15s ease, color 0.15s ease;
}
.mobile-nav-item:hover {
  background: var(--color-canvas-alt);
  color: var(--color-accent);
}
.mobile-nav-item--sale {
  color: var(--color-accent);
  font-weight: 700;
}

.mobile-nav-divider {
  height: 1px;
  background: var(--color-line);
  margin: 16px 0;
}

/* ── SLIDE CART PANEL (Slides in from RIGHT) ─────────────── */
.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
  z-index: 998;
}
.cart-overlay.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease;
}

.cart-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  max-width: 90vw;
  background: var(--color-paper);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0s linear 0.3s;
  z-index: 999;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
}
.cart-panel.is-open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cart-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--color-line);
  flex-shrink: 0;
}
.cart-panel__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-ink);
}
.cart-panel__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-ink);
  background: none;
  border: none;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.15s ease;
}
.cart-panel__close:hover {
  background: var(--color-canvas-alt);
}
.cart-panel__close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  display: block;
}

.cart-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px;
}

.cart-panel__empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  text-align: center;
  color: var(--color-muted);
}
.cart-panel__empty svg {
  width: 48px;
  height: 48px;
  fill: none;
  stroke: var(--color-line);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cart-panel__empty p {
  margin: 0;
  font-size: 14px;
}

.cart-panel__footer {
  border-top: 1px solid var(--color-line);
  padding: 18px 20px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cart-panel__subtotal {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-ink);
  margin-bottom: 4px;
}

.btn-cp-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1em;
  padding: 14px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: opacity 0.15s ease, filter 0.15s ease;
  background: var(--color-accent);
  color: #ffffff;
}
.btn-cp-primary:hover {
  filter: brightness(1.08);
}

/* ── CART PANEL ITEM ─────────────────────────────────────── */
.cp-item {
  display: flex;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--color-line);
  transition: opacity 0.2s ease, max-height 0.25s ease 0.05s,
              padding 0.25s ease 0.05s, border-color 0.25s ease 0.05s;
  max-height: 200px;
  overflow: hidden;
}
.cp-item.is-removing {
  opacity: 0;
  max-height: 0;
  padding: 0;
  border-color: transparent;
}

.cp-item__thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
  background: var(--color-canvas-alt);
  flex-shrink: 0;
  overflow: hidden;
}
.cp-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cp-item__info {
  flex: 1;
  min-width: 0;
}
.cp-item__name {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cp-item__variant {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--color-muted);
}

/* Qty controls */
.cp-item__qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-line);
  border-radius: var(--radius);
  overflow: hidden;
}
.cp-qty-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-ink);
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
}
.cp-qty-btn:hover {
  background: var(--color-canvas-alt);
}
.cp-qty-val {
  width: 32px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-ink);
  border-left: 1px solid var(--color-line);
  border-right: 1px solid var(--color-line);
  line-height: 28px;
}

.cp-item__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  flex-shrink: 0;
}
.cp-item__price {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-ink);
  white-space: nowrap;
}
.cp-item__remove {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  border-radius: var(--radius);
  transition: color 0.15s ease;
}
.cp-item__remove:hover {
  color: #ef233c;
}
.cp-item__remove svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  display: block;
}
