/* Search Page Styles - Web version matching mobile ExploreMapScreen */

/* ============================================
   BASE CONTAINER STYLES
   ============================================ */

.explore-search-container {
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height for mobile */
  display: flex;
  flex-direction: column;
  background-color: #f5f5f5;
  overflow: hidden;
}

/* ============================================
   DESKTOP LAYOUT (side by side)
   ============================================ */

.explore-search-container.desktop {
  flex-direction: column;
}

.explore-search-container.desktop .search-capsule-container {
  padding: 16px;
  background-color: #ffffff;
  border-bottom: 1px solid #e0e0e0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  z-index: 10;
}

.explore-search-container.desktop .search-content {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.explore-search-container.desktop .sitter-list {
  width: 420px;
  min-width: 420px;
  max-width: 420px;
  background-color: #ffffff;
  overflow-y: auto;
  flex-shrink: 0;
  flex-grow: 0;
  border-right: 1px solid #e0e0e0;
}

.explore-search-container.desktop .map-container {
  flex: 1;
  position: relative;
}

/* ============================================
   MOBILE LAYOUT (map + bottom sheet)
   ============================================ */

.explore-search-container.mobile {
  position: relative;
}

/* Full screen map behind everything */
.map-fullscreen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}

.map-fullscreen .map-view {
  width: 100%;
  height: 100%;
}

/* Floating search capsule on mobile */
.mobile-search-capsule-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 12px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: linear-gradient(to bottom, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0) 100%);
}

.mobile-search-capsule-container .search-capsule-container {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

/* Bottom Sheet */
.bottom-sheet {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #ffffff;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: height;
}

.bottom-sheet-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0 8px 0;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.bottom-sheet-handle:active {
  cursor: grabbing;
}

.handle-bar {
  width: 44px;
  height: 5px;
  background-color: #d1d1d6;
  border-radius: 3px;
}

.bottom-sheet-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* Sitter list inside bottom sheet */
.bottom-sheet .sitter-list {
  width: 100%;
  background-color: #ffffff;
  border: none;
}

/* ============================================
   SEARCH CAPSULE (shared)
   ============================================ */

.search-capsule {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: #ffffff;
  border-radius: 32px;
  padding: 12px 20px;
  border: 1px solid #e0e0e0;
  cursor: pointer;
  transition: all 0.2s ease;
  max-width: 600px;
  margin: 0 auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.search-capsule:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: #bdbdbd;
}

.search-capsule-content {
  flex: 1;
  text-align: center;
}

.capsule-title {
  font-size: 16px;
  font-weight: 600;
  color: #212121;
  margin: 0;
  display: block;
}

.capsule-subtitle {
  font-size: 13px;
  color: #757575;
  margin: 4px 0 0 0;
  display: block;
}

.search-capsule i {
  color: #757575;
  font-size: 16px;
}

/* ============================================
   MAP STYLES
   ============================================ */

.map-view {
  width: 100%;
  height: 100%;
  background-color: #e8e8e8;
}

.map-container {
  flex: 1;
  position: relative;
}

/* Map loading indicator */
.map-loading-indicator {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #ffffff;
  padding: 8px 20px;
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 100;
}

/* Position loading indicator properly on mobile */
.map-fullscreen .map-loading-indicator {
  top: 80px;
}

.loading-dots {
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 2px;
  animation: dots 1s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60% { content: '...'; }
  80%, 100% { content: ''; }
}

/* Map Avatar Markers */
.map-avatar-marker {
  position: absolute;
  width: 44px;
  height: 44px;
  border-radius: 22px;
  background-color: #ffffff;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.map-avatar-marker:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000 !important;
}

.map-avatar-marker img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 20px;
}

.map-avatar-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  font-size: 16px;
  font-weight: 700;
  border-radius: 20px;
}

/* ============================================
   SITTER LIST & CARDS
   ============================================ */

.sitter-list {
  background-color: #ffffff;
  overflow-y: scroll; /* Always show scrollbar to prevent width shifts */
}

/* No extra padding for loading state - skeleton cards have their own padding */

/* Sitter Card - matching mobile */
.sitter-card {
  padding: 16px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.sitter-card:hover {
  background-color: #fafafa;
}

.sitter-card:last-child {
  border-bottom: none;
}

.sitter-top-section {
  display: flex;
  gap: 16px;
}

.sitter-image {
  width: 80px;
  height: 80px;
  border-radius: 40px;
  overflow: hidden;
  flex-shrink: 0;
  background-color: #e0e0e0;
}

.sitter-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sitter-image-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  font-size: 28px;
  font-weight: 700;
}

.sitter-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.sitter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.sitter-name {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #212121;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  padding-right: 12px;
}

.sitter-price {
  text-align: right;
  flex-shrink: 0;
}

.price-from {
  display: block;
  font-size: 11px;
  color: #757575;
}

.price-amount {
  font-size: 18px;
  font-weight: 700;
  color: #212121;
  line-height: 1.2;
}

.price-unit {
  font-size: 11px;
  color: #757575;
}

.sitter-location {
  display: flex;
  align-items: center;
  color: #757575;
  font-size: 14px;
  flex: 1;
  min-width: 0;
}

.sitter-location i {
  margin-right: 4px;
  font-size: 12px;
  color: #9e9e9e;
}

.sitter-location span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sitter-distance {
  display: flex;
  align-items: center;
  color: #757575;
  font-size: 14px;
  font-weight: 500;
}

.sitter-distance i {
  margin-right: 6px;
  font-size: 12px;
  color: #9e9e9e;
}

.sitter-availability {
  display: flex;
  align-items: center;
  margin-top: 4px;
  color: #2e7d32;
  font-size: 12px;
}

.sitter-availability i {
  margin-right: 6px;
  font-size: 14px;
}

/* Review section */
.sitter-review-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}

.sitter-rating {
  margin-bottom: 8px;
}

.star-rating {
  display: flex;
  align-items: center;
}

.star-rating .stars {
  display: flex;
  gap: 2px;
}

.star-rating .stars i {
  font-size: 14px;
  color: #4f46e5;
}

.star-rating .stars i.far {
  color: #e0e0e0;
}

.star-rating .review-count {
  margin-left: 6px;
  font-size: 12px;
  color: #757575;
}

.sitter-review-text {
  margin: 0;
  font-size: 13px;
  color: #616161;
  font-style: italic;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================
   SKELETON LOADING
   ============================================ */

.sitter-card.skeleton {
  pointer-events: none;
  display: flex;
  gap: 16px;
  padding: 16px;
}

.skeleton-image {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 40px;
  width: 80px;
  height: 80px;
  flex-shrink: 0;
}

.skeleton-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.skeleton-line {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  height: 16px;
  border-radius: 4px;
  margin-bottom: 10px;
}

.skeleton-line.short {
  width: 60%;
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ============================================
   NO RESULTS STATE
   ============================================ */

.no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: #757575;
}

.no-results i {
  font-size: 48px;
  margin-bottom: 16px;
  color: #e0e0e0;
}

.no-results h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  color: #424242;
}

.no-results p {
  margin: 0;
  font-size: 14px;
  max-width: 280px;
}

/* ============================================
   SEARCH MODAL
   ============================================ */

.search-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  padding: 20px;
}

.search-modal {
  background-color: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #f0f0f0;
  position: sticky;
  top: 0;
  background: #ffffff;
  z-index: 1;
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #212121;
}

.modal-header button {
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: #757575;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background-color 0.2s;
}

.modal-header button:hover {
  background-color: #f5f5f5;
}

.modal-body {
  padding: 24px;
}

.form-group {
  margin-bottom: 24px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #212121;
  font-size: 14px;
}

.form-group select,
.form-group input[type="text"],
.form-group input[type="date"] {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  font-size: 16px;
  background-color: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  -webkit-appearance: none;
}

.form-group select:focus,
.form-group input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Location input with button */
.location-input-wrapper {
  position: relative;
  display: flex;
  gap: 8px;
}

.location-input-wrapper input {
  flex: 1;
  padding-right: 16px;
}

.location-btn {
  padding: 14px 16px;
  background-color: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  cursor: pointer;
  color: #757575;
  transition: all 0.2s;
  flex-shrink: 0;
}

.location-btn:hover {
  background-color: #e8e8e8;
  color: #4f46e5;
}

/* Form row for date inputs */
.form-row {
  display: flex;
  gap: 16px;
}

.form-col {
  flex: 1;
}

.form-col label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #212121;
  font-size: 14px;
}

.form-col input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  font-size: 16px;
  background-color: #ffffff;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}

.form-col input:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.search-btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.search-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.search-btn i {
  font-size: 14px;
}

/* Google Places Autocomplete dropdown styling */
.pac-container {
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  margin-top: 8px;
  font-family: inherit;
  z-index: 10000 !important;
}

.pac-item {
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
}

.pac-item:hover {
  background-color: #f5f5f5;
}

.pac-item-query {
  font-size: 14px;
  color: #212121;
}

.pac-matched {
  font-weight: 600;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

@media (max-width: 900px) {
  .explore-search-container.desktop .sitter-list {
    width: 350px;
    min-width: 350px;
    max-width: 350px;
  }
}

/* Tablet breakpoint - still side by side but smaller */
@media (max-width: 768px) {
  /* Mobile styles are handled by the .mobile class in React */
  
  /* Modal adjustments for mobile */
  .search-modal-overlay {
    padding: 0;
    align-items: flex-end;
  }
  
  .search-modal {
    border-radius: 16px 16px 0 0;
    max-height: 90vh;
    max-height: 90dvh;
  }
  
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  
  .form-col {
    margin-bottom: 16px;
  }
  
  .form-col:last-child {
    margin-bottom: 0;
  }
}

/* Small mobile adjustments */
@media (max-width: 480px) {
  .mobile-search-capsule-container {
    padding: 8px;
  }
  
  .search-capsule {
    padding: 10px 16px;
  }
  
  .capsule-title {
    font-size: 14px;
  }
  
  .capsule-subtitle {
    font-size: 12px;
  }
  
  .sitter-card {
    padding: 12px;
  }
  
  .sitter-image {
    width: 64px;
    height: 64px;
  }
  
  .sitter-name {
    font-size: 16px;
  }
  
  .modal-body {
    padding: 16px;
  }
  
  .bottom-sheet-handle {
    padding: 10px 0 6px 0;
  }
  
  .handle-bar {
    width: 36px;
    height: 4px;
  }
}

/* Safe area support for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-sheet {
    padding-bottom: env(safe-area-inset-bottom);
  }
  
  .search-modal {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ============================================
   REACT-MODAL-SHEET OVERRIDES
   ============================================ */

/* Sheet container styling */
[data-rsbs-root] {
  z-index: 200 !important;
}

[data-rsbs-overlay] {
  background: transparent !important;
}

[data-rsbs-backdrop] {
  display: none !important;
}

[data-rsbs-sheet] {
  background-color: #ffffff !important;
  border-top-left-radius: 16px !important;
  border-top-right-radius: 16px !important;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15) !important;
}

/* Header handle styling */
[data-rsbs-header] {
  padding: 12px 0 8px 0 !important;
  cursor: grab !important;
}

[data-rsbs-header]::before {
  content: '' !important;
  display: block !important;
  width: 44px !important;
  height: 5px !important;
  background-color: #d1d1d6 !important;
  border-radius: 3px !important;
  margin: 0 auto !important;
}

[data-rsbs-header]:active {
  cursor: grabbing !important;
}

/* Content area */
[data-rsbs-content] {
  background-color: #ffffff !important;
}

[data-rsbs-scroll] {
  -webkit-overflow-scrolling: touch !important;
}

/* Sitter list inside sheet */
[data-rsbs-scroll] .sitter-list {
  width: 100%;
  background-color: #ffffff;
  border: none;
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* Ensure list has proper height */
[data-rsbs-content] .sitter-list {
  min-height: 100%;
}

/* Fix for sheet not blocking map interaction when collapsed */
[data-rsbs-root][data-rsbs-state="closed"] {
  pointer-events: none;
}

/* Animate smoothly */
[data-rsbs-sheet] {
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1) !important;
}
