:root {
  --bg: #f4f5f7;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --border: #e2e5ea;
  --border-strong: #cfd4dc;
  --text: #1a1d21;
  --text-muted: #5c6670;
  --accent: #e30613;
  --accent-hover: #c10510;
  --accent-soft: rgba(227, 6, 19, 0.08);
  --header-bg: #e30613;
  --header-text: #ffffff;
  --protect: #6b4eff;
  --agm: #0d9b8c;
  --standard: #1a7ab8;
  --whatsapp: #25d366;
  --whatsapp-hover: #1ebe57;
  --danger: #c62828;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(26, 29, 33, 0.08);
  --shadow-sm: 0 2px 8px rgba(26, 29, 33, 0.06);
  --font: "DM Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

.container {
  width: min(960px, calc(100% - 2rem));
  margin-inline: auto;
}

/* —— Header bar (red) —— */
.site-header {
  background: var(--header-bg);
  color: var(--header-text);
  padding: 0.9rem 0;
  box-shadow: 0 2px 10px rgba(227, 6, 19, 0.25);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.brand-mark {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

.wordmark {
  margin: 0;
  font-size: clamp(1.15rem, 3vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--header-text);
}

/* —— Hero strip —— */
.hero {
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  padding: 1.35rem 0 1.15rem;
}

.hero-text {
  margin: 0;
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.hero-text::after {
  content: "";
  display: block;
  width: 48px;
  height: 3px;
  margin-top: 0.55rem;
  background: var(--accent);
  border-radius: 2px;
}

main { padding: 1.5rem 0 3rem; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.45rem;
  margin-bottom: 1.15rem;
  box-shadow: var(--shadow);
}

.filters-card {
  border-top: 3px solid var(--accent);
}

.card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.12rem;
  color: var(--text);
}

.hint {
  margin: 0 0 1.15rem;
  color: var(--text-muted);
  font-size: 0.92rem;
}
.hint.small { margin: 0.5rem 0 0; font-size: 0.85rem; }

.filters-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (min-width: 720px) {
  .filters-grid { grid-template-columns: repeat(4, 1fr); }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.field select,
.search-row input {
  appearance: none;
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0.72rem 0.85rem;
  font: inherit;
  font-weight: 500;
  font-size: 0.95rem;
  text-transform: none;
  letter-spacing: normal;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field select:focus,
.search-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f0f1f3;
}

.filters-actions {
  margin-top: 1.15rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.search-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.search-row input { flex: 1 1 200px; }

.btn {
  border: none;
  border-radius: 8px;
  padding: 0.7rem 1.15rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, opacity 0.15s, border-color 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--accent);
  border-color: var(--accent);
}

.btn-secondary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-whatsapp {
  background: var(--whatsapp);
  color: #06280f;
  font-weight: 700;
  padding: 0.8rem 1.3rem;
}
.btn-whatsapp:hover:not(:disabled) {
  background: var(--whatsapp-hover);
}

.results-section { margin-bottom: 1.1rem; }

.results-header {
  margin-bottom: 0.9rem;
}
.results-header h2 { margin: 0 0 0.25rem; font-size: 1.15rem; }
.vehicle-summary {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.results-list {
  display: grid;
  gap: 0.75rem;
}

.battery-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.05rem 1.15rem;
  display: grid;
  gap: 0.55rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}
.battery-card:hover {
  border-color: rgba(227, 6, 19, 0.4);
}
.battery-card.selected {
  border-color: var(--accent);
  border-width: 2px;
  padding: calc(1.05rem - 1px) calc(1.15rem - 1px);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-sm);
}
.battery-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.battery-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.battery-sku {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--text);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-protect { background: rgba(107, 78, 255, 0.12); color: #4a32c8; }
.badge-agm { background: rgba(13, 155, 140, 0.12); color: #087a6e; }
.badge-standard { background: rgba(26, 122, 184, 0.12); color: #0f5f94; }

.battery-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.battery-meta strong { color: var(--text); font-weight: 600; }

.option-tag {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
}

.price-line {
  font-size: 0.9rem;
  color: var(--text-muted);
}
.price-line .price-value {
  color: var(--accent);
  font-weight: 700;
}

.quote-bar {
  position: sticky;
  bottom: 0.75rem;
  margin-top: 1rem;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.quote-info { font-size: 0.92rem; color: var(--text-muted); }
.quote-info strong { color: var(--text); }
#selected-label { color: var(--accent); font-weight: 600; }

.note-card {
  background: transparent;
  box-shadow: none;
  border-style: dashed;
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 1rem 1.2rem;
}
.note-card p { margin: 0; }

.site-footer {
  padding: 1.5rem 0 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  border-top: 1px solid var(--border);
  background: #fff;
}

.empty-state {
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

.loading {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 0.5rem 0;
}

/* —— Floating chat assistant —— */
.chat-widget {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1000;
  font-family: var(--font);
}

.chat-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.1rem;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(227, 6, 19, 0.35);
  transition: background 0.15s, transform 0.1s;
}
.chat-toggle:hover { background: var(--accent-hover); }
.chat-toggle:active { transform: scale(0.98); }
.chat-toggle-icon { font-size: 1.15rem; line-height: 1; }

.chat-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.65rem);
  width: min(360px, calc(100vw - 2rem));
  max-height: min(480px, calc(100vh - 6rem));
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(26, 29, 33, 0.18);
  overflow: hidden;
}
.chat-panel[hidden] { display: none !important; }

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  background: var(--accent);
  color: #fff;
}
.chat-header strong {
  display: block;
  font-size: 0.98rem;
}
.chat-subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.78rem;
  opacity: 0.9;
  font-weight: 500;
}
.chat-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.chat-close:hover { background: rgba(255, 255, 255, 0.35); }

.chat-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  background: #f7f8fa;
  min-height: 180px;
}

.chat-bubble {
  max-width: 92%;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-bubble.bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}
.chat-bubble.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-bubble .sku-list {
  margin: 0.45rem 0 0;
  padding-left: 1.1rem;
}
.chat-bubble .sku-list li { margin: 0.2rem 0; }
.chat-bubble .sku-list strong { color: var(--accent); }
.chat-bubble.bot .sku-list strong { color: var(--accent); }

.chat-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}
.chat-choice {
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
}
.chat-choice:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chat-form {
  display: flex;
  gap: 0.4rem;
  padding: 0.65rem 0.75rem;
  border-top: 1px solid var(--border);
  background: #fff;
}
.chat-form input {
  flex: 1 1 auto;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  font: inherit;
  font-size: 0.88rem;
  min-width: 0;
}
.chat-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.chat-send {
  padding: 0.6rem 0.85rem;
  font-size: 0.85rem;
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .chat-widget {
    right: 0.65rem;
    bottom: 0.65rem;
  }
  .chat-toggle-label { display: none; }
  .chat-toggle { padding: 0.85rem; border-radius: 50%; }
  .chat-panel {
    width: calc(100vw - 1.3rem);
    max-height: min(70vh, 520px);
  }
  /* Keep sticky quote bar from fighting the FAB */
  .quote-bar { bottom: 4.5rem; }
}


.chat-wa-wrap {
  display: flex;
  justify-content: stretch;
  padding: 0.15rem 0 0.35rem;
}
.chat-wa-btn {
  width: 100%;
  font-size: 0.92rem;
  padding: 0.75rem 1rem;
}
