/* ================================
   MAP COMPONENTS & CUSTOM MARKERS
   ================================ */

/* Custom Car Marker */
.custom-car-marker {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.car-marker-container {
  position: relative;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.car-marker-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.2));
}

.car-marker-pulse-ring {
  fill: none;
  stroke: #4CAF50;
  stroke-width: 2;
  opacity: 0.6;
  animation: car-pulse-ring 2s infinite ease-out;
}

.car-marker-dot {
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.3));
}

.car-marker-inner {
  animation: car-inner-pulse 1.5s infinite ease-in-out;
}

@keyframes car-pulse-ring {
  0% {
    r: 8;
    opacity: 0.8;
    stroke-width: 3;
  }
  50% {
    r: 14;
    opacity: 0.4;
    stroke-width: 2;
  }
  100% {
    r: 18;
    opacity: 0;
    stroke-width: 1;
  }
}

@keyframes car-inner-pulse {
  0%, 100% {
    opacity: 1;
    r: 5;
  }
  50% {
    opacity: 0.7;
    r: 4;
  }
}

/* Custom Pickup Marker (Yeşil Bayrak - Kalkış) */
.custom-pickup-marker {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.pickup-marker-container {
  position: relative;
  width: 32px;
  height: 48px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
}

.pickup-marker-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
  animation: flag-wave 3s ease-in-out infinite;
}

/* Custom Dropoff Marker (Kırmızı Bayrak - Varış) */
.custom-dropoff-marker {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.dropoff-marker-container {
  position: relative;
  width: 32px;
  height: 48px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
}

.dropoff-marker-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
  animation: flag-wave 3s ease-in-out infinite;
}

@keyframes flag-wave {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(1px) rotate(1deg);
  }
  75% {
    transform: translateX(-1px) rotate(-1deg);
  }
}

/* Dark theme marker adjustments */
[data-theme="dark"] .car-marker-pulse-ring {
  stroke: #9fd49f;
}

[data-theme="dark"] .car-marker-dot {
  fill: #66BB6A;
}

/* Pickup marker - Yeşil bayrak dark mode */
[data-theme="dark"] .pickup-marker-svg line {
  stroke: #388E3C;
}

[data-theme="dark"] .pickup-marker-svg path {
  fill: #66BB6A;
  stroke: #388E3C;
}

[data-theme="dark"] .pickup-marker-svg circle {
  fill: #388E3C;
}

/* Dropoff marker - Kırmızı bayrak dark mode */
[data-theme="dark"] .dropoff-marker-svg line {
  stroke: #D32F2F;
}

[data-theme="dark"] .dropoff-marker-svg path {
  fill: #EF5350;
  stroke: #D32F2F;
}

[data-theme="dark"] .dropoff-marker-svg circle {
  fill: #D32F2F;
}

/* ================================
   CUSTOM LEAFLET CONTROLS
   ================================ */

/* Custom Tooltip */
.custom-tooltip {
  background: var(--surface-container-high) !important;
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--outline-variant) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--on-surface) !important;
  font-size: 0.75rem !important;
  font-weight: 500 !important;
  padding: var(--space-xs) var(--space-sm) !important;
  box-shadow: var(--elevation-2) !important;
}

.custom-tooltip::before {
  border-top-color: var(--outline-variant) !important;
}

/* Custom Popup */
.custom-popup .leaflet-popup-content-wrapper {
  background: var(--surface-container) !important;
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
  border: 1px solid var(--outline-variant) !important;
  border-radius: var(--radius-md) !important;
  color: var(--on-surface) !important;
  box-shadow: var(--elevation-3) !important;
}

.custom-popup .leaflet-popup-content {
  margin: var(--space-md) !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
}

.custom-popup .leaflet-popup-tip {
  background: var(--surface-container) !important;
  border: 1px solid var(--outline-variant) !important;
  border-top: none !important;
  border-right: none !important;
}

/* Zoom Control Styling */
.leaflet-control-zoom {
  border: none !important;
  box-shadow: var(--elevation-2) !important;
  border-radius: var(--radius-md) !important;
  overflow: hidden;
  backdrop-filter: var(--backdrop-blur);
  -webkit-backdrop-filter: var(--backdrop-blur);
}

.leaflet-control-zoom a {
  background: var(--surface-container-high) !important;
  border: 1px solid var(--outline-variant) !important;
  color: var(--on-surface) !important;
  font-size: 18px !important;
  font-weight: 500 !important;
  width: 40px !important;
  height: 40px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: all var(--transition-fast) !important;
  text-decoration: none !important;
  border-radius: 0 !important;
}

.leaflet-control-zoom a:hover {
  background: var(--surface-container-highest) !important;
  transform: scale(1.05);
}

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

.leaflet-control-zoom-in {
  border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
}

.leaflet-control-zoom-out {
  border-radius: 0 0 var(--radius-md) var(--radius-md) !important;
}

/* ================================
   TOAST NOTIFICATIONS
   ================================ */

.toast {
  position: fixed;
  top: calc(80px + var(--space-xl));
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  z-index: 10000;
  background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(250,250,250,0.95));
  backdrop-filter: var(--backdrop-blur) saturate(180%);
  -webkit-backdrop-filter: var(--backdrop-blur) saturate(180%);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.04);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 400px;
  min-width: 280px;
}

.toast-show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-content {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.toast-message {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--on-surface);
  line-height: 1.4;
}

/* Toast Types */
.toast-success {
  border-left: 4px solid var(--success-500);
}

.toast-info {
  border-left: 4px solid var(--secondary-500);
}

.toast-warning {
  border-left: 4px solid var(--warning-500);
}

.toast-error {
  border-left: 4px solid var(--error-500);
}

.toast-success .toast-message::before {
  content: '✓';
  color: var(--success-500);
  font-weight: bold;
  margin-right: var(--space-xs);
}

.toast-info .toast-message::before {
  content: 'ℹ';
  color: var(--secondary-500);
  font-weight: bold;
  margin-right: var(--space-xs);
}

.toast-warning .toast-message::before {
  content: '⚠';
  color: var(--warning-500);
  font-weight: bold;
  margin-right: var(--space-xs);
}

.toast-error .toast-message::before {
  content: '✕';
  color: var(--error-500);
  font-weight: bold;
  margin-right: var(--space-xs);
}

/* ================================
   CONNECTION STATUS INDICATORS
   ================================ */

.status-connected .status-dot {
  background: var(--success-500);
  animation: pulse-glow 2s infinite;
}

.status-reconnecting .status-dot {
  background: var(--warning-500);
  animation: pulse-warning 1s infinite;
}

.status-disconnected .status-dot {
  background: var(--outline);
  animation: none;
}

.status-error .status-dot {
  background: var(--error-500);
  animation: pulse-error 0.5s infinite;
}

@keyframes pulse-warning {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.9);
  }
}

@keyframes pulse-error {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.3;
    transform: scale(1.1);
  }
}

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

@media (max-width: 480px) {
  .toast {
    top: calc(70px + var(--space-md));
    max-width: calc(100vw - 2rem);
    min-width: calc(100vw - 2rem);
    border-radius: var(--radius-md);
  }

  .car-marker-container {
    width: 36px;
    height: 36px;
  }

  .car-marker-svg {
    width: 36px;
    height: 36px;
  }

  .pickup-marker-container,
  .dropoff-marker-container {
    width: 28px;
    height: 42px;
  }

  .pickup-marker-svg,
  .dropoff-marker-svg {
    width: 28px;
    height: 42px;
  }

  .leaflet-control-zoom {
    position: fixed;
    top: auto !important;
    bottom: calc(var(--info-strip-height, 140px) + 60px) !important;
    right: var(--space-sm) !important;
    left: auto !important;
  }

  .leaflet-control-zoom a {
    width: 38px !important;
    height: 38px !important;
    font-size: 18px !important;
    background: rgba(255, 255, 255, 0.95) !important;
  }

  /* Optimize popup for mobile */
  .custom-popup .leaflet-popup-content-wrapper {
    max-width: 250px !important;
  }

  .custom-popup .leaflet-popup-content {
    margin: var(--space-sm) !important;
    font-size: 0.75rem !important;
  }
}

/* Tablet responsive adjustments */
@media (min-width: 481px) and (max-width: 1024px) {
  .toast {
    top: calc(80px + var(--space-lg));
    max-width: 360px;
  }

  .leaflet-control-zoom {
    position: fixed;
    top: auto !important;
    bottom: calc(var(--info-strip-height, 90px) + 80px) !important;
    right: var(--space-md) !important;
  }
}

/* Landscape mode adjustments */
@media (max-width: 768px) and (orientation: landscape) {
  .toast {
    top: calc(60px + var(--space-sm));
    max-width: 320px;
  }

  .leaflet-control-zoom {
    bottom: calc(var(--info-strip-height, 70px) + 50px) !important;
  }
}

/* ================================
   PERFORMANCE OPTIMIZATIONS
   ================================ */

/* GPU acceleration for smooth animations */
.car-marker-container,
.destination-marker-container,
.toast,
.driver-info-panel,
.track-btn {
  will-change: transform;
}

/* Prevent unnecessary repaints during map interactions */
.leaflet-zoom-animated .leaflet-zoom-box {
  will-change: transform;
}

/* Optimize marker rendering */
.custom-car-marker,
.custom-destination-marker {
  transform: translateZ(0);
  backface-visibility: hidden;
}