/* Base Styles */
body {
  font-family: 'Vazirmatn', sans-serif;
  background-color: #f9f5ff;
  color: #2d3748;
  direction: rtl;
  margin: 0;
  padding: 0;
  line-height: 1.5;
}


#load-more-container {
    margin-top: 20px;
}

#load-more-btn {
    padding: 10px 20px;
    font-size: 16px;
    width: 200px;
}

#end-of-list {
    font-size: 18px;
    color: #6c757d;
}

.loader {
    display: none;
    text-align: center;
    margin-top: 20px;
}

.loader::after {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #007bff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Home Container */
.home-container {
  width: 100%;
  padding: 0 1rem 6.25rem;
  border-radius: 0.75rem;
  box-shadow: 0 0.25rem 1.25rem rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.3s ease;
}

/* Spacing Utility */
.g-4 {
  margin-bottom: 12.5rem;
}

/* Categories Section */
.categories {
  background-color: #ffffff;
  padding: 0.75rem;
  border-radius: 0.5rem;
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.05);
  margin-top: 0.9375rem;
}

.categories h2 {
  font-weight: 700;
  font-size: 1.3rem;
  color: #4a3c8c;
  border-bottom: 2px solid #6b46c1;
  padding-bottom: 0.375rem;
  margin-bottom: 0.5rem;
}

.category-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #f9fafb;
  padding: 0.5rem;
  border-radius: 0.375rem;
  transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  text-decoration: none;
  color: #2d3748;
  font-weight: 500;
  font-size: 0.75rem;
  height: 4rem;
  margin: 0.125rem;
}

.category-item img {
  width: 2rem;
  height: 2rem;
  margin-bottom: 0.25rem;
}

.category-item:hover {
  background-color: #6b46c1;
  color: #ffffff;
  transform: scale(1.05);
  box-shadow: 0 0.1875rem 0.5rem rgba(107, 70, 193, 0.2);
}

.category-item:hover img {
  filter: brightness(0) invert(1);
}

/* Search Filters */
.search-filters {
  margin: 0.9375rem 0;
}

.search-filters .card {
  border: none;
  border-radius: 0.5rem;
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.05);
  padding: 0.75rem;
  background-color: #ffffff;
}

.search-filters h3 {
  font-weight: 700;
  font-size: 1.2rem;
  color: #4a3c8c;
  margin-bottom: 0.625rem;
}

.search-filters .form-control {
  border-radius: 0.375rem;
  border: 1px solid #e2e8f0;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-filters .form-control:focus {
  border-color: #6b46c1;
  box-shadow: 0 0 0.375rem rgba(107, 70, 193, 0.2);
}

.search-filters .btn-toggle,
.search-filters .btn-primary {
  background-color: #6b46c1;
  color: #ffffff;
  border: none;
  border-radius: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-weight: 500;
  font-size: 0.875rem;
  margin: 0.25rem;
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.search-filters .btn-toggle:hover,
.search-filters .btn-primary:hover {
  background-color: #553c9a;
  transform: translateY(-2px);
}

.filter-group {
  display: none;
  transition: opacity 0.3s ease;
}

.filter-group.show {
  display: block;
  opacity: 1;
}

/* Ads Sections */
.featured-ads,
.all-ads {
  background-color: #ffffff;
  padding: 0.75rem;
  border-radius: 0.5rem;
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.05);
  margin-bottom: 0.9375rem;
}

.featured-ads h2,
.all-ads h2 {
  font-weight: 700;
  font-size: 1.3rem;
  color: #4a3c8c;
  border-bottom: 2px solid #6b46c1;
  padding-bottom: 0.375rem;
  margin-bottom: 0.5rem;
}

.ad-card {
  border: none;
  border-radius: 0.75rem;
  overflow: hidden;
  background: linear-gradient(180deg, #6b46c1 0%, #9f7aea 100%);
  color: #ffffff;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  margin: 0 0.375rem;
  min-width: 12.5rem;
  display: flex;
  flex-direction: column;
}

.ad-card a {
  text-decoration: none;
}

.ad-card:hover {
  transform: scale(1.03);
  box-shadow: 0 0.5rem 1.25rem rgba(107, 70, 193, 0.3);
}

.ad-card img {
  aspect-ratio: 4/3;
  object-fit: cover;
  width: 100%;
  height: 10rem;
  border-radius: 0.75rem 0.75rem 0 0;
}

.card-body {
  padding: 0.75rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 0.5rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-text,
.ad-info,
.mileage-info {
  font-size: 0.85rem;
  color: #e2e8f0;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.card-text {
  font-weight: 700;
  font-size: 0.9rem;
}

.ad-info i,
.mileage-info i {
  color: #ffffff;
  font-size: 0.9rem;
}

.badges-container {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.featured-badge,
.stair-badge,
.ladder-badge,
.urgent-badge,
.exhibition-badge {
  background-color: #ffffff;
  padding: 0.1875rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.7rem;
  font-weight: 600;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.featured-badge {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  color: #6b46c1;
}

.stair-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  color: #f6ad55;
}

.ladder-badge,
.urgent-badge,
.exhibition-badge {
  color: #553c9a;
  font-size: 0.65rem;
  padding: 0.125rem 0.3125rem;
}

.urgent-badge {
  color: #e53e3e;
}

.exhibition-badge {
  color: #9b2c2c;
}

.featured-badge:hover,
.stair-badge:hover {
  transform: scale(1.1);
}

/* Slider Styles */
.featured-slider {
  direction: rtl;
}

.featured-slider .slick-slide {
  margin: 0 0.375rem;
}

.featured-slider .slick-list {
  overflow: hidden;
}

.featured-slider .slick-track {
  display: flex;
  align-items: stretch;
}

.featured-slider .slick-prev,
.featured-slider .slick-next {
  z-index: 1;
  width: 2rem;
  height: 2rem;
  background-color: rgba(107, 70, 193, 0.7);
  border-radius: 50%;
}

.featured-slider:hover .slick-prev:hover,
.featured-slider:hover .slick-next:hover {
  z-index: 1;
  width: 2rem;
  height: 2rem;
  background-color: rgba(107, 70, 193, 0.7);
  border-radius: 50%;
}
.featured-slider .slick-prev:before,
.featured-slider .slick-next:before {
  color: #ffffff;
  font-size: 1rem;
}

.featured-slider .slick-prev {
  right: -0.75rem;
}

.featured-slider .slick-next {
  left: -0.75rem;
}

.featured-slider .slick-dots {
  bottom: -1.5rem;
}

.featured-slider .slick-dots li button:before {
  color: #6b46c1;
  font-size: 0.5rem;
}

/* Loader */
.loader {
  display: none;
  text-align: center;
  padding: 1rem;
}

.loader img {
  width: 2.5rem;
}

/* Popup Styles */
.popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(0.25rem);
  justify-content: center;
  align-items: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease-in-out;
}

.popup-overlay.active {
  display: flex;
}

.popup-content {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(0.625rem);
  border-radius: 1rem;
  padding: 1.5rem;
  max-width: 90vw;
  width: 37.5rem;
  max-height: 85vh;
  overflow-y: auto;
  text-align: center;
  box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.2);
  animation: slideIn 0.4s ease-out;
}

.popup-content h2 {
  margin: 0 0 0.75rem;
  font-size: 1.75rem;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.3;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}

.popup-content p {
  margin: 0 0 1.25rem;
  font-size: 1rem;
  color: #4a4a4a;
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}

.popup-banner img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
}

.popup-link {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: linear-gradient(45deg, #6b48ff, #9b59b6);
  color: #fff;
  text-decoration: none;
  border-radius: 0.5rem;
  font-weight: 600;
  margin: 0.75rem 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.popup-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.25rem 0.75rem rgba(107, 72, 255, 0.3);
}

.popup-close {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  padding: 0.625rem 1.25rem;
  border: none;
  background: #dc3545;
  color: #fff;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.popup-close:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.25rem 0.75rem rgba(220, 53, 69, 0.3);
}

.popup-timer {
  font-size: 0.8125rem;
  color: #2c3e50;
  display: flex;
  justify-content: center;
  gap: 0.3125rem;
  font-weight: 600;
  margin: 1rem 0 2.875rem;
}

.popup-timer span {
  color: #dc3545;
}
/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateY(3.125rem); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@media (min-width: 1200px) {
  .categories .row {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 0.25rem;
  }

  .category-item {
    flex: 0 0 5.625rem;
    font-size: 0.65rem;
  }

  .category-item img {
    width: 3rem;
    height: 3rem;
  }
}



@media (max-width: 767.98px) {
  .categories .row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(5rem, 1fr));
    gap: 0.25rem;
  }

  .category-item {
    font-size: 0.6rem;
    padding: 0.5rem;
  }

  .category-item img {
    width: 2rem;
    height: 2rem;
  }

  .ad-card img {
    height: 12rem;
  }

  .search-filters .card {
    padding: 0.625rem;
  }

  .search-filters h3 {
    font-size: 1.1rem;
  }
}

@media (max-width: 576px) {
  .categories h2,
  .featured-ads h2,
  .all-ads h2 {
    font-size: 1.2rem;
  }

  .category-item {
    font-size: 0.55rem;
    height: 3.5rem;
  }

  .category-item img {
    width: 1.875rem;
    height: 1.875rem;
  }

  .ad-card img {
    height: 10rem;
  }

  .search-filters .btn-toggle,
  .search-filters .btn-primary {
    padding: 0.3125rem 0.625rem;
    font-size: 0.8rem;
  }

  .card-title {
    font-size: 0.9rem;
  }

  .card-text,
  .ad-info,
  .mileage-info {
    font-size: 0.75rem;
  }

  .featured-badge,
  .stair-badge,
  .ladder-badge,
  .urgent-badge,
  .exhibition-badge {
    font-size: 0.65rem;
    padding: 0.125rem 0.25rem;
  }

  .popup-content h2 {
    font-size: 1.5rem;
  }

  .popup-content p {
    font-size: 0.875rem;
  }

  .popup-link {
    font-size: 0.8125rem;
    padding: 0.625rem 1.125rem;
  }

  .popup-timer {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .popup-content {
    padding: 1rem;
    max-width: 95vw;
  }
}
