/* Cars Mobile-First CSS */
/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
  color: #202124;
  background-color: #f8f9fa;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Mobile-first search hero */
.search-hero {
  background: white;
  padding: 16px 8px;
  border-bottom: 1px solid #e0e0e0;
}

.search-container {
  max-width: 1200px;
  margin: 0 auto;
}

.hero-search-form {
  margin-bottom: 16px;
}

.search-input-group {
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #9aa0a6;
  z-index: 1;
  pointer-events: none;
}

.hero-search-input {
  width: 100%;
  padding: 16px 16px 16px 48px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-size: 16px;
  background: #f8f9fa;
  transition: all 0.2s ease;
  -webkit-appearance: none;
}

.hero-search-input:focus {
  outline: none;
  border-color: #1a73e8;
  background: white;
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.15);
}

.hero-search-btn {
  background: #00c853;
  color: white;
  border: none;
  padding: 16px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.hero-search-btn:hover {
  background: #00a843;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 200, 83, 0.3);
}

.hero-search-btn:active {
  transform: translateY(0);
}

/* Quick filter chips */
.quick-filters {
  margin-top: 16px;
}

.filter-chips-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.filter-chips-scroll::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  background: #f1f3f4;
  color: #5f6368;
  padding: 8px 16px;
  border-radius: 20px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.filter-chip:hover {
  background: #e8f0fe;
  color: #1a73e8;
  text-decoration: none;
}

.filter-chip.active {
  background: #1a73e8;
  color: white;
  border-color: #1a73e8;
}

/* Filters and sort header */
.filters-sort-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 8px;
  background: white;
  border-bottom: 1px solid #e0e0e0;
}

.filters-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f3f4;
  border: 1px solid #e0e0e0;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.filters-btn:hover {
  background: #e8f0fe;
  border-color: #1a73e8;
  color: #1a73e8;
}

.filters-active-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: #00c853;
  border-radius: 50%;
}

.results-count {
  flex: 1;
  font-size: 14px;
  color: #5f6368;
  font-weight: 500;
}

.sort-form {
  display: flex;
}

.sort-select {
  background: #f1f3f4;
  border: 1px solid #e0e0e0;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  min-width: 100px;
}

.sort-select:focus {
  outline: none;
  border-color: #1a73e8;
}

/* Car listings grid */
.car-listings {
  padding: 16px 8px;
  max-width: 1200px;
  margin: 0 auto;
}

.car-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 0 !important;
}

.car-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: relative;
}

.car-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  text-decoration: none;
  color: inherit;
}

.car-image-container {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
}

.car-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.car-card:hover .car-image {
  transform: scale(1.05);
}

.car-image-placeholder {
  width: 100%;
  height: 100%;
  background: #f1f3f4;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9aa0a6;
}

.car-price {
  font-size: 18px;
  font-weight: 700;
  color: #202124;
  margin: 0 0 12px 0;
}

.heart-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.heart-btn:hover {
  background: rgba(255, 255, 255, 1);
  transform: scale(1.1);
}

.heart-btn.active {
  background: #ff6b6b;
  color: white;
}

.heart-btn.active svg {
  fill: currentColor;
}

.car-info {
  padding: 16px;
}

.car-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px 0;
  color: #202124;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.car-details {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  color: #5f6368;
}

.car-separator {
  color: #dadce0;
}

.car-location {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #5f6368;
}

.car-location svg {
  flex-shrink: 0;
}

.seller-type {
  margin-left: auto;
  background: #f1f3f4;
  color: #5f6368;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.seller-type.dealer {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.seller-type.dealer svg {
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
}

.dealer-logo-small {
  width: 16px;
  height: 16px;
  object-fit: contain;
  border-radius: 2px;
}

/* Filters modal */
.filters-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.filters-modal.open {
  opacity: 1;
  visibility: visible;
}

.filters-modal-content {
  background: white;
  width: 100%;
  max-height: 80vh;
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.filters-modal.open .filters-modal-content {
  transform: translateY(0);
}

.filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid #e0e0e0;
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}

.filters-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: #202124;
}

.close-filters-btn {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #5f6368;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.close-filters-btn:hover {
  background: #f1f3f4;
}

.filters-form {
  padding: 20px;
}

.filter-group {
  margin-bottom: 20px;
}

.filter-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #202124;
  margin-bottom: 8px;
}

.filter-group input,
.filter-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  background: #f8f9fa;
  transition: all 0.2s ease;
}

.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  border-color: #1a73e8;
  background: white;
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.15);
}

.filter-row {
  display: flex;
  gap: 12px;
}

.filter-row .filter-group {
  flex: 1;
}

.filters-actions {
  display: flex;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid #e0e0e0;
  margin-top: 20px;
}

.btn-primary {
  flex: 1;
  background: #00c853;
  color: white;
  border: none;
  padding: 16px 24px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: #00a843;
  text-decoration: none;
  color: white;
}

.btn-secondary {
  flex: 1;
  background: #f1f3f4;
  color: #5f6368;
  border: 1px solid #e0e0e0;
  padding: 16px 24px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: #e8f0fe;
  color: #1a73e8;
  border-color: #1a73e8;
  text-decoration: none;
}

/* No results */
.no-results {
  text-align: center;
  padding: 60px 20px;
}

.no-results-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.no-results h3 {
  font-size: 20px;
  font-weight: 600;
  color: #202124;
  margin-bottom: 8px;
}

.no-results p {
  font-size: 16px;
  color: #5f6368;
  margin-bottom: 24px;
}

.no-results-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Floating CTA */
.floating-cta {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #00c853;
  color: white;
  padding: 16px 20px;
  border-radius: 28px;
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0, 200, 83, 0.4);
  z-index: 98;
  transition: all 0.2s ease;
}

.floating-cta:hover {
  background: #00a843;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 200, 83, 0.5);
  text-decoration: none;
  color: white;
}

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 100px;
  right: 20px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e0e0e0;
  color: #5f6368;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  z-index: 97;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: #1a73e8;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.3);
}

/* Tablet styles */
@media (min-width: 640px) {
  .search-hero {
    padding: 24px;
  }

  .hero-search-form {
    max-width: 600px;
    margin: 0 auto 20px auto;
  }

  .car-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .filters-sort-header {
    padding: 20px;
    top: 0;
  }

  .car-listings {
    padding: 24px;
  }

  .floating-cta {
    bottom: 30px;
    right: 30px;
  }

  .back-to-top {
    bottom: 120px;
    right: 30px;
  }

  /* Make car cards horizontal on tablet like desktop */
  .car-card {
    display: flex;
    flex-direction: row;
    height: auto;
  }

  .car-image-container {
    width: 320px;
    flex-shrink: 0;
    aspect-ratio: 4/3;
  }

  .car-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  /* Tablet filters modal - show as slide from right */
  .filters-modal {
    align-items: center;
    justify-content: flex-end;
  }

  .filters-modal-content {
    width: 400px;
    max-height: 90vh;
    border-radius: 20px;
    margin: 20px;
    transform: translateX(100%);
  }

  .filters-modal.open .filters-modal-content {
    transform: translateX(0);
  }
}

/* Desktop styles */
@media (min-width: 1024px) {
  .search-hero {
    padding: 32px 24px;
  }

  .car-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .filters-sort-header {
    position: static;
    top: auto;
  }

  .car-listings {
    padding: 32px;
  }

  .car-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  }

  /* Make car cards horizontal on desktop */
  .car-card {
    display: flex;
    flex-direction: row;
    height: auto;
  }

  .car-image-container {
    width: 380px;
    flex-shrink: 0;
    aspect-ratio: 4/3;
  }

  .car-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
}

/* Hide desktop layout elements on mobile/tablet */
.desktop-filters {
  display: none;
}

.desktop-layout {
  display: block;
}

.main-content {
  width: 100%;
}

/* Desktop styles - Only add left sidebar on desktop */
@media (min-width: 1024px) {
  .desktop-layout {
    display: flex;
    gap: 32px;
    max-width: 1400px;
    margin: 0 auto;
  }

  .desktop-filters {
    display: block;
    width: 280px;
    flex-shrink: 0;
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    height: fit-content;
  }

  .desktop-filters h3 {
    font-size: 18px;
    font-weight: 600;
    color: #202124;
    margin: 0 0 20px 0;
  }

  .desktop-filters .filter-group {
    margin-bottom: 16px;
  }

  .desktop-filters .filter-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #202124;
    margin-bottom: 6px;
  }

  .desktop-filters .filter-group input,
  .desktop-filters .filter-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    background: #f8f9fa;
    transition: all 0.2s ease;
  }

  .desktop-filters .filter-group input:focus,
  .desktop-filters .filter-group select:focus {
    outline: none;
    border-color: #1a73e8;
    background: white;
    box-shadow: 0 2px 6px rgba(26, 115, 232, 0.15);
  }

  .desktop-filters .filter-row {
    display: flex;
    gap: 10px;
  }

  .desktop-filters .filter-row .filter-group {
    flex: 1;
  }

  /* Dealer Services specific styling */
  .desktop-filters .service-filters label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: normal;
    margin-bottom: 8px;
    cursor: pointer;
  }

  .desktop-filters .service-filters input[type="checkbox"] {
    width: auto !important;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    accent-color: #22c55e;
  }

  .desktop-filters .service-filters span {
    font-size: 13px;
    line-height: 1.2;
  }

  .desktop-filters-actions {
    display: flex;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
    margin-top: 16px;
  }

  .main-content {
    flex: 1;
    min-width: 0;
  }

  /* Hide mobile filters button on desktop */
  .filters-btn {
    display: none;
  }

  /* Make car cards horizontal on desktop */
  .car-card {
    display: flex;
    flex-direction: row;
    height: auto;
  }

  .car-image-container {
    width: 380px;
    flex-shrink: 0;
    aspect-ratio: 4/3;
  }

  .car-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Sold car styles */
.car-card.sold {
  opacity: 0.8;
  position: relative;
}

.sold-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  border-radius: 12px 12px 0 0;
}

.sold-badge {
  background: #dc3545;
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 1px;
  transform: rotate(-15deg);
  box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.car-price.sold-price {
  display: flex;
  align-items: center;
  gap: 8px;
}

.original-price {
  text-decoration: line-through;
  opacity: 0.6;
  font-size: 14px;
}

.sold-text {
  background: #dc3545;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.car-card.sold .car-info {
  opacity: 0.8;
}

/* Mark as sold button styles */
.sold-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  align-items: center;
}

.mark-sold-btn {
  background: #28a745;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.mark-sold-btn:hover {
  background: #218838;
  transform: translateY(-1px);
}

.mark-sold-btn.sold {
  background: #6c757d;
}

.mark-sold-btn.sold:hover {
  background: #5a6268;
}

.mark-sold-btn.loading {
  opacity: 0.7;
  cursor: not-allowed;
}

.mark-sold-btn.loading::after {
  content: '';
  width: 12px;
  height: 12px;
  border: 2px solid transparent;
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 4px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Removed dark mode detection */