/* ==========================================================================
   CONTAINER & HEADER
   ========================================================================== */
.car-shop-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: #fcfcfc;
}

.shop-header {
  text-align: center;
  margin-bottom: 40px;
}

.shop-main-title {
  font-size: 2.5em;
  color: #1a1a1a;
  margin-bottom: 10px;
  font-weight: 800;
}

.shop-subtitle {
  color: #666;
  font-size: 1.1em;
}

/* ==========================================================================
   ADVANCED FILTER
   ========================================================================== */
.car-filter-advanced {
  background: #fff;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  border: 1px solid #eee;
  margin-bottom: 40px;
}

.filter-grid {
  display: grid;
  grid-template-columns: 1.5fr 0.8fr 1fr 1.5fr 1fr;
  gap: 15px;
  align-items: flex-end;
}

@media (max-width: 992px) {
  .filter-grid {
    grid-template-columns: 1fr 1fr;
  }
  .filter-actions {
    grid-column: span 2;
  }
}

.filter-col label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #444;
  margin-bottom: 8px;
}

.range-inputs {
  display: flex;
  gap: 5px;
}
.range-inputs input {
  width: 50% !important;
}

.filter-col input,
.filter-col select {
  width: 100%;
  height: 42px;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 0 10px;
  transition: all 0.3s;
}

.btn-filter-submit {
  background: #2271b1;
  color: #fff;
  border: none;
  height: 42px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  text-transform: uppercase;
}

/* ==========================================================================
   CAR CARD STRUCTURE
   ========================================================================== */
.car-shop-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 30px;
}

.car-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  border: 1px solid #eee;
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: transform 0.3s;
}

.car-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   GALLERY, BADGES & THUMBNAILS
   ========================================================================== */
.car-gallery {
  position: relative;
  height: 240px; /* Tăng nhẹ để đủ chỗ cho thumbnails */
  flex-shrink: 0;
  background: #f0f0f0;
  overflow: hidden;
}

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

/* Thanh ảnh nhỏ (Thumbnails) */
.thumb-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 6px;
  padding: 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.5));
  overflow-x: auto;
  scrollbar-width: none; /* Ẩn scrollbar Firefox */
  z-index: 4;
}

.thumb-nav::-webkit-scrollbar {
  display: none; /* Ẩn scrollbar Chrome/Safari */
}

.thumb-nav img {
  width: 45px;
  height: 35px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid rgba(255, 255, 255, 0.5);
  transition: all 0.2s;
  flex-shrink: 0;
}

.thumb-nav img:hover,
.thumb-nav img.active {
  border-color: #fff;
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   CAR CARD BODY
   ========================================================================== */
.car-card-body {
  padding: 15px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.car-brand-tag {
  font-size: 11px;
  font-weight: 700;
  color: #2271b1;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.car-card-title {
  font-size: 1.25em;
  margin: 0 0 15px;
  color: #1a1a1a;
  font-weight: 700;
  line-height: 1.4;
  min-height: 2.8em;
}

.car-specs-box {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid #f5f5f5;
}

.spec-item {
  font-size: 12px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 4px;
}

.location-box {
  grid-column: span 3;
  font-size: 12px;
  color: #888;
  margin-top: 5px;
}

/* ==========================================================================
   DESCRIPTION TOGGLE
   ========================================================================== */
.description-action {
  margin: 15px 0;
  min-height: 35px;
}

.btn-toggle-desc {
  background: #f8f9fa;
  border: 1px solid #eee;
  color: #2271b1;
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  justify-content: center;
}

.car-description-content {
  background: #fdfdfd;
  border: 1px solid #f0f0f0;
  padding: 12px;
  margin-top: 8px;
  font-size: 12px;
  color: #555;
  border-radius: 6px;
}

/* ==========================================================================
   FOOTER & ADMIN BAR
   ========================================================================== */
.car-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 15px;
  border-top: 1px solid #eee;
  margin-top: auto;
}

.car-card-price {
  font-size: 1.35em;
  font-weight: 800;
  color: #d63638;
}

.btn-contact {
  background: #2271b1;
  color: #fff;
  padding: 10px 20px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(34, 113, 177, 0.2);
}

.btn-contact:hover {
  background: #1a5a8e; /* Màu đậm hơn khi hover */
  color: #fff;

  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(34, 113, 177, 0.3);
}

.admin-contact-bar {
  margin-top: 15px;
  padding: 8px 12px;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-contact-bar a {
  color: #2271b1;
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ==========================================================================
   PAGINATION
   ========================================================================== */
.car-pagination {
  text-align: center;
  margin-top: 50px;
  display: flex;
  justify-content: center;
  gap: 5px;
}

.car-pagination .page-numbers {
  padding: 8px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  text-decoration: none;
  color: #333;
  font-weight: 600;
}

.car-pagination .current {
  background: #2271b1;
  color: #fff;
  border-color: #2271b1;
}

.car-no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px;
  background: #fff;
  border-radius: 12px;
  border: 2px dashed #eee;
}

/* Container chung */
.img-count-badge,
.car-status-badge {
  position: absolute;
  top: 12px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  z-index: 10;
  border-radius: 6px; /* Bo góc hiện đại */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3); /* Đổ bóng đậm để tách biệt khỏi nền ảnh */
}

/* Badge số lượng ảnh - Giữ tone tối nhưng thêm viền sáng */
.img-count-badge {
  left: 12px;
  background: rgba(0, 0, 0, 0.75); /* Tăng độ tối để nổi bật trên ảnh trắng */
  color: #ffffff;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Badge XE MỚI - Dùng màu Gradient đỏ sâu (Deep Crimson) */
.badge-new {
  right: 12px;
  background: linear-gradient(135deg, #c01313 0%, #7c0000 100%);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Badge XE CŨ - Thay TRẮNG bằng VÀNG HỔ PHÁCH (Amber) hoặc XANH NAVY */
/* Màu Amber tạo cảm giác "Certified Pre-owned" rất sang trọng */
/* .badge-old {
  right: 12px;
  background: linear-gradient(
    135deg,
    #f59e0b 0%,
    #d97706 100%
  );
  color: #f1f5f9;
  border: 1px solid rgba(0, 0, 0, 0.1);
} */

/* Cách 2 cho XE CŨ nếu bạn muốn tone trầm: Xanh Slate đậm */
.badge-old {
  right: 12px;
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Hiệu ứng bóng đổ tinh tế cho chữ để đọc dễ hơn trên mọi nền */
.img-count-badge,
.car-status-badge {
  text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   MOBILE OPTIMIZATION (CLEAR & READABLE)
   ========================================================================== */
@media (max-width: 768px) {
  /* 1. Tổng thể & Card */
  .car-shop-wrapper {
    padding: 10px 0;
  }
  .car-card {
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: 8px solid #f0f0f0;
  }
  .car-card-body {
    padding: 15px;
  }

  /* 2. Tiêu đề xe */
  .car-card-title {
    font-size: 1.15em !important;
    line-height: 1.4;
    margin-bottom: 12px;
  }

  /* 3. CẤU TRÚC THÔNG SỐ 2 HÀNG */
  .car-specs-box {
    display: flex;
    flex-wrap: wrap; /* Cho phép rớt dòng */
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
  }

  /* Hàng 1: Các chỉ số kỹ thuật (To và rõ) */
  .spec-item {
    font-size: 13px !important; /* Tăng kích thước font */
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
    gap: 5px;
  }

  /* Hàng 2: Địa chỉ (Tách biệt hoàn toàn) */
  .location-box {
    flex-basis: 100%; /* Ép rớt xuống hàng riêng */
    font-size: 12px !important;
    color: #777;
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
  }

  /* 4. FOOTER: GIÁ VÀ NÚT LIÊN HỆ */
  .car-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
  }

  .car-card-price {
    font-size: 1.25em !important;
    font-weight: 800;
    color: #d63638;
    flex-shrink: 0; /* Không cho giá bị co lại */
  }

  .btn-contact {
    padding: 10px 18px !important; /* Nút lớn hơn một chút */
    font-size: 12px !important;
    font-weight: 700;
    width: auto !important;
    text-align: center;
    border-radius: 6px;
    white-space: nowrap; /* Ép nút luôn nằm trên 1 hàng, không cho rớt chữ */
  }

  /* 5. Ảnh & Badge */
  .car-gallery {
    height: 210px;
  }
  .car-status-badge,
  .img-count-badge {
    font-size: 10px !important;
    padding: 4px 10px !important;
  }
}
