/* ── Car Card base ── */
.car-card {
  background: #111318;
  border: 1.5px solid #3a4060;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: filter 0.2s, box-shadow 0.2s, transform 0.2s;
  position: relative;
}

@media (hover: hover) {
  .car-card:hover {
    filter: brightness(1.08);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    transform: translateY(-2px);
  }
}

.car-card.is-favourite {
  border-color: rgba(245,158,11,0.85) !important;
  box-shadow: 0 0 0 1px rgba(245,158,11,0.35),
              0 3px 16px rgba(245,158,11,0.15) !important;
}

/* ═══════════════════════════════════
   CARD TOP
   Left:  make / model / year / type pill + tags
   Right: PI badge + fav (top-aligned)
═══════════════════════════════════ */
.card-top {
  padding: 10px 12px 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

/* ── Left column ── */
.card-title-group {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.car-make {
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.car-model {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.car-year-type {
  font-size: 0.64rem;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Type pill + mode tags on ONE row, left-aligned ── */
.card-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
}

/* ── Car Type Pill (now inline with tags) ── */
.car-type-pill {
  font-size: 0.57rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  background: rgba(255,255,255,0.07);
  color: var(--text2);
  border: 1px solid rgba(255,255,255,0.14);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

/* ── Mode tags (same row as type pill) ── */
.tag {
  font-size: 0.57rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.tag-road-racing   { background:rgba(59,130,246,0.2);  color:#93c5fd;  border:1px solid rgba(59,130,246,0.45); }
.tag-street-racing { background:rgba(168,85,247,0.2);  color:#c4b5fd;  border:1px solid rgba(168,85,247,0.45); }
.tag-touge         { background:rgba(236,72,153,0.2);  color:#f9a8d4;  border:1px solid rgba(236,72,153,0.45); }
.tag-dirt-racing   { background:rgba(249,115,22,0.2);  color:#fdba74;  border:1px solid rgba(249,115,22,0.45); }
.tag-cross-country { background:rgba(34,197,94,0.2);   color:#86efac;  border:1px solid rgba(34,197,94,0.45); }
.tag-drift         { background:rgba(234,179,8,0.2);   color:#fde047;  border:1px solid rgba(234,179,8,0.45); }
.tag-drag          { background:rgba(20,184,166,0.2);  color:#5eead4;  border:1px solid rgba(20,184,166,0.45); }

.no-tags {
  font-size: 0.58rem;
  color: var(--text2);
  opacity: 0.35;
  font-style: italic;
}

/* ── Right column — top-aligned with make ── */
.card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
  /* Align top edge with the make label */
  margin-top: 0;
}

/* PI + fav on same row */
.card-right-top {
  display: flex;
  align-items: center;
  gap: 7px;
}

/* ── Favourite Star ── */
.fav-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
  border-radius: 5px;
  transition: transform 0.15s, opacity 0.15s;
  opacity: 0.22;
  filter: grayscale(1);
}

.fav-btn:hover {
  opacity: 0.75;
  transform: scale(1.2);
  filter: grayscale(0);
}

.car-card.is-favourite .fav-btn {
  opacity: 1;
  filter: grayscale(0);
}

/* ── PI Badge ── */
.pi-badge {
  font-size: 0.82rem;
  font-weight: 900;
  padding: 5px 11px;
  border-radius: 7px;
  letter-spacing: 0.6px;
  white-space: nowrap;
}

.pi-D  { background:var(--pi-d-bg);  color:var(--pi-d-fg);  }
.pi-C  { background:var(--pi-c-bg);  color:var(--pi-c-fg);  }
.pi-B  { background:var(--pi-b-bg);  color:var(--pi-b-fg);  }
.pi-A  { background:var(--pi-a-bg);  color:var(--pi-a-fg);  }
.pi-S1 { background:var(--pi-s1-bg); color:var(--pi-s1-fg); }
.pi-S2 { background:var(--pi-s2-bg); color:var(--pi-s2-fg); }
.pi-R  { background:var(--pi-r-bg);  color:var(--pi-r-fg); border:1px solid rgba(167,139,250,0.35); }
.pi-X  { background:var(--pi-x-bg);  color:var(--pi-x-fg); border:1px solid rgba(246,173,85,0.45); }

/* ── Card Divider ── */
.card-divider {
  height: 1px;
  background: rgba(255,255,255,0.06);
  margin: 0 12px;
}

/* ═══════════════════════════════════
   BOTTOM ROW
   flag · country · 4-space gap · tune · edit · del
   All on one single line
═══════════════════════════════════ */
.card-bottom {
  padding: 6px 12px 8px;
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
}

.flag {
  font-size: 0.88rem;
  flex-shrink: 0;
  margin-right: 5px;
}

.origin-text {
  font-size: 0.7rem;
  color: var(--text2);
  flex-shrink: 0;
  white-space: nowrap;
  /* 4-space gap via letter-spacing trick — actual gap controlled
     by the next sibling's margin-left */
}

/* Tune detail — inline, ~4-space gap from country */
.tune-inline {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
  flex: 1;
  margin-left: 0.5rem; /* ~4 character spaces at current font size */
}

.tune-inline-icon {
  font-size: 0.68rem;
  flex-shrink: 0;
  opacity: 0.6;
}

.tune-inline-text {
  font-size: 0.64rem;
  color: var(--text2);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.72;
}

/* Spacer when no tune — still pushes buttons right but small */
.card-bottom-spacer {
  flex: 1;
  min-width: 0.5rem;
  max-width: 0.5rem;
}

/* ── Action buttons — icon only ── */
.card-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  margin-left: 8px;
}

.btn-edit,
.btn-del {
  background: rgba(255,255,255,0.05);
  color: var(--text2);
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 0.78rem;
  padding: 4px 8px;
  min-height: 26px;
  min-width: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-edit:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text);
  border-color: rgba(255,255,255,0.22);
}

.btn-del:hover {
  background: rgba(239,68,68,0.18);
  color: #fca5a5;
  border-color: rgba(239,68,68,0.38);
}