/**
 * Property Sort Widget Styles
 * Professional styling for property sorting interface
 * 
 * @package Property_Sort
 * @version 1.0.0
 */

/* Main sort widget container */
.property-sort-widget {
  background: #ffffff;
  display: flex;
  gap: 10px;
  align-items: center;
  transition: box-shadow 0.3s ease;
}

/* Sort label styling */
.property-sort-widget label {
  font-weight: 500;
  color: #999;
  font-size: 16px;
  margin: 0;
  white-space: nowrap;
  letter-spacing: 0.025em;
}

/* Sort dropdown styling */
.property-sort-widget select {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
  background: white;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 180px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 8px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 36px;
}

.property-sort-widget select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.property-sort-widget select:hover {
  border-color: #9ca3af;
}

/* Property Sort Custom Select Dropdown Styles */
.property-sort-select-wrapper {
  position: relative;
  width: 100%;
}

.property-sort-select-custom {
  position: relative;
  width: 100%;
}

.property-sort-select-trigger {
  padding: 8px 30px 8px 12px;
  border-radius: 10px;
  background: #edeff7;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.property-sort-select-trigger:hover {
  border-color: #9ca3af;
}

.property-sort-select-trigger:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.property-sort-select-text {
  color: #000;
  font-weight: 600;
}

.property-sort-select-options {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #d1d5db;
  border-top: none;
  border-radius: 0 0 4px 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
/* Hide scrollbar for options */
.property-sort-select-options::-webkit-scrollbar {
  display: none !important;
}

.property-sort-select-options {
  -ms-overflow-style: none; /* Internet Explorer 10+ */
  scrollbar-width: none; /* Firefox */
}
.property-sort-select-custom.active .property-sort-select-options {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.property-sort-select-option {
  padding: 10px 12px;
  cursor: pointer;
  color: #374151;
  font-size: 14px;
  transition: all 0.2s ease;
  border-bottom: 1px solid #f3f4f6;
}

.property-sort-select-option:last-child {
  border-bottom: none;
}

.property-sort-select-option:hover {
  background-color: #f8fafc;
  color: #1e57df;
}

.property-sort-select-option.selected {
  background-color: #1e57df;
  color: white;
  font-weight: 600;
}

.property-sort-select-option:first-child {
  font-style: italic;
  color: #6b7280;
}

.property-sort-select-option:first-child.selected {
  font-style: normal;
  color: white;
}

/* Loading state */
.property-sort-widget.loading {
  position: relative;
  opacity: 0.7;
}

.property-sort-widget.loading select {
  pointer-events: none;
  cursor: not-allowed;
}

.property-sort-widget.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 12px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #2563eb;
  border-radius: 50%;
  animation: rizton-spin 1s linear infinite;
}

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

/* AJAX Loading States */
.loading-properties {
  position: relative;
  pointer-events: none;
}

.properties-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
  min-height: 200px;
}

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

.properties-loading-overlay span {
  color: #374151;
  font-size: 14px;
  font-weight: 500;
}

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

/* Disabled state for sort widget during loading */
.property-sort-widget.loading .property-sort-select-custom {
  pointer-events: none;
  opacity: 0.6;
}

.property-sort-widget.loading .property-sort-select-trigger {
  cursor: not-allowed;
  background-color: #f3f4f6;
}

/* Rizton Preloader Styles for Sorting */
#rizton-preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #0a1931;
  z-index: 9999999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.75s ease-in-out, visibility 0.75s ease-in-out;
  opacity: 1;
  visibility: visible;
}

#rizton-preloader.loaded {
  opacity: 0;
  visibility: hidden;
}

.rizton-logo-container {
  position: relative;
  width: 100px;
  height: 110px;
}

.rizton-logo-container svg {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

.rizton-logo-draw-path {
  fill: none;
  fill-opacity: 0;
  stroke: #3b82f6;
  stroke-width: 1;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  transform-origin: center;
  animation: rizton-draw 2s ease-in-out forwards,
    rizton-fillAndScale 0.5s ease-in-out 2s forwards;
}

@keyframes rizton-draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes rizton-fillAndScale {
  to {
    fill-opacity: 1;
    fill: #1e57df;
    transform: scale(1.05);
  }
}

/* Hide/dim content during sorting */
body.rizton-sorting {
  overflow: hidden;
}

body.rizton-sorting .site-main,
body.rizton-sorting .site-content,
body.rizton-sorting #main,
body.rizton-sorting #content,
body.rizton-sorting .elementor-section {
  opacity: 0.2;
  pointer-events: none;
  transition: opacity 0.3s ease-in-out;
}

/* Mobile responsive design */
@media (max-width: 768px) {
  .property-sort-widget {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 16px;
  }

  .property-sort-widget select {
    width: 100%;
    min-width: unset;
  }
}
