/* ── TDW Search Modal ─────────────────────────────── */
#tdw-search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  overflow-y: auto;
  padding: 20px;
  box-sizing: border-box;
}

#tdw-search-modal {
  position: relative;
  background: #fff;
  border-radius: 14px;
  max-width: 1100px;
  margin: 0 auto;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(0,0,0,.22);
  animation: tdwSlideDown .2s ease;
  overflow: hidden;
}
@keyframes tdwSlideDown {
  from { transform: translateY(-20px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

/* ── Søgebar ───────────────────────────────────────── */
#tdw-search-bar {
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 2px solid #222;
  background: #fff;
  flex-shrink: 0;
  gap: 12px;
  border-radius: 14px 14px 0 0;
  height: 64px;
}
#tdw-search-icon-wrap {
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  height: 100%;
}
#tdw-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 17px;
  padding: 0;
  height: 100%;
  background: transparent;
  color: #111;
  font-family: inherit;
  font-weight: 500;
  line-height: 64px;
}
#tdw-search-input::placeholder { color: #999; }
#tdw-search-close {
  background: #111;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  border-radius: 50%;
  transition: background .15s;
  flex-shrink: 0;
  line-height: 1;
}
#tdw-search-close:hover { background: #444; }

/* ── Body ─────────────────────────────────────────── */
#tdw-search-body {
  overflow-y: auto;
  padding: 24px 24px 32px;
  flex: 1;
}
.tdw-search-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #555;
  margin: 0 0 16px;
}

/* ── Grid — equal height ─────────────────────────── */
.tdw-search-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  align-items: stretch;
}
.tdw-search-card-wrap {
  display: flex;
}

/* ── Kort ─────────────────────────────────────────── */
.tdw-search-card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s, transform .15s;
  display: flex;
  flex-direction: column;
  width: 100%;
}
.tdw-search-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,.10);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}
.tdw-search-card-img {
  position: relative;
  background: #f8f8f8;
  aspect-ratio: 1;
  overflow: hidden;
  flex-shrink: 0;
}
.tdw-search-card-img img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 10px;
}
.tdw-search-badge {
  position: absolute;
  top: 8px; left: 8px;
  background: #e53e3e;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 5px;
}
.tdw-search-card-body {
  padding: 10px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tdw-search-card-brand {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #aaa;
}
.tdw-search-card-title {
  font-size: 12px;
  font-weight: 600;
  color: #111;
  line-height: 1.4;
  flex: 1;
}
.tdw-search-card-price {
  font-size: 13px;
  font-weight: 700;
  color: #111;
  margin-top: 6px;
}
.tdw-search-card-price del { color: #bbb; font-weight: 400; font-size: 11px; }
.tdw-search-card-price ins { text-decoration: none; color: #1a7a3c; }
.tdw-search-card-price .nx-save-badge { display: none; } /* skjul inline badge i kort */

/* ── Variationer ──────────────────────────────────── */
.tdw-search-card-variants {
  padding: 0 12px 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.tdw-search-variant-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border: 1.5px solid #ddd;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  color: #444;
  transition: border-color .12s, background .12s;
  white-space: nowrap;
}
.tdw-search-variant-btn:hover { border-color: #1E73BE; color: #1E73BE; }
.tdw-search-variant-btn.active {
  border-color: #1E73BE;
  background: #1E73BE;
  color: #fff;
}

/* ── ATC knap ─────────────────────────────────────── */
.tdw-search-card-footer {
  padding: 0 12px 12px;
  margin-top: auto;
}
.tdw-search-card-atc {
  display: block;
  text-align: center;
  background: #1E73BE;
  color: #fff !important;
  font-size: 12px;
  font-weight: 700;
  padding: 9px 8px;
  border-radius: 7px;
  text-decoration: none !important;
  border: none;
  cursor: pointer;
  width: 100%;
  transition: background .15s;
  font-family: inherit;
}
.tdw-search-card-atc:hover { background: #155a96; }
.tdw-search-card-atc:disabled { background: #aaa; cursor: not-allowed; }
.tdw-search-card-atc.added { background: #1a7a3c; }

/* ── Vis alle ─────────────────────────────────────── */
.tdw-search-footer { text-align: center; margin-top: 24px; }
.tdw-search-view-all {
  display: inline-block;
  background: #f4f4f4;
  color: #333;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 28px;
  border-radius: 8px;
  text-decoration: none;
  transition: background .15s;
}
.tdw-search-view-all:hover { background: #e0e0e0; }

.tdw-search-spinner, .tdw-search-empty {
  text-align: center;
  padding: 48px 0;
  color: #bbb;
  font-size: 14px;
}

/* ── Responsivt ──────────────────────────────────── */
@media (max-width: 860px) {
  .tdw-search-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  #tdw-search-overlay { padding: 8px; }
  #tdw-search-modal { max-height: calc(100vh - 16px); border-radius: 10px; }
  #tdw-search-bar { height: 52px; padding: 0 12px; gap: 10px; }
  #tdw-search-input { font-size: 15px; line-height: 52px; }
  #tdw-search-body { padding: 14px 12px 24px; }

  /* 1 kolonne — normale vertikale kort */
  .tdw-search-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .tdw-search-card-img { aspect-ratio: 16/9; }
  .tdw-search-card-img img { padding: 8px; }
  .tdw-search-card-body { padding: 10px 12px 4px; }
  .tdw-search-card-variants {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0 12px 8px;
    gap: 6px;
  }
  .tdw-search-variant-btn {
    font-size: 12px;
    padding: 5px 10px;
  }
  .tdw-search-card-footer { padding: 0 12px 12px; }
}

/* Kort-link wrapper (billede + tekst) */
.tdw-search-card-link {
  display: flex;
  flex-direction: column;
  flex: 1;
  text-decoration: none;
  color: inherit;
}
.tdw-search-card-link:hover { text-decoration: none; color: inherit; }

/* ── Udsolgt ─────────────────────────────────────── */
.tdw-search-card-atc.out-of-stock {
  background: #e5e5e5 !important;
  color: #999 !important;
  cursor: not-allowed;
  pointer-events: none;
}

/* Udsolgt variation-knap */
.tdw-search-variant-btn.variant-out-of-stock {
  color: #ccc;
  border-color: #eee;
  cursor: not-allowed;
  text-decoration: line-through;
}
.tdw-search-variant-btn.variant-out-of-stock:hover {
  border-color: #eee;
  color: #ccc;
}
