/* ============================================================
   Catálogo público — paleta roja Servillantas
   Mobile-first, ligero, sin frameworks
   ============================================================ */
:root {
  --brand: #e53935;
  --brand-dark: #c62828;
  --brand-soft: #fde6e7;
  --text: #2a2a2e;
  --text-muted: #7a7a82;
  --surface: #ffffff;
  --bg: #f5f5f7;
  --border: #e2e2e5;
  --border-soft: #ededef;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --radius: 8px;
  --radius-sm: 6px;
  --whatsapp: #25d366;
  --whatsapp-dark: #1ebe57;
}

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

body {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ============ Top bar ============ */
.topbar {
  background: var(--brand);
  color: white;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
}
.brand-mark { font-size: 22px; }
.quote-button {
  position: relative;
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background .15s;
}
.quote-button:hover { background: rgba(255,255,255,0.25); }
.quote-icon { font-size: 18px; }
.quote-count {
  background: white;
  color: var(--brand);
  font-weight: 700;
  font-size: 12px;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}

/* ============ Hero ============ */
.hero {
  background: white;
  padding: 32px 0 24px;
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}
.hero-sub {
  margin-top: 6px;
  color: var(--text-muted);
}

/* ============ Filtros ============ */
.filters {
  background: white;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 56px;
  z-index: 40;
}
.filter-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 130px;
}
.filter-search { flex: 1; min-width: 220px; }
.filter-field label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.filter-field input,
.filter-field select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.filter-field input:focus,
.filter-field select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.clear-button {
  padding: 10px 16px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  height: fit-content;
  align-self: flex-end;
}
.clear-button:hover { background: var(--bg); }
.result-count {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ============ Catálogo grid ============ */
.catalog {
  padding: 24px 0 80px;
}
.tire-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.tire-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.tire-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: #d0d0d4;
}
.tire-card .badge-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.badge-rim { background: var(--brand-soft); color: var(--brand-dark); }
.badge-ref { background: var(--bg); color: var(--text-muted); }
.badge-commercial { background: #fff4d6; color: #8a6500; }
.tire-card .desc {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.35;
}
.tire-card .brand-text {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.3px;
}
.tire-card .price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed var(--border-soft);
}
.tire-card .price {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.tire-card button {
  background: var(--brand);
  color: white;
  border: none;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: background .12s;
}
.tire-card button:hover { background: var(--brand-dark); }
.tire-card button.added {
  background: #e0e0e0;
  color: var(--text-muted);
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 20px;
  font-size: 16px;
}

/* ============ Modal cotización ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* Cuando lleva el atributo HTML hidden, queda oculto realmente.
   Por defecto el `display: flex` de arriba sobreescribiria al hidden,
   por eso necesitamos esta regla explicita. */
.modal[hidden] {
  display: none !important;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  animation: fade-in .15s;
}
.modal-panel {
  position: relative;
  background: white;
  width: min(540px, 92vw);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: pop-in .18s;
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.95); } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 18px; }
.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
}
.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}
.quote-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.quote-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  transition: border-color .12s;
}
.quote-item:hover { border-color: var(--border); }
.quote-item-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.quote-item-desc {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}
.quote-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
}
.quote-tag {
  background: white;
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--brand-dark);
}
.quote-item-price {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
.quote-item-price .muted { color: var(--text-muted); font-weight: 400; }
.quote-item-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.quote-qty {
  display: inline-flex;
  align-items: center;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.quote-qty button {
  width: 30px;
  height: 30px;
  border: none;
  background: white;
  cursor: pointer;
  font-weight: 700;
  font-size: 16px;
  color: var(--text);
  transition: background .12s;
}
.quote-qty button:hover { background: var(--bg); }
.quote-qty input {
  width: 42px;
  text-align: center;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 4px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  background: white;
  outline: none;
  /* Quitar las flechitas de spinner */
  -moz-appearance: textfield;
}
.quote-qty input::-webkit-outer-spin-button,
.quote-qty input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.quote-subtotal {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  text-align: right;
}
.quote-remove {
  background: white;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .12s;
}
/* SVGs dentro de botones del modal no deben recibir clicks (los hereda el button) */
.quote-remove svg,
.quote-button svg,
.modal-close svg { pointer-events: none; }
.quote-remove:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}
.quote-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.empty-cart-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.quote-empty small { color: var(--text-muted); font-size: 12px; }
.quote-summary {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}
.quote-units { font-weight: 600; }
.quote-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding: 12px 14px;
  background: var(--brand-soft);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-dark);
}
.quote-total strong {
  font-size: 24px;
  color: var(--brand-dark);
}
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.modal-footer button {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.modal-footer .secondary {
  background: white;
  border: 1px solid var(--border);
  color: var(--text);
}
.modal-footer .primary {
  background: var(--whatsapp);
  color: white;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-footer .primary:hover { background: var(--whatsapp-dark); }
.modal-footer .primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============ Footer ============ */
.site-footer {
  background: white;
  border-top: 1px solid var(--border);
  padding: 16px 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ============ Mobile ============ */
@media (max-width: 640px) {
  .hero { padding: 20px 0 16px; }
  .hero h1 { font-size: 22px; }
  .filter-row { gap: 8px; }
  .filter-field { min-width: 100%; }
  .filter-search { min-width: 100%; }
  .clear-button { width: 100%; }
  .tire-grid { grid-template-columns: 1fr; }
  .filters { position: static; }
}
