:root {
  --bg0: #070a12;
  --bg1: #0b1020;
  --panel: rgba(255, 255, 255, 0.06);
  --panel2: rgba(255, 255, 255, 0.08);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.68);
  --muted2: rgba(255, 255, 255, 0.52);
  --border: rgba(255, 255, 255, 0.10);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --radiusSm: 10px;
  --max: 1100px;
  --focus: 0 0 0 3px rgba(123, 97, 255, 0.35);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 800px at 15% 0%, #162243 0%, transparent 60%),
              radial-gradient(900px 600px at 100% 20%, #2a1c43 0%, transparent 60%),
              linear-gradient(180deg, var(--bg1), var(--bg0));
}

a { color: inherit; }

.vf-root {
  min-height: 100%;
}

.vf-screen {
  display: none;
  min-height: 100vh;
}

.vf-screen.is-active {
  display: block;
}

.vf-login,
.vf-callback {
  display: grid;
  place-items: center;
  padding: 24px;
}

.vf-loginCard {
  width: 100%;
  max-width: 460px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  backdrop-filter: blur(14px);
}

.vf-brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.vf-brandMark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #7b61ff, #ff5fd7);
  font-weight: 800;
  letter-spacing: 0.5px;
}

.vf-brandTitle {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.05;
}

.vf-brandTag {
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
}

.vf-loginBody {
  margin-top: 14px;
}

.vf-muted { color: var(--muted); }
.vf-small { font-size: 12px; }
.vf-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.10);
}

.vf-btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
  background: rgba(255,255,255,0.10);
  transition: transform 120ms ease, background 120ms ease;
}

.vf-btn:active { transform: translateY(1px); }
.vf-btn:focus { outline: none; box-shadow: var(--focus); }

.vf-btnPrimary {
  width: 100%;
  background: linear-gradient(135deg, #7b61ff, #ff5fd7);
}

.vf-btnSecondary {
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.14);
}

.vf-alert {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
}

.vf-alertError {
  border-color: rgba(255, 64, 64, 0.45);
  background: rgba(255, 64, 64, 0.12);
}

/* APP SHELL */
.vf-app {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
}

.vf-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(0,0,0,0.35);
  border-bottom: 1px solid rgba(255,255,255,0.10);
  backdrop-filter: blur(14px);
}

.vf-topbarTitle {
  font-weight: 800;
  letter-spacing: 0.2px;
}

.vf-iconBtn {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
}
.vf-iconBtn:focus { outline: none; box-shadow: var(--focus); }

.vf-userChip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06);
}

.vf-userAvatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255,255,255,0.12);
}

.vf-userName {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.vf-sidenav {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: min(340px, 86vw);
  background: rgba(8, 10, 18, 0.85);
  border-right: 1px solid rgba(255,255,255,0.12);
  box-shadow: var(--shadow);
  transform: translateX(-110%);
  transition: transform 180ms ease;
  z-index: 30;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(14px);
}

.vf-sidenav.is-open {
  transform: translateX(0);
}

.vf-sidenavHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

.vf-brandSmall {
  display: flex;
  gap: 12px;
  align-items: center;
}

.vf-brandMarkSmall {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #7b61ff, #ff5fd7);
  font-weight: 900;
}

.vf-sidenavTitle { font-weight: 800; }
.vf-sidenavSub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.vf-nav {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.vf-navItem {
  display: flex;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

.vf-navItem:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.10);
}

.vf-navItem.is-active {
  background: rgba(123, 97, 255, 0.18);
  border-color: rgba(123, 97, 255, 0.35);
}

.vf-navIcon { width: 22px; text-align: center; }

.vf-navItemButton {
  width: 100%;
  font: inherit;
  cursor: pointer;
}

.vf-pill {
  margin-left: auto;
  font-size: 11px;
  color: rgba(255,255,255,0.78);
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
}

.vf-sidenavFooter {
  margin-top: auto;
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,0.10);
}

.vf-link {
  color: rgba(123, 97, 255, 0.95);
  text-decoration: none;
}
.vf-link:hover { text-decoration: underline; }

.vf-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 25;
}

.vf-main {
  padding: 18px 14px 40px;
}

.vf-container {
  max-width: var(--max);
  margin: 0 auto;
}

.vf-h1 {
  font-size: 26px;
  margin: 0;
  font-weight: 900;
}

.vf-h2 {
  font-size: 16px;
  margin: 0;
  font-weight: 800;
}

.vf-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  backdrop-filter: blur(14px);
}

.vf-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.vf-spacer { flex: 1; }

.vf-input {
  width: 100%;
  max-width: 420px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: var(--text);
}

.vf-input:focus { outline: none; box-shadow: var(--focus); }

.vf-chipRow {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.vf-chip {
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 10px;
  cursor: pointer;
  font-weight: 800;
  font-size: 12px;
}

.vf-chip.is-active {
  background: rgba(123, 97, 255, 0.18);
  border-color: rgba(123, 97, 255, 0.35);
}

.vf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.vf-tile {
  position: relative;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.vf-tile:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.14);
}

.vf-tile.is-selected {
  border-color: rgba(123, 97, 255, 0.45);
  background: rgba(123, 97, 255, 0.14);
}

.vf-tileTitle {
  font-weight: 900;
  font-size: 13px;
  line-height: 1.15;
}

.vf-tileMeta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}

.vf-tileBadge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.35);
}

.vf-tileBadgeStar {
  border-color: rgba(255, 215, 90, 0.40);
  background: rgba(255, 215, 90, 0.10);
}

.vf-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.vf-toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(12px);
  z-index: 40;
  max-width: min(90vw, 760px);
  font-size: 13px;
}

@media (min-width: 960px) {
  .vf-topbarTitle {
    font-size: 16px;
  }
}


/* ---------- MULTI-PAGE ADDITIONS ---------- */

.vf-menuLinks {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.vf-menuLinkCard {
  display: block;
  text-decoration: none;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
}

.vf-menuLinkCard:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.14);
}

.vf-cardTitle {
  font-weight: 900;
  font-size: 15px;
}

.vf-cardSub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- GARAGE LAYOUT ---------- */

.vf-garageLayout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 12px;
}

@media (min-width: 980px) {
  .vf-garageLayout {
    grid-template-columns: 1.2fr 0.8fr;
    align-items: start;
  }
}

.vf-gridFixed {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.vf-vehicleTile {
  position: relative;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 68px;
}

.vf-vehicleTile:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.14);
}

.vf-vehicleTile.is-selected {
  border-color: rgba(123, 97, 255, 0.45);
  background: rgba(123, 97, 255, 0.14);
}

.vf-tileThumb {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.10);
  display: grid;
  place-items: center;
}

.vf-tileImg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vf-tileInfo {
  min-width: 0;
}

.vf-tileId {
  font-size: 11px;
  color: var(--muted2);
  margin-top: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vf-controlsGrid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
}

.vf-field {
  display: grid;
  gap: 6px;
}

.vf-fieldLabel {
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
}

.vf-inputSmall {
  width: 100px;
  max-width: 140px;
  padding: 10px 10px;
}

.vf-pager {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.vf-btnTiny {
  padding: 9px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
}

/* ---------- PREVIEW ---------- */

.vf-previewViewport {
  margin-top: 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.25);
  height: 260px;
  display: grid;
  place-items: center;
  overflow: hidden;
  perspective: 900px;
  touch-action: none; /* allow pointer drag rotation */
}

.vf-previewImg {
  width: 92%;
  height: 92%;
  object-fit: contain;
  /*
    IMPORTANT:
    Many of the exported PNGs are square (e.g., 1024×1024) and include transparent padding.
    The tile thumbnails use object-fit: cover, which hides most padding.
    The selected preview uses contain, which shows the full square. That can make some
    vehicles LOOK like they sit lower than expected.
    
    We auto-center the visible (non-transparent) pixels by applying a translateY in JS.
    (See: public/js/garage-page.js -> autoCenterPreviewImage)
  */
  display: block;
  transform: translateY(var(--vf-previewShiftY, 0px)) rotateY(var(--vf-rotY, 0deg)) rotateZ(var(--vf-rotZ, 0deg));
  transform-style: preserve-3d;
  user-select: none;
  -webkit-user-drag: none;
}

.vf-previewHint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.vf-previewControls {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Make menu cards two columns on wider screens */
@media (min-width: 720px) {
  .vf-menuLinks {
    grid-template-columns: 1fr 1fr;
  }
}
