/* ==========================================================
   CATALOG - catalog.css
   ========================================================== */

/* ── Filter Bar ────────────────────────────────────────── */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: clamp(16px, 2vw, 24px) clamp(20px, 2.5vw, 32px);
  border-radius: var(--radius-sm);
  margin-bottom: clamp(28px, 3vw, 40px);
}

.fg {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.fg label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
}

.fg select,
.fg input {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius-xs);
  padding: 9px 14px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
}

.fg select:hover, .fg select:focus,
.fg input:hover, .fg input:focus {
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
}

.fg select option { background: var(--bg2); }

.fg.grow { flex: 1; min-width: 180px; }

.fg.grow input { width: 100%; }

/* Segmented Control */
.seg {
  display: flex;
  gap: 4px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-xs);
  padding: 3px;
}

.seg button {
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.55);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.seg button.on {
  background: rgba(255,255,255,0.16);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.seg .d {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.seg button[data-v="electric"] .d { background: #22c55e; }
.seg button[data-v="hybrid"]  .d  { background: #f59e0b; }

/* Filter loading spinner */
.filters-loading {
  position: relative;
}

.filters-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: translateY(-50%) rotate(360deg); } }

/* ── Vehicle Grid ──────────────────────────────────────── */
.gc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

/* ── Vehicle Card ──────────────────────────────────────── */
.gc-card {
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease);
}

.gc-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 24px 60px -16px rgba(0,0,0,0.5);
}

/* ── Card Media ────────────────────────────────────────── */
.gc-media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--bg2);
  flex-shrink: 0;
}

.gc-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
  will-change: transform;
}

.gc-card:hover .gc-media img { transform: scale(1.04); }

/* Badges */
.badge-dt,
.badge-body {
  position: absolute;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 4px 10px;
  border-radius: 100px;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 5px;
}

.badge-dt {
  top: 12px;
  left: 12px;
  background: rgba(14,14,16,0.65);
  color: rgba(255,255,255,0.9);
  border: 1px solid rgba(255,255,255,0.15);
}

.badge-dt i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
}

.badge-dt.hyb i { background: #f59e0b; }

.badge-body {
  top: 12px;
  right: 12px;
  background: rgba(14,14,16,0.55);
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.1);
}

/* ── Card Body ─────────────────────────────────────────── */
.cbody {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}

.crow {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.crow h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
}

.cprice {
  text-align: right;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--ink-2);
}

.cprice b {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

/* ── Card Actions ──────────────────────────────────────── */
.cacts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}

.cacts .btn {
  flex: 1;
  justify-content: center;
  font-size: 12px;
  padding: 9px 12px;
}

/* ── Empty state ───────────────────────────────────────── */
.gc-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-2);
  font-size: 15px;
}

/* ── Loading skeleton ──────────────────────────────────── */
.gc-skeleton {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg2);
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}

.gc-skeleton .sk-img {
  aspect-ratio: 16/10;
  background: rgba(255,255,255,0.05);
}

.gc-skeleton .sk-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sk-line {
  height: 12px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
}

.sk-line.w-60 { width: 60%; }
.sk-line.w-40 { width: 40%; }

@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

/* ── Filter result count ───────────────────────────────── */
.filter-count {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 16px;
  margin-bottom: 16px;
}
.filter-count:empty {
  display: none;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 640px) {
  .gc-grid {
    grid-template-columns: 1fr;
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .fg { 
    flex-direction: column; 
    align-items: stretch; 
  }

  .crow {
    flex-direction: column;
    gap: 8px;
  }
  
  .cprice {
    text-align: left;
  }
  
  .cacts {
    flex-direction: column;
  }
}
