/**
 * PlaidCars — Tesla VIN decoder styles.
 *
 * Self-contained — no Bootstrap / theme deps. Scoped under
 * `.pc-tm-vin-widget` so it can drop into any host page without bleeding.
 */

.pc-tm-vin-widget {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  max-width: 920px;
  margin: 24px auto;
  color: #1a1a1a;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.pc-tm-vin-widget *,
.pc-tm-vin-widget *::before,
.pc-tm-vin-widget *::after { box-sizing: border-box; }

.pc-tm-vin-card {
  background: #fff;
  border-radius: 14px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 6px 24px -8px rgba(0, 0, 0, 0.08);
  border: 1px solid #ececec;
  overflow: hidden;
}

/* ---------- Header ---------- */
.pc-tm-vin-header {
  padding: 22px 26px 18px;
  border-bottom: 1px solid #f0f0f0;
  background: linear-gradient(180deg, #fafbfc 0%, #fff 100%);
}
.pc-tm-vin-header h3 {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: #111;
}
.pc-tm-vin-header p {
  margin: 0;
  color: #666;
  font-size: 13px;
}

/* ---------- Input ---------- */
.pc-tm-vin-input-wrap { padding: 18px 26px 6px; }

.pc-tm-vin-input {
  width: 100%;
  padding: 14px 16px;
  font-family: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 18px;
  letter-spacing: 0.14em;
  border: 2px solid #e2e2e2;
  border-radius: 9px;
  text-transform: uppercase;
  background: #fafafa;
  color: #111;
  transition: border-color 0.15s ease, background 0.15s ease,
    box-shadow 0.15s ease;
}
.pc-tm-vin-input:focus {
  outline: none;
  border-color: #1565c0;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(21, 101, 192, 0.12);
}
.pc-tm-vin-input.is-valid {
  border-color: #2e7d32;
  background: #f5fbf3;
  box-shadow: 0 0 0 4px rgba(46, 125, 50, 0.1);
}
.pc-tm-vin-input.is-invalid {
  border-color: #c62828;
  background: #fff5f5;
  box-shadow: 0 0 0 4px rgba(198, 40, 40, 0.1);
}

/* Progress bar */
.pc-tm-vin-progress {
  height: 3px;
  background: #f0f0f0;
  margin-top: 10px;
  border-radius: 2px;
  overflow: hidden;
}
.pc-tm-vin-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #1565c0, #42a5f5);
  width: 0%;
  transition: width 0.25s ease;
}
.pc-tm-vin-progress-bar.is-complete {
  background: linear-gradient(90deg, #2e7d32, #66bb6a);
}

/* Sample VIN chips */
.pc-tm-vin-samples {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.pc-tm-vin-samples-label {
  font-size: 12px;
  color: #888;
  margin-right: 4px;
}
.pc-tm-vin-sample {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  color: #374151;
  transition: all 0.15s ease;
  font-family: inherit;
  line-height: 1.4;
}
.pc-tm-vin-sample:hover {
  background: #1565c0;
  border-color: #1565c0;
  color: #fff;
  transform: translateY(-1px);
}
.pc-tm-vin-sample:active { transform: translateY(0); }

/* ---------- Anatomy (always-visible 17-position breakdown) ---------- */
.pc-tm-vin-anatomy {
  padding: 18px 26px 4px;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
}
.pc-tm-vin-anatomy-title {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: #999;
  letter-spacing: 0.06em;
  margin: 0 0 4px;
}

.pc-tm-vin-seg {
  display: flex;
  flex-direction: column;
  text-align: center;
  border-radius: 8px;
  padding: 10px 4px 8px;
  background: #fafafa;
  border: 1px solid #efefef;
  min-height: 96px;
  position: relative;
  transition: all 0.2s ease;
  border-top: 3px solid #d0d0d0;
}
.pc-tm-vin-seg.is-active {
  background: #fff;
  border-color: #1565c0;
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
}
.pc-tm-vin-seg.is-filled {
  background: #fff;
  border-color: #d8e6db;
}
.pc-tm-vin-seg.is-filled.has-known {
  background: #f7fcf6;
  border-color: #c8e6c9;
}
.pc-tm-vin-seg.is-filled.is-warn {
  background: #fff7e1;
  border-color: #ffd082;
}

.pc-tm-vin-seg.group-origin  { border-top-color: #1565c0; }
.pc-tm-vin-seg.group-vehicle { border-top-color: #00897b; }
.pc-tm-vin-seg.group-config  { border-top-color: #ef6c00; }
.pc-tm-vin-seg.group-meta    { border-top-color: #6a1b9a; }
.pc-tm-vin-seg.group-serial  { border-top-color: #455a64; }

.pc-tm-vin-seg-pos {
  font-size: 9px;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
  font-weight: 600;
}
.pc-tm-vin-seg-chars {
  font-family: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  font-weight: 700;
  color: #111;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  min-height: 20px;
  line-height: 20px;
  word-break: break-all;
}
.pc-tm-vin-seg-chars .pc-tm-vin-ch { display: inline-block; }
.pc-tm-vin-seg-chars .pc-tm-vin-ch-empty { color: #d4d4d4; font-weight: 400; }

.pc-tm-vin-seg-label {
  font-size: 10.5px;
  color: #555;
  font-weight: 600;
  margin-bottom: 5px;
  line-height: 1.2;
}
.pc-tm-vin-seg-value {
  font-size: 11px;
  color: #1565c0;
  line-height: 1.25;
  font-weight: 500;
  word-wrap: break-word;
}
.pc-tm-vin-seg-value.is-empty { color: #ccc; font-style: italic; }
.pc-tm-vin-seg-value.is-warn  { color: #b25500; }
.pc-tm-vin-seg-value.is-error { color: #c62828; }

/* ---------- Result card (after a meaningful VIN is entered) ---------- */
.pc-tm-vin-result {
  padding: 22px 26px 24px;
  border-top: 1px solid #f0f0f0;
  background: linear-gradient(180deg, #fff 0%, #fbfbfd 100%);
  animation: pcTmVinFadeIn 0.25s ease-out;
}
@keyframes pcTmVinFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.pc-tm-vin-result-headline {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  color: #111;
}
.pc-tm-vin-result-sub {
  color: #666;
  font-size: 14px;
  margin: 0;
}
.pc-tm-vin-result-vin {
  display: inline-block;
  margin-top: 10px;
  font-family: "SF Mono", Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #555;
  background: #f3f4f6;
  padding: 4px 10px;
  border-radius: 4px;
}

.pc-tm-vin-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 18px;
}
.pc-tm-vin-fact {
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 8px;
  padding: 12px 14px;
}
.pc-tm-vin-fact-label {
  font-size: 10.5px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  font-weight: 600;
}
.pc-tm-vin-fact-value {
  font-size: 13.5px;
  color: #1a1a1a;
  font-weight: 500;
  line-height: 1.35;
}

.pc-tm-vin-checkdigit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 5px;
  font-weight: 600;
  margin-top: 14px;
}
.pc-tm-vin-checkdigit.ok      { background: #e8f5e9; color: #2e7d32; }
.pc-tm-vin-checkdigit.bad     { background: #ffebee; color: #c62828; }
.pc-tm-vin-checkdigit.unknown { background: #f5f5f5; color: #757575; }

.pc-tm-vin-error {
  margin: 14px 26px 18px;
  padding: 14px 18px;
  background: #fff8e1;
  border-left: 3px solid #f57c00;
  color: #6d4c00;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.45;
}

.pc-tm-vin-details-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 18px;
  background: #fff;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  padding: 7px 14px;
  font-size: 12.5px;
  cursor: pointer;
  color: #444;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.15s ease;
}
.pc-tm-vin-details-toggle:hover {
  background: #f5f5f5;
  border-color: #bdbdbd;
}
.pc-tm-vin-details {
  margin-top: 14px;
  display: none;
}
.pc-tm-vin-details.is-open { display: block; }

.pc-tm-vin-details table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
  border: 1px solid #ececec;
  border-radius: 8px;
  overflow: hidden;
}
.pc-tm-vin-details th,
.pc-tm-vin-details td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid #f3f3f3;
}
.pc-tm-vin-details tbody tr:last-child td { border-bottom: none; }
.pc-tm-vin-details th {
  font-size: 11px;
  text-transform: uppercase;
  color: #888;
  letter-spacing: 0.06em;
  font-weight: 600;
  background: #fafafa;
}
.pc-tm-vin-details td.code {
  font-family: "SF Mono", Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  color: #111;
}
.pc-tm-vin-details td.muted { color: #777; }

/* Footer hint when nothing is entered yet */
.pc-tm-vin-footer-hint {
  padding: 14px 26px 22px;
  font-size: 12px;
  color: #888;
  font-style: italic;
  border-top: 1px solid #f0f0f0;
  margin-top: 6px;
}

/* Responsive: collapse anatomy grid on narrow viewports */
@media (max-width: 760px) {
  .pc-tm-vin-anatomy { grid-template-columns: repeat(5, 1fr); }
  .pc-tm-vin-seg { min-height: 92px; }
}
@media (max-width: 420px) {
  .pc-tm-vin-anatomy { grid-template-columns: repeat(2, 1fr); }
  .pc-tm-vin-header,
  .pc-tm-vin-input-wrap,
  .pc-tm-vin-result { padding-left: 16px; padding-right: 16px; }
  .pc-tm-vin-anatomy { padding-left: 16px; padding-right: 16px; }
}
