/* Property Listings Widget - Frontend Styles */

/* Accessibility Utilities */
.plw-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Focus Management */
*:focus {
  outline: 2px solid #007cba;
  outline-offset: 2px;
}

/* Main Container */
.plw-container {
  max-width: 100%;
  margin: 0 auto;
  position: relative;
  box-sizing: border-box;
}

/* Ensure container maintains basic layout during AJAX loading */
.plw-container .plw-properties-container {
  min-height: 200px; /* Prevent collapse during loading */
  position: relative;
}

/* Filter Form Styles */

.plw-filters {
  padding: 0 !important;
  border-radius: 0px !important;
  margin-bottom: 0px !important;
}

.plw-container .plw-filter-form {
  border-radius: 0px !important;
}

.plw-filter-form {
  background: #efefef;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 30px;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e9ecef;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Mobile Filter Toggle */
.plw-mobile-filter-toggle {
  display: flex;
  width: 100%;
  padding: 12px 16px;
  background: #073d5f;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 15px;
  transition: all 0.3s ease;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.plw-mobile-filter-toggle:hover {
  background: #073d5f;
  transform: translateY(-1px);
}

.plw-mobile-filter-toggle:active {
  transform: translateY(0);
}

.plw-mobile-filter-toggle.active {
  background: #6c757d;
}

.plw-mobile-filter-toggle.active:hover {
  background: #6c757d;
}

.plw-mobile-filter-toggle i {
  font-size: 14px;
  transition: all 0.2s ease;
  margin-right: 6px;
}

.plw-mobile-filter-toggle.active i {
  transform: rotate(0deg);
}

/* Hide mobile toggle on desktop */
@media (min-width: 1025px) {
  .plw-mobile-filter-toggle {
    display: none !important;
  }

  .plw-filter-fields {
    display: block !important;
  }
}

.plw-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 15px;
  width: 100%;
  box-sizing: border-box;
}

.plw-filter-field {
  flex: 1;
  min-width: 200px;
  box-sizing: border-box;
}

.plw-filter-label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: #495057;
}

.plw-filter-input,
.plw-filter-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 14px;
  background-color: #fff;
}

.plw-filter-input:focus,
.plw-filter-select:focus {
  outline: none;
  border-color: #007cba;
  box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.plw-filter-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 5px;
}

/* Property Grid Styles */
.plw-property-grid {
  display: grid;
  gap: 20px;
  margin-bottom: 30px;
  width: 100%;
  min-height: 200px; /* Prevent collapse when empty */
  box-sizing: border-box;
}

/* Ensure grid maintains layout during loading */
.plw-properties-container {
  width: 100%;
  box-sizing: border-box;
  position: relative;
}

.plw-layout-grid.plw-columns-1 {
  grid-template-columns: 1fr;
}

.plw-layout-grid.plw-columns-2 {
  grid-template-columns: repeat(2, 1fr);
}

.plw-layout-grid.plw-columns-3 {
  grid-template-columns: repeat(3, 1fr);
}

.plw-layout-grid.plw-columns-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* List Layout Styles - Override grid display */
.plw-property-grid.plw-layout-list {
  display: flex !important;
  flex-direction: column;
  gap: 20px;
}

.plw-property-grid.plw-layout-list .plw-property-card {
  display: flex !important;
  flex-direction: row;
  min-height: auto;
  max-width: 100%;
}

.plw-property-grid.plw-layout-list .plw-property-image {
  width: 250px;
  height: 180px;
  flex-shrink: 0;
}

.plw-property-grid.plw-layout-list .plw-property-content {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.plw-property-grid.plw-layout-list .plw-property-details {
  margin: 10px 0;
}

.plw-property-grid.plw-layout-list .plw-property-actions {
  margin-top: auto;
  padding-top: 15px;
}

/* List Layout Responsive */
@media (max-width: 768px) {
  .plw-property-grid.plw-layout-list .plw-property-card {
    flex-direction: column !important;
  }

  .plw-property-grid.plw-layout-list .plw-property-image {
    width: 100%;
    height: 200px;
  }
}

/* Property Card Styles */
.plw-property-card {
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 0px !important;
  overflow: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  position: relative;
  min-height: 300px; /* Ensure cards have minimum height */
  display: flex;
  flex-direction: column;
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.plw-property-card:hover,
.plw-property-card:focus-within {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: #007cba;
}

.plw-property-card:focus {
  outline: 2px solid #007cba;
  outline-offset: 2px;
}

.plw-property-image {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
}

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

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

/* Enhanced visual feedback for clickable cards */
.plw-property-card.plw-clickable-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
  border-color: #007cba;
}

/* Dynamic Header Styles */
.plw-dynamic-header {
  margin-top: -10px;
  margin-bottom: 30px;
  padding: 20px 0;
  border-bottom: 1px solid #e9ecef;
}

.plw-header-title {
  font-size: 28px;
  font-weight: 600;
  color: #23282d;
  margin: 0 0 8px 0;
  line-height: 1.2;
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.plw-header-subtext {
  font-size: 16px;
  color: #646970;
  margin: 0;
  font-weight: 400;
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Hide subtext when empty and adjust title margin */
.plw-header-subtext:empty {
  display: none;
}

.plw-dynamic-header:has(.plw-header-subtext:empty) .plw-header-title {
  margin-bottom: 0;
}

/* Responsive adjustments for dynamic header */
@media (max-width: 768px) {
  .plw-dynamic-header {
    margin-bottom: 20px;
    padding: 15px 0;
  }

  .plw-header-title {
    font-size: 24px;
  }

  .plw-header-subtext {
    font-size: 14px;
  }
}

.plw-image-count {
  display: none !important;
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.plw-property-content {
  padding: 20px;
  flex: 1; /* Take up remaining space in flex container */
  min-height: 150px; /* Ensure content has minimum height */
}

.plw-property-price {
  font-size: 24px;
  font-weight: 700;
  color: #000 !important;
  margin-bottom: 10px;
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.plw-property-title {
  margin: 0 0 10px 0;
  font-size: 18px;
  font-weight: 500 !important;
  line-height: 1.3;
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.plw-property-title a {
  color: #333;
  text-decoration: none;
  font-family: inherit;
}

.plw-property-title a:hover {
  color: #007cba;
}

.plw-property-location {
  color: #454545 !important;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.plw-property-details {
  display: flex;
  flex-wrap: wrap;
  gap: 30px !important;
  margin-bottom: 15px;
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.plw-detail-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  color: #454545 !important;
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* BER Rating Images within property details */
.plw-detail-item .plw-ber-rating-image {
  height: 18px;
  width: auto;
  max-width: 45px;
  border-radius: 2px;
  transition: transform 0.2s ease;
  vertical-align: middle;
}

/* Ensure BER rating detail item aligns properly with other details */
.plw-detail-item.plw-detail-ber {
  align-items: center;
}

.plw-detail-item.plw-detail-ber .plw-ber-rating-image {
  margin: 0;
  flex-shrink: 0;
}

.plw-property-excerpt {
  color: #6c757d;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 15px;
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.plw-property-actions {
  display: flex;
  gap: 10px;
  padding-left: 14px;
  padding-bottom: 20px;
  justify-content: flex-start; /* Left align the buttons */
}

/* Button Styles */
.plw-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.plw-filter-actions .plw-btn {
  font-weight: 600;
  border-radius: 6px;
}

.plw-property-actions .plw-btn {
  flex: none; /* Don't stretch to fill width */
  justify-content: center;
  min-height: auto; /* Remove fixed height */
  font-weight: 600;
  text-align: center;
  border-radius: 6px; /* Rounded corners like filter buttons */
  box-shadow: 0 2px 4px rgba(0, 124, 186, 0.2); /* Same shadow as filter buttons */
  padding: 6px 16px; /* Same padding as filter buttons */
}

.plw-property-actions .plw-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 124, 186, 0.3);
}

.plw-btn-primary {
  background: #007cba;
  color: #fff;
}

.plw-btn-primary:hover {
  background: #005a87;
}

.plw-filter-actions .plw-btn-primary {
  box-shadow: 0 2px 4px rgba(0, 124, 186, 0.2);
}

.plw-filter-actions .plw-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 124, 186, 0.3);
}

.plw-btn-secondary {
  background: #6c757d;
  color: #fff;
}

.plw-btn-secondary:hover {
  background: #545b62;
}

.plw-filter-actions .plw-btn-secondary {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
}

.plw-filter-actions .plw-btn-secondary:hover {
  background: #e9ecef;
  border-color: #adb5bd;
  transform: translateY(-1px);
  color: #495057;
}

/* Loading States */
.plw-loading {
  text-align: center;
  padding: 40px 20px;
  position: absolute !important;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.plw-loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #007cba;
  border-radius: 50%;
  animation: plw-spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

.plw-no-properties,
.plw-error {
  text-align: center;
  padding: 40px 20px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e9ecef;
}

.plw-no-properties-icon {
  font-size: 48px;
  color: #6c757d;
  margin-bottom: 20px;
}

.plw-no-properties h3 {
  color: #23282d;
  font-size: 24px;
  margin: 0 0 15px 0;
  font-weight: 600;
}

.plw-no-properties-message {
  color: #646970;
  font-size: 16px;
  margin: 0 0 20px 0;
  line-height: 1.5;
}

.plw-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 20px 0 30px 0;
}

.plw-filter-badge {
  display: inline-block;
  padding: 8px 16px;
  background: #007cba;
  color: white;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
}

.plw-no-properties-suggestions {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 20px;
  margin: 30px auto;
  max-width: 600px;
  text-align: left;
}

.plw-no-properties-suggestions h4 {
  color: #23282d;
  font-size: 16px;
  margin: 0 0 15px 0;
  font-weight: 600;
}

.plw-no-properties-suggestions ul {
  margin: 0;
  padding: 0 0 0 20px;
  list-style: disc;
}

.plw-no-properties-suggestions li {
  color: #646970;
  font-size: 14px;
  line-height: 1.8;
  margin-bottom: 8px;
}

.plw-no-properties-suggestions li:last-child {
  margin-bottom: 0;
}

.plw-no-properties-suggestions li strong {
  color: #23282d;
  font-weight: 600;
}

.plw-no-properties-actions {
  margin-top: 30px;
}

.plw-no-properties-actions .plw-btn {
  padding: 12px 24px;
  font-size: 16px;
}

/* Font Awesome Icons - Preserve Font Awesome font family */
.plw-property-location i,
.plw-detail-item i,
.plw-filter-actions i,
.plw-btn i,
.fa-solid,
.fa-regular,
.fa-light,
.fa-thin,
.fa-duotone,
.fa-brands {
  font-family: "Font Awesome 6 Free", "Font Awesome 6 Pro",
    "Font Awesome 6 Brands", "Font Awesome 5 Free", "Font Awesome 5 Pro",
    "FontAwesome" !important;
  margin-right: 3px !important;
  font-size: 14px !important;
  display: inline-block;
  width: 14px;
  text-align: center;
}

.plw-property-location i,
.plw-detail-item i {
  color: #000;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .plw-layout-grid.plw-columns-3,
  .plw-layout-grid.plw-columns-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .plw-property-details {
    justify-content: flex-start;
  }

  .plw-property-actions {
    flex-direction: column;
    display: inline;
  }

  /* Mobile Filter Fields - hidden by default, shown when toggle is active */
  .plw-filter-fields {
    display: none;
  }

  .plw-filter-form {
    padding: 15px;
    background: #fff;
    border: none;
    box-shadow: none;
    margin-bottom: 0px;
  }

  .plw-filter-row {
    flex-direction: column;
    gap: 10px;
  }

  .plw-filter-field {
    min-width: auto;
  }

  .plw-filter-actions {
    flex-direction: column;
    gap: 8px;
  }

  .plw-filter-actions .plw-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .plw-layout-grid.plw-columns-2,
  .plw-layout-grid.plw-columns-3,
  .plw-layout-grid.plw-columns-4 {
    grid-template-columns: 1fr;
  }

  .plw-property-image {
    height: 180px;
  }

  .plw-property-content {
    padding: 15px;
  }

  .plw-property-price {
    font-size: 20px;
  }

  .plw-property-title {
    font-size: 16px;
  }
}
/* ==========================================================================
   LAZY LOADING STYLES
   ========================================================================== */

/* Load More Container */
.plw-load-more-container {
  text-align: center;
  padding: 30px 20px;
  margin-top: 30px;
}

.plw-load-more-btn {
  background: #007cba;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 180px;
  justify-content: center;
}

.plw-load-more-btn:hover {
  background: #005a87;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 124, 186, 0.3);
}

.plw-load-more-btn:active {
  transform: translateY(0);
}

.plw-load-more-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.plw-load-more-btn i {
  font-size: 14px;
}

.plw-load-more-btn .fa-spinner {
  animation: spin 1s linear infinite;
}

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

/* Load More Info */
.plw-load-more-info {
  margin-top: 15px;
  color: #666;
  font-size: 14px;
}

.plw-showing-count {
  font-weight: 500;
  color: #333;
  line-height: 1.4;
}

/* All Properties Seen Message */
.plw-showing-count span[style*="italic"] {
  display: block;
  margin-top: 8px;
  font-size: 14px;
  color: #888 !important;
  font-style: italic !important;
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 4px;
  /* border-left: 3px solid #007cba; */
}

/* Lazy Loading Error Messages */
.plw-lazy-error {
  background: #fff2f2;
  border: 1px solid #ff6b6b;
  border-radius: 4px;
  padding: 10px 15px;
  margin: 10px 0;
  color: #d63638;
  font-size: 14px;
  text-align: center;
}

/* Loading State for Lazy Loading */
.plw-container.plw-lazy-loading .plw-property-grid {
  opacity: 0.7;
  pointer-events: none;
}

/* Smooth Transitions for New Properties */
.plw-property-item.plw-lazy-loaded {
  animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
  .plw-load-more-container {
    padding: 20px 15px;
    margin-top: 20px;
  }

  .plw-load-more-btn {
    width: 100%;
    max-width: 280px;
    padding: 14px 20px;
    font-size: 15px;
  }

  .plw-load-more-info {
    margin-top: 12px;
    font-size: 13px;
  }
}

/* Accessibility Enhancements for Lazy Loading */
.plw-load-more-btn:focus {
  outline: 2px solid #007cba;
  outline-offset: 2px;
}

/* Screen Reader Announcements */
.plw-lazy-status {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .plw-load-more-btn {
    border: 2px solid currentColor;
  }
}

/* Hide filter results count since count is handled by lazy load function */
.plw-filter-results-count {
  display: none !important;
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .plw-load-more-btn {
    transition: none;
  }

  .plw-load-more-btn:hover {
    transform: none;
  }

  .plw-property-item.plw-lazy-loaded {
    animation: none;
  }

  .plw-load-more-btn .fa-spinner {
    animation: none;
  }
}
