/* ============================================
   PreisFinder — Light Design
   Palette: Off-White + Indigo accent
   Typography: Space Grotesk (display) + Inter (body)
   ============================================ */

:root {
  --bg: #fafafa;
  --bg-2: #ffffff;
  --bg-3: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-hover: #f0f2f5;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --text: #1a1d23;
  --text-muted: #4a5568;
  --text-dim: #8b95a5;
  --accent: #4f46e5;            /* indigo-600 */
  --accent-2: #4338ca;          /* indigo-700 */
  --accent-soft: rgba(79, 70, 229, 0.08);
  --accent-softer: rgba(79, 70, 229, 0.04);
  --warn: #d97706;
  --err: #dc2626;
  --ok: #059669;
  --success-bg: #ecfdf5;
  --warn-bg: #fffbeb;
  --error-bg: #fef2f2;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.12);
  --max-w: 1200px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}
a:hover { color: var(--accent-2); text-decoration: underline; }

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
}

/* ============ HEADER ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

/* Scroll-Anchor-Offset: sorgt dafür, dass scrollIntoView() nicht unter dem
   sticky Header verschwindet. Wird von app.js für alle In-Page-Übergänge
   genutzt (Produktkarte -> Angebotsansicht, Paginierung), statt manueller
   Pixel-Berechnungen, die bei DOM-Änderungen leicht veralten und zu
   ruckartigen "Seitenwechsel"-Sprüngen führen. */
.product-card,
#offer-view,
#results-section {
  scroll-margin-top: 80px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.brand__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--accent);
  color: white;
  border-radius: 10px;
}
.brand__accent { color: var(--accent); }
.header__nav { display: flex; gap: 12px; align-items: center; }
.header__link {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.header__link:hover {
  color: var(--text);
  background: var(--surface-hover);
  text-decoration: none;
}

/* ============ HERO ============ */
.hero {
  padding: 80px 0 60px;
  text-align: center;
  background:
    radial-gradient(ellipse 800px 400px at 50% 0%, var(--accent-soft) 0%, transparent 70%),
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}
.hero__title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
  line-height: 1.1;
  color: var(--text);
}
.hero__subtitle {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto 40px;
  line-height: 1.65;
}
.hero__subtitle strong { color: var(--text); font-weight: 600; }

/* ============ SEARCH ============ */
.search {
  display: flex;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
  align-items: stretch;
}
.search__input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
.search__icon {
  position: absolute;
  left: 18px;
  color: var(--text-dim);
  pointer-events: none;
}
.search__input {
  width: 100%;
  height: 56px;
  padding: 0 48px 0 50px;
  background: var(--bg-2);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit;
  font-size: 1.05rem;
  outline: none;
  transition: all 0.18s;
  box-shadow: var(--shadow-sm);
}
.search__input::placeholder { color: var(--text-dim); }
.search__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.search__clear {
  position: absolute;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  background: var(--surface-hover);
  color: var(--text-muted);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.search__clear:hover { background: var(--err); color: white; }
.search__btn {
  height: 56px;
  padding: 0 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
  box-shadow: var(--shadow);
}
.search__btn:hover { background: var(--accent-2); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.search__btn:active { transform: translateY(0); }
.search__btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ============ SUGGESTIONS ============ */
.hero__suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 28px;
  align-items: center;
}
.suggestions__label {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-right: 4px;
}
.chip {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}
.chip:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* ============ START INFO ============ */
.start-info {
  padding: 60px 24px;
}
.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  max-width: 680px;
  margin: 0 auto;
  box-shadow: var(--shadow-sm);
}
.info-card h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem;
  margin: 0 0 20px;
  color: var(--text);
}
.info-card ol {
  margin: 0 0 20px;
  padding-left: 24px;
  line-height: 2;
  color: var(--text-muted);
}
.info-card ol li { padding-left: 4px; }
.info-card__hint {
  color: var(--text-dim);
  font-size: 0.9rem;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* ============ STATUS ============ */
.status {
  padding: 60px 24px;
  text-align: center;
  color: var(--text-muted);
}
.status__spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.status--error { color: var(--err); }
.status--error h3 { color: var(--text); margin: 12px 0 8px; font-family: 'Space Grotesk', sans-serif; }
.status--error p { color: var(--text-muted); max-width: 580px; margin: 0 auto 16px; }
.status__details {
  margin: 16px auto 24px;
  max-width: 720px;
  text-align: left;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.status__details summary { cursor: pointer; color: var(--text-muted); font-weight: 500; }
.status__details pre {
  margin: 12px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.8rem;
}
.status__hint {
  margin-top: 24px !important;
  font-size: 0.9rem;
  color: var(--text-dim);
}

/* ============ PRODUCT GRID ============ */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 32px 0;
}
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.product-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, var(--accent-softer) 100%);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.product-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.product-card:hover::before { opacity: 1; }
.product-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.product-card__image-wrap {
  width: 100%;
  height: 180px;
  background: var(--bg-3);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.product-card__image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.product-card__image-placeholder {
  color: var(--text-dim);
  font-size: 2.5rem;
}
.product-card__name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  margin: 0;
  color: var(--text);
  min-height: 2.7em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-card__specs {
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.product-card__rating {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.product-card__rating-stars { color: var(--warn); }
.product-card__footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.product-card__price {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.product-card__price-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}
.product-card__offers {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: right;
  background: var(--surface-hover);
  padding: 4px 10px;
  border-radius: 999px;
}

/* ============ PAGINATION ============ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 32px 0 60px;
}
.pagination__btn {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 10px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.pagination__btn:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.pagination__btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination__info { color: var(--text-muted); font-size: 0.9rem; }

/* ============ OFFER VIEW ============ */
.offer-view { padding: 24px 0 60px; }
.back-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 8px 0;
  margin-bottom: 24px;
  transition: color 0.15s;
}
.back-btn:hover { color: var(--accent); }

.offer-view__header {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
}
.offer-view__image-wrap {
  width: 180px;
  height: 180px;
  background: var(--bg-3);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.offer-view__image { max-width: 100%; max-height: 100%; object-fit: contain; }
.offer-view__name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.6rem;
  margin: 0 0 12px;
  line-height: 1.25;
  color: var(--text);
}
.offer-view__specs {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.65;
  margin: 0 0 20px;
  max-width: 720px;
}
.offer-view__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}
.offer-view__bestprice {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
}
.offer-view__count {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}
.offer-view__ghlink {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ============ FILTERS ============ */
.offer-view__filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}
.filter input { accent-color: var(--accent); }
.filter__sep {
  width: 1px;
  height: 22px;
  background: var(--border);
  margin: 0 4px;
}

/* ============ VARIANT SELECTOR ============ */
.variant-selector {
  background: var(--accent-softer);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}
.variant-selector__title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  margin: 0 0 8px;
  color: var(--accent);
}
.variant-selector__hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 16px;
}
.variant-selector .product-grid {
  padding: 0;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.variant-selector .product-card {
  padding: 12px;
}
.variant-selector .product-card__image-wrap {
  height: 120px;
}
.variant-selector .product-card__name {
  font-size: 0.9rem;
  min-height: 2.5em;
}

/* ============ OFFER LIST ============ */
.offer-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.offer-row {
  display: grid;
  grid-template-columns: 80px 1fr auto auto;
  gap: 20px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.offer-row:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}
.offer-row--best {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent-softer) 0%, var(--surface) 60%);
  box-shadow: var(--shadow);
}
.offer-row--best::before {
  content: 'Bestpreis';
  position: absolute;
  margin-top: -8px;
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  letter-spacing: 0.03em;
}
.offer-row__logo-wrap {
  width: 80px;
  height: 50px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 6px;
}
.offer-row__logo { max-width: 100%; max-height: 100%; object-fit: contain; }
.offer-row__shop {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.offer-row__shop-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}
.offer-row__shop-meta {
  font-size: 0.82rem;
  color: var(--text-dim);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.offer-row__shop-meta .tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--surface-hover);
  border-radius: 4px;
  color: var(--text-muted);
}
.offer-row__shop-meta .tag--ok { background: var(--success-bg); color: var(--ok); }
.offer-row__shop-meta .tag--warn { background: var(--warn-bg); color: var(--warn); }
.offer-row__shop-meta .rating-stars {
  color: var(--warn);
  font-weight: 600;
}
.offer-row__price-block {
  text-align: right;
  min-width: 140px;
}
.offer-row__price {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}
.offer-row__price--best { color: var(--accent); }
.offer-row__shipping {
  font-size: 0.82rem;
  color: var(--ok);
  margin-top: 2px;
  font-weight: 500;
}
.offer-row__total {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.offer-row__goto {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: white !important;
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  white-space: nowrap;
  transition: all 0.15s;
  text-decoration: none !important;
  box-shadow: var(--shadow-sm);
}
.offer-row__goto:hover {
  background: var(--accent-2);
  color: white !important;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  text-decoration: none !important;
}
.offer-row__goto--secondary {
  background: var(--surface);
  color: var(--text) !important;
  border: 1px solid var(--border-strong);
}
.offer-row__goto--secondary:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent) !important;
}

/* ============ MORE OFFERS LINK ============ */
.more-offers {
  text-align: center;
  padding: 24px 0;
}
.more-offers__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--accent);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-weight: 600;
  font-family: 'Space Grotesk', sans-serif;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.more-offers__link:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  text-decoration: none;
}

/* ============ FOOTER ============ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  background: var(--bg-2);
}
.site-footer a { color: var(--text-muted); text-decoration: underline; }
.site-footer a:hover { color: var(--accent); }
.footer__small { color: var(--text-dim); margin-top: 4px; font-size: 0.8rem; }

/* ============ RESPONSIVE ============ */
@media (max-width: 720px) {
  .hero { padding: 48px 0 40px; }
  .search { flex-direction: column; }
  .search__btn { justify-content: center; }
  .product-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .product-card { padding: 14px; }
  .product-card__image-wrap { height: 130px; }
  .offer-view__header { grid-template-columns: 1fr; padding: 20px; }
  .offer-view__image-wrap { width: 100%; height: 200px; }
  .offer-row {
    grid-template-columns: 60px 1fr;
    grid-template-areas:
      "logo shop"
      "logo price"
      "actions actions";
    gap: 8px 12px;
    padding: 14px;
  }
  .offer-row__logo-wrap { grid-area: logo; align-self: start; width: 60px; height: 40px; }
  .offer-row__shop { grid-area: shop; }
  .offer-row__price-block { grid-area: price; text-align: left; min-width: 0; }
  .offer-row__actions { grid-area: actions; }
  .offer-row__goto { width: 100%; justify-content: center; }
  .product-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .hero__title { font-size: 1.8rem; }
  .hero__subtitle { font-size: 0.95rem; }
  .header__nav { gap: 4px; }
  .header__link { padding: 6px 8px; font-size: 0.82rem; }
}
