/*
 * APPLE-STYLE SCROLLBARS
 * ======================
 * Ultra-thin, elegant scrollbars without arrows
 * Consistent across all browsers and platforms
 */

/* ============================================================================
   GLOBAL SCROLLBAR RESET - Remove default arrows and styling
   ============================================================================ */

/* Remove scrollbar arrows/buttons globally */
::-webkit-scrollbar-button {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Remove scrollbar corner */
::-webkit-scrollbar-corner {
  display: none !important;
  background: transparent !important;
}

/* ============================================================================
   APPLE-STYLE SCROLLBAR BASE
   ============================================================================ */

/* Ultra-thin scrollbar track */
::-webkit-scrollbar {
  width: 3px !important;  /* Apple-thin vertical */
  height: 3px !important; /* Apple-thin horizontal */
  background: transparent !important;
}

/* Invisible track by default */
::-webkit-scrollbar-track {
  background: transparent !important;
  border-radius: 0 !important;
  /* REMOVED: margin: 0 !important; - was causing unwanted margin-bottom on datetime container on touch mobile */
}

/* Apple-style thumb - appears only on hover/scroll */
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2) !important;
  border-radius: 2px !important;
  border: none !important;
  min-height: 20px !important;
  transition: background-color 0.2s ease !important;
}

/* Hover state - slightly more visible */
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.4) !important;
}

/* Active state - most visible */
::-webkit-scrollbar-thumb:active {
  background: rgba(0, 0, 0, 0.6) !important;
}

/* ============================================================================
   DARK MODE SCROLLBARS
   ============================================================================ */

.dark ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2) !important;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4) !important;
}

.dark ::-webkit-scrollbar-thumb:active {
  background: rgba(255, 255, 255, 0.6) !important;
}

/* ============================================================================
   FIREFOX SCROLLBAR STYLING
   ============================================================================ */

* {
  scrollbar-width: thin !important;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent !important;
}

.dark * {
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent !important;
}

/* ============================================================================
   LIST SHEET SPECIFIC - EXTRA THIN FOR MOBILE
   ============================================================================ */

#listings-sheet,
#listings-sheet *,
#listings-content-mobile,
[data-listings-container="true"] {
  scrollbar-width: thin !important;
  scrollbar-color: rgba(0, 0, 0, 0.15) transparent !important;
}

#listings-sheet ::-webkit-scrollbar,
#listings-content-mobile::-webkit-scrollbar,
[data-listings-container="true"]::-webkit-scrollbar {
  width: 2px !important;  /* Extra thin for mobile list */
  height: 2px !important;
}

#listings-sheet ::-webkit-scrollbar-thumb,
#listings-content-mobile::-webkit-scrollbar-thumb,
[data-listings-container="true"]::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15) !important;
  border-radius: 1px !important;
  min-height: 30px !important;
}

#listings-sheet ::-webkit-scrollbar-thumb:hover,
#listings-content-mobile::-webkit-scrollbar-thumb:hover,
[data-listings-container="true"]::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3) !important;
}

/* Dark mode for list sheet */
.dark #listings-sheet ::-webkit-scrollbar-thumb,
.dark #listings-content-mobile::-webkit-scrollbar-thumb,
.dark [data-listings-container="true"]::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15) !important;
}

.dark #listings-sheet ::-webkit-scrollbar-thumb:hover,
.dark #listings-content-mobile::-webkit-scrollbar-thumb:hover,
.dark [data-listings-container="true"]::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3) !important;
}

/* ============================================================================
   SPOT DETAILS SCROLLBAR - SLIGHTLY MORE VISIBLE
   ============================================================================ */

#spot-detail-content::-webkit-scrollbar {
  width: 3px !important;
}

#spot-detail-content::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, 0.3) !important;
  border-radius: 2px !important;
}

#spot-detail-content::-webkit-scrollbar-thumb:hover {
  background: rgba(59, 130, 246, 0.5) !important;
}

/* ============================================================================
   MODAL AND POPUP SCROLLBARS
   ============================================================================ */

.modal-content::-webkit-scrollbar,
.popup-content::-webkit-scrollbar,
.dropdown-content::-webkit-scrollbar {
  width: 2px !important;
}

.modal-content::-webkit-scrollbar-thumb,
.popup-content::-webkit-scrollbar-thumb,
.dropdown-content::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2) !important;
  border-radius: 1px !important;
}

/* ============================================================================
   CALENDAR AND TIME PICKER SCROLLBARS
   ============================================================================ */

.calendar-grid::-webkit-scrollbar,
.picker-time-slots::-webkit-scrollbar {
  width: 2px !important;
}

.calendar-grid::-webkit-scrollbar-thumb,
.picker-time-slots::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2) !important;
  border-radius: 1px !important;
}

/* ============================================================================
   AMENITIES AND FILTER SCROLLBARS - ULTRA THIN
   ============================================================================ */

#amenities-container::-webkit-scrollbar,
.amenity-chips-container::-webkit-scrollbar,
.amenities-container::-webkit-scrollbar {
  width: 1px !important;  /* Ultra thin for filters */
  height: 1px !important;
}

#amenities-container::-webkit-scrollbar-thumb,
.amenity-chips-container::-webkit-scrollbar-thumb,
.amenities-container::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1) !important;
  border-radius: 1px !important;
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */

/* Mobile - Even thinner scrollbars */
@media (max-width: 768px) {
  ::-webkit-scrollbar {
    width: 2px !important;
    height: 2px !important;
  }
  
  #listings-sheet ::-webkit-scrollbar,
  #listings-content-mobile::-webkit-scrollbar {
    width: 1px !important;  /* Barely visible on mobile */
  }
}

/* Desktop - Slightly more visible when needed */
@media (min-width: 1024px) {
  ::-webkit-scrollbar {
    width: 4px !important;
    height: 4px !important;
  }
  
  ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5) !important;
  }
  
  .dark ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5) !important;
  }
}

/* ============================================================================
   ACCESSIBILITY - ENSURE SCROLLBARS ARE VISIBLE WHEN NEEDED
   ============================================================================ */

/* High contrast mode */
@media (prefers-contrast: high) {
  ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.8) !important;
  }
  
  .dark ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.8) !important;
  }
}

/* Reduced motion - Keep scrollbars more visible */
@media (prefers-reduced-motion: reduce) {
  ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3) !important;
    transition: none !important;
  }
  
  .dark ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3) !important;
  }
}

/* CRITICAL: Ensure proper contrast on dark overlays and backgrounds */
.dark *[style*="background: rgba(0"],
.dark *[style*="background-color: rgba(0"],
html.dark *[style*="background: rgba(0"],
html.dark *[style*="background-color: rgba(0"],
body.dark *[style*="background: rgba(0"],
body.dark *[style*="background-color: rgba(0"] {
  color: #f9fafb !important; /* Light text on dark backgrounds */
}

/* Ensure text is light on any very dark background */
*[style*="background: #0"],
*[style*="background-color: #0"],
*[style*="background: rgba(0, 0, 0"],
*[style*="background-color: rgba(0, 0, 0"] {
  color: #f9fafb !important; /* Light text on very dark backgrounds */
}

/* Override any gray-800 text that might appear on dark backgrounds in dark mode */
.dark .text-gray-800,
html.dark .text-gray-800,
body.dark .text-gray-800,
.dark [style*="color: #ffffff"],
html.dark [style*="color: #ffffff"],
body.dark [style*="color: #ffffff"] {
  color: #f9fafb !important; /* Light text in dark mode */
}

/* ULTRA-AGGRESSIVE CONTRAST FIX - Override any remaining gray-800 text in dark mode */

/* NUCLEAR OPTION: Force white text on any element with gray-800 color in dark contexts */
html.dark *[style*="color: rgb(31, 41, 55)"],
body.dark *[style*="color: rgb(31, 41, 55)"],
.dark *[style*="color: rgb(31, 41, 55)"],
html.dark *[style*="color:rgb(31, 41, 55)"],
body.dark *[style*="color:rgb(31, 41, 55)"],
.dark *[style*="color:rgb(31, 41, 55)"],
html.dark *[style*="color: rgb(31,41,55)"],
body.dark *[style*="color: rgb(31,41,55)"],
.dark *[style*="color: rgb(31,41,55)"],
html.dark *[style*="color:rgb(31,41,55)"],
body.dark *[style*="color:rgb(31,41,55)"],
.dark *[style*="color:rgb(31,41,55)"] {
  color: #ffffff !important;
}

/* Cover computed styles that might result in gray-800 */

