/* Custom styling for Klupice Online - Dark Mode */

html, body {
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  background-color: #0b0f19;
  color: #f1f5f9;
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Hide scrollbar for clean horizontal filters */
.scrollbar-none::-webkit-scrollbar {
  display: none;
}
.scrollbar-none {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Custom Marker Styling */
.custom-bench-pin {
  background: transparent;
  border: none;
}

.bench-marker-icon {
  width: 36px;
  height: 44px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.25));
}

.bench-marker-icon:hover {
  transform: scale(1.15) translateY(-4px);
  z-index: 999 !important;
}

.bench-pin-svg {
  width: 100%;
  height: 100%;
}

.bench-marker-condition-Peak path.pin-body,
.bench-marker-condition-Z path.pin-body { fill: #9333ea; }
.bench-marker-condition-S path.pin-body { fill: #f59e0b; }
.bench-marker-condition-A path.pin-body { fill: #10b981; }
.bench-marker-condition-B path.pin-body { fill: #3b82f6; }
.bench-marker-condition-C path.pin-body { fill: #64748b; }
.bench-marker-condition-F path.pin-body { fill: #ef4444; }

/* Backward compatibility */
.bench-marker-condition-odlicno path.pin-body { fill: #10b981; }
.bench-marker-condition-dobro path.pin-body { fill: #3b82f6; }
.bench-marker-condition-popravak path.pin-body { fill: #ef4444; }

/* User Location GPS Marker Pulse */
.user-gps-marker {
  width: 18px;
  height: 18px;
  background-color: #2563eb;
  border: 3px solid #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
  position: relative;
}

.user-gps-marker::after {
  content: '';
  position: absolute;
  top: -8px;
  left: -8px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: rgba(37, 99, 235, 0.25);
  animation: gpsPulse 2s infinite ease-out;
}

@keyframes gpsPulse {
  0% {
    transform: scale(0.6);
    opacity: 1;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* Leaflet Cluster Custom Theme */
.marker-cluster-small {
  background-color: rgba(16, 185, 129, 0.3) !important;
}
.marker-cluster-small div {
  background-color: rgba(5, 150, 105, 0.9) !important;
  color: white !important;
  font-weight: 700;
  font-size: 13px;
}

.marker-cluster-medium {
  background-color: rgba(13, 148, 136, 0.3) !important;
}
.marker-cluster-medium div {
  background-color: rgba(15, 118, 110, 0.9) !important;
  color: white !important;
  font-weight: 700;
  font-size: 13px;
}

.marker-cluster-large {
  background-color: rgba(2, 132, 199, 0.3) !important;
}
.marker-cluster-large div {
  background-color: rgba(3, 105, 161, 0.9) !important;
  color: white !important;
  font-weight: 700;
  font-size: 13px;
}

/* Leaflet Container & Controls Dark Theme */
.leaflet-container {
  background: #0b0f19 !important;
}

.leaflet-bar {
  border: 1px solid #334155 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5) !important;
  border-radius: 10px !important;
  overflow: hidden;
}

.leaflet-bar a {
  background-color: #0f172a !important;
  color: #cbd5e1 !important;
  border-bottom: 1px solid #1e293b !important;
}

.leaflet-bar a:hover {
  background-color: #1e293b !important;
  color: #ffffff !important;
}

.leaflet-bar a.leaflet-disabled {
  background-color: #0b0f19 !important;
  color: #475569 !important;
}

/* Leaflet Popup Styling - Dark Mode */
.leaflet-popup-content-wrapper {
  background: #0f172a !important;
  color: #f1f5f9 !important;
  border: 1px solid #334155 !important;
  border-radius: 16px !important;
  padding: 0 !important;
  overflow: hidden !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6) !important;
}
.leaflet-popup-content {
  margin: 0 !important;
  line-height: 1.4 !important;
}
.leaflet-popup-tip {
  background: #0f172a !important;
  border: 1px solid #334155 !important;
  box-shadow: none !important;
}
.leaflet-popup-tip-container {
  margin-top: -1px;
}

/* Active tag toggle styling in add form */
.tag-toggle-btn.selected {
  background-color: rgba(16, 185, 129, 0.22) !important;
  border-color: #10b981 !important;
  color: #34d399 !important;
  font-weight: 600;
}

/* Satellite City Names Overlay (Clean, no borders, no counties) */
.satellite-city-marker {
  background: transparent !important;
  border: none !important;
}

.satellite-city-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  transform: translate(-10px, -50%);
}

.satellite-city-label .city-point {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.9), 0 0 4px rgba(0, 0, 0, 0.7);
  flex-shrink: 0;
}

.satellite-city-label .city-name {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 3px #000, 0 0 4px #000, 0 0 6px rgba(0, 0, 0, 0.9);
}

.satellite-city-tier-1 .city-point {
  width: 7px;
  height: 7px;
  background: #fde047;
  border: 1px solid rgba(0, 0, 0, 0.4);
}

.satellite-city-tier-1 .city-name {
  font-size: 13px;
  font-weight: 800;
  text-shadow: 0 1px 4px #000, 0 0 6px #000, 0 0 8px rgba(0, 0, 0, 0.95);
}

/* ====================================================================
   MOBILE OPTIMIZATIONS (iPhone iOS Safari & Android Chrome/Brave)
   ==================================================================== */

/* Momentum scrolling for all scroll containers */
.overflow-y-auto, .overflow-x-auto, #sidePanel, form {
  -webkit-overflow-scrolling: touch;
}

/* Fast tap response (removes 300ms mobile touch delay) */
button, a, input, select, textarea, .city-filter, .tag-filter, .uploader-filter {
  touch-action: manipulation;
}

/* Mobile-specific adjustments */
@media screen and (max-width: 768px) {
  /* Prevent iOS automatic zoom on inputs */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="url"],
  input[type="search"],
  textarea,
  select {
    font-size: 16px !important;
  }

  /* Safe Area Inset support for iPhone Notch & Home Indicator */
  header {
    padding-top: max(0.625rem, env(safe-area-inset-top, 0.625rem)) !important;
    padding-left: max(0.75rem, env(safe-area-inset-left, 0.75rem)) !important;
    padding-right: max(0.75rem, env(safe-area-inset-right, 0.75rem)) !important;
  }

  #sidePanel {
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 1rem)) !important;
  }

  #benchDetailModal > div,
  #addBenchModal > div,
  #authModal > div {
    max-height: calc(100dvh - 2rem) !important;
    border-radius: 1.25rem !important;
  }

  /* Compact Leaflet Attribution on small screens */
  .leaflet-control-attribution {
    font-size: 8px !important;
    background: rgba(11, 15, 25, 0.8) !important;
    color: #64748b !important;
    backdrop-filter: blur(4px);
    border-radius: 4px 0 0 0;
  }

  .leaflet-control-attribution a {
    color: #94a3b8 !important;
  }
}
