/* ═══════════════════════════════════════════════════════════════
   Car Recommender — Estilos frontend
   ═══════════════════════════════════════════════════════════════ */

:root {
  --cr-primary:      #2563eb;
  --cr-primary-dark: #1d4ed8;
  --cr-primary-light:#eff6ff;
  --cr-accent:       #f59e0b;
  --cr-success:      #10b981;
  --cr-error:        #ef4444;
  --cr-bg:           #f8fafc;
  --cr-surface:      #ffffff;
  --cr-border:       #e2e8f0;
  --cr-text:         #1e293b;
  --cr-text-muted:   #64748b;
  --cr-radius:       12px;
  --cr-radius-sm:    8px;
  --cr-shadow:       0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --cr-shadow-lg:    0 4px 6px rgba(0,0,0,.07), 0 10px 40px rgba(0,0,0,.1);
}

/* ── Contenedor principal ──────────────────────────────────────── */
.cr-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  max-width: 860px;
  margin: 2rem auto;
  color: var(--cr-text);
  line-height: 1.5;
}

.cr-wrap * { box-sizing: border-box; }

/* ── Header ───────────────────────────────────────────────────── */
.cr-header {
  text-align: center;
  margin-bottom: 2rem;
}

.cr-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 .5rem;
  color: var(--cr-text);
}

.cr-subtitle {
  color: var(--cr-text-muted);
  margin: 0;
  font-size: .95rem;
}

/* ── Formulario de filtros ─────────────────────────────────────── */
.cr-filters {
  background: var(--cr-surface);
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  padding: 2rem;
  box-shadow: var(--cr-shadow);
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.cr-filter-label {
  display: block;
  font-weight: 600;
  font-size: .875rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--cr-text-muted);
  margin-bottom: .75rem;
}

/* ── Opciones (botones de selección) ──────────────────────────── */
.cr-options {
  display: flex;
  flex-wrap: wrap;
  gap: .625rem;
}

.cr-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  padding: .875rem 1.25rem;
  background: var(--cr-bg);
  border: 2px solid var(--cr-border);
  border-radius: var(--cr-radius-sm);
  cursor: pointer;
  transition: all .18s ease;
  min-width: 120px;
  flex: 1;
  font-family: inherit;
  color: var(--cr-text);
}

.cr-option:hover {
  border-color: var(--cr-primary);
  background: var(--cr-primary-light);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, .15);
}

.cr-option--active {
  border-color: var(--cr-primary);
  background: var(--cr-primary-light);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .2);
}

.cr-option-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.cr-option-text {
  font-weight: 600;
  font-size: .9rem;
}

.cr-option-desc {
  font-size: .75rem;
  color: var(--cr-text-muted);
}

.cr-options--wide .cr-option {
  flex-direction: row;
  justify-content: flex-start;
  gap: .625rem;
  min-width: auto;
  flex: 1 1 calc(50% - .5rem);
}

.cr-options--wide .cr-option-icon {
  font-size: 1.1rem;
  width: 1.5rem;
  text-align: center;
}

/* ── Botones de acción ─────────────────────────────────────────── */
.cr-actions {
  display: flex;
  gap: .75rem;
  align-items: center;
  flex-wrap: wrap;
}

.cr-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .75rem 1.75rem;
  border-radius: var(--cr-radius-sm);
  font-family: inherit;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .18s ease;
  text-decoration: none;
}

.cr-btn--primary {
  background: var(--cr-primary);
  color: #fff;
  border-color: var(--cr-primary);
}

.cr-btn--primary:hover:not(:disabled) {
  background: var(--cr-primary-dark);
  border-color: var(--cr-primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37, 99, 235, .35);
}

.cr-btn--primary:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.cr-btn--secondary {
  background: transparent;
  color: var(--cr-text-muted);
  border-color: var(--cr-border);
}

.cr-btn--secondary:hover {
  border-color: var(--cr-text-muted);
  color: var(--cr-text);
}

/* ── Resultados ────────────────────────────────────────────────── */
.cr-results {
  margin-top: 2.5rem;
}

.cr-results-header {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: 1.25rem;
}

.cr-results-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
}

.cr-count {
  font-size: .85rem;
  color: var(--cr-text-muted);
  background: var(--cr-bg);
  border: 1px solid var(--cr-border);
  padding: .2rem .625rem;
  border-radius: 999px;
}

/* ── Grid de tarjetas ─────────────────────────────────────────── */
.cr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}

/* ── Tarjeta individual ───────────────────────────────────────── */
.cr-card {
  background: var(--cr-surface);
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius);
  box-shadow: var(--cr-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
}

.cr-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--cr-shadow-lg);
}

.cr-card-body {
  padding: 1.25rem;
  flex: 1;
}

.cr-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 .75rem;
  color: var(--cr-text);
}

.cr-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-bottom: .875rem;
}

.cr-tag {
  font-size: .7rem;
  font-weight: 600;
  padding: .2rem .5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.cr-tag--size   { background: #e0e7ff; color: #3730a3; }
.cr-tag--format { background: #fef3c7; color: #92400e; }
.cr-tag--auto   { background: #d1fae5; color: #065f46; }

.cr-card-price {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--cr-primary);
}

.cr-card-footer {
  padding: .875rem 1.25rem;
  background: var(--cr-bg);
  border-top: 1px solid var(--cr-border);
}

.cr-card-link {
  display: block;
  text-align: center;
  color: var(--cr-primary);
  font-weight: 600;
  font-size: .9rem;
  text-decoration: none;
  transition: color .15s;
}

.cr-card-link:hover {
  color: var(--cr-primary-dark);
  text-decoration: underline;
}

/* ── Estados vacío / error / carga ────────────────────────────── */
.cr-empty, .cr-error, .cr-loading {
  margin-top: 2rem;
  text-align: center;
  padding: 2.5rem 1.5rem;
  border-radius: var(--cr-radius);
}

.cr-empty {
  background: var(--cr-bg);
  border: 1px dashed var(--cr-border);
}

.cr-empty-icon { font-size: 2.5rem; display: block; margin-bottom: .5rem; }
.cr-empty-sub  { color: var(--cr-text-muted); font-size: .9rem; margin: .25rem 0 0; }

.cr-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--cr-error);
  font-weight: 600;
}

.cr-loading {
  background: var(--cr-bg);
  color: var(--cr-text-muted);
}

.cr-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--cr-border);
  border-top-color: var(--cr-primary);
  border-radius: 50%;
  animation: cr-spin .7s linear infinite;
  margin: 0 auto .75rem;
}

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

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 600px) {
  .cr-filters { padding: 1.25rem; gap: 1.25rem; }

  .cr-option { min-width: 90px; padding: .75rem .75rem; }
  .cr-option-desc { display: none; }

  .cr-options--wide .cr-option { flex: 1 1 100%; }

  .cr-actions { flex-direction: column; align-items: stretch; }
  .cr-btn { justify-content: center; }

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