/* =============================================================
   Kodumarket Julge — Mobile bottom bar + Search overlay
   ============================================================= */

/* ============================================================
   BOTTOM BAR — mobile only (≤ 900 px)
   ============================================================ */
.km-bottombar {
  display: none; /* hidden on desktop */
}

@media (max-width: 900px) {
  .km-bottombar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99;
    padding: 10px 8px calc(14px + env(safe-area-inset-bottom, 0px));
    background: var(--km-ink, #0A1628);
    color: #fff;
    border-top: 1px solid rgba(255, 255, 255, .06);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, .2);
  }

  .km-bottombar__item {
    appearance: none;
    background: transparent;
    border: 0;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 7px 4px;
    border-radius: 14px;
    color: rgba(255, 255, 255, .65);
    position: relative;
    transition: background .15s ease, color .15s ease;
    min-width: 0;
  }
  .km-bottombar__item:hover {
    color: #fff;
  }

  .km-bottombar__icon {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
  }
  .km-bottombar__icon svg {
    width: 18px;
    height: 18px;
    display: block;
  }

  .km-bottombar__label {
    font-family: 'Geist Mono', ui-monospace, monospace;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: .04em;
    text-transform: uppercase;
    line-height: 1;
  }

  /* Active — green fill, dark text */
  .km-bottombar__item.is-active {
    background: var(--km-green-500, #10B981);
    color: var(--km-ink, #0A1628);
  }
  .km-bottombar__item.is-active .km-bottombar__label {
    font-family: 'Geist', -apple-system, sans-serif;
    font-weight: 700;
    letter-spacing: -0.01em;
    text-transform: none;
  }

  /* Cart badge */
  .km-bottombar__badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 18px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--km-green-500, #10B981);
    color: var(--km-ink, #0A1628);
    font-family: 'Geist', sans-serif;
    font-size: 9px;
    font-weight: 700;
    display: grid;
    place-items: center;
    line-height: 1;
  }
  .km-bottombar__item.is-active .km-bottombar__badge {
    background: var(--km-ink, #0A1628);
    color: var(--km-green-500, #10B981);
    border: 1.5px solid var(--km-green-500, #10B981);
  }

  /* Lift the main content so bottom bar doesn't obscure it */
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  /* On mobile, kill the site footer fixed behavior */
  .km-footer {
    margin-bottom: 0;
  }
}

/* ============================================================
   SEARCH OVERLAY
   ============================================================ */
.km-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--km-ink, #0A1628);
  color: #fff;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.km-search-overlay--open {
  opacity: 1;
  pointer-events: auto;
}
body.km-has-search-open {
  overflow: hidden;
}

/* --- Top bar --- */
.km-search-overlay__top {
  background: var(--km-ink, #0A1628);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  padding: 20px 48px;
  flex-shrink: 0;
}
.km-search-overlay__top-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  max-width: 1680px;
  margin: 0 auto;
}

.km-search-overlay__logo {
  background: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.km-search-overlay__logo img {
  height: 30px;
  display: block;
  width: auto;
  max-width: 160px;
}

.km-search-overlay__form {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 14px;
  transition: border-color .15s ease;
}
.km-search-overlay__form:focus-within {
  border-color: rgba(255, 255, 255, .35);
}

.km-search-overlay__icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: rgba(255, 255, 255, .55);
}

.km-search-overlay__input {
  flex: 1;
  background: transparent;
  border: 0;
  color: #fff;
  font: 500 18px/1.3 'Geist', -apple-system, sans-serif;
  outline: none;
  min-width: 0;
}
.km-search-overlay__input::placeholder {
  color: rgba(255, 255, 255, .4);
}

.km-search-overlay__esc {
  font: 500 10px/1 'Geist Mono', ui-monospace, monospace;
  color: rgba(255, 255, 255, .4);
  letter-spacing: .08em;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 6px;
  flex-shrink: 0;
}

.km-search-overlay__close {
  appearance: none;
  background: transparent;
  border: 0;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, .7);
  border-radius: 10px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s ease, color .15s ease;
}
.km-search-overlay__close:hover {
  background: rgba(255, 255, 255, .08);
  color: #fff;
}
.km-search-overlay__close svg {
  width: 18px;
  height: 18px;
}

/* --- Body --- */
.km-search-overlay__body {
  flex: 1;
  overflow-y: auto;
  background: var(--km-ink, #0A1628);
}
.km-search-overlay__grid {
  max-width: 1680px;
  margin: 0 auto;
  padding: 40px 48px 48px;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 300px;
  gap: 40px;
}

.km-search-overlay__col-kicker {
  font: 500 10px/1 'Geist Mono', ui-monospace, monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .4);
  margin-bottom: 14px;
}
.km-search-overlay__col-kicker--mt {
  margin-top: 28px;
}

/* --- Left: categories + recent --- */
.km-search-overlay__cats {
  display: grid;
  gap: 0;
}
.km-search-overlay__cat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  font: 400 14px/1.3 'Geist', sans-serif;
  color: #fff;
  text-decoration: none;
  transition: color .15s ease;
}
.km-search-overlay__cat:hover { color: var(--km-green-500, #10B981); }
.km-search-overlay__cat-n {
  font: 500 10px/1 'Geist Mono', ui-monospace, monospace;
  color: rgba(255, 255, 255, .4);
  margin-right: 8px;
}
.km-search-overlay__cat-c {
  font: 500 11px/1 'Geist Mono', ui-monospace, monospace;
  color: rgba(255, 255, 255, .4);
}

.km-search-overlay__recent-empty {
  font: 400 12px/1.4 'Geist', sans-serif;
  color: rgba(255, 255, 255, .35);
  padding: 4px 0;
}
.km-search-overlay__recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
  gap: 8px;
}
.km-search-overlay__recent-link {
  appearance: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  font: 400 13px/1.3 'Geist', sans-serif;
  color: rgba(255, 255, 255, .75);
  text-align: left;
  min-width: 0;
}
.km-search-overlay__recent-link:hover { color: #fff; }
.km-search-overlay__recent-link svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  color: rgba(255, 255, 255, .4);
}
.km-search-overlay__recent-link span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.km-search-overlay__recent-remove {
  appearance: none;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: rgba(255, 255, 255, .3);
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 6px;
  transition: color .15s ease, background .15s ease;
}
.km-search-overlay__recent-remove:hover {
  color: #fff;
  background: rgba(255, 255, 255, .08);
}

/* --- Middle: live results --- */
.km-search-overlay__results {
  display: grid;
  gap: 0;
}
.km-search-overlay__hint,
.km-search-overlay__loading {
  font: 400 14px/1.5 'Geist', sans-serif;
  color: rgba(255, 255, 255, .5);
  padding: 14px 0;
}
.km-search-overlay__hint--err { color: #F87171; }

.km-search-overlay__result {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 80px;
  gap: 16px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  text-decoration: none;
  color: #fff !important;
  transition: background .15s ease, color .15s ease;
  border-radius: 8px;
  padding-left: 8px;
  padding-right: 8px;
  margin: 0 -8px;
}
.km-search-overlay__result:hover,
.km-search-overlay__result:focus {
  background: rgba(16, 185, 129, .12);
}
.km-search-overlay__result:hover .km-search-overlay__result-name,
.km-search-overlay__result:focus .km-search-overlay__result-name {
  color: var(--km-green-500, #10B981);
}
.km-search-overlay__result-thumb {
  width: 56px;
  height: 56px;
  background: rgba(255, 255, 255, .05);
  border-radius: 10px;
  padding: 6px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.km-search-overlay__result-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.km-search-overlay__result-body {
  min-width: 0;
}
.km-search-overlay__result-name {
  display: block;
  font: 500 14px/1.35 'Geist', sans-serif;
  letter-spacing: -0.015em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.km-search-overlay__result-name mark {
  background: rgba(16, 185, 129, .25);
  color: var(--km-green-500, #10B981);
  padding: 0 2px;
  border-radius: 2px;
}
.km-search-overlay__result-price {
  font: 700 15px/1 'Geist Mono', ui-monospace, monospace;
  color: #fff;
  text-align: right;
  white-space: nowrap;
}
.km-search-overlay__result-price .woocommerce-Price-amount {
  color: #fff;
}
.km-search-overlay__result-price del {
  opacity: .5;
  font-size: 12px;
  margin-right: 4px;
}

.km-search-overlay__see-all {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  padding: 12px 16px;
  background: var(--km-green-500, #10B981);
  color: var(--km-ink, #0A1628);
  border-radius: 10px;
  font: 700 13px/1 'Geist', sans-serif;
  text-decoration: none;
  transition: transform .15s ease;
}
.km-search-overlay__see-all:hover {
  transform: translateX(2px);
  color: var(--km-ink, #0A1628);
}

/* --- Right: popular + campaign --- */
.km-search-overlay__popular {
  display: grid;
  gap: 0;
  margin-bottom: 24px;
}
.km-search-overlay__popular-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  text-decoration: none;
  color: #fff;
}
.km-search-overlay__popular-n {
  font: 500 11px/1 'Geist Mono', ui-monospace, monospace;
  color: rgba(255, 255, 255, .4);
}
.km-search-overlay__popular-body { min-width: 0; }
.km-search-overlay__popular-name {
  display: block;
  font: 500 13px/1.35 'Geist', sans-serif;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.km-search-overlay__popular-cat {
  display: block;
  font: 500 10px/1 'Geist Mono', ui-monospace, monospace;
  color: rgba(255, 255, 255, .4);
  margin-top: 3px;
}
.km-search-overlay__popular-tag {
  font: 500 10px/1 'Geist Mono', ui-monospace, monospace;
  color: var(--km-green-500, #10B981);
  border: 1px solid rgba(16, 185, 129, .4);
  padding: 3px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.km-search-overlay__promo {
  padding: 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: var(--km-ink, #0A1628);
}
.km-search-overlay__promo-kicker {
  font: 500 10px/1 'Geist Mono', ui-monospace, monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .7;
}
.km-search-overlay__promo-title {
  font: 700 22px/1.2 'Geist', sans-serif;
  letter-spacing: -0.03em;
  margin-top: 6px;
  text-wrap: balance;
}
.km-search-overlay__promo-cta {
  margin-top: 12px;
  font: 500 11px/1 'Geist Mono', ui-monospace, monospace;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ============================================================
   RESPONSIVE — search overlay mobile
   ============================================================ */
@media (max-width: 900px) {
  .km-search-overlay__top {
    padding: 14px 16px;
  }
  .km-search-overlay__top-inner {
    gap: 10px;
  }
  .km-search-overlay__logo {
    display: none; /* Give more room for the input on mobile */
  }
  .km-search-overlay__esc {
    display: none;
  }
  .km-search-overlay__form {
    padding: 10px 14px;
  }
  .km-search-overlay__input {
    font-size: 16px; /* prevent iOS zoom */
  }
  .km-search-overlay__grid {
    grid-template-columns: 1fr;
    padding: 24px 16px 32px;
    gap: 32px;
  }
  .km-search-overlay__col--right {
    /* Keep promo+popular visible, but below */
  }
}
