/* Responsive Design */

/* Tablet Styles */
@media (max-width: 1024px) {
  .sidebar {
    width: 350px;
  }

  .header-left {
    gap: 20px;
  }

  .filter-group {
    gap: 10px;
  }

  .filter-bar select {
    min-width: 120px;
    font-size: 13px;
  }
}

/* Mobile Styles */
@media (max-width: 768px) {
  body {
    overflow: auto;
  }

  .header {
    height: auto;
    padding: 15px;
    flex-direction: column;
    gap: 15px;
  }

  .header-left {
    width: 100%;
    gap: 15px;
  }

  .search-container {
    max-width: none;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
  }

  .filter-bar {
    height: auto;
    padding: 15px;
    flex-direction: column;
    gap: 15px;
  }

  .filter-group {
    width: 100%;
    flex-direction: column;
    gap: 10px;
  }

  .filter-bar select {
    width: 100%;
    min-width: auto;
  }

  .filter-actions {
    width: 100%;
    justify-content: center;
  }

  .main-container {
    height: auto;
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: 50vh;
    order: 2;
  }

  .map-container {
    height: 50vh;
    order: 1;
  }

  .view-toggle .view-btn {
    padding: 8px 12px;
    font-size: 14px;
  }

  /* Property Card Mobile */
  .property-card {
    padding: 15px;
  }

  .property-image {
    height: 160px;
  }

  .property-info {
    gap: 15px;
  }

  .property-title {
    font-size: 15px;
  }

  .property-price {
    font-size: 18px;
  }

  /* Modal Mobile */
  .modal-content {
    margin: 10px;
    width: calc(100% - 20px);
    max-height: 95vh;
  }

  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 20px;
  }

  .close {
    right: 15px;
    top: 15px;
  }

  /* Map Controls Mobile */
  .map-controls {
    top: 15px;
    right: 15px;
    gap: 8px;
  }

  .map-control-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
  }

  /* Toast Mobile */
  .toast-container {
    top: 80px;
    right: 15px;
    left: 15px;
  }

  .toast {
    min-width: auto;
    width: 100%;
  }

  /* Search Suggestions Mobile */
  .search-suggestions {
    max-height: 200px;
  }

  /* Filter Section Mobile */
  .checkbox-group {
    grid-template-columns: 1fr;
  }

  .price-range {
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
  }

  .price-range input {
    width: 100%;
  }

  .price-range span {
    text-align: center;
    order: 1;
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .logo {
    font-size: 20px;
  }

  .header-stats {
    font-size: 13px;
    padding: 6px 12px;
  }

  .search-bar input {
    font-size: 14px;
    padding: 10px 0;
  }

  .search-bar button {
    padding: 10px 15px;
    font-size: 14px;
  }

  .sidebar-header {
    padding: 15px;
  }

  .sidebar-header h3 {
    font-size: 16px;
  }

  .property-card {
    padding: 12px;
  }

  .property-image {
    height: 140px;
    margin-bottom: 10px;
  }

  .property-title {
    font-size: 14px;
    margin-bottom: 6px;
  }

  .property-price {
    font-size: 16px;
    margin-bottom: 8px;
  }

  .property-info {
    font-size: 13px;
    gap: 12px;
  }

  .property-address {
    font-size: 13px;
  }

  /* Popup Mobile */
  .popup-content {
    min-width: 250px;
    padding: 12px;
  }

  .popup-image {
    height: 120px;
    margin-bottom: 10px;
  }

  .popup-title {
    font-size: 14px;
  }

  .popup-price {
    font-size: 16px;
  }

  .popup-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  /* Marker Mobile */
  .price-marker {
    padding: 4px 8px;
    font-size: 11px;
  }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .main-container {
    flex-direction: row;
    height: calc(100vh - 160px);
  }

  .sidebar {
    width: 40%;
    height: auto;
    order: 1;
  }

  .map-container {
    width: 60%;
    height: auto;
    order: 2;
  }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 2dppx) {
  .price-marker {
    border-width: 1px;
  }

  .property-image img,
  .popup-image img {
    image-rendering: -webkit-optimize-contrast;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #1a1a1a;
    --card-bg: #2d2d2d;
    --text-color: #ffffff;
    --text-muted: #aaaaaa;
    --border-color: #404040;
  }

  body.dark-mode {
    background-color: var(--bg-color);
    color: var(--text-color);
  }

  .dark-mode .header,
  .dark-mode .filter-bar,
  .dark-mode .sidebar {
    background: var(--card-bg);
    border-color: var(--border-color);
  }

  .dark-mode .property-card {
    border-color: var(--border-color);
  }

  .dark-mode .property-card:hover {
    background: #333333;
  }
}

/* Print Styles */
@media print {
  .header,
  .filter-bar,
  .map-controls,
  .modal {
    display: none !important;
  }

  .main-container {
    flex-direction: column;
    height: auto;
  }

  .sidebar {
    width: 100%;
  }

  .map-container {
    height: 400px;
  }

  .property-card {
    break-inside: avoid;
    border: 1px solid #ddd;
    margin-bottom: 20px;
  }
}

/* Animation Preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus Styles for Accessibility */
@media (prefers-reduced-motion: no-preference) {
  .property-card:focus,
  .search-bar input:focus,
  .filter-bar select:focus,
  .btn-primary:focus,
  .btn-secondary:focus {
    outline: 2px solid #1a73e8;
    outline-offset: 2px;
  }
}
