/* =========================
   HEADER (wie /orders)
========================= */

:root {
  --ctrl-size: clamp(30px, 5vw, 34px);
}

/* Top Info Bar (Opening Hours) */
.top-bar {
  background: var(--ep-yellow);
  color: #000;
  padding: 6px 20px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  justify-content: center;
  gap: clamp(15px, 3vw, 30px);
  z-index: 1000;
  flex-wrap: wrap;
  text-align: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.top-bar span {
  display: flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 600px) {
  .top-bar {
    font-size: 11px;
    padding: 4px 10px;
    gap: 10px;
  }
}

html, body {
  overflow-x: clip;
}

/* Header Container */
header {
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 6px solid var(--ep-yellow);
  padding: 12px clamp(12px, 2vw, 24px);
  display: flex;
  gap: clamp(8px, 1.5vw, 16px);
  align-items: center;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  /* Updated dynamically if top-bar is present or fixed by container */
  z-index: 100;
  flex-wrap: wrap;
  box-shadow: none;
  width: 100%;
  min-height: 60px;
}

/* Logo */
.logo-area {
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.5vw, 12px);
  text-decoration: none;
  color: inherit;
  flex: 0 1 auto;
  min-width: 0;
}

.logo-area:visited {
  color: inherit;
}

.logo-area img {
  height: clamp(40px, 8vw, 60px);
  width: auto;
  object-fit: contain;
  display: block;
  transition: height 0.2s ease;
}

.logo-area h1 {
  margin: 0;
  font-size: clamp(16px, 3vw, 20px);
  white-space: normal;
  line-height: 1.1;
  max-width: 150px;
  color: var(--ep-yellow);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Actions wrapper */
.actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 3px;
  margin-left: auto;
}

.cutoff-countdown-row {
  display: none;
  width: 100%;
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.25;
  color: #ef4444;
  padding: 1px 6px 0 6px;
  box-sizing: border-box;
  text-align: left;
  white-space: normal;
  pointer-events: none;
}

/* ===== Suche (WICHTIG: radius 8px wie /orders) ===== */
.search {
  flex: 1 1 auto;
  display: flex;
  align-items: stretch;
  min-width: 80px;
  max-width: 1020px;
  margin: 0 auto;
  flex-wrap: nowrap;
  position: relative;
  gap: 6px;
}

.search select,
.search input,
.search button,
.ag-select-trigger {
  height: clamp(32px, 5vw, 36px);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  background: #fff;
}

.search select,
.ag-select-trigger {
  padding: 0 clamp(8px, 1.5vw, 10px);
  font-weight: 700;
  font-size: clamp(13px, 2.5vw, 14px);
  cursor: pointer;
  color: var(--text-main);
}

.ag-select-wrap {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  flex: 0 0 210px !important;
  width: 210px !important;
  min-width: 210px !important;
  max-width: 210px !important;
}

.ag-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  -webkit-user-select: none; user-select: none;
  white-space: nowrap;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: hidden;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ag-select-wrap.open .ag-select-trigger,
.ag-select-trigger:focus-visible {
  border-color: var(--ep-yellow);
  box-shadow: 0 0 0 2px rgba(244, 195, 0, 0.25);
}

.ag-select-label {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  flex: 1 1 0% !important;
  width: 0 !important;
  min-width: 0 !important;
  text-align: left;
  display: block;
}

.ag-select-chevron {
  flex: 0 0 auto;
  opacity: 0.65;
  transition: transform 0.2s ease;
}

.ag-select-wrap.open .ag-select-chevron {
  transform: rotate(180deg);
}

.ag-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 240px;
  max-width: min(340px, calc(100vw - 20px));
  max-height: min(65vh, 420px);
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(15, 23, 42, 0.08);
  z-index: 1200;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.ag-dropdown-pinned {
  flex: 0 0 auto;
  background: #ffffff;
  border-bottom: 2px solid #e2e8f0;
  padding: 6px;
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.ag-dropdown-list {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.ag-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  -webkit-user-select: none; user-select: none;
  transition: background 0.12s ease, color 0.12s ease;
  line-height: 1.3;
}

.ag-dropdown-item:hover,
.ag-dropdown-item:focus-visible {
  background: #f1f5f9;
  outline: none;
}

.ag-dropdown-item.active {
  background: var(--ep-yellow);
  color: #0f172a;
  font-weight: 800;
}

.ag-dropdown-pinned .ag-item-all {
  font-weight: 800;
}

.search input {
  padding: 0 clamp(10px, 2vw, 14px);
  font-size: clamp(14px, 2.5vw, 16px);
  flex: 1 1 auto;
  min-width: 0;
}

.search button {
  width: clamp(32px, 5vw, 36px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#clearSearchBtn {
  position: absolute;
  right: 48px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: none; /* Initial versteckt, JS setzt auf 'flex' */
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 18px;
  cursor: pointer;
  z-index: 20;
}

#clearSearchBtn:hover {
  color: #475569;
}

@media (max-width: 1100px) {
  #clearSearchBtn {
    right: 44px; /* Auf Mobil etwas enger */
    font-size: 20px;
  }
}

/* Top right icons */
.top-actions {
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.5vw, 10px);
}

.icon-btn {
  display: flex;
  align-items: center;
  gap: clamp(4px, 1vw, 8px);
  padding: 0 clamp(8px, 2vw, 12px);
  height: clamp(32px, 5vw, 36px);
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-main);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, transform .12s;
  white-space: nowrap;
}

.icon-btn:hover {
  background: var(--bg-body);
}

.icon-btn.active {
  background: var(--ep-yellow);
  border-color: var(--ep-yellow);
}

.icon-btn:active {
  transform: scale(.98);
}

.icon-btn img {
  display: block;
  transform: translateY(2px);
  width: clamp(16px, 3vw, 20px);
  height: auto;
}

/* Favoriten Stern grÃ¶ÃŸer */
header .icon-btn[href="/favorites"] img {
  width: clamp(24px, 6vw, 32px);
  height: clamp(24px, 6vw, 32px);
  transform: translateY(0);
}

/* Lieferdatum */
.delivery-wrap {
  display: flex;
  height: clamp(34px, 5vw, 38px);
  align-items: center;
  padding: 0 clamp(8px, 1.5vw, 10px);
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
}

.delivery-wrap select {
  border: none;
  background: transparent;
  font-weight: 700;
  outline: none;
  cursor: pointer;
  font-size: clamp(13px, 2.5vw, 14px);
}

/* Burger (Standard weiÃŸ, gelb nur wenn aktiv) */
.burger {
  width: clamp(36px, 6vw, 42px);
  height: clamp(34px, 5vw, 38px);
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-main);
  transition: background .12s, border-color .12s;
  padding-bottom: 2px;
  /* Leicht nach oben versetzen fÃ¼r optische Zentrierung */
}

.burger:hover {
  background: var(--bg-body);
}

.burger.active {
  background: var(--ep-yellow);
  border-color: var(--ep-yellow);
  color: #000;
}

/* Dropdown Menu */
.menu {
  position: absolute;
  right: 24px;
  top: 72px;
  min-width: 220px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 8px;
  display: none;
  z-index: 999;
}

.menu.open {
  display: block;
}

.menu a {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 600;
}

.menu a:hover {
  background: var(--bg-body);
}

.menu a.active {
  background: var(--ep-yellow);
  color: #111;
}

.menu .sep {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

/* Suggestbox */
.suggest-box {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
  overflow: hidden;
  z-index: 50;
}

.suggest-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  align-items: center;
}

.suggest-item:hover,
.suggest-item.active {
  background: #f1f5f9;
}

.suggest-item .num {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: #64748b;
  font-size: 12px;
}

.suggest-item .desc {
  font-size: 14px;
  color: #0f172a;
}

/* Platz sparen */
@media (min-width: 1101px) and (max-width: 1450px) {
  .del-label {
    display: none;
  }

  header .top-actions a[href="/favorites"] .txt {
    display: none;
  }
}

/* Mobile Layout */
@media (max-width: 1100px) {
  header {
    top: -78px;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    width: 100%;
  }

  .logo-area,
  .search,
  .actions,
  .top-actions,
  .delivery-wrap {
    min-width: 0;
  }

  .logo-area {
    order: 1;
    flex: 0 0 calc(100% + 20px);
    max-width: none;
    margin: -6px -10px 0 -10px;
    padding: 6px 10px;
    background: #ffffff;
  }

  .actions {
    order: 2;
    flex: 0 0 100%;
    width: 100%;
    margin-left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
  }

  .top-actions {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: nowrap;
  }

  .delivery-wrap {
    flex: 1 1 auto;
    max-width: none !important;
    min-width: 0 !important;
    height: 38px !important;
    padding: 0 !important;
  }

  .delivery-wrap select {
    width: 100% !important;
    height: 100% !important;
    padding: 0 18px 0 6px !important;
    line-height: 1 !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    letter-spacing: -0.2px !important;
  }

  .top-actions a[href="/favorites"] {
    flex: 0 0 auto;
  }

  .top-actions a[href="/favorites"] .txt {
    display: none;
  }

  .search {
    order: 3;
    width: 100%;
    max-width: none;
    flex: 0 0 100%;
    min-width: 0;
  }

  .search input {
    font-size: 16px !important;
  }
  .search select,
  .delivery-wrap select,
  #hdrArtGroupSel,
  .ag-select-trigger {
    font-size: 12px !important;
  }

  .logo-area img {
    height: 60px;
    width: auto;
    object-fit: contain;
  }

  .logo-area h1 {
    font-size: 15px !important;
  }

  .icon-btn {
    padding: 4px 8px !important;
  }

  .actions {
    margin-top: 4px !important;
  }

  .search input {
    padding: 8px 10px !important;
    height: 36px !important;
  }

  .search button,
  .ag-select-trigger {
    height: 36px !important;
  }

  #hdrArtGroupSel,
  .ag-select-trigger {
    font-size: 12px !important;
    font-weight: 700;
    max-width: 135px;
    padding: 0 8px !important;
  }

  .ag-dropdown-menu {
    min-width: min(260px, calc(100vw - 20px));
    max-height: min(60vh, 380px);
  }
}

/* =========================
   SUBNAV (nur wo vorhanden)
========================= */
.subnav {
  top: 72px;
  z-index: 40;
  background: var(--ep-yellow) !important;
  border-bottom: none;
  box-shadow: none;
}

.subnav-inner {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #e2e8f0 transparent;
}

.subnav-inner::-webkit-scrollbar {
  height: 8px;
}

.subnav-inner::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 999px;
}

.subnav-inner::-webkit-scrollbar-track {
  background: transparent;
}

.subnav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  text-decoration: none;
  color: #1f2937;
  font-weight: 800;
  font-size: 13px;
  border-bottom: 3px solid transparent;
}

.subnav a:hover {
  background: rgba(255, 255, 255, .25);
}

@media (max-width: 1100px) {
  .subnav {
    top: 56px;
  }
}

/* =========================
   Mobile: Logo + Text hide on scroll
========================= */
@media (max-width: 1100px) {

  .logo-area {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: -6px -10px 0 -10px; /* Standard-Abstände */
    padding: 6px 10px;
    /* Sehr weicher, nativer Slide via margin-top statt stockender Höhen-Animation */
    
  }

  
}

#cartCount {
  display: inline-block;
  min-width: 2ch;
  text-align: center;
}

#cartCount {
  display: inline-block;
  min-width: 2.2ch;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
