body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f5f5f5;
  min-height: 100vh;
}

.cars-title {
  padding-left: 20px;
  margin-top: 0;
}

.container {
  width: 100%;
  padding: 50px 20px;
  min-height: 65vh;
}

.container > div {
  display: flex;
  flex-direction: row;
}

h2{
  margin: 0 0 10px 0;
}

.filters-main-container{
  display: flex;
  gap: 30px;
  align-items: flex-start;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .08);
  background: #fff;
  border-radius: 12px;
  max-width: 320px;
  width: 100%;
}

.filters {
    width: 100%;
  border-radius: 16px;
  position: sticky;
  height: fit-content;
  top: 20px;
  padding: 16px; 
}

.filter-item {
 
}

.filter-header {
  width: 100%;
  background: none;
  border: none;
  padding: 16px 0;
  font-weight: 700;
  font-size: 16px;
  display: flex;
  justify-content: space-between;
  cursor: pointer;
}

.filter-header::after {
  content: "›";
  transform: rotate(90deg);
  transition: .2s;
}

.filter-item.open .filter-header::after {
  transform: rotate(-90deg);
}

.filter-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
}

.filter-item.open .filter-body {
  max-height: 200px;
  padding-bottom: 16px;
}

.filter-body input,
.filter-body select {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 8px;
  border: 1px solid #ddd;
}


.car-card {
  background: #fff;
  border: 1px solid #20419a36;
  border-radius: 20px;
  padding-bottom: 16px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .08);
  transition: transform .2s ease;
  cursor: pointer;
  overflow: hidden;
  width: 440px;
  margin: 10px;
  height: 350px;
}

.card-text-container {
  padding: 0 16px;
}

.card-title-container, .card-info-container {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  margin: 5px 0 0 0;
}

.card-info-container { 
  margin: 20px 0 0 0;
}

.car-card:hover {
  transform: translateY(-4px);
}

.car-id {
  width: 100%;
  text-align: end;
  color: rgb(87, 87, 87);
  font-weight: 600;
  margin: 10px 0;
}

.car-title {
  font-size: 18px;
  font-weight: bold;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.car-meta {
  font-size: 16px;
  color: rgb(87, 87, 87);
  margin: 0 10px 0 0;
  font-weight: 600;
  display: flex;
  align-items: center;
  border: 1px solid #20419a99;
  border-radius: 20px;
  padding: 5px 8px;
  width: max-content;
}

.car-meta img{
  width: 15px;
  height: 15px;
  margin-right: 3px;
}

.car-price {
  font-size: 18px;
  font-weight: bold;
  color: #20419a;
  padding-left: 15px;
}

.cars-header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  /* max-width: 1550px; */
}

.cars-header h1 {
  margin: 0;
}

.cars-sort {
  height: 60px;
  border-radius: 10px;
  padding: 5px 10px;
  font-size: 24px;
  font-weight: 600;
  width: 280px;
}

/* фильтр */

.sort-filter {
  position: relative;
  max-width: 260px;
  width: 100%;
}

.sort-header {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  background: #fff;
  font-weight: 600;
  font-size: 18px;
  cursor: pointer;
  color: black;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sort-header .arrow {
  transition: transform 0.25s ease;
}

.sort-filter.open .arrow {
  transform: rotate(180deg);
}

.sort-body {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;

  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,.12);
  overflow: hidden;

  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: 0.25s ease;
  z-index: 20;
}

.sort-filter.open .sort-body {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.sort-body button {
  width: 100%;
  padding: 12px 14px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
}

.sort-body button:hover {
  background: #f3f4f6;
}

.sort-body button.active {
  font-weight: 600;
  background: #eef1ff;
}

.admin-controls {
  margin-right: 5px;
}

.admin-btn {
  cursor: pointer;
}

.tooltip-wrapper {
  position: relative;
  display: flex;
  flex-direction: row-reverse;
}

.car-tooltip-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #20419a;
  color: #20419a;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.car-tooltip-box {
  position: absolute;
  right: 25px;
  top: -225px;
  width: 260px;
  background: #20419a;
  color: #fff;
  padding: 40px 16px 16px 16px;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: .2s ease;
  z-index: 10;
}

/* .tooltip-wrapper:hover .car-tooltip-box {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
} */

.car-tooltip-box.fixed {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.tooltip-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 14px;
}

.tooltip-row span {
  opacity: .7;
}

.tooltip-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
}

.car-image {
  width: 100%;
  height: 200px;
  margin-bottom: 10px;
  object-fit: cover;
}
.car-image-placeholder {
  width: 100%;
  height: 200px;
  margin-bottom: 10px;
  padding: 45px;
}


.cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center; 
}

.cars-wrapper {
  width: 100%;
}

.pagination {
  display: flex;
  flex-direction: row;
  justify-content: center;
}


.pagination>button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  margin: 0 5px;
  border: 1px solid #20419a5e;
  border-radius: 5px;
  color: #20419a;
}


.pagination button.active {
  background: #20419a24;
  border: 1px solid #20419a5e;
  color: #20419a;
  font-weight: 600;
}

@media (max-width: 1600px) {
  .car-card {
    width: 350px;
    margin: 10px;
    height: 350px;
  }
  
}

@media (max-width: 1400px) {
  .car-card {
    width: 300px;
    margin: 10px;
    height: 380px;
    display: flex;
    flex-direction: column;
  }
  .card-title-container {
    flex-direction: column;
    text-align: start;
    justify-content: start;
    align-items: start;
  }

  .card-title-container > div {
    margin-top: 10px;
  }

  .card-text-container {
    padding: 0 10px 10px 10px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
}

@media (hover: hover) and (pointer: fine) {
  .tooltip-wrapper:hover .car-tooltip-box {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }
}

@media (max-width: 940px) {
 .cards > div {
    display: flex;
    justify-content: center;
    width: 100%;
  }
  .car-card {
    max-width: 500px;
    width: 100%;
    margin: 10px 0;
  }

  .car-tooltip-box {
    right: 20px;
    top: -205px;
  }

  .cars-sort {
    font-size: 18px;
    width: 220px;
  }
}

@media (max-width: 768px) {
  .cars-sort {
    width: 100%;
    margin: 20px;
    font-size: 18px;
    font-weight: 600;
  }
  .cards > div {
    display: flex;
    justify-content: center;
    width: 100%;
  }

  .container > div {
    flex-direction: column;
  }

  .container {
    padding: 15px 10px 50px 10px;
  }

  .cars-header h1.cars-title {
    padding: 0;
    margin-top: 30px;
    text-align: center;
  }

    .card-text-container {
    padding: 0 13px 13px 13px;
  }

  .cars-header {
    margin-bottom: 20px;
    margin-top: 20px;
    flex-direction: column-reverse;
  }


  .filters {
    min-width: unset;
    width: 100%;
    padding: 0;
    overflow: hidden;
  }

  /* заголовок фільтрів — кнопка */
  .filters > h2 {
    padding: 16px;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  /* стрілка */
  .filters > h2::after {
    content: '▾';
    transition: transform 0.3s ease;
  }

  /* контент фільтрів */
  .filters .filter-item {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
  }

  /* відкритий стан */
  .filters.open .filter-item {
    max-height: 500px; /* достатньо для кожного блоку */
    border-bottom: 1px solid #eee;
  }

  .filters.open > h2::after {
    transform: rotate(180deg);
  }

  .filter-item.open .filter-body {
    padding: 16px;
  }  

  .filter-header {
    padding: 15px 15px;
  }

  .sort-filter { 
    max-width: 100%;
    width: 100%;
  }
  .sort-header {
    height: 54px;
  }
  .car-price {
    padding: 0;
  }

  .filters-main-container{
    max-width: 100%;
    width: 100%;
  }
  
}