/* ============================================
   LISTINGS PAGE STYLES
   ============================================ */

.listings-section {
  padding: 40px 0 80px;
  background: var(--soft-white);
  position: relative;
}

.listings-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 40px;
  position: relative;
  align-items: flex-start;
}

/* Sidebar by default on Desktop */
.filters-sidebar {
  background: var(--white);
  padding: 30px;
  border-radius: 15px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.05);
  height: auto;
  position: sticky;
  top: 90px;
  z-index: 20;
  width: 100%;
  box-sizing: border-box;
  opacity: 1;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  border: 1px solid var(--light-gray);
  transition: opacity 0.3s ease;
}

.filter-toggle {
  display: flex;
  width: fit-content;
  min-width: 200px;
  padding: 14px 25px;
  background: var(--white);
  color: var(--charcoal);
  border: 2px solid var(--light-gray);
  border-radius: 12px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 4px 12px var(--shadow);
  transition: all 0.3s ease;
}

@media (min-width: 969px) {
  .filter-toggle {
    display: none;
    /* Hidden on desktop */
  }
}

.filter-toggle:hover {
  border-color: var(--secondary-teal);
  color: var(--secondary-teal);
}

.filter-toggle.active {
  background: var(--secondary-teal);
  color: white;
  border-color: var(--secondary-teal);
}

/* Remove global dropdown styles on desktop */
.filters-sidebar.active {
  max-height: none;
  padding: 30px;
  opacity: 1;
  margin-bottom: 0;
}

/* Better grid for filters when expanded on desktop */
.filters-sidebar .filter-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 30px;
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--light-gray);
}

.filter-header h3 {
  font-size: 1.3rem;
  color: var(--charcoal);
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-reset {
  background: var(--light-gray);
  color: var(--charcoal);
  padding: 6px 12px;
  border-radius: 5px;
  font-size: 0.85rem;
  font-weight: 600;
}

.btn-reset:hover {
  background: var(--warning-red);
  color: var(--white);
}

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

.filter-group h4 {
  font-size: 1rem;
  margin-bottom: 12px;
  color: var(--charcoal);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

/* Accordion Support */
.filter-group.collapsible h4:hover {
  color: var(--primary-orange);
}

.filter-group.collapsible .checkbox-group {
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 2000px;
  opacity: 1;
  overflow: hidden;
  padding-top: 10px;
  display: flex;
}

.filter-group.collapsible.collapsed .checkbox-group {
  max-height: 0 !important;
  opacity: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  overflow: hidden !important;
  pointer-events: none;
}

.toggle-icon {
  font-size: 0.8rem;
  transition: transform 0.3s ease;
  color: var(--medium-gray);
}

.filter-group select {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--light-gray);
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
}

.filter-group select:focus {
  outline: none;
  border-color: var(--primary-orange);
}

.price-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.price-inputs input,
.search-box input {
  flex: 1;
  padding: 8px;
  border: 2px solid var(--light-gray);
  border-radius: 6px;
  font-size: 0.85rem;
  max-width: 100px;
  box-sizing: border-box;
}

.price-inputs span {
  color: var(--medium-gray);
  font-weight: 500;
  flex-shrink: 0;
}

.price-inputs input:focus {
  outline: none;
  border-color: var(--primary-orange);
}

.price-shortcuts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 5px;
}

.price-shortcuts::-webkit-scrollbar {
  width: 6px;
}

.price-shortcuts::-webkit-scrollbar-track {
  background: var(--light-gray);
  border-radius: 3px;
}

.price-shortcuts::-webkit-scrollbar-thumb {
  background: var(--primary-orange);
  border-radius: 3px;
}

.price-shortcuts button {
  background: var(--light-gray);
  padding: 10px 12px;
  border: none;
  border-radius: 6px;
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--charcoal);
  font-weight: 500;
}

.price-shortcuts button:hover,
.price-shortcuts button.active {
  background: var(--primary-orange);
  color: var(--white);
}

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.95rem;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-orange);
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
}

.switch-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--kenya-green);
}

/* Listings Content */
.listings-content {
  background: var(--white);
  padding: 25px;
  border-radius: 15px;
  box-shadow: 0 5px 20px var(--shadow);
  min-width: 0;
  overflow: visible;
  position: relative;
  z-index: 1;
}

.listings-content .properties-grid {
  margin-top: 0;
}

.listings-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--light-gray);
}

.results-info p {
  font-size: 1rem;
  color: var(--medium-gray);
}

.results-info strong {
  color: var(--primary-orange);
  font-size: 1.2rem;
}

.sort-options {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sort-options label {
  font-weight: 600;
  color: var(--charcoal);
}

.sort-options select {
  padding: 10px 15px;
  border: 2px solid var(--light-gray);
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
}

.sort-options select:focus {
  outline: none;
  border-color: var(--primary-orange);
}

/* Property Actions */
.property-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
  /* background: #110010; */
}

.property-actions .btn-view {
  width: 85%;
  cursor: pointer;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

/* Property Buttons New Styles */
.action-buttons button {
  border: none;
  padding: 10px;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-whatsapp {
  background: #25d366;
  color: var(--white);
  width: 45px;
  height: 45px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.btn-whatsapp:hover {
  background: #128c7e;
  transform: scale(1.05);
}

.btn-maps {
  background: #4285f4;
  color: var(--white);
  width: 45px;
  height: 45px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.btn-maps:hover {
  background: #1a73e8;
  transform: scale(1.05);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 40px;
}

.page-btn {
  background: var(--light-gray);
  color: var(--charcoal);
  padding: 10px 15px;
  border-radius: 8px;
  font-weight: 600;
  min-width: 45px;
}

.page-btn:hover {
  background: var(--primary-orange);
  color: var(--white);
}

.page-btn.active {
  background: var(--primary-orange);
  color: var(--white);
}

.pagination span {
  color: var(--medium-gray);
}

/* Market Info Section */
.market-info {
  background: linear-gradient(135deg,
      var(--charcoal) 0%,
      var(--secondary-teal) 100%);
  color: var(--white);
  padding: 60px 0;
}

.market-info h2 {
  text-align: center;
  font-size: 2rem;
  margin-bottom: 40px;
}

.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
}

.market-card {
  background: rgba(255, 255, 255, 0.1);
  padding: 30px;
  border-radius: 15px;
  backdrop-filter: blur(10px);
}

.market-card h3 {
  font-size: 1.4rem;
  margin-bottom: 20px;
  color: var(--accent-yellow);
}

.market-card ul {
  list-style: none;
}

.market-card li {
  margin-bottom: 12px;
  padding-left: 20px;
  position: relative;
}

.market-card li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--accent-yellow);
}

.market-card strong {
  color: var(--white);
}

@media (max-width: 968px) {
  .listings-layout {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .filter-toggle {
    display: flex;
    width: 100%;
    min-width: unset;
    margin-bottom: 20px;
  }

  .filters-sidebar {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding: 0;
    margin-bottom: 0;
    position: static;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .filters-sidebar.active {
    display: block;
    max-height: 3000px;
    /* Allow room for all filter content */
    padding: 25px;
    opacity: 1;
    margin-bottom: 30px;
    overflow-y: visible;
  }

  .filters-sidebar .filter-grid-container {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .listings-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }

  .results-info {
    text-align: center;
  }

  .search-summary {
    margin-right: 0;
  }

  .sort-options {
    justify-content: space-between;
  }

  .pagination {
    flex-wrap: wrap;
    gap: 5px;
  }

  .market-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .listings-content {
    padding: 15px;
  }

  .filters-sidebar.active {
    padding: 15px;
  }

  .property-actions {
    flex-direction: column;
  }

  .property-actions .btn-view {
    width: 100%;
  }

  .action-buttons {
    width: 100%;
    justify-content: space-between;
  }

  .btn-whatsapp,
  .btn-maps {
    flex: 1;
    height: 50px;
  }
}

/* Search Box Styles */
.search-box {
  margin-bottom: 25px;
  background: #ffffff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid #e9ecef;
}

.search-box form {
  display: flex;
  gap: 10px;
  position: relative;
}

.search-box input[type="text"] {
  flex: 1;
  padding: 16px 20px;
  font-size: 16px;
  font-family: "Open Sans", sans-serif;
  border: 2px solid #e1e8ed;
  border-radius: 10px;
  background: #f8f9fa;
  color: #333;
  transition: all 0.3s ease;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.04);
}

.search-box input[type="text"]:focus {
  outline: none;
  border-color: #008b8b;
  background: #ffffff;
  box-shadow:
    0 0 0 3px rgba(0, 139, 139, 0.1),
    inset 0 2px 4px rgba(0, 0, 0, 0.04);
}

.search-box input[type="text"]::placeholder {
  color: #6c757d;
  font-weight: 400;
}

.search-box button[type="submit"] {
  padding: 0 30px;
  background: #008b8b;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 60px;
  box-shadow: 0 4px 8px rgba(0, 139, 139, 0.2);
}

.search-box button[type="submit"]:hover {
  background: #006666;
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 139, 139, 0.25);
}

.search-box button[type="submit"]:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 139, 139, 0.2);
}

.search-box button[type="submit"] i {
  font-size: 18px;
}

/* Search suggestions dropdown */
.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
  border: 1px solid #e1e8ed;
  border-top: none;
  z-index: 1000;
  max-height: 300px;
  overflow-y: auto;
  display: none;
}

.search-suggestions.show {
  display: block;
}

.search-suggestions .suggestion-item {
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.2s ease;
  border-bottom: 1px solid #f1f3f5;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-suggestions .suggestion-item:last-child {
  border-bottom: none;
}

.search-suggestions .suggestion-item:hover {
  background: #f8f9fa;
}

.search-suggestions .suggestion-item i {
  color: #008b8b;
  font-size: 14px;
}

.search-suggestions .suggestion-item .suggestion-text {
  flex: 1;
  font-size: 14px;
  color: #495057;
}

.search-suggestions .suggestion-item .suggestion-type {
  font-size: 12px;
  color: #6c757d;
  background: #f1f3f5;
  padding: 2px 8px;
  border-radius: 4px;
}

/* Search loading indicator */
.search-loading {
  display: none;
  position: absolute;
  right: 80px;
  top: 50%;
  transform: translateY(-50%);
}

.search-loading.show {
  display: block;
}

.search-loading i {
  color: #008b8b;
  font-size: 16px;
  animation: spin 1s linear infinite;
}

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

  100% {
    transform: rotate(360deg);
  }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .search-box {
    margin-bottom: 20px;
    padding: 15px;
  }

  .search-box form {
    flex-direction: column;
    gap: 12px;
  }

  .search-box input[type="text"] {
    padding: 14px 16px;
    font-size: 15px;
  }

  .search-box button[type="submit"] {
    padding: 14px;
    width: 100%;
  }

  .search-box button[type="submit"] i {
    font-size: 16px;
  }

  .search-suggestions {
    position: relative;
    top: 0;
    margin-top: 10px;
    border-radius: 10px;
    border: 1px solid #e1e8ed;
  }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  .search-box {
    background: #2d3748;
    border-color: #4a5568;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  }

  .search-box input[type="text"] {
    background: #4a5568;
    border-color: #718096;
    color: #e2e8f0;
  }

  .search-box input[type="text"]:focus {
    border-color: #008b8b;
    background: #2d3748;
    box-shadow: 0 0 0 3px rgba(0, 139, 139, 0.2);
  }

  .search-box input[type="text"]::placeholder {
    color: #a0aec0;
  }

  .search-suggestions {
    background: #2d3748;
    border-color: #4a5568;
  }

  .search-suggestions .suggestion-item {
    border-color: #4a5568;
    color: #e2e8f0;
  }

  .search-suggestions .suggestion-item:hover {
    background: #4a5568;
  }

  .search-suggestions .suggestion-item .suggestion-text {
    color: #e2e8f0;
  }

  .search-suggestions .suggestion-item .suggestion-type {
    background: #4a5568;
    color: #a0aec0;
  }
}

.loading-spinner {
  text-align: center;
  padding: 60px;
  font-size: 18px;
  color: #666;
}

.loading-spinner i {
  font-size: 24px;
  margin-right: 10px;
}

.no-results,
.no-results-filtered {
  text-align: center;
  padding: 60px;
  grid-column: 1 / -1;
}

.no-results i,
.no-results-filtered i {
  font-size: 48px;
  color: #ddd;
  margin-bottom: 20px;
}

.search-summary {
  background: #f0f7ff;
  padding: 10px 15px;
  border-radius: 8px;
  margin-right: 20px;
  font-size: 14px;
}

.error-message {
  text-align: center;
  padding: 60px;
  grid-column: 1 / -1;
}

.error-message i {
  font-size: 48px;
  color: #ff6b35;
  margin-bottom: 20px;
}

.btn-text {
  background: none;
  border: none;
  color: #008b8b;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.btn-reset-all {
  background: #008b8b;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 15px;
}

/* Pagination Styles */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 8px;
  border: 1px solid #e0e0e0;
  background: white;
  color: #666;
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-btn:hover:not(.active):not(.disabled) {
  background: #f5f5f5;
  border-color: #008b8b;
  color: #008b8b;
}

.page-btn.active {
  background: #008b8b;
  border-color: #008b8b;
  color: white;
}

.page-btn.disabled,
.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.page-dots {
  padding: 0 4px;
  color: #999;
  font-weight: 500;
}

/* Hide pagination when not needed */
.pagination[style*="display: none"] {
  display: none !important;
}

/* Loading Spinner */
.loading-spinner {
  text-align: center;
  padding: 60px;
  grid-column: 1 / -1;
}

.loading-spinner i {
  font-size: 24px;
  color: #008b8b;
  margin-right: 10px;
}

/* No Results */
.no-results,
.no-results-filtered {
  text-align: center;
  padding: 60px;
  grid-column: 1 / -1;
}

.no-results i,
.no-results-filtered i {
  font-size: 48px;
  color: #ddd;
  margin-bottom: 20px;
}

.no-results h3,
.no-results-filtered h4 {
  color: #666;
  margin-bottom: 10px;
}

.btn-reset-all {
  background: #008b8b;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 15px;
  font-weight: 500;
}

.btn-reset-all:hover {
  background: #006666;
}

/* Search Summary */
.search-summary {
  background: #f0f7ff;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  color: #006666;
  margin-left: 16px;
}

.search-summary strong {
  font-weight: 600;
}

.search-summary small {
  color: #666;
  margin-left: 8px;
}

/* Responsive Pagination */
@media (max-width: 768px) {
  .pagination {
    gap: 4px;
  }

  .page-btn {
    min-width: 36px;
    height: 36px;
    font-size: 13px;
  }

  .page-dots {
    padding: 0 2px;
  }

  .search-summary {
    margin-left: 0;
    margin-top: 10px;
    width: 100%;
  }

  .listings-toolbar {
    flex-wrap: wrap;
  }
}