/* 🌙🌞 ADVANCED THEME SYSTEM WITH DAY/NIGHT MODE SUPPORT */

/* 📝 CSS Variables for Dynamic Theme Support */
:root {
  /* 🎨 Primary Brand Colors */
  --primary-color: #f93;
  --primary-hover: #ff8000;
  --primary-light: #ffd9b3;
  --secondary-color: #68d585;
  --secondary-hover: #40ca65;

  /* 🌞 Light Mode Colors */
  --bg-primary-light: #ffffff;
  --bg-secondary-light: #f8f9fa;
  --bg-tertiary-light: #e9ecef;
  --text-primary-light: #212529;
  --text-secondary-light: #6c757d;
  --text-muted-light: #868e96;
  --border-light: #dee2e6;
  --shadow-light: rgba(0, 0, 0, 0.1);
  --shadow-hover-light: rgba(0, 0, 0, 0.15);

  /* 🌙 Dark Mode Colors */
  --bg-primary-dark: #1a1a1a;
  --bg-secondary-dark: #2d2d30;
  --bg-tertiary-dark: #3e3e42;
  --text-primary-dark: #ffffff;
  --text-secondary-dark: #b3b3b3;
  --text-muted-dark: #8a8a8a;
  --border-dark: #404040;
  --shadow-dark: rgba(0, 0, 0, 0.3);
  --shadow-hover-dark: rgba(0, 0, 0, 0.5);

  /* 🎯 Active Theme Variables (Default: Light Mode) */
  --bg-primary: var(--bg-primary-light);
  --bg-secondary: var(--bg-secondary-light);
  --bg-tertiary: var(--bg-tertiary-light);
  --text-primary: var(--text-primary-light);
  --text-secondary: var(--text-secondary-light);
  --text-muted: var(--text-muted-light);
  --border-color: var(--border-light);
  --shadow-color: var(--shadow-light);
  --shadow-hover: var(--shadow-hover-light);

  /* 🚀 Enhanced Brand Colors with Theme Support */
  --success-color: #28a745;
  --info-color: #17a2b8;
  --warning-color: #ffc107;
  --danger-color: #dc3545;

  /* 📐 Spacing & Layout */
  --border-radius: 8px;
  --border-radius-lg: 12px;
  --transition-speed: 0.3s;
  --box-shadow: 0 4px 12px var(--shadow-color);
  --box-shadow-hover: 0 8px 25px var(--shadow-hover);
}

/* 🌙 Dark Mode Theme Variables */
[data-theme="dark"] {
  --bg-primary: var(--bg-primary-dark);
  --bg-secondary: var(--bg-secondary-dark);
  --bg-tertiary: var(--bg-tertiary-dark);
  --text-primary: var(--text-primary-dark);
  --text-secondary: var(--text-secondary-dark);
  --text-muted: var(--text-muted-dark);
  --border-color: var(--border-dark);
  --shadow-color: var(--shadow-dark);
  --shadow-hover: var(--shadow-hover-dark);
}

/* 🎨 Auto Dark Mode Support (System Preference) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: var(--bg-primary-dark);
    --bg-secondary: var(--bg-secondary-dark);
    --bg-tertiary: var(--bg-tertiary-dark);
    --text-primary: var(--text-primary-dark);
    --text-secondary: var(--text-secondary-dark);
    --text-muted: var(--text-muted-dark);
    --border-color: var(--border-dark);
    --shadow-color: var(--shadow-dark);
    --shadow-hover: var(--shadow-hover-dark);
  }
}

/* 🔄 Smooth Theme Transitions */
* {
  transition: background-color var(--transition-speed) ease,
              color var(--transition-speed) ease,
              border-color var(--transition-speed) ease,
              box-shadow var(--transition-speed) ease;
}

/* 🌊 Sequential Fade Animation (Enhanced) */
.sequential-fade {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 1.5s cubic-bezier(0.4, 0, 0.2, 1),
              transform 1.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.sequential-fade.visible {
  opacity: 1;
  transform: translateY(0);
}

/* 🏠 BIG SQUARE PROPERTY CARDS GRID */
.big-square-properties-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  padding: 2rem 0;
  max-width: 1400px;
  margin: 0 auto;
}

.big-square-property-card {
  background: var(--bg-primary);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--box-shadow);
  border: 1px solid var(--border-color);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  transform: translateY(0);
}

.big-square-property-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 60px var(--shadow-hover);
}

.property-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

/* 🖼️ Big Square Image Container */
.big-square-image-container {
  position: relative;
  width: 100%;
  height: 320px;
  overflow: hidden;
}

.big-square-property-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.big-square-property-card:hover .big-square-property-image {
  transform: scale(1.1);
}

/* 🏷️ Property Badges Overlay */
.property-badges-overlay {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.property-badge {
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 0.4rem 0.8rem;
  border-radius: 25px;
  font-size: 0.75rem;
  font-weight: 600;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.badge-category { 
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
}
.badge-type { 
  background: linear-gradient(135deg, var(--secondary-color), var(--secondary-hover));
}
.badge-rooms { 
  background: linear-gradient(135deg, var(--info-color), #0d6efd);
}
.badge-area { 
  background: linear-gradient(135deg, var(--warning-color), #e67e22);
  color: #000;
}

/* 👁️ Hover Overlay */
.property-hover-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 153, 51, 0.9), rgba(255, 128, 0, 0.9));
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.big-square-property-card:hover .property-hover-overlay {
  opacity: 1;
}

.view-details-btn {
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary-color);
  padding: 1rem 2rem;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  transform: translateY(20px);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.big-square-property-card:hover .view-details-btn {
  transform: translateY(0);
}

.view-icon {
  font-size: 1.2rem;
}

/* 📝 Property Info Container */
.big-square-property-info {
  padding: 1.5rem;
  background: var(--bg-primary);
}

.property-price-big {
  color: var(--primary-color);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.property-location-big {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.location-icon {
  font-size: 1.1rem;
}

/* 🏠 Property Features Quick Info */
.property-features-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.feature-icon {
  font-size: 1rem;
  color: var(--primary-color);
}

/* 🚫 No Properties State for Big Cards */
.no-properties-big {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  background: var(--bg-secondary);
  border-radius: 20px;
  border: 1px solid var(--border-color);
}

.no-properties-content-big {
  max-width: 500px;
  margin: 0 auto;
}

.no-properties-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.no-properties-big h4 {
  color: var(--text-primary);
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.no-properties-big p {
  color: var(--text-secondary);
  font-size: 1rem;
}

.no-properties-big a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
}

.no-properties-big a:hover {
  text-decoration: underline;
}

/* 🔍 ENHANCED SEARCH SECTION */
.search-section {
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.search-container {
  background: var(--bg-primary);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--border-radius-lg);
  padding: 1.5rem;
  box-shadow: var(--box-shadow);
  border: 1px solid var(--border-color);
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

.search-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  
  opacity: 0.8;
}

.search-container:hover {
  box-shadow: var(--box-shadow-hover);
  transform: translateY(-2px);
}

/* 🏷️ Enhanced Labels */
.search-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  text-align: left;
  position: relative;
  padding-left: 1.5rem;
}

.search-label::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 12px;
  background: var(--primary-color);
  border-radius: 2px;
  transition: all var(--transition-speed) ease;
}

/* 📝 Enhanced Form Controls */
.search-select,
.search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: all var(--transition-speed) ease;
  outline: none;
  position: relative;
}

.search-select:focus,
.search-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(255, 153, 51, 0.1);
  transform: translateY(-1px);
}

.search-select:hover:not(:disabled),
.search-input:hover:not(:disabled) {
  border-color: var(--primary-light);
  box-shadow: 0 2px 8px var(--shadow-color);
}

/* 💰 Enhanced Price Inputs */
.price-inputs {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-secondary);
  padding: 0.25rem;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
}

.price-inputs .search-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.5rem;
}

.price-separator {
  color: var(--text-secondary);
  font-weight: bold;
  font-size: 1.1rem;
  padding: 0 0.5rem;
}

/* 🔍 Enhanced Search Button */
.search-btn {
  width: 100%;
  padding: 0.75rem 1.2rem;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  color: white;
  border: none;
  border-radius: var(--border-radius);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}

.search-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.search-btn:hover {
  background: linear-gradient(135deg, var(--primary-hover), #e67300);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 153, 51, 0.3);
}

.search-btn:hover::before {
  left: 100%;
}

.search-btn:active {
  transform: translateY(0);
}

.search-icon {
  font-size: 1.1rem;
  transition: transform var(--transition-speed) ease;
}

.search-btn:hover .search-icon {
  transform: rotate(360deg);
}

/* 🗑️ Enhanced Clear Button */
.clear-btn {
  padding: 0.5rem 1.5rem;
  background: linear-gradient(135deg, var(--text-secondary), var(--text-muted));
  color: white;
  border: none;
  border-radius: calc(var(--border-radius) - 2px);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-decoration: none;
}

.clear-btn:hover {
  background: linear-gradient(135deg, #5a6268, #495057);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(108, 117, 125, 0.3);
  color: white;
  text-decoration: none;
}

/* 📊 Enhanced Results Info */
.search-results-info {
  margin-bottom: 1rem;
}

.search-results-info small {
  font-size: 0.875rem;
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: calc(var(--border-radius) * 2);
  border: 1px solid var(--border-color);
  display: inline-block;
  box-shadow: 0 2px 8px var(--shadow-color);
}

/* 🏆 Enhanced Badges */
.badge {
  display: inline-block;
  padding: 0.25em 0.6em;
  font-size: 0.75em;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: calc(var(--border-radius) / 2);
  transition: all var(--transition-speed) ease;
}

.bg-secondary {
  background: linear-gradient(135deg, var(--text-secondary), var(--text-muted)) !important;
  color: white !important;
}

.bg-success {
  background: linear-gradient(135deg, var(--success-color), #1e7e34) !important;
  color: white !important;
}

.bg-info {
  background: linear-gradient(135deg, var(--info-color), #117a8b) !important;
  color: white !important;
}

.text-success {
  color: var(--success-color) !important;
}

.text-info {
  color: var(--info-color) !important;
}

/* 📄 Enhanced Pagination */
.pagination {
  margin-bottom: 0;
}

.page-link {
  color: var(--primary-color);
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 0.5rem 0.75rem;
  margin-left: -1px;
  line-height: 1.25;
  text-decoration: none;
  transition: all var(--transition-speed) ease;
  position: relative;
  overflow: hidden;
}

.page-link:hover {
  z-index: 2;
  color: var(--primary-hover);
  text-decoration: none;
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px var(--shadow-color);
}

.page-link:focus {
  z-index: 3;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(255, 153, 51, 0.25);
}

.page-item.active .page-link {
  z-index: 3;
  color: white;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  border-color: var(--primary-color);
  box-shadow: 0 2px 8px rgba(255, 153, 51, 0.3);
}

.page-item.disabled .page-link {
  color: var(--text-muted);
  pointer-events: none;
  cursor: auto;
  background-color: var(--bg-secondary);
  border-color: var(--border-color);
  opacity: 0.6;
}

/* 📱 Enhanced Responsive Design */
@media (max-width: 992px) {
  .big-square-properties-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem 1rem;
  }

  .search-container {
    max-width: 100%;
    margin: 0 1rem;
    padding: 1.25rem;
  }
}

@media (max-width: 768px) {
  .big-square-properties-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1rem;
  }

  .big-square-image-container {
    height: 250px;
  }

  .big-square-property-info {
    padding: 1.2rem;
  }

  .property-price-big {
    font-size: 1.5rem;
  }

  .property-features-quick {
    flex-direction: column;
    gap: 0.5rem;
  }

  .search-container {
    padding: 1rem;
    margin: 0 1rem;
    border-radius: var(--border-radius);
  }

  .price-inputs {
    flex-direction: column;
    gap: 0.5rem;
  }

  .price-separator {
    display: none;
  }

  .search-btn {
    margin-top: 1rem;
    padding: 1rem;
    font-size: 1rem;
  }

  .search-label {
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
  }

  .search-container .row.mb-3 {
    margin-bottom: 1rem !important;
  }

  .clear-btn {
    margin-top: 0.5rem;
    width: 100%;
    max-width: 200px;
  }

  .pagination {
    flex-wrap: wrap;
    justify-content: center;
  }

  .page-item {
    margin: 0.1rem;
  }

  .page-link {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 576px) {
  .big-square-properties-grid {
    padding: 0.5rem;
  }

  .big-square-image-container {
    height: 200px;
  }

  .property-badges-overlay {
    top: 0.5rem;
    left: 0.5rem;
  }

  .property-badge {
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
  }

  .big-square-property-info {
    padding: 1rem;
  }

  .property-price-big {
    font-size: 1.3rem;
  }

  .search-container {
    border-radius: var(--border-radius);
    padding: 0.8rem;
  }

  .row.g-3 {
    --bs-gutter-x: 0.5rem;
  }

  .col-sm-6 {
    margin-bottom: 1rem;
  }

  .search-btn span {
    display: none;
  }

  .search-btn {
    padding: 1rem;
    justify-content: center;
  }

  .search-icon {
    font-size: 1.2rem;
  }

  .clear-btn span {
    font-size: 0.8rem;
  }

  .page-link {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
  }
}

/* 🎬 Enhanced Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes cardPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

.big-square-property-card {
  animation: fadeInUp 0.6s ease-out;
}

.big-square-property-card:hover {
  animation: cardPulse 2s infinite;
}

.search-container {
  animation: fadeInUp 0.6s ease-out;
}

.search-results-info {
  animation: slideInRight 0.8s ease-out;
}

/* 🔍 Focus Within Enhancement */
.search-container:focus-within {
  box-shadow: 0 12px 40px var(--shadow-hover);
  transform: translateY(-3px);
}

/* ⚡ Loading States */
.search-btn.loading {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
}

.search-btn.loading::after {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 0.5rem;
}

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

/* ❌ Error States */
.search-input.error,
.search-select.error {
  border-color: var(--danger-color);
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.search-input.error:focus,
.search-select.error:focus {
  border-color: var(--danger-color);
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25);
}

/* ✅ Success States */
.search-input.success,
.search-select.success {
  border-color: var(--success-color);
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

/* ⚡ Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .big-square-property-card {
    animation: none;
  }
  
  .search-container {
    animation: none;
  }
  
  .search-results-info {
    animation: none;
  }
}

/* 📱 iOS Safari Fixes */
@supports (-webkit-touch-callout: none) {
  .search-input,
  .search-select {
    -webkit-appearance: none;
    border-radius: var(--border-radius);
  }
}

/* 🎯 Print Styles */
@media print {
  .search-container,
  .pagination {
    display: none !important;
  }
  
  .big-square-properties-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}
