/* BioRoute Chișinău - Mobile First & Desktop Dual Responsive Stylesheet */

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
}

html, body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
  background-color: #020617;
  color: #f8fafc;
}

/* Hide scrollbar utility */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Custom Scrollbars */
.custom-scroll::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
.custom-scroll::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.6);
}
.custom-scroll::-webkit-scrollbar-thumb {
  background: rgba(51, 65, 85, 0.8);
  border-radius: 6px;
}
.custom-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(16, 185, 129, 0.6);
}

/* Safe areas */
.safe-top {
  padding-top: max(0.5rem, var(--safe-top));
}
.safe-bottom {
  padding-bottom: max(0.75rem, var(--safe-bottom));
}

/* Leaflet Container & Dark Canvas */
#map {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  z-index: 0;
}

.leaflet-container {
  background: #090d16 !important;
  font-family: inherit !important;
  width: 100% !important;
  height: 100% !important;
}

/* Reposition Leaflet Controls for Mobile & Desktop Ergonomics */
.leaflet-control-zoom {
  border: 1px solid rgba(51, 65, 85, 0.6) !important;
  border-radius: 16px !important;
  overflow: hidden !important;
  box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.6) !important;
  background: rgba(15, 23, 42, 0.9) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
}

.leaflet-control-zoom a {
  background: rgba(15, 23, 42, 0.9) !important;
  color: #94a3b8 !important;
  width: 38px !important;
  height: 38px !important;
  line-height: 38px !important;
  font-size: 16px !important;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5) !important;
  transition: all 0.2s ease !important;
}

.leaflet-control-zoom a:hover, .leaflet-control-zoom a:active {
  background: #059669 !important;
  color: #ffffff !important;
}

.leaflet-control-attribution {
  display: none !important;
}

/* Interactive Map Markers */
.custom-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.custom-pin:active {
  transform: scale(1.25) !important;
}

/* Pulsing radar for critical points */
.radar-pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  animation: radar-anim 2s infinite cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes radar-anim {
  0% {
    transform: scale(0.9);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.8);
  }
  70% {
    transform: scale(1.7);
    box-shadow: 0 0 0 14px rgba(239, 68, 68, 0);
  }
  100% {
    transform: scale(2.0);
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

/* Animated Neon Route */
.route-neon-glow {
  stroke-dasharray: 8, 14;
  animation: neon-dash 25s linear infinite;
}

@keyframes neon-dash {
  to {
    stroke-dashoffset: -1000;
  }
}

/* Rotating Truck Marker */
.truck-vehicle-container {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s linear;
}

/* Role button styling */
.role-btn {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.role-btn.active-role {
  background-color: #059669 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
}

/* Slide to confirm gesture control */
#slide-confirm-container {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#slide-thumb {
  touch-action: none;
  transition: transform 0.05s ease-out;
}

/* Floating Card Animations */
.floating-card-enter {
  animation: slide-up-spring 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slide-up-spring {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* QR Code Canvas Styling */
#qrcode-canvas {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  min-width: 180px;
}

#qrcode-canvas img, #qrcode-canvas canvas {
  margin: 0 auto;
  border-radius: 12px;
  display: block;
}

/* Toast Messages */
.toast-card {
  pointer-events: auto;
  animation: toast-spring 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toast-spring {
  from {
    transform: translateY(-20px) scale(0.9);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Print Styles for Waybill */
@media print {
  body * {
    visibility: hidden;
  }
  #modal-waybill, #modal-waybill * {
    visibility: visible;
  }
  #modal-waybill {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: auto;
    background: white !important;
    color: black !important;
  }
  #modal-waybill .bg-slate-900,
  #modal-waybill .bg-slate-950 {
    background: white !important;
    color: black !important;
    border-color: #ccc !important;
  }
  #modal-waybill .text-white,
  #modal-waybill .text-slate-400,
  #modal-waybill .text-emerald-400 {
    color: black !important;
  }
}
