/* Custom Styling for SLS Finder Kepulauan Selayar */

:root {
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --accent: #f59e0b;
}

body, html {
  height: 100%;
  height: -webkit-fill-available;
  height: 100dvh;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#map {
  height: 100%;
  width: 100%;
  z-index: 10;
  background-color: #0b1e33; /* Dark ocean tone prevents white flicker on tile load */
}

/* Fix Leaflet tile rendering & distortion on iOS Safari & Android WebKit */
.leaflet-tile {
  max-width: none !important;
  max-height: none !important;
  -webkit-user-select: none;
  user-select: none;
}
.leaflet-container img.leaflet-tile {
  max-width: none !important;
  max-height: none !important;
}

/* Map controls z-index harmonization with modals & drawer */
.leaflet-top,
.leaflet-bottom {
  z-index: 20 !important;
}

/* Position Leaflet Zoom Controls below Top Search Bar */
.leaflet-top.leaflet-left {
  top: 66px !important;
  left: 12px !important;
}

@media (min-width: 640px) {
  .leaflet-top.leaflet-left {
    top: 76px !important;
    left: 16px !important;
  }
}

/* Custom map pulse marker for GPS */
.gps-pulse-icon {
  position: relative;
}

.gps-pulse-dot {
  width: 18px;
  height: 18px;
  background-color: #0284c7;
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}

.gps-pulse-ring {
  position: absolute;
  top: -9px;
  left: -9px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: rgba(2, 132, 199, 0.4);
  animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.5);
    opacity: 1;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* Bottom Sheet Drawer Animation */
.bottom-sheet {
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  will-change: transform, opacity;
}

.bottom-sheet.hidden-drawer {
  transform: translateY(120%);
  pointer-events: none;
  opacity: 0;
}

.bottom-sheet.show-drawer {
  transform: translateY(0%);
  pointer-events: auto;
  opacity: 1;
}

/* Collapsible Drawer Body (Cool Minimalist Hide/Show) */
.drawer-body {
  transition: max-height 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 500px;
  opacity: 1;
  transform: scaleY(1);
  transform-origin: top;
}

.bottom-sheet.is-minimized .drawer-body {
  max-height: 0 !important;
  opacity: 0 !important;
  transform: scaleY(0);
  pointer-events: none;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

.bottom-sheet.is-minimized #drawerHandle div {
  background-color: #38bdf8;
  width: 32px;
}

.bottom-sheet.is-minimized #drawerHeader {
  padding-bottom: 0;
}

/* Floating Reopen Pill Styling */
#btnReopenDrawer {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  background-color: rgba(15, 23, 42, 0.95) !important;
  color: #f8fafc !important;
  border-color: rgba(56, 189, 248, 0.4) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 16px rgba(56, 189, 248, 0.2) !important;
}

#btnReopenDrawer span.text-slate-800 {
  color: #f8fafc !important;
}

#btnReopenDrawer .border-l {
  border-color: rgba(51, 65, 85, 0.8) !important;
}

#btnToggleDrawer {
  color: #94a3b8 !important;
}
#btnToggleDrawer:hover {
  background-color: #334155 !important;
  color: #ffffff !important;
}

/* Smooth modal transitions */
.modal-overlay {
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.hidden-modal {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-overlay.show-modal {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Custom scrollbars (Permanent Dark) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #0f172a;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Form native selects dark styling */
select option {
  background-color: #0f172a !important;
  color: #f8fafc !important;
}

/* Autocomplete Search Dropdown (Solid Dark Theme, No Transparency) */
#searchSuggestions {
  background-color: #0f172a !important;
  border: 1px solid #334155 !important;
  box-shadow: 0 20px 35px -5px rgba(0, 0, 0, 0.8), 0 0 15px rgba(0, 0, 0, 0.6) !important;
  border-radius: 1rem !important;
  overflow: hidden !important;
}

.suggestion-item {
  background-color: #0f172a !important;
  border-bottom: 1px solid #1e293b !important;
}

.suggestion-item:last-child {
  border-bottom: none !important;
}

.suggestion-item:hover,
.suggestion-item:active {
  background-color: #1e293b !important;
}

.suggestion-title {
  color: #f8fafc !important;
}

.suggestion-subtitle {
  color: #94a3b8 !important;
}

/* Leaflet Customization (Permanent Dark Glassmorphism) */
.leaflet-control-zoom {
  border: 1px solid rgba(56, 189, 248, 0.3) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5) !important;
  border-radius: 16px !important;
  overflow: hidden;
  margin: 0 !important;
}

.leaflet-control-zoom a {
  background-color: rgba(15, 23, 42, 0.95) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #f8fafc !important;
  border: none !important;
  border-bottom: 1px solid rgba(51, 65, 85, 0.8) !important;
  width: 44px !important;
  height: 44px !important;
  line-height: 44px !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all 0.15s ease !important;
}

.leaflet-control-zoom a:last-child {
  border-bottom: none !important;
}

.leaflet-control-zoom a:hover,
.leaflet-control-zoom a:active {
  background-color: rgba(30, 41, 59, 1) !important;
  color: #38bdf8 !important;
}

.leaflet-control-attribution {
  font-size: 10px !important;
  background: rgba(15, 23, 42, 0.85) !important;
  color: #94a3b8 !important;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  padding: 2px 6px !important;
  border-top-left-radius: 6px;
}

.leaflet-control-attribution a {
  color: #38bdf8 !important;
}

/* SLS Polygon Tooltip (Universal High Contrast) */
.sls-tooltip,
.sls-tooltip.satellite-tooltip {
  background-color: rgba(15, 23, 42, 0.95) !important;
  border: 1px solid #38bdf8 !important;
  color: #f8fafc !important;
  border-radius: 6px !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  padding: 4px 8px !important;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.25) !important;
}
.sls-tooltip::before,
.sls-tooltip.satellite-tooltip::before {
  border-top-color: rgba(15, 23, 42, 0.95) !important;
}

/* Leaflet DivIcon Clean Reset */
.leaflet-div-icon.gps-pulse-icon,
.leaflet-div-icon.custom-pin {
  background: transparent !important;
  border: none !important;
}

/* Glassmorphism utility */
.glass-panel {
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Mobile Safe-Area Inset Support */
header {
  padding-top: max(env(safe-area-inset-top), 0.5rem);
  padding-left: max(env(safe-area-inset-left), 0.5rem);
  padding-right: max(env(safe-area-inset-right), 0.5rem);
}

.bottom-sheet {
  padding-bottom: max(env(safe-area-inset-bottom), 0.75rem);
  padding-left: max(env(safe-area-inset-left), 0.75rem);
  padding-right: max(env(safe-area-inset-right), 0.75rem);
}

/* Excel Feature Tab Buttons */
.excel-tab-btn {
  transition: all 0.15s ease;
}
.excel-tab-btn.active {
  background-color: #1e293b !important;
  color: #34d399 !important;
  border-bottom: 2px solid #10b981 !important;
}

/* Custom Popup for Excel Points on Leaflet */
.excel-point-popup .leaflet-popup-content-wrapper {
  background: rgba(15, 23, 42, 0.96) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #f8fafc !important;
  border: 1px solid rgba(56, 189, 248, 0.3) !important;
  border-radius: 18px !important;
  box-shadow: 0 16px 32px -4px rgba(0, 0, 0, 0.7), 0 0 16px rgba(16, 185, 129, 0.2) !important;
  padding: 0 !important;
}

.excel-point-popup .leaflet-popup-content {
  margin: 12px 14px !important;
  line-height: 1.4 !important;
}

.excel-point-popup .leaflet-popup-tip {
  background: rgba(15, 23, 42, 0.96) !important;
}

.excel-point-popup a.leaflet-popup-close-button {
  color: #94a3b8 !important;
  padding: 8px 10px !important;
  font-size: 16px !important;
}
.excel-point-popup a.leaflet-popup-close-button:hover {
  color: #f8fafc !important;
}

