/* ─── shopping.dmbound.com — Stile ─────────────────────────────────────────── */
:root {
  --color-bg: #f5f7fa;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-text: #1a202c;
  --color-text-muted: #718096;
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-success: #16a34a;
  --color-warning: #d97706;
  --color-danger: #dc2626;
  --color-amazon: #ff9900;
  --color-ebay: #e53238;
  --color-google: #4285f4;
  --color-idealo: #0071bf;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-hover: 0 4px 12px rgba(0,0,0,.12), 0 8px 32px rgba(0,0,0,.08);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */
header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(0,0,0,.06);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 18px;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
}

.logo-sub {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: -2px;
}

/* ─── Search Bar ──────────────────────────────────────────────────────────── */
.search-wrap {
  flex: 1;
  position: relative;
}

.search-form {
  display: flex;
  align-items: center;
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: 50px;
  overflow: hidden;
  transition: border-color .2s, box-shadow .2s;
}

.search-form:focus-within {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.search-icon {
  padding: 0 14px 0 18px;
  color: var(--color-text-muted);
  font-size: 16px;
  flex-shrink: 0;
}

#search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 0;
  font-size: 15px;
  color: var(--color-text);
  outline: none;
}

#search-input::placeholder { color: var(--color-text-muted); }

#search-btn {
  background: var(--color-primary);
  color: white;
  border: none;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 0 50px 50px 0;
  transition: background .2s;
  white-space: nowrap;
}

#search-btn:hover { background: var(--color-primary-dark); }
#search-btn:disabled { background: #94a3b8; cursor: not-allowed; }

/* ─── Main Layout ─────────────────────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ─── Hero (home) ─────────────────────────────────────────────────────────── */
#hero {
  text-align: center;
  padding: 80px 24px 60px;
}

.hero-title {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #1e40af, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 18px;
  color: var(--color-text-muted);
  margin-bottom: 48px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.hero-search-wrap {
  max-width: 640px;
  margin: 0 auto 32px;
}

.hero-search-wrap .search-form {
  background: var(--color-surface);
  border-width: 2px;
  box-shadow: var(--shadow);
}

.hero-search-wrap #search-btn {
  padding: 14px 32px;
  font-size: 15px;
}

.hero-search-wrap #search-input {
  padding: 14px 0;
  font-size: 16px;
}

.popular-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.tag-chip {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 50px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all .2s;
}

.tag-chip:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* ─── Features grid ───────────────────────────────────────────────────────── */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 56px;
}

.feature-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.feature-icon { font-size: 28px; margin-bottom: 10px; }
.feature-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.feature-desc { font-size: 12px; color: var(--color-text-muted); }

/* ─── Results layout ──────────────────────────────────────────────────────── */
#results-page { display: none; padding: 24px 0; }

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.results-meta {
  font-size: 14px;
  color: var(--color-text-muted);
}

.results-meta strong { color: var(--color-text); }

.results-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.sort-select {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  outline: none;
}

.sort-select:focus { border-color: var(--color-primary); }

.filter-btn {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: border-color .2s;
}

.filter-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }

.results-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 768px) {
  .results-layout { grid-template-columns: 1fr; }
  #filters-panel { display: none; }
  #filters-panel.open { display: block; }
}

/* ─── Filtri ──────────────────────────────────────────────────────────────── */
#filters-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  position: sticky;
  top: 80px;
}

.filter-section { margin-bottom: 20px; }
.filter-section:last-child { margin-bottom: 0; }

.filter-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-muted);
  margin-bottom: 10px;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 6px;
  cursor: pointer;
}

.filter-option input[type=checkbox] {
  width: 15px; height: 15px;
  accent-color: var(--color-primary);
}

.price-range {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.price-input {
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  width: 100%;
  outline: none;
}

.price-input:focus { border-color: var(--color-primary); }

.apply-filters-btn {
  width: 100%;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
  transition: background .2s;
}

.apply-filters-btn:hover { background: var(--color-primary-dark); }

/* ─── Product Cards ───────────────────────────────────────────────────────── */
#results-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 16px;
  align-items: center;
  transition: box-shadow .2s, transform .1s;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  position: relative;
}

.product-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.product-card.best-deal {
  border-color: var(--color-success);
  background: linear-gradient(to right, #f0fdf4, var(--color-surface));
}

.best-deal-badge {
  position: absolute;
  top: -1px;
  left: 16px;
  background: var(--color-success);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 0 0 8px 8px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.card-image {
  width: 100px;
  height: 100px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--color-bg);
  padding: 4px;
}

.card-image-placeholder {
  width: 100px;
  height: 100px;
  background: var(--color-bg);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--color-border);
  flex-shrink: 0;
}

.card-body { min-width: 0; }

.card-source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 50px;
  margin-bottom: 6px;
}

.source-amazon_it { background: #fff3e0; color: #e65100; }
.source-amazon_de { background: #fff3e0; color: #bf360c; }
.source-amazon_com { background: #fff8e1; color: #f57f17; }
.source-ebay_it { background: #fce4ec; color: #c62828; }
.source-ebay_com { background: #fce4ec; color: #880e4f; }
.source-google_shopping { background: #e3f2fd; color: #1565c0; }
.source-idealo { background: #e1f5fe; color: #01579b; }
.source-unknown { background: #f3f4f6; color: #6b7280; }

.card-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.card-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.rating-stars { color: var(--color-warning); letter-spacing: -1px; }

.origin-badge {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 500;
}

.origin-EU { background: #dcfce7; color: #166534; }
.origin-Non-EU { background: #fef3c7; color: #92400e; }
.origin-Sconosciuta { background: #f3f4f6; color: #6b7280; }

/* ─── Price Panel ─────────────────────────────────────────────────────────── */
.card-price-panel {
  text-align: right;
  min-width: 140px;
  flex-shrink: 0;
}

.price-total-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--color-text-muted);
  margin-bottom: 2px;
}

.price-total {
  font-size: 24px;
  font-weight: 800;
  color: var(--color-text);
  line-height: 1;
  margin-bottom: 4px;
}

.price-total.best { color: var(--color-success); }

.price-breakdown {
  font-size: 11px;
  color: var(--color-text-muted);
  line-height: 1.6;
}

.price-breakdown .row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.price-breakdown .row.duty { color: var(--color-warning); }
.price-breakdown .row.vat { color: #6366f1; }
.price-breakdown .row.shipping { color: var(--color-text-muted); }
.price-breakdown .row.total {
  font-weight: 700;
  color: var(--color-text);
  border-top: 1px solid var(--color-border);
  margin-top: 4px;
  padding-top: 4px;
}

.tax-toggle {
  font-size: 11px;
  color: var(--color-primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 0;
  text-align: right;
  display: block;
  margin-top: 4px;
  width: 100%;
}

.buy-btn {
  display: block;
  margin-top: 10px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
  text-align: center;
  text-decoration: none;
  width: 100%;
}

.buy-btn:hover { background: var(--color-primary-dark); }

/* ─── Source errors ───────────────────────────────────────────────────────── */
.source-errors {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 12px;
  color: #9a3412;
  margin-bottom: 16px;
}

/* ─── Loading ─────────────────────────────────────────────────────────────── */
#loading {
  display: none;
  text-align: center;
  padding: 80px 24px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-text { color: var(--color-text-muted); font-size: 14px; }

.loading-sources {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.loading-source-dot {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 50px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
  animation: pulse 1.5s ease-in-out infinite;
}

.loading-source-dot:nth-child(2) { animation-delay: .2s; }
.loading-source-dot:nth-child(3) { animation-delay: .4s; }
.loading-source-dot:nth-child(4) { animation-delay: .6s; }

@keyframes pulse {
  0%, 100% { opacity: .5; }
  50% { opacity: 1; border-color: var(--color-primary); color: var(--color-primary); }
}

/* ─── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}

.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.empty-sub { font-size: 14px; color: var(--color-text-muted); }

/* ─── Footer ──────────────────────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 32px 24px;
  font-size: 12px;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  margin-top: 48px;
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .product-card {
    grid-template-columns: 72px 1fr;
    grid-template-rows: auto auto;
  }
  .card-price-panel {
    grid-column: 1 / -1;
    text-align: left;
    border-top: 1px solid var(--color-border);
    padding-top: 12px;
    margin-top: 4px;
  }
  .card-image, .card-image-placeholder { width: 72px; height: 72px; }
  .header-inner { gap: 12px; }
  .logo-text { font-size: 15px; }
  .logo-sub { display: none; }
}

@media (max-width: 480px) {
  .product-card { grid-template-columns: 1fr; }
  .card-image, .card-image-placeholder { display: none; }
}
