/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0a;
  --bg2: #111111;
  --bg3: #1a1a1a;
  --border: #2a2a2a;
  --accent: #f59e0b;
  --accent2: #fbbf24;
  --text: #f0f0f0;
  --text2: #a0a0a0;
  --text3: #606060;
  --green: #10b981;
  --red: #ef4444;
  --blue: #3b82f6;
  --radius: 12px;
  --radius-sm: 8px;
  --header-h: 57px;
  --filter-h: 57px;
}

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── Header ── */
.site-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(10,10,10,0.97);
  backdrop-filter: blur(12px);
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.5px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Header search */
.header-search-form {
  flex: 1;
  max-width: 540px;
}

.header-search-box {
  display: flex;
  align-items: center;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0 6px 0 12px;
  height: 38px;
  gap: 8px;
  transition: border-color 0.2s;
}

.header-search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(245,158,11,0.1);
}

.header-search-icon {
  color: var(--text3);
  flex-shrink: 0;
}

.header-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  min-width: 0;
}

.header-search-input::placeholder { color: var(--text3); }

.header-search-btn {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 7px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  height: 28px;
  line-height: 1;
}

.header-search-btn:hover { background: var(--accent2); }

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Dollar badge */
.dollar-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.82rem;
  white-space: nowrap;
}

.dollar-label { color: var(--text2); }
.dollar-value { color: var(--accent); font-weight: 700; }

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  gap: 10px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  background: var(--bg2);
  position: sticky;
  top: var(--header-h);
  z-index: 90;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
}

.filter-group-inline {
  gap: 6px;
}

.filter-select,
.filter-input {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 0.83rem;
  font-family: inherit;
  transition: border-color 0.15s;
  height: 34px;
}

.filter-select {
  padding-right: 28px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23606060' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.filter-select:focus,
.filter-input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px rgba(245,158,11,0.1);
}

.filter-input-year {
  width: 96px;
}

.filter-input-price {
  width: 100px;
}

.filter-sep {
  color: var(--text3);
  font-size: 0.85rem;
}

/* Condition pills */
.condition-pills {
  display: flex;
  gap: 4px;
}

.condition-pill {
  padding: 6px 13px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text2);
  cursor: pointer;
  font-size: 0.82rem;
  font-family: inherit;
  transition: all 0.15s;
  height: 34px;
  white-space: nowrap;
}

.condition-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.condition-pill.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: 600;
}

/* Reset & mobile toggle */
.filter-reset-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text3);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.8rem;
  font-family: inherit;
  cursor: pointer;
  height: 34px;
  transition: all 0.15s;
}

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

.filter-mobile-toggle {
  display: none;
  align-items: center;
  gap: 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 0.83rem;
  font-family: inherit;
  cursor: pointer;
  height: 34px;
  position: relative;
}

.filter-count-badge {
  background: var(--accent);
  color: #000;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}

/* ── Main Content ── */
.main-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 20px 80px;
}

/* Results meta (contador) */
.results-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 16px;
}

.results-count {
  font-size: 0.9rem;
  color: var(--text2);
  font-weight: 500;
}

.results-query {
  font-size: 0.9rem;
  color: var(--text3);
}

/* ── Stats Bar ── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.stat {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent);
}

/* ── Analysis Box ── */
.analysis-box {
  background: linear-gradient(135deg, rgba(245,158,11,0.05), rgba(251,191,36,0.03));
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 20px;
}

.analysis-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.analysis-icon { font-size: 1rem; }
.analysis-title { font-weight: 600; font-size: 0.9rem; }

.analysis-badge {
  background: rgba(245,158,11,0.15);
  color: var(--accent);
  border: 1px solid rgba(245,158,11,0.3);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  margin-left: auto;
}

.analysis-text {
  color: var(--text2);
  font-size: 0.9rem;
  line-height: 1.7;
}

/* ── Skeleton Cards ── */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg3) 25%,
    rgba(60,60,60,0.5) 50%,
    var(--bg3) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

.skeleton-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.skeleton-img {
  height: 196px;
  width: 100%;
}

.skeleton-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skeleton-title { height: 15px; width: 85%; }
.skeleton-title-2 { height: 15px; width: 60%; }
.skeleton-price { height: 28px; width: 45%; }
.skeleton-ars { height: 12px; width: 35%; }
.skeleton-meta { height: 24px; width: 70%; border-radius: 6px; }
.skeleton-loc { height: 11px; width: 55%; margin-top: 6px; }

/* ── Cars Grid ── */
.cars-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}

/* ── Car Card ── */
.car-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.car-card:hover {
  border-color: rgba(245,158,11,0.4);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.car-image-wrap {
  position: relative;
  overflow: hidden;
}

.car-image {
  width: 100%;
  height: 196px;
  object-fit: cover;
  background: var(--bg3);
  display: block;
  transition: transform 0.3s;
}

.car-card:hover .car-image {
  transform: scale(1.03);
}

.car-image-placeholder {
  width: 100%;
  height: 196px;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
}

/* Badges sobre la imagen */
.car-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.badge-justo {
  background: rgba(16,185,129,0.92);
  color: #fff;
}

.badge-caro {
  background: rgba(239,68,68,0.92);
  color: #fff;
}

.badge-condition {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.badge-new {
  background: rgba(16,185,129,0.15);
  color: var(--green);
  border: 1px solid rgba(16,185,129,0.4);
}

.badge-used {
  background: rgba(60,60,60,0.8);
  color: var(--text2);
  border: 1px solid var(--border);
}

/* Badge oferta del día */
.badge-oferta {
  background: linear-gradient(135deg, rgba(239,68,68,0.9), rgba(220,38,38,0.9));
  color: #fff;
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.4); }
  50% { box-shadow: 0 0 0 4px rgba(239,68,68,0); }
}

/* Source badges */
.source-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.source-ml {
  background: rgba(245,158,11,0.12);
  color: var(--accent);
  border: 1px solid rgba(245,158,11,0.25);
}

.source-kavak {
  background: rgba(59,130,246,0.12);
  color: var(--blue);
  border: 1px solid rgba(59,130,246,0.25);
}

/* Card body */
.car-body {
  padding: 14px 16px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.car-year-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.car-year {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: 5px;
  padding: 2px 7px;
  white-space: nowrap;
  flex-shrink: 0;
}

.car-title {
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.car-price-usd {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.car-price-ars {
  font-size: 0.82rem;
  color: var(--text2);
}

.car-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.car-tag {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 9px;
  font-size: 0.76rem;
  color: var(--text2);
}

.car-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  gap: 8px;
}

.car-location {
  font-size: 0.78rem;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.car-cta-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  text-decoration: none;
  display: inline-block;
}

.car-cta-btn:hover {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

/* ── No Results ── */
.no-results {
  text-align: center;
  padding: 80px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.no-results-emoji {
  font-size: 3rem;
  margin-bottom: 8px;
}

.no-results h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.no-results p {
  color: var(--text2);
  font-size: 0.95rem;
}

.popular-suggestions {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.suggestions-label {
  font-size: 0.85rem;
  color: var(--text3);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.chip {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.83rem;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(245,158,11,0.05);
}

/* ── Price bar (precio vs mercado) ── */
.price-bar-wrap {
  height: 3px;
  background: var(--bg3);
  border-radius: 2px;
  overflow: hidden;
  margin: 4px 0 2px;
}
.price-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
  min-width: 4px;
}

/* ── Score badge ── */
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: 800;
  margin-bottom: 6px;
}
.score-high {
  background: rgba(16,185,129,0.15);
  color: var(--green);
  border: 1.5px solid rgba(16,185,129,0.35);
}
.score-med {
  background: rgba(245,158,11,0.15);
  color: var(--accent);
  border: 1.5px solid rgba(245,158,11,0.35);
}

/* ── Share button en card ── */
.car-share-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text3);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex; align-items: center; justify-content: center;
}
.car-share-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Fav button en card ── */
.fav-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.6);
  color: rgba(255,255,255,0.5);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
  backdrop-filter: blur(4px);
  padding: 0; line-height: 1;
}
.fav-btn:hover { color: #ef4444; border-color: #ef4444; }
.fav-btn.fav-active { color: #ef4444; border-color: #ef4444; background: rgba(239,68,68,0.15); }

/* ── Badge bajada de precio ── */
.price-drop-badge {
  display: inline-block;
  background: rgba(16,185,129,0.15);
  color: var(--green);
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 0.72rem;
  font-weight: 700;
  margin-left: 8px;
  white-space: nowrap;
}

/* ── Botón comparar en card ── */
.car-compare-btn {
  position: absolute;
  bottom: 10px;
  left: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.6);
  color: rgba(255,255,255,0.7);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  backdrop-filter: blur(4px);
  padding: 0;
  line-height: 1;
}
.car-compare-btn:hover,
.car-compare-btn.compare-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}

/* ── Barra comparador fija ── */
.compare-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: rgba(17,17,17,0.97);
  border-top: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 200;
  backdrop-filter: blur(12px);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.5);
}
.compare-bar-thumbs { display: flex; gap: 6px; }
.compare-thumb {
  width: 44px; height: 44px;
  border-radius: 8px; object-fit: cover;
  border: 2px solid var(--accent);
}
.compare-thumb-placeholder {
  width: 44px; height: 44px;
  border-radius: 8px;
  background: var(--bg3);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  border: 2px solid var(--accent);
}
.compare-bar-label { font-size: 0.88rem; color: var(--text2); flex: 1; }
.compare-bar-btn {
  background: var(--accent); color: #000;
  border: none; border-radius: 8px;
  padding: 10px 20px; font-size: 0.9rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: background 0.15s;
}
.compare-bar-btn:hover { background: var(--accent2); }
.compare-bar-clear {
  background: transparent;
  border: 1px solid var(--border); color: var(--text3);
  border-radius: 50%; width: 32px; height: 32px;
  cursor: pointer; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0;
}
.compare-bar-clear:hover { border-color: var(--red); color: var(--red); }

/* ── Modal Comparador ── */
.comparador-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 300;
  align-items: center; justify-content: center;
  padding: 16px; overflow-y: auto;
}
.comparador-content {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%; max-width: 960px;
  max-height: 90vh; overflow-y: auto;
  position: relative;
}
.comparador-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg2); z-index: 1;
}
.comparador-title { font-size: 1.1rem; font-weight: 700; }
.comparador-close {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); border-radius: 50%;
  width: 32px; height: 32px; cursor: pointer; font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.comparador-close:hover { border-color: var(--red); color: var(--red); }
.comparador-body { overflow-x: auto; min-height: 200px; }

/* ── Load more button ── */
.load-more-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 20px;
  padding: 10px 28px;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.load-more-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Footer ── */
.site-footer {
  text-align: center;
  padding: 36px 24px;
  border-top: 1px solid var(--border);
  color: var(--text3);
  font-size: 0.82rem;
}

.site-footer a { color: var(--text2); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* ── Responsive Mobile ── */
@media (max-width: 680px) {
  .header-search-form {
    display: none; /* el search se muestra debajo en mobile */
  }

  .logo {
    font-size: 1rem;
  }

  .dollar-badge .dollar-label {
    display: none;
  }

  /* Filter bar: solo mostrar toggle en mobile */
  .filter-bar {
    padding: 10px 16px;
    gap: 8px;
    flex-wrap: wrap;
  }

  .filter-bar .filter-group,
  .filter-bar .filter-group-inline,
  .filter-bar .filter-reset-btn {
    display: none;
  }

  .filter-bar.mobile-open .filter-group,
  .filter-bar.mobile-open .filter-group-inline,
  .filter-bar.mobile-open .filter-reset-btn {
    display: flex;
  }

  .filter-mobile-toggle {
    display: flex;
  }

  /* Cuando los filtros están abiertos en mobile, mostrar en columna */
  .filter-bar.mobile-open {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar.mobile-open .filter-group {
    width: 100%;
  }

  .filter-bar.mobile-open .filter-select {
    width: 100%;
  }

  .filter-bar.mobile-open .filter-input-year,
  .filter-bar.mobile-open .filter-input-price {
    flex: 1;
    min-width: 0;
  }

  .filter-bar.mobile-open .filter-mobile-toggle {
    display: flex;
  }

  /* Search bar dedicada en mobile */
  .mobile-search-bar {
    display: block;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg2);
  }

  .mobile-search-bar .header-search-box {
    width: 100%;
    height: 42px;
  }

  .cars-grid {
    grid-template-columns: 1fr;
  }

  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
  }

  .main-content {
    padding: 16px 16px 60px;
  }

  .car-image,
  .car-image-placeholder,
  .skeleton-img {
    height: 200px;
  }
}

@media (min-width: 681px) {
  .mobile-search-bar {
    display: none;
  }
}

@media (max-width: 1024px) {
  .filter-input-price {
    width: 88px;
  }
  .filter-input-year {
    width: 82px;
  }
}

/* ── Toggle filter (checkbox) ── */
.filter-toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 6px 12px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.83rem;
  color: var(--text2);
  transition: all 0.15s;
  white-space: nowrap;
  user-select: none;
}
.filter-toggle-label:has(.filter-toggle-input:checked) {
  border-color: var(--green);
  color: var(--green);
  background: rgba(16,185,129,0.08);
}
.filter-toggle-input {
  display: none;
}
.filter-toggle-text { font-weight: 500; }

/* ── Related models section ── */
.related-models {
  margin-top: 24px;
  padding: 18px 20px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.related-models-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

/* ── Year breakdown chart ── */
.year-breakdown {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.year-breakdown-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}
.year-breakdown-bars {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  height: 60px;
  overflow-x: auto;
}
.year-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 44px;
  flex: 1;
  cursor: pointer;
}
.year-bar {
  width: 100%;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  transition: background 0.15s;
  min-height: 4px;
}
.year-bar-wrap:hover .year-bar { background: var(--accent2); }
.year-bar-label {
  font-size: 0.65rem;
  color: var(--text3);
  font-weight: 600;
  white-space: nowrap;
}
.year-bar-price {
  font-size: 0.6rem;
  color: var(--text2);
  white-space: nowrap;
}

/* ── Search autocomplete ── */
.search-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  z-index: 500;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.suggestion-item {
  padding: 10px 16px;
  font-size: 0.88rem;
  cursor: pointer;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.1s;
}
.suggestion-item:hover,
.suggestion-item.active {
  background: var(--bg3);
  color: var(--accent);
}
.suggestion-icon { color: var(--text3); font-size: 0.75rem; }

/* ── Oportunidades del día ── */
.oportunidades {
  margin-bottom: 28px;
  padding: 20px;
  background: linear-gradient(135deg, rgba(245,158,11,0.06) 0%, rgba(251,191,36,0.03) 100%);
  border: 1px solid rgba(245,158,11,0.2);
  border-radius: var(--radius);
}
.oportunidades-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.oportunidades-icon { font-size: 1.1rem; }
.oportunidades-title {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}
.oportunidades-sub {
  font-size: 0.78rem;
  color: var(--text3);
  margin-left: 4px;
}
.oportunidades-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

/* ── Alerta trigger button (results meta) ── */
.alerta-trigger-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 4px;
  font-family: inherit;
  margin-left: auto;
  flex-shrink: 0;
}
.alerta-trigger-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── Hero banner (home only) ── */
.hero-banner {
  padding: 32px 0 12px;
  display: none; /* shown via JS when featured */
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.hero-banner.visible { display: block; }
.hero-title {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 8px;
}
.hero-subtitle {
  font-size: 0.95rem;
  color: var(--text2);
  max-width: 600px;
}
.hero-stats {
  display: flex;
  gap: 32px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.hero-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hero-stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}
.hero-stat-label {
  font-size: 0.75rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
@media (max-width: 680px) {
  .hero-title { font-size: 1.3rem; }
  .hero-stats { gap: 20px; }
  .hero-stat-value { font-size: 1.2rem; }
}

/* ── Popular searches (home) ── */
.popular-searches {
  padding: 20px 0 4px;
  display: none; /* shown via JS when featured */
}
.popular-searches.visible { display: block; }
.popular-title {
  font-size: 0.82rem;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 10px;
}
.popular-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pop-chip {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.83rem;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.pop-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(245,158,11,0.06);
}

/* ── Footer links ── */
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: center;
  margin-bottom: 4px;
}
.footer-links a {
  font-size: 0.82rem;
  color: var(--text3);
  text-decoration: none;
}
.footer-links a:hover { color: var(--accent); }

/* ── Scroll to top ── */
.scroll-top-btn {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  border: none;
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  z-index: 190;
  box-shadow: 0 4px 16px rgba(245,158,11,0.4);
  transition: transform 0.15s, opacity 0.15s;
}
.scroll-top-btn:hover { transform: translateY(-2px); }

/* ── Inventory count in header ── */
.inventory-count {
  font-size: 0.75rem;
  color: var(--text3);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 10px;
  white-space: nowrap;
  flex-shrink: 0;
}
@media (max-width: 480px) {
  .inventory-count { display: none !important; }
}

/* ── Fav button in header ── */
.fav-header-btn {
  position: relative;
  background: none;
  border: 1px solid var(--border);
  color: var(--text2);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s;
  display: flex; align-items: center; gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.fav-header-btn:hover { border-color: var(--accent); color: var(--accent); }

.fav-header-badge {
  background: var(--accent);
  color: #000;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  align-items: center; justify-content: center;
}

/* ── Modal genérico (fav + alertas) ── */
.fav-modal,
.alerta-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 400;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 16px;
  overflow-y: auto;
}

.fav-modal-content,
.alerta-modal-content {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 1200px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.alerta-modal-content {
  max-width: 460px;
}

.fav-modal-header,
.alerta-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  background: var(--bg2); z-index: 1;
}

.fav-modal-title,
.alerta-modal-title {
  font-size: 1.1rem; font-weight: 700;
}

.fav-modal-close,
.alerta-modal-close {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); border-radius: 50%;
  width: 32px; height: 32px; cursor: pointer; font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.fav-modal-close:hover,
.alerta-modal-close:hover { border-color: var(--red); color: var(--red); }

.fav-modal-body {
  padding: 20px 22px 28px;
}

.alerta-modal-body {
  padding: 22px;
}

/* ── Alerta form ── */
.alerta-form {
  display: flex; flex-direction: column; gap: 12px;
}
.alerta-label {
  font-size: 0.85rem; font-weight: 600; color: var(--text2);
}
.alerta-input {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s;
  width: 100%;
}
.alerta-input:focus {
  outline: none;
  border-color: var(--accent);
}
.alerta-submit {
  background: var(--accent); color: #000;
  border: none; border-radius: var(--radius-sm);
  padding: 12px; font-size: 0.95rem; font-weight: 700;
  cursor: pointer; font-family: inherit;
  transition: background 0.15s; margin-top: 4px;
}
.alerta-submit:hover { background: var(--accent2); }

/* ── Mobile search bar (visible en ≤680px) ── */
.mobile-search-bar {
  display: none;
}
@media (max-width: 680px) {
  .mobile-search-bar {
    display: flex;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
  }
  .mobile-search-bar .header-search-box {
    width: 100%;
    height: 42px;
  }
  .mobile-search-bar .header-search-input {
    font-size: 1rem;
  }
}
