/* CSS стили для обновленного дизайна карточек и фильтров */

/* ===== НАЧАЛО СТИЛЕЙ ФИЛЬТРА ===== */
* {
  box-sizing: border-box;
}

#car-request-form {
  max-width: 1280px;
  margin: 0 auto;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.wrapper {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
}

/* ⬆️ Верхняя часть формы (3 ряда + картинка) */
.top-group {
  display: flex;
  gap: 16px;
  width: 100%;
  align-items: stretch;
}

.top-group .left {
  flex: 2;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.top-group .right {
  flex: 1;
  min-height: 100%;
  background: #f6f8fa;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 14px;
}

/* ⬇️ Ряды после картинки */
.row {
  display: flex;
  gap: 12px;
  width: 100%;
}

/* ⬛ Поля */
.block {
  flex: 1;
  position: relative;
  background-color: #fff;
  border: 1px solid #dfe3e6;
  border-radius: 8px;
  padding: 1px 12px;
  min-height: 51px;
  transition: border-color 0.2s ease;
  display: flex;
  align-items: center;
}

.block:focus-within {
  border-color: #005bff;
}

.block select,
.block input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 14px;
  line-height: 18px;
  color: #1b1b1b;
  padding: 0;
  appearance: none;
  outline: none;
}

.block input::placeholder {
  color: #a0a0a0;
}

/* Поле с двумя input (год от/до) */
.double {
  display: flex;
  gap: 10px;
}

.double input {
  flex: 1;
}

.block select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: transparent;
  border: none;
  outline: none;
  width: 100%;
  font-size: 14px;
  line-height: 18px;
  padding-right: 24px;
  color: #1b1b1b;
  background-image: url('data:image/svg+xml;charset=UTF-8,<svg fill="%23666" height="10" viewBox="0 0 24 24" width="10" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px 12px;
  cursor: pointer;
}

.block select:focus {
  outline: none;
}

.block:focus-within {
  border-color: #005bff;
}

.block select:disabled {
  color: #aaa;
  cursor: not-allowed;
}

.toggle-params {
  font-size: 14px;
  font-weight: 500;
  color: #005bff;
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.2s;
}

.toggle-params:hover {
  color: #003fba;
}

.selected-field {
  background-color: #e6f2ff !important;
}

/* Одиночный селект */
.custom-singeselect-wrapper {
  position: relative;
  width: 100%;
  background: #fff;
  border: 1px solid #dfe3e6;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.custom-singeselect-wrapper.open {
  border-color: #005bff;
}

.custom-singeselect-toggle {
  font-size: 14px;
  color: #1b1b1b;
}

.custom-singeselect-options {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #dfe3e6;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  padding: 8px;
  z-index: 1000;
  flex-direction: column; /* ✅ вертикально */
  gap: 6px;
  max-height: 350px;
  overflow-x: auto;
  overflow-y: scroll;
}

.custom-singeselect-wrapper.open .custom-singeselect-options {
  display: flex; /* ✅ при открытии — вертикальный flex */
}

.custom-singeselect-options .custom-option {
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 14px;
  background: #f5f7f9;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

.custom-singeselect-options .custom-option:hover {
  background-color: #eaf1ff;
}

.custom-singeselect-options .custom-option.selected {
  background-color: #d6e8ff;
  font-weight: 600;
}

/* Мультиселект */
.custom-multiselect-wrapper {
  position: relative;
  width: 100%;
  background: #fff;
  border: 1px solid #dfe3e6;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.custom-multiselect-wrapper.open {
  border-color: #005bff;
}

.custom-multiselect-toggle {
  font-size: 14px;
  color: #1b1b1b;
  user-select: none;
}

.custom-multiselect-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #dfe3e6;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  padding: 10px;
  z-index: 1000;
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.custom-multiselect-wrapper.open .custom-multiselect-options {
  display: grid;
}

.custom-option {
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 14px;
  background: #f5f7f9;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s ease;
}

.custom-option:hover {
  background-color: #eaf1ff;
}

.custom-option.selected {
  background-color: #d6e8ff;
  font-weight: 600;
}

/* 🔥 Для поколений — с правильным скрытием */
#generation-wrapper .custom-singeselect-options {
  display: none; /* по умолчанию скрыто */
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

#generation-wrapper.open .custom-singeselect-options {
  display: grid; /* при открытии — grid */
}

#generation-wrapper .custom-option {
  position: relative;
  height: 150px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  overflow: hidden;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 8px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#generation-wrapper .custom-option:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

#generation-wrapper .custom-option.selected {
  outline: 2px solid #005bff;
}

/* Кнопки */
.car-link-btn-filter {
  color: #4a4a4a;
  text-decoration: none;
  font-size: 14px;
  padding: 10px 15px;
  background-color: #dddddd;
  border-radius: 7px;
  margin-top: 15px;
  min-width: 169px;
  font-weight: 400;
  display: inline-block;
  text-align: center;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.car-link-btn-filter:hover {
  color: #ffffff;
  background-color: #048e1c;
}

.car-link-btn-reset {
  background: #dedede;
  color: #000000;
  padding: 11px 24px;
  font-weight: 400;
  border-radius: 8px;
  border: 0px solid #282828;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.car-link-btn-reset:hover {
  background-color: #c7c7c7;
}

.filter-button-logged-in {
  background-color: #048e1c;
  color: #fff;
  border: 0px solid #282828;
}

.big {
  min-width: 205%;
}

/* 🔁 Адаптив фильтра */
@media (max-width: 1024px) {
  .top-group {
    flex-direction: column;
  }

  .top-group .right {
    min-height: 120px;
  }

  .row {
    flex-direction: column;
    gap: 10px;
  }
  
  .filter-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }
}

/* Состояние загрузки */
.loading {
  padding: 20px;
  text-align: center;
  color: #666;
  font-size: 16px;
}

/* Сообщение об ошибке */
.error {
  padding: 20px;
  text-align: center;
  color: #e53935;
  font-size: 16px;
  background-color: #ffebee;
  border-radius: 6px;
  border: 1px solid #ffcdd2;
}

/* Сообщение о пустых результатах */
.no-results {
  padding: 30px;
  text-align: center;
  color: #666;
  font-size: 16px;
  background-color: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #eee;
}
/* ===== КОНЕЦ СТИЛЕЙ ФИЛЬТРА ===== */

/* ===== НАЧАЛО СТИЛЕЙ КАРТОЧЕК АВТО ===== */
/* Общие стили карточки */
.car-card-v2 {
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  margin-bottom: 24px;
  background-color: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transition: all 0.3s ease;
}

.car-card-v2:hover {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.car-card-v2-top {
  display: flex;
  flex-wrap: wrap;
  padding: 10px 15px;
  position: relative;
}

/* Блок с фото */
.car-photo {
  width: 240px;
  height: auto;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  margin-right: 20px;
}

.car-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Блок с информацией */
.car-info {
  flex: 1;
  min-width: 200px;
  margin-right: 20px;
}

.car-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  color: #333;
}

.car-generation {
  font-size: 14px;
  color: #666;
  margin-bottom: 12px;
}

/* Новая табличная структура характеристик */
.car-details-table {
  margin-top: 10px;
}

.car-details-row {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: 5px;
}

.car-details-col {
  flex: 1;
  min-width: 140px;
  margin-right: 15px;
}

.car-details-label {
  font-size: 13px;
  color: #777;
  margin-bottom: 2px;
}

.car-details-value {
  font-size: 14px;
  color: #333;
  margin-bottom: 8px;
  font-weight: 500;
}

/* Блок с ценой и ссылками */
.car-price-block {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  flex-shrink: 0;
}

.car-price {
  font-size: 20px;
  font-weight: 700;
  color: #333;
  margin-bottom: 10px;
}

.car-purchase-timeframe {
  font-size: 14px;
  color: #666;
  margin-bottom: 12px;
}

.car-link, .car-link-phone {
  width: 100%;
  padding: 8px 16px;
  border-radius: 6px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  text-decoration: none;
  display: block;
}

.car-link {
  background-color: #2a41e8;
  color: #fff;
}

.car-link:hover {
  background-color: #1c32d9;
  color: #fff;
}

.car-link-phone {
  background-color: #e8f0fe;
  color: #2a41e8;
  border: 1px solid #c1d9fd;
}

.car-link-phone:hover {
  background-color: #d6e5fd;
  color: #2a41e8;
}

/* Адрес */
.car-address {
  padding: 10px 20px;
  background-color: #f9f9f9;
  border-top: 1px solid #eee;
  font-size: 14px;
  color: #666;
  display: flex;
  align-items: center;
}

.car-address .dot {
  width: 8px;
  height: 8px;
  background-color: #4caf50;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
}

/* Кнопка "Показать все параметры" */
.car-details-toggle {
  width: 100%;
  padding: 8px 16px;
  border-radius: 6px;
  text-align: center;
  font-size: 14px;
  background-color: #f0f0f0;
  color: #555;
  border: 1px solid #ddd;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: auto;
}

.car-details-toggle:hover {
  background-color: #e8e8e8;
}

.car-details-toggle.active {
  background-color: #e8f0fe;
  color: #2a41e8;
  border: 1px solid #c1d9fd;
}

/* Детальная информация (развернутая) */
.car-details-full {
  border-top: 1px solid #eee;
  padding: 0 0 20px;
  background-color: #f9f9f9;
}

.car-details-table-full {
  width: 100%;
}

.car-details-full-row {
  display: flex;
  flex-wrap: wrap;
  padding: 0 20px;
}

.car-details-full-col-spacer {
  width: 240px;
  margin-right: 20px;
  flex-shrink: 0;
}

.car-details-full-col {
  flex: 1;
  min-width: 200px;
  padding: 15px 0;
}

.car-details-full-item {
  margin-bottom: 12px;
}

.car-details-full-label {
  font-size: 14px;
  color: #777;
  margin-bottom: 3px;
}

.car-details-full-value {
  font-size: 15px;
  color: #333;
}

.car-comment {
  grid-column: span 2;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
  .car-card-v2-top {
    flex-direction: column;
  }
  
  .car-photo {
    width: 100%;
    height: 180px;
    margin-right: 0;
    margin-bottom: 15px;
  }
  
  .car-info {
    width: 100%;
    margin-right: 0;
    margin-bottom: 15px;
  }
  
  .car-price-block {
    width: 100%;
  }
  
  .car-details-full-col-spacer {
    display: none;
  }
  
  .car-details-full-row {
    flex-direction: column;
  }
  
  .car-details-col {
    min-width: 100%;
    margin-right: 0;
  }
}

/* Стили для планшетов */
@media (min-width: 769px) and (max-width: 1024px) {
  .car-card-v2-top {
    flex-wrap: wrap;
  }
  
  .car-photo {
    width: 180px;
    height: 135px;
  }
  
  .car-info {
    min-width: calc(100% - 450px);
  }
  
  .car-price-block {
    min-width: 220px;
  }
}

/* Стили для комментария */
.car-details-full-item.car-comment {
  background-color: #f5f5f5;
  padding: 10px;
  border-radius: 6px;
  margin-top: 10px;
  margin-bottom: 5px;
}

.car-details-full-item.car-comment .car-details-full-value {
  white-space: pre-line;
  line-height: 1.5;
}
/* ===== КОНЕЦ СТИЛЕЙ КАРТОЧЕК АВТО ===== */