/* Property Listing Styles */
.property-listing-container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px;
}

.property-listing {
  display: grid;
  grid-template-columns: 0.75fr 3fr;
  gap: 30px;
}

@media (max-width: 768px) {
  .property-listing {
    grid-template-columns: 1fr;
  }
}

/* Filter Form */
.filter-form {
  background-color: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filter-group {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e9ecef;
}

.filter-group:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.filter-group h4 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
}

.filter-group .icon {
  margin-right: 8px;
  font-size: 18px;
}

.filter-group input[type="text"],
.filter-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  margin-bottom: 10px;
}

.filter-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  cursor: pointer;
}

.filter-group input[type="checkbox"],
.filter-group input[type="radio"] {
  margin-right: 8px;
}

.filter-group input[type="range"] {
  width: 100%;
  margin-bottom: 8px;
}

/* Style for disabled university dropdown when contextually set */
select#university:disabled {
  background-color: #e9ecef; /* Light grey background */
  color: #6c757d; /* Muted text color */
  cursor: not-allowed;
  opacity: 0.8; /* Slightly more prominent than default disabled */
  border: 1px dashed #adb5bd; /* Optional: different border to indicate it's special */
}

/* Property Results */
#property-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.property-card-link:hover {
  color: #000;
}

.property-card {
  background-color: #faf5ef;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s cubic-bezier(0.4, 2, 0.3, 1),
    box-shadow 0.2s cubic-bezier(0.4, 2, 0.3, 1);
}

.property-card:hover {
  transform: translateY(-7px) scale(1.02);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.13);
}

.property-image {
  height: 200px;
  overflow: hidden;
  position: relative;
}

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

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

.no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background-color: #e9ecef;
  color: #6c757d;
  font-size: 14px;
}

.property-content {
  padding: 15px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 4px;
}

.property-title {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.property-location,
.property-type,
.property-provider,
.property-bills {
  color: #6c757d;
  font-size: 14px;
  margin-bottom: 10px;
}

.property-price {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
}

.property-bills {
  padding: 8px;
  border: 1px solid #c2c2c2;
  border-radius: 4px;
}

.property-details {
  display: flex;
  gap: 4px;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 14px;
  color: #495057;
}

.property-excerpt {
  font-size: 14px;
  color: #6c757d;
  margin-bottom: 15px;
  line-height: 1.5;
  max-height: 63px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* Controls and Pagination */
.property-controls {
  margin: 30px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.per-page,
.sort {
  display: flex;
  align-items: center;
  gap: 8px;
}

.per-page label,
.sort label {
  font-size: 14px;
  color: #495057;
}

.per-page select,
.sort select {
  padding: 6px 10px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
}

#clear-all {
  background-color: #6c757d;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s ease;
}

#clear-all:hover {
  background-color: #5a6268;
}

.pagination nav {
  display: flex;
  width: 100%;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 30px;
}

.pagination button {
  background-color: #f8f9fa;
  border: 1px solid #ced4da;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  color: #c2c2c2;
}

.pagination button:hover:not(:disabled) {
  background-color: #e9ecef;
}

.pagination button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.pagination:hover button.current {
  background-color: var(--accent);
  cursor: not-allowed;
}

.pagination button.current {
  background-color: var(--accent);
  color: #fff;
}

.page-numbers {
  display: flex;
  align-items: center;
  gap: 5px;
}

.page-numbers button {
  margin: 0 2px;
  padding: 5px;
  min-width: 30px;
  text-align: center;
}

.page-numbers span {
  margin: 0 5px;
}

#page-info {
  font-size: 14px;
  color: #6c757d;
}

/* Loading and Error States */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  color: #888;
  font-size: 16px;
}

.loading-spinner .spinner {
  width: 32px;
  height: 32px;
  border: 4px solid #e3e3e3;
  border-top: 4px solid #888;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}

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

.error-message {
  background-color: #f8d7da;
  color: #721c24;
  padding: 15px;
  border-radius: 4px;
  margin-bottom: 20px;
  text-align: center;
}

.no-results {
  text-align: center;
  padding: 40px 10px 30px 10px;
  color: #b00;
  font-size: 18px;
  background: #fff3f3;
  border-radius: 8px;
  margin-top: 20px;
}

.no-results button.clear-button {
  margin-top: 16px;
  background: #b00;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 8px 18px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s;
}

.no-results button.clear-button:hover {
  background: #d00;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  margin-top: 8px;
  padding: 0;
  min-height: 0;
  align-items: center;
  justify-content: flex-start;
}

.filter-chip {
  background: #e3e3e3;
  color: #333;
  border-radius: 16px;
  padding: 4px 12px 4px 10px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: 4px;
  margin-bottom: 4px;
  transition: background 0.2s;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-chip .remove-chip {
  background: none;
  border: none;
  color: #888;
  font-size: 16px;
  margin-left: 2px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.filter-chip .remove-chip:hover {
  color: #d00;
}

/* Styles for contextual filter chip (e.g., University on a University page) */
.contextual-filter-chip {
  background-color: #007bff; /* Example: A primary blue */
  color: #ffffff;
  border: 1px solid #0056b3;
  font-weight: 500;
}

.contextual-filter-chip .remove-chip {
  display: none !important; /* Ensure the remove button is always hidden for this chip */
}

#results-count {
  font-size: 16px;
  color: #333;
  font-weight: 500;
  margin-bottom: 10px;
  margin-top: 0;
}

@media (max-width: 600px) {
  .property-listing {
    gap: 10px;
  }
  .property-card {
    min-width: 90vw;
    max-width: 100vw;
  }
  .active-filters {
    flex-direction: row;
    gap: 4px;
    margin-bottom: 10px;
    margin-top: 6px;
  }
  .filter-chip {
    font-size: 13px;
    padding: 3px 10px 3px 8px;
  }
  #results-count {
    font-size: 15px;
  }
}

/* Sticky filter sidebar (desktop) */
@media (min-width: 769px) {
  .filter-form {
    position: sticky;
    top: 24px;
    z-index: 10;
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: block !important;
  }
  .open-filter-mobile {
    display: none !important;
  }
}

/* Popup filter (mobile) */
@media (max-width: 768px) {
  .filter-form {
    display: none !important;
    position: fixed;
    top: 0;
    right: 0;
    left: auto;
    bottom: 0;
    width: 90vw;
    max-width: 400px;
    height: 100vh;
    background: #fff;
    z-index: 1002;
    box-shadow: -2px 0 16px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 1.2, 0.4, 1), box-shadow 0.2s;
    will-change: transform;
    border-radius: 0;
    overflow-y: auto;
    padding-top: 48px;
  }
  .filter-form.filter-popup-active {
    display: block !important;
    transform: translateX(0);
    box-shadow: -2px 0 24px rgba(0, 0, 0, 0.18);
  }
  .open-filter-mobile {
    display: block !important;
    background: #6c757d;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 8px 18px;
    font-size: 16px;
    margin-bottom: 12px;
    margin-top: 8px;
    cursor: pointer;
    z-index: 1001;
    position: relative;
  }
  .filter-popup-backdrop {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.25);
    z-index: 1001;
  }
}

.close-filter-mobile {
  position: absolute;
  top: 10px;
  right: 16px;
  background: none;
  border: none;
  color: #888;
  font-size: 32px;
  z-index: 1003;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  display: none; /* Hide by default */
}

/* Show close button only on mobile */
@media (max-width: 768px) {
  .close-filter-mobile {
    display: block;
  }
}
