* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  background-color: #ffffff;
}

body {
  font-family: "Outfit", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #111827;
  background: #ffffff;
  margin: 0;
}

header {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0,0,0,0.1);
  padding: 1rem 6%;
  position: sticky;
  top: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

* {
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
}

header h1, header h1 a {
  font-weight: 700;
  font-size: 1.5rem;
  color: #111827 !important;
  margin: 0;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ================== */
/* IMAGES */
/* ================== */
.fav-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}

.saved-row {
  width: 100%;
}

.saved-btn {
  padding: 12px 16px;
  font-size: 16px;
  border: none;
  background: #ffffff;
  color: #000000;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.back-btn {
  margin-bottom: 24px;
  padding: 12px 20px;
  background: #ffffff;
  color: #111827;
  border: 1px solid rgba(0,0,0,0.1);
  font-size: 16px;
  cursor: pointer;
}

.fav-btn:hover {
  transform: scale(1.1);
}

.main-image {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 14px;
  opacity: 0;
  filter: blur(12px);
  transform: scale(1.03);
  transition: opacity 0.6s ease, filter 0.6s ease, transform 0.6s ease;
}

.main-image.loaded {
  opacity: 1;
  filter: blur(0);
  transform: scale(1);
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: #666;
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: #555;
  animation: fadeUp 0.4s ease forwards;
}

.empty-state h2 {
  font-size: 26px;
  margin-bottom: 10px;
}

.empty-state p {
  font-size: 16px;
  margin-bottom: 24px;
}

.empty-state button {
  padding: 12px 22px;
  border: none;
  border-radius: 6px;
  background: #000;
  color: #ffffff;
  font-size: 16px;
  cursor: pointer;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.empty-state h2 {
  font-size: 26px;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 16px;
}

.main-image:hover {
  transform: scale(1.05);
}

.main-image-box {
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  flex: 1;
}

/* ================== */
/* FILTERS (DESKTOP BASE) */
/* ================== */
.filters {
  background: #f3f4f6;
  border-radius: 14px;
  padding: 18px;
  position: sticky;
  top: 80px;
  height: fit-content;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.05);
  color: #111827;
}

.filter-group {
  margin-bottom: 18px;

}

.filter-group.collapsed .filter-content {
  display: none;
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  border: none;
  background: none;
  padding: 8px 0;
  width: 100%;
  font-weight: bold;
  color: #111827;
}

.filter-content {
  margin-top: 8px;
  padding-left: 6px;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 8px;
  cursor: pointer;
  color: #e2e8f0;
}

.checkbox input {
  width: 18px;
  height: 18px;
  background-color: #ffffff;
  border: 1px solid #ccc;
  -webkit-appearance: checkbox;
  appearance: checkbox;
  accent-color: #000;
}

/* ================== */
/* LAYOUT */
/* ================== */
.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  grid-template-rows: auto 1fr;
  max-width: 1400px;
  margin: 0 auto;
  gap: 24px;
  padding: 24px;
  align-items: start;
}

.filters {
  grid-column: 1;
  grid-row: 2;
}

.content {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
  width: 100%;
  overflow-x: hidden;
}

/* ================== */
/* TOP FILTER BAR */
/* ================== */
.top-filters-bar {
  grid-column: 2;
  grid-row: 1;
  background: #f3f4f6;
  border-radius: 14px;
  padding: 34px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.05);
  margin-bottom: 24px;
  z-index: 50;
  position: sticky;
  top: 80px;
}

/* Selected Filter Chips */
.selected-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

#unselectAll {
  padding: 12px 18px;
  border-radius: 5px;
  border: 1px solid rgba(0,0,0,0.1);
  background: #ffffff;
  color: #111827;
  font-size: 18px;
  cursor: pointer;
  width: 100%;
  max-width: 100%;
  font-weight: 600;
}
#unselectAll:hover {
  background: #f3f4f6;
}

.filter-chip {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 5px;
  padding: 12px 24px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  color: #111827;
}

.filter-chip button {
  background: none;
  border: none;
  margin-left: 8px;
  font-size: 16px;
  cursor: pointer;
}

/* ================== */
/* SORT + WRAPER */
/* ================== */
.wraper {
  display: flex;
  align-items: center;
  gap: 16px;
}

.sort-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sort-select {
  padding: 12px 16px;
  font-size: 16px;
  border: none;
  background: #ffffff;
  color: #000000;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ================== */
/* CAR CARD */
/* ================== */
.car-card {
  background: #f3f4f6;
  border-radius: 16px;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  grid-auto-rows: min-content;
  gap: 15px;
  margin-bottom: 20px;
  position: relative;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.05);
  overflow: hidden;
  box-sizing: border-box;
  width: 100%;
}

.car-media {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
  height: auto;
  /* important */
}

.car-media .thumbs img {
  height: 100px;
  /* fixed height, instead of calc() */
}

.thumbs {
  display: flex;
  flex-direction: row;
  /* stack vertically */
  gap: 10px;
  /* space between thumbnails */

}

.thumbs img {
  width: 100%;
  /* make each thumb fill container width */
  border-radius: 10px;
  object-fit: cover;
}

.details-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 12px 0;
  width: 100%;
  flex-wrap: wrap;
  gap: 10px;
}

.details-row .price {
  margin: 0;
  font-size: 24px;
}

.details-row .condition {
  margin: 0;
  font-size: 14px;
}

.car-info {
  display: flex;
  flex-direction: column;
}

.car-info .carName {
  font-size: 26px;
  margin-bottom: 8px;
}

.condition {
  font-size: 14px;
  color: #94a3b8;
  margin-bottom: 16px;
}

.specs,
.vin {
  font-size: 15px;
  color: #4b5563;
  line-height: 1.5;
}

.price {
  font-size: 28px;
  font-weight: 600;
  margin: 0;
  color: #111827;
}

.btn-wrap {
  margin-top: auto;
  padding-top: 15px;
}

.details-btn {
  width: 100%;
  max-width: 200px;
  padding: 12px 18px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.1);
  background: #ffffff;
  color: #111827;
  font-size: 18px;
  cursor: pointer;
}

.details-btn:hover {
  background: #374151;
}

/* ================== */
/* MOBILE FILTER BUTTON */
/* ================== */
.mobile-filters-btn {
  display: none;
  padding: 12px 24px;
  font-size: 16px;
  border: none;
  background: #ffffff;
  color: #000000;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ================== */
/* OVERLAY */
/* ================== */
.filters-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 1000;
}

.filter-group .filter-content {
  display: grid;
  /* make the checkboxes grid items */
  grid-template-columns: repeat(2, 1fr);
  /* 2 columns, adjust as needed */
  gap: 8px;
  /* space between checkboxes */
}

.filter-group .filter-content label {
  display: flex;
  align-items: center;
  gap: 5px;
  /* space between checkbox and text */
}

.filters-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

/* Skeleton loader animation */
@keyframes shimmer {
  0% {
    background-position: -400px 0;
  }

  100% {
    background-position: 400px 0;
  }
}

.car-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.12);
}

.skeleton {
  background: #ddd;
  background-image: linear-gradient(90deg, #ddd 25%, #eee 50%, #ddd 75%);
  background-size: 400px 100%;
  background-repeat: no-repeat;
  animation: shimmer 1.5s infinite linear;
  border-radius: 16px;
}

/* Skeleton card container */
.skeleton-card {
  display: grid;
  grid-template-columns: 55% 45%;
  gap: 32px;
  padding: 24px;
  border-radius: 16px;
  background: #f5f5f5;
}

/* Left side skeletons (image + thumbs) */
.skeleton-card .left {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton.main-image-skeleton {
  width: 100%;
  height: 220px;
  border-radius: 14px;
}

.skeleton.thumbs-skeleton {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.skeleton.thumb-skeleton {
  height: 60px;
  border-radius: 10px;
}

/* Right side skeletons (info text blocks) */
.skeleton-card .right {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.skeleton.text-skeleton {
  height: 24px;
  width: 60%;
  border-radius: 8px;
}

.skeleton.text-skeleton.short {
  width: 30%;
}

.skeleton.text-skeleton.medium {
  width: 45%;
}

.skeleton.button-skeleton {
  height: 42px;
  width: 40%;
  border-radius: 8px;
  margin-top: auto;
}

.car-card {

  overflow: hidden;
  background: #f3f4f6;
  border-radius: 16px;
  padding: 24px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 32px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
  margin-bottom: 15px;
  width: 100%;
  max-width: 100%;
}

/* Animated geometric background */
.car-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 10% 20%, rgba(0, 0, 0, 0.05), transparent 50%),
    radial-gradient(circle at 80% 50%, rgba(0, 0, 0, 0.05), transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(0, 0, 0, 0.05), transparent 50%);
  background-size: 200% 200%;
  z-index: 0;
  animation: bgMove 20s linear infinite;
  pointer-events: none;
}

.car-card {
  transform: translateY(0);
  transition: transform 0.2s ease-out;
}

@keyframes bgMove {
  0% {
    background-position: 0% 0%, 100% 50%, 50% 100%;
  }

  50% {
    background-position: 100% 0%, 0% 50%, 50% 0%;
  }

  100% {
    background-position: 0% 0%, 100% 50%, 50% 100%;
  }
}

/* Make sure content is above the background */
.car-card>* {
  z-index: 1;
}

/* ================== */
/* MOBILE */
/* ================== */
@media (max-width: 768px) {
  .car-media {
    position: relative;
    /* positioning context for fav-btn */
  }

  .car-cards-container {
    margin-bottom: 15px;
  }

  .fav-btn {
    position: absolute;
    top: 10px;
    /* distance from top of main image */
    right: 10px;
    /* distance from right edge */
    width: 42px;
    /* same as desktop */
    height: 42px;
    padding: 0;
    font-size: 20px;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    /* keep existing style */
    color: #000;
  }

  #unselectAll {
    flex-shrink: 0;
    /* don't shrink */
    width: 100%;
    max-width: 320px;
    padding: 12px 18px;
    border-radius: 5px;
    border: 1px solid rgba(0,0,0,0.1);
    background: #ffffff;
    color: #111827;
    font-size: 16px;
    /* scales better on mobile */
    cursor: pointer;
    margin-top: auto;
    /* push to bottom in flex container */
    align-self: center;
  }

  .filter-group,
  .filter-header,
  .checkbox {
    font-size: 16px;
    /* increase for mobile readability */
  }

  .skeleton-card {
    display: flex;
    /* stack left + right vertically */
    flex-direction: column;
    gap: 16px;
    padding: 16px;
  }

  .content,
  .car-cards-container {
    width: 100%;
    max-width: 100%;
    margin-bottom: 15px;
  }

  .skeleton.main-image-skeleton {
    height: 180px;
  }

  .skeleton.thumb-skeleton {
    height: 50px;
  }

  .car-card,
  .skeleton-card {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    /* stack left + right vertically */
    gap: 16px;
    padding: 16px;
    margin: 0 auto;
    /* center cards */
    margin-bottom: 15px;
  }

  .skeleton-card .left,
  .skeleton-card .right {
    width: 100%;
  }

  .skeleton-card .left,
  .skeleton-card .right {
    width: 100%;
  }

  .saved-btn {
    width: 100%;
    padding: 12px;
    font-size: 18px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: -100px;
    z-index: 500
  }

  .checkbox input {
    width: 20px;
    height: 20px;
  }

  .layout {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 12px;
    gap: 16px;
  }

  .filter-content {
    flex: 1;
    /* take all space above button */
    overflow-y: auto;
  }

  /* ===== MOBILE FILTER PANEL ===== */
  .filters {
    position: fixed;
    top: 0;
    left: -100%;
    width: 85%;
    max-width: 360px;
    height: 100vh;
    background: #fff;
    z-index: 1001;
    overflow-y: auto;
    transition: left 0.3s ease;
    border-radius: 0 14px 14px 0;
    padding: 20px 20px 80px 20px;
    /* extra bottom padding so content doesn't overlap button */

    flex-direction: column;

    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* 3 columns */
    gap: 10px;
  }

  .filters.show {
    left: 0;
  }

  .car-media .thumbs {
    overflow-x: auto;
    /* allow horizontal scroll */
    gap: 10px;
    flex-wrap: nowrap;
    /* don’t wrap to next line */
    width: 100%;
    padding-bottom: 4px;
    /* small spacing under thumbs */
  }

  .car-media .thumbs img {
    flex: 0 0 auto;
    /* prevent shrinking */
    width: 80px;
    /* fixed width, scales well */
    height: 60px;
    /* fixed height */
    object-fit: cover;
    border-radius: 10px;
  }

  .car-media .thumbs::-webkit-scrollbar {
    height: 6px;
  }

  .car-media .thumbs::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
  }

  /* 🔥 CONTROLS OVERLAY ON TOP OF BAR */
  .wraper {
    position: absolute;
    top: -55px;
    left: 0;
    width: 100%;
    display: flex;
    gap: 8px;
    margin-top: -10px;
  }

  /* SORT = BIGGER */
  .sort-wrapper {
    flex: 1;
    flex-direction: column;
    /* stack on mobile */
    align-items: stretch;
  }

  .sort-select {
    width: 100%;
    padding: 12px;
    font-size: 16px;

    -webkit-appearance: none;
    /* remove default iOS styles */
    -moz-appearance: none;
    appearance: none;
    background: #ffffff;
    color: #000000;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;

  }

  /* FILTER BUTTON = SMALLER */
  .mobile-filters-btn {
    display: inline-block;
    flex: 1;
    width: 100%;
    margin: 0;
  }

  /* Push bar down so overlay fits */
  .top-filters-bar {
    margin-top: 72px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 30px 16px;
  }

  .car-card {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .car-info {
    align-items: center;
    text-align: center;
  }

  .details-btn {
    width: 100%;
    max-width: 320px;
  }

  .layout {
    display: flex !important;
    /* remove grid */




  }

  #unselectAll {
    display: block;
    /* make sure it's block */
    grid-column: 1 / -1;
    /* span all columns of the parent grid */
    width: 100%;
    /* take full width */
    max-width: 100%;
    /* no limit */
    padding: 16px 20px;
    /* mobile-friendly padding */
    border-radius: 8px;
    text-align: center;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.1);
    color: #111827;
    font-size: 16px;
    cursor: pointer;
    margin: 20px 0 0 0;
    /* spacing above */
  }
}