/**
 * Zapsell AutoScout Plugin Frontend Styles - IMPROVED DESIGN
 * 
 * Modern, clean styling inspired by Auto Eberhart reference
 */

/* ==========================================================================
   Base Styles & Layout
   ========================================================================== */

.zapsell-autoscout-listings,
.zapsell-autoscout-single-car {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #333;
  max-width: 1400px;
  margin: 0 auto;
}

/* Loading States */
.zapsell-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start; /* Changed from center to flex-start */
  padding-top: 80px; /* Add top padding to position spinner in viewport */
  z-index: 100;
  backdrop-filter: blur(3px);
  border-radius: 8px;
  border: 1px solid rgba(126, 194, 66, 0.2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Ensure the listings container can have absolute positioned children */
.zapsell-autoscout-listings {
  position: relative;
  min-height: 300px; /* Ensure container has minimum height for loading overlay */
}

/* When loading, ensure the container maintains proper dimensions */
.zapsell-autoscout-listings.zapsell-loading {
  min-height: 400px;
  background: #f8f9fa;
}

/* Better loading overlay visibility */
.zapsell-loading-overlay {
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.zapsell-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e9ecef;
  border-top: 4px solid var(--zapsell-brand-color);
  border-right: 4px solid rgba(126, 194, 66, 0.3);
  border-radius: 50%;
  animation: zapsell-spin 1s linear infinite;
  margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(126, 194, 66, 0.2);
}

.zapsell-loading-overlay p {
  margin: 0;
  font-size: 16px;
  color: #495057;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

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

/* Error Messages */
.zapsell-error,
.zapsell-error-container {
  background-color: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
  color: #856404;
}

/* No Results Message */
.zapsell-no-results {
  text-align: center;
  padding: 40px 20px;
  background-color: #f8f9fa;
  border-radius: 8px;
  margin: 20px 0;
}

.zapsell-no-results p {
  margin: 0;
  color: #666;
  font-size: 16px;
}

/* ==========================================================================
   Toolbar & Page Size Selector
   ========================================================================== */

.zapsell-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.zapsell-toolbar-left {
  display: flex;
  align-items: center;
}

.zapsell-toolbar-right {
  display: flex;
  align-items: center;
}

.zapsell-toolbar-center {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 20px;
}

.zapsell-results-count {
  font-size: 16px;
  color: #495057;
  font-weight: 600;
}

.zapsell-page-size-selector {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  white-space: nowrap;
  flex-shrink: 0;
}

.zapsell-page-size-selector label {
  font-weight: 500;
  margin: 0;
  color: #495057;
}

.zapsell-page-size-selector select {
  padding: 8px 16px;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 15px;
  min-width: 80px;
  transition: all 0.2s;
}

.zapsell-page-size-selector select:focus {
  outline: none;
  border-color: var(--zapsell-brand-color);
  box-shadow: 0 0 0 3px rgba(29, 60, 112, 0.1);
}

.zapsell-per-page-label {
  color: #6c757d;
  font-size: 15px;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .zapsell-toolbar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 20px;
  }

  .zapsell-toolbar-left,
  .zapsell-toolbar-right {
    justify-content: center;
  }

  .zapsell-page-size-selector {
    justify-content: center;
    flex-wrap: nowrap;
  }
}

/* ==========================================================================
   Car Listings Grid - Modern Premium Design
   ========================================================================== */

/* Homepage listings container - prevents grid from affecting external elements */
.zapsell-autoscout-homepage-listings {
  display: block !important;
  width: 100%;
  clear: both;
  isolation: isolate; /* Creates new stacking context */
  contain: layout; /* Contain layout to prevent grid bleeding */
}

/* Force grid to only affect direct children */
.zapsell-listings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px 20px;
  width: 100%;
  contain: layout;
}

.zapsell-listings-homepage-grid {
  grid-template-columns: repeat(4, 1fr);
  display: grid !important; /* Ensure grid only applies to this element */
}

/* Prevent any element immediately after homepage listings from being affected by grid */
.zapsell-autoscout-homepage-listings + * {
  grid-column: unset !important;
  grid-row: unset !important;
}

/* Responsive Grid Breakpoints for homepage grid */
@media (max-width: 1200px) {
  .zapsell-listings-homepage-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .zapsell-listings-homepage-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .zapsell-listings-homepage-grid {
    grid-template-columns: 1fr;
  }
  
  /* Ensure homepage container doesn't interfere with elements below it on mobile */
  .zapsell-autoscout-homepage-listings {
    margin-bottom: 20px;
    display: block;
  }
  
  /* Force any element after the listings to appear below */
  .zapsell-autoscout-homepage-listings::after {
    content: "";
    display: block;
    clear: both;
    height: 0;
  }
}

/* Responsive Grid Breakpoints */
@media (max-width: 768px) {
  .zapsell-listings-grid {
    grid-template-columns: 1fr;
  }
}


.zapsell-car-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: none;
  transition: box-shadow 0.3s ease;
}

.zapsell-car-link {
  text-decoration: none;
  color: inherit;
  display: block;
  height: 100%;
}

.zapsell-car-link:hover,
.zapsell-car-link:focus {
  text-decoration: none;
  color: inherit;
}

.zapsell-car-card:hover {
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.zapsell-car-card-image-container {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 70%; /* aspect ratio */
  overflow: hidden;
  background-color: #f0f0f0;
}

.zapsell-car-card-image {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  transition: transform 0.3s ease;
  display: block;
  min-width: 100%;
  min-height: 100%;
}

.zapsell-car-card-image:hover {
  transform: translate(-50%, -50%) scale(1.10);
}

/* Note: Placeholder images are now handled in PHP directly */

/* Car Info Section - Clean and organized */
.zapsell-car-info {
  padding: 15px;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: white;
  text-align: center;
  align-items: center;
}
.zapsell-car-info.zapsell-car-header-left {
  align-items: flex-start;
  justify-content: flex-start;
}
.zapsell-car-title-left {
  text-align: left;
}

/* Car Year - Subtle */
.zapsell-car-year {
  color: #6c757d;
  font-size: 15px;
  margin: 0 0 20px 0;
  line-height: 1.4;
  font-weight: 400;
}

/* Price - Premium styling */
.zapsell-car-price {
  font-size: 19px;
  font-weight: 500;
  margin: 0 0 12px;
  color: #1a1a1a;
}

.zapsell-price {
  font-size: 19px;
  font-weight: 500;
  color: #1a1a1a;
}

/* Car Specifications - Clean 2x2 grid layout */
.zapsell-car-specs {
  color: #666;
  border-top: 1px dotted #666;
  padding-top: 15px;

  width: 100%;
  display: flex;
  justify-content: space-around;
}

.zapsell-spec {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 6px;
  transition: background 0.2s;
}

.zapsell-car-card:hover .zapsell-spec {
  background: #f1f3f5;
}

/* Note: Icons are now handled as separate SVG files in templates */

.zapsell-spec-value {
  color: #1a1a1a;
  font-weight: 500;
  font-size: 14px;
  max-width: 100%;
}

/* Mobile Responsive */
@media (max-width: 640px) {
  .zapsell-listings-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .zapsell-car-info {
    padding: 15px;
  }

  .zapsell-car-title {
    font-size: 18px;
  }

  .zapsell-price {
    font-size: 18px;
  }

  .zapsell-car-specs {
    flex-direction: row;
    gap: 8px;
  }

  .zapsell-car-spec-item {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

/* ==========================================================================
   Pagination - Modern Clean Design
   ========================================================================== */

.zapsell-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 48px 0 32px;
  flex-wrap: wrap;
}

.zapsell-pagination-btn,
.zapsell-pagination-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border: 1px solid #dee2e6;
  background: white;
  color: #495057;
  text-decoration: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.2s;
  min-width: 48px;
  min-height: 48px;
}

.zapsell-pagination-btn:hover,
.zapsell-pagination-number:hover {
  background-color: #f8f9fa;
  border-color: var(--zapsell-brand-color);
  color: var(--zapsell-brand-color);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.zapsell-pagination-current {
  background: var(--zapsell-brand-color);
  color: white;
  border-color: var(--zapsell-brand-color);
  box-shadow: 0 4px 12px rgba(29, 60, 112, 0.3);
}

.zapsell-pagination-current:hover {
  background: var(--zapsell-brand-color);
  transform: translateY(-2px);
  color: #fff;
}

.zapsell-pagination-ellipsis {
  color: #6c757d;
  padding: 12px 8px;
  font-weight: 600;
}

.zapsell-pagination-numbers {
  display: flex;
  align-items: center;
  gap: 8px;
}

.zapsell-pagination-info {
  text-align: center;
  color: #6c757d;
  font-size: 15px;
  margin-top: 24px;
  font-weight: 400;
}

/* Mobile Responsive Pagination */
@media (max-width: 768px) {
  .zapsell-pagination {
    padding: 0 16px;
    margin: 32px 0 24px;
  }
  
  .zapsell-pagination-btn,
  .zapsell-pagination-number {
    padding: 10px 16px;
    min-width: 44px;
    min-height: 44px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .zapsell-pagination {
    gap: 6px;
    padding: 0 16px;
    margin: 32px -16px 24px;
    overflow-x: auto;
    overflow-y: visible;
    justify-content: center;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
    width: calc(100% + 32px);
  }
  
  .zapsell-pagination::-webkit-scrollbar {
    display: none; /* Chrome, Safari */
  }
  
  .zapsell-pagination-btn,
  .zapsell-pagination-number {
    padding: 8px 12px;
    min-width: 40px;
    min-height: 40px;
    font-size: 13px;
    flex-shrink: 0;
  }
  
  .zapsell-pagination-ellipsis {
    padding: 8px 4px;
    flex-shrink: 0;
  }
  
  .zapsell-pagination-info {
    font-size: 14px;
    padding: 0 32px;
  }
}

/* ==========================================================================
   No Listings State
   ========================================================================== */

.zapsell-no-listings {
  text-align: center;
  padding: 64px 32px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  margin: 32px 0;
}

.zapsell-no-listings p {
  font-size: 18px;
  color: #6c757d;
  margin: 0;
  font-weight: 500;
}

/* ===========================
   Additional Car Card Styles
   =========================== */

.zapsell-car-card a {
  text-decoration: none;
  color: inherit;
}

.zapsell-car-title {
  font-size: 20px;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 10px;
  line-height: 1.3;
  color: #1a1a1a;
}

.zapsell-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zapsell-car-registration-date {
  color: #666;
  font-size: 14px;
  margin: 0 0 8px;
}

.zapsell-spec-icon {
  width: 30px !important;
  height: 30px !important;
  opacity: 0.7;
}

.zapsell-car-spec-item {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 8px;
  font-size: 14px;
  flex: 1;
  max-width: 33%;
}

.zapsell-car-spec-item span {
  color: #333;
  font-weight: 500;
}



/* Prevent icons from zooming */
.zapsell-spec-icon,
.zapsell-spec-icon:hover {
  transform: none !important;
  transition: none !important;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  .zapsell-pagination,
  .zapsell-page-size-selector,
  .zapsell-car-actions,
  .zapsell-car-navigation {
    display: none !important;
  }

  .zapsell-car-card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ddd;
  }

  .zapsell-filter-container {
    display: none !important;
  }
}

/* ==========================================================================
   Filter Bar Styles
   ========================================================================== */

.zapsell-filter-container {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 32px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.zapsell-filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f0f0f0;
}

.zapsell-filter-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #333;
}

.zapsell-clear-filters-btn {
  background: var(--zapsell-brand-color) !important;
  color: #fff !important;
  border: none !important;
  padding: 10px 20px !important;
  border-radius: 4px !important;
  font-size: 16px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
}

.zapsell-filter-sections {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.zapsell-filter-section {
  flex: 1;
  min-width: 250px;
}

.zapsell-filter-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  padding: 12px 0;
  border-bottom: 1px solid #f0f0f0;
}

.zapsell-filter-toggle {
  color: #666;
  font-weight: normal;
  font-size: 20px;
  transition: transform 0.2s ease;
}

.zapsell-filter-section.collapsed .zapsell-filter-toggle {
  transform: rotate(90deg);
}

.zapsell-filter-section.collapsed .zapsell-filter-options {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
}

.zapsell-filter-options {
  max-height: none;
  overflow: visible;
  transition: all 0.3s ease;
  opacity: 1;
}

.zapsell-filter-option {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f8f8f8;
}

.zapsell-filter-option:last-child {
  border-bottom: none;
}

.zapsell-filter-option input[type="checkbox"] {
  margin-right: 12px;
  width: 16px;
  height: 16px;
  accent-color: var(--zapsell-brand-color);
}

.zapsell-filter-option label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  cursor: pointer;
  font-size: 15px;
  color: #333;
}

.zapsell-filter-option-text {
  flex: 1;
}

.zapsell-filter-option-count {
  color: #666;
  font-size: 14px;
  background: #f5f5f5;
  padding: 2px 8px;
  border-radius: 12px;
  margin-left: 12px;
}

.zapsell-filter-loading {
  text-align: center;
  padding: 20px;
  color: #666;
  font-style: italic;
}

.zapsell-filter-error {
  text-align: center;
  padding: 20px;
  color: #d63384;
  background: #f8d7da;
  border: 1px solid #f1aeb5;
  border-radius: 4px;
  margin: 16px 0;
}

/* Sort Section Styling */
.zapsell-sort-section {
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 16px;
}

.zapsell-sort-section .zapsell-filter-section-title {
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.zapsell-sort-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background-color: #fff;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.zapsell-sort-select:focus {
  outline: none;
  border-color: var(--zapsell-brand-color);
  box-shadow: 0 0 0 2px rgba(29, 60, 112, 0.1);
}

.zapsell-sort-select:hover {
  border-color: #bbb;
}

/* Year Range Filter Styling */
.zapsell-range-filter .zapsell-year-range {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.zapsell-range-filter .zapsell-price-range {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.zapsell-year-from,
.zapsell-year-to {
  flex: 1;
}

.zapsell-year-range label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #555;
}

.zapsell-price-range label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #555;
}

.zapsell-filter-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background-color: #fff;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.zapsell-filter-select:focus {
  outline: none;
  border-color: var(--zapsell-brand-color);
  box-shadow: 0 0 0 2px rgba(29, 60, 112, 0.2);
}

.zapsell-filter-select:hover {
  border-color: #bbb;
}

.zapsell-filter-select.zapsell-required-field {
  border-color: var(--zapsell-brand-color);
  background-color: #f8f9fa;
  box-shadow: 0 0 0 2px rgba(29, 60, 112, 0.1);
}

/* Year range helper text */
.zapsell-year-helper {
  margin-top: 8px;
  text-align: center;
}

/* Year Price helper text */
.zapsell-price-helper {
  margin-top: 8px;
  text-align: center;
}

.zapsell-year-helper small {
  color: #666;
  font-size: 12px;
  font-style: italic;
}

.zapsell-price-helper small {
  color: #666;
  font-size: 12px;
  font-style: italic;
}

/* Mobile responsive for year range */
@media (max-width: 480px) {
  .zapsell-range-filter .zapsell-year-range {
    flex-direction: column;
    gap: 12px;
  }
}

/* Model Filter - Disabled State */
.zapsell-model-filter-disabled {
  opacity: 0.6;
}

.zapsell-model-filter-disabled .zapsell-filter-section-title {
  color: #999;
  cursor: not-allowed;
}

.zapsell-filter-disabled-message {
  text-align: center;
  padding: 16px;
  color: #666;
  font-style: italic;
  font-size: 14px;
}

.zapsell-model-filter-disabled .zapsell-filter-toggle {
  display: none;
}

.zapsell-filter-actions {
  display: none;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
}

.zapsell-apply-filters-btn {
  width: 100%;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.zapsell-apply-filters-btn:hover {
  background: #122b5a;
}

/* Filter + Listings Layout */
.zapsell-listings-with-filters {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 32px;
  align-items: start;
  padding: 20px 0;
  overflow: visible;
}

.zapsell-listings-content {
  min-width: 0; /* Prevent grid overflow */
  overflow: visible;
}

/* Mobile: Ensure listings content doesn't clip pagination */
@media (max-width: 768px) {
  .zapsell-listings-content {
    width: 100%;
    overflow: visible !important;
  }
  
  .zapsell-autoscout-listings {
    overflow: visible !important;
    padding: 0 16px;
  }
}

@media (max-width: 480px) {
  .zapsell-autoscout-listings {
    padding: 0;
  }
}

/* Active Filter Indicators */
.zapsell-active-filters {
  margin-bottom: 24px;
}

.zapsell-active-filters-title {
  font-size: 14px;
  font-weight: 600;
  color: #666;
  margin-bottom: 12px;
}

.zapsell-active-filter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.zapsell-active-filter-tag {
  display: inline-flex;
  align-items: center;
  background: #e3f2fd;
  color: #1565c0;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 14px;
  border: 1px solid #bbdefb;
}

.zapsell-active-filter-tag .remove {
  margin-left: 8px;
  cursor: pointer;
  font-weight: bold;
  opacity: 0.7;
}

.zapsell-active-filter-tag .remove:hover {
  opacity: 1;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
  .zapsell-listings-with-filters {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .zapsell-filter-sections {
    flex-direction: column;
  }

  .zapsell-filter-section {
    min-width: auto;
  }
}

@media (max-width: 768px) {
  .zapsell-filter-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 80%;
    bottom: 0;
    z-index: 9999;
    background: white;
    border: none;
    border-radius: 0;
    padding: 20px;
    margin: 0;
    max-height: 100vh;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1);
  }

  .zapsell-filter-container.active {
    transform: translateX(0);
  }

  .zapsell-filter-header {
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .zapsell-filter-header h3 {
    flex-grow: 1;
    order: 1;
    margin: 0;
  }

  .zapsell-clear-filters-btn {
    order: 2;
    font-size: 12px !important;
    padding: 6px 10px !important;
  }

  .zapsell-close-filters-btn {
    background: none;
    border: none;
    font-size: 32px;
    font-weight: 400;
    color: #333;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    order: 3;
  }

  .zapsell-filter-actions {
    display: block;
    padding: 16px;
    margin: 24px -20px -20px -20px; /* Extend to edges of panel */
    border-top: none;
    position: sticky;
    bottom: 0;
  }

  .zapsell-filter-actions .zapsell-apply-filters-btn {
   background: var(--zapsell-brand-color) !important;
      color: #fff !important;
      border: none;
  }

  .zapsell-filter-actions .zapsell-apply-filters-btn:hover {
    background-color: #f0f0f0;
  }

 

  .zapsell-mobile-only {
    display: block !important;
  }

  /* Mobile filter toggle button */
  .zapsell-mobile-filter-toggle {
    display: inline-flex;
    align-items: center;
    background: var(--zapsell-brand-color);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 16px;
    transition: background-color 0.2s ease;
  }

  .zapsell-mobile-filter-toggle:hover {
    background: #122b5a;
  }

  .zapsell-mobile-filter-toggle svg {
    width: 16px;
    height: 16px;
    margin-right: 8px;
  }
}

/* Desktop only - hide mobile elements */
@media (min-width: 769px) {
  .zapsell-mobile-only {
    display: none !important;
  }
}
/* ==========================================================================
   Single Car Page - Style 2 (Compact)
   ========================================================================== */

.zapsell-single-car-style-2.compact-view {
  max-width: 1200px;
  margin: 30px auto;
}

.zapsell-compact-layout {
  display: grid;
  grid-template-columns: 5fr 2fr;
  gap: 30px;
}

.zapsell-main-content .zapsell-main-title {
  font-size: 34px;
  font-weight: 600;
  margin: 0 0 5px 0;
}

.zapsell-main-content .zapsell-subtitle {
  font-size: 16px;
  font-weight: 400;
  color: #6c757d;
  margin: 0 0 20px 0;
}

.zapsell-description-section {
  margin-top: 30px;
}

.zapsell-description-section h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 15px;
}

.zapsell-description-content {
  font-size: 15px;
  line-height: 1.6;
}

.zapsell-sidebar-content .zapsell-price-box {
  background-color: #f8f9fa;
  padding: 7px;
  border-radius: 8px;
  text-align: center;
  margin-bottom: 20px;
}

.zapsell-sidebar-content .zapsell-price-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--zapsell-brand-color);
}

.zapsell-sidebar-content .zapsell-specs-box {
  background-color: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.zapsell-sidebar-content .zapsell-specs-box h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 15px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid #e9ecef;
}

.zapsell-specs-list .zapsell-spec-item-compact {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 8px 0;
  border-bottom: 1px solid #e9ecef;
}

.zapsell-specs-list .zapsell-spec-item-compact:last-child {
  border-bottom: none;
}

.zapsell-spec-group + .zapsell-spec-group {
  margin-top: 20px;
}

.zapsell-spec-group-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 10px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #dee2e6;
  color: #343a40;
}

.zapsell-spec-item-compact .zapsell-spec-label {
  color: #6c757d;
  font-size: 16px;
}

.zapsell-spec-item-compact .zapsell-spec-value {
  font-weight: 500;
   font-size: 16px;
}

.zapsell-inquiry-box .zapsell-inquiry-button {
  display: block;
  width: 100%;
  padding: 15px;
  background-color: var(--zapsell-brand-color);
  color: #fff;
  text-decoration: none;
  border-radius: 5px;
  font-weight: 600;
  text-align: center;
  transition: background-color 0.3s ease;
}

.zapsell-inquiry-box .zapsell-inquiry-button:hover {
  background-color: #122b5a;
}

.zapsell-single-navigation-style-2 {
  margin-top: 40px;
  text-align: left;
}

.zapsell-back-button {
  display: inline-block;
  padding: 10px 20px;
  background-color: #f1f3f5;
  color: #333;
  text-decoration: none;
  border-radius: 5px;
  font-weight: 500;
  transition: background-color 0.3s ease;
}

.zapsell-single-back-link:hover {
  background: #f8f9fa;
  color: #1a1a1a;
  text-decoration: none;
  transform: translateY(-2px);
}

.zapsell-new-gallery {
  margin-bottom: 40px;
}

.zapsell-main-image-container {
  position: relative;
  margin-bottom: 10px;
  width: 100%;
  height: 0;
  padding-bottom: 70%; /*  aspect ratio for main image */
  overflow: hidden;
  background-color: #f0f0f0;
  border-radius: 8px;
}

.zapsell-main-image-new {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  border-radius: 8px;
  display: block;
  min-width: 100%;
  min-height: 100%;
  background-color: #f0f0f0;
  opacity: 1;
}

.zapsell-main-image-new:not([src]),
.zapsell-main-image-new[src=""] {
  opacity: 0.3;
}

.zapsell-gallery-nav {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  transform: translateY(-50%);
}

/* Gallery navigation buttons - override Elementor styles */
.zapsell-new-gallery .zapsell-gallery-nav button.zapsell-gallery-prev,
.zapsell-new-gallery .zapsell-gallery-nav button.zapsell-gallery-next,
button.zapsell-gallery-prev,
button.zapsell-gallery-next,
.zapsell-gallery-prev,
.zapsell-gallery-next {
  background: rgba(0, 0, 0, 0.5) !important;
  background-color: rgba(0, 0, 0, 0.5) !important;
  color: white !important;
  border: none !important;
  cursor: pointer;
  border-radius: 50%;
  margin: 0 15px;
  transition: background-color 0.3s ease, transform 0.2s ease;
  padding:10px 20px;
}

/* Hover state - use brand color */
.zapsell-new-gallery .zapsell-gallery-nav button.zapsell-gallery-prev:hover,
.zapsell-new-gallery .zapsell-gallery-nav button.zapsell-gallery-next:hover,
button.zapsell-gallery-prev:hover,
button.zapsell-gallery-next:hover,
.zapsell-gallery-prev:hover,
.zapsell-gallery-next:hover {
  background: var(--zapsell-brand-color) !important;
  background-color: var(--zapsell-brand-color) !important;
  transform: scale(1.1) !important;
}

/* Active/clicked state - use brand color */
.zapsell-new-gallery .zapsell-gallery-nav button.zapsell-gallery-prev:active,
.zapsell-new-gallery .zapsell-gallery-nav button.zapsell-gallery-next:active,
button.zapsell-gallery-prev:active,
button.zapsell-gallery-next:active,
.zapsell-gallery-prev:active,
.zapsell-gallery-next:active {
  background: var(--zapsell-brand-color) !important;
  background-color: var(--zapsell-brand-color) !important;
  transform: scale(0.95) !important;
}

.zapsell-gallery-counter {
  position: absolute;
  bottom: 15px;
  right: 15px;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 14px;
}

.zapsell-thumbnails-container {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.zapsell-thumbnail-wrapper {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 70%; /* aspect ratio for thumbnails */
  overflow: hidden;
  background-color: #f0f0f0;
  border-radius: 4px;
}

.zapsell-thumbnail-wrapper a {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.zapsell-thumbnail-new {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.2s ease;
  display: block;
  min-width: 100%;
  min-height: 100%;
  opacity: 1;
  background-color: #f0f0f0;
}

.zapsell-thumbnail-new:not([src]),
.zapsell-thumbnail-new[src=""] {
  opacity: 0.3;
}

.zapsell-thumbnail-new.active {
  border-color: var(--zapsell-brand-color);
}

@media (max-width: 768px) {
  .zapsell-thumbnails-container {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .zapsell-main-title{
    font-size: 28px !important;
  }
}

@media (max-width: 992px) {
  .zapsell-compact-layout {
    grid-template-columns: 1fr;
  }

  .zapsell-sidebar-content {
    margin-top: 30px;
  }

  .zapsell-details-list{
    grid-template-columns: repeat(1, 1fr) !important;
  }

  .zapsell-equipment-grid{
        grid-template-columns: 1fr !important;
  }

  .zapsell-equipment-list-cols{
     grid-template-columns: 1fr !important;
  }
}

/* ==========================================================================
   Energy Efficiency Bar
   ========================================================================== */

.zapsell-energy-efficiency-container {
  display: flex;
  align-items: center;
}

.zapsell-energy-efficiency-bar {
  width: 120px;
}

.zapsell-energy-bar-item {
  color: white;
  padding: 3px 10px;
  margin-bottom: 5px;
  font-size: 16px;
  font-weight: bold;
  clip-path: polygon(0% 0%, 90% 0%, 100% 50%, 90% 100%, 0% 100%);
}

.zapsell-energy-bar-item[data-rating="A"] {
  background-color: #00a651;
}
.zapsell-energy-bar-item[data-rating="B"] {
  background-color: #57b743;
}
.zapsell-energy-bar-item[data-rating="C"] {
  background-color: #aacc44;
}
.zapsell-energy-bar-item[data-rating="D"] {
  background-color: #f8ee33;
  color: #333;
}
.zapsell-energy-bar-item[data-rating="E"] {
  background-color: #f2b629;
}
.zapsell-energy-bar-item[data-rating="F"] {
  background-color: #ee8023;
}
.zapsell-energy-bar-item[data-rating="G"] {
  background-color: #e7332a;
}

.zapsell-spec-item-compact .enerygy-container{
  display: flex;
  justify-content: space-between !important;
}

.zapsell-energy-bar-item[data-rating="A"] {
  width: 30%;
}
.zapsell-energy-bar-item[data-rating="B"] {
  width: 40%;
}
.zapsell-energy-bar-item[data-rating="C"] {
  width: 50%;
}
.zapsell-energy-bar-item[data-rating="D"] {
  width: 60%;
}
.zapsell-energy-bar-item[data-rating="E"] {
  width: 70%;
}
.zapsell-energy-bar-item[data-rating="F"] {
  width: 80%;
}
.zapsell-energy-bar-item[data-rating="G"] {
  width: 90%;
}

.zapsell-energy-pointer-container {
  position: relative;
  width: 40px;
  height: 100%;
}

.zapsell-energy-pointer {
  position: absolute;
  width: 40px;
  height: 28px;
  background-color: black;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 16px;
  clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%, 15% 50%);
}

.zapsell-advanced-filter-toggle-container{
  width: 100%;
  margin: 10px 0;
}

.zapsell-advanced-filter-toggle-btn {
  background-color: var(--zapsell-brand-color) !important;
  font-size: 16px !important;
  width: 100% !important;
  padding: 10px 20px !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  border: none !important;
  text-align: center !important;
  color: #fff !important;
  transition: all 0.2s ease !important;
}



/* Equipment Section */
.zapsell-equipment-section {
  margin-top: 30px;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  overflow: hidden;
}

.zapsell-toggle-button {
  background-color: #f8f9fa !important;
  border: none !important;
  padding: 15px 20px !important;
  width: 100% !important;
  text-align: left !important;
  font-size: 18px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  color: var(--zapsell-brand-color) !important;
}

.zapsell-toggle-button.active {
  background: var(--zapsell-brand-color) !important;
  color: #fff !important;
}

.zapsell-toggle-button .zapsell-toggle-icon {
  transition: transform 0.3s ease;
}

.zapsell-toggle-button.active .zapsell-toggle-icon {
  transform: rotate(180deg);
}

.zapsell-toggle-content {
  padding: 20px;
  background-color: #fff;
}

.zapsell-equipment-content h4 {
  font-size: 16px;
  font-weight: 600;
  margin-top: 10px;
  margin-bottom: 18px;
}

.zapsell-equipment-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.zapsell-equipment-standard {
  grid-column: span 2;
}

.zapsell-equipment-optional {
  grid-column: span 1;
}

.zapsell-equipment-list-cols {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.zapsell-equipment-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.zapsell-equipment-list li {
  display: flex;
  align-items: flex-start;
  margin-bottom: 14px;
  font-size: 16px;
}

.zapsell-checkmark {
  color: #28a745;
  font-size: 16px;
  margin-right: 10px;
}

/* Details Section */
.zapsell-details-section {
  margin-top: 30px;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  overflow: hidden;
}

.zapsell-details-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 40px;
}

.zapsell-details-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #e9ecef;
  align-items: center;
  gap: 10px;
}

.zapsell-details-list li:last-child {
  border-bottom: none;
}

.zapsell-details-list .zapsell-spec-label {
  color: #6c757d;
}

.zapsell-details-list .zapsell-spec-value {
  font-weight: 500;
}

.zapsell-details-columns {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.zapsell-details-column {
    flex: 1 1 calc(25% - 15px);
    min-width: 250px;
}

.zapsell-detail-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    gap: 10px;
}

/* ==========================================================================
   Elementor Compatibility - Fix Grid Bleeding Issue
   ========================================================================== */

/* Prevent Elementor containers from applying grid to plugin content */
.elementor-widget-shortcode .zapsell-autoscout-homepage-listings,
.elementor-element .zapsell-autoscout-homepage-listings,
[class*="elementor"] .zapsell-autoscout-homepage-listings {
  display: block !important;
  grid-column: 1 / -1 !important; /* Span all columns if in a grid */
}

/* Additional mobile fix for Elementor sections containing the shortcode */
@media (max-width: 480px) {
  
  /* Ensure button appears below shortcode */
  .elementor-widget-shortcode:has(.zapsell-autoscout-homepage-listings),
  .elementor-widget-shortcode:has(.zapsell-autoscout-homepage-listings) ~ .elementor-widget-button {
    width: 100% !important;
    display: block !important;
  }
}
