/* Custom Styles for School Bus Tracker */
:root {
  --primary-color: #007bff;
  --success-color: #28a745;
  --info-color: #17a2b8;
  --warning-color: #ffc107;
  --danger-color: #dc3545;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f8f9fa;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

/* Map Styles */
#map {
  border-radius: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Custom Leaflet Popup */
.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.leaflet-popup-content {
  margin: 15px;
  line-height: 1.4;
  font-size: 1.1rem;
}

/* Bus Icon Styles */
.bus-icon {
  background: var(--primary-color);
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.parent-icon {
  background: var(--success-color);
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Status Cards */
.status-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 15px;
  margin-bottom: 15px;
}

/* Bus Status Item */
.bus-status-item {
  background-color: rgba(23, 162, 184, 0.9);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.1rem;
}

.bus-status-item:last-child {
  margin-bottom: 0;
}

.bus-number {
  font-weight: bold;
  font-size: 1.1rem;
}

.bus-speed {
  background-color: rgba(255, 255, 255, 0.3);
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: bold;
}

.bus-eta {
  background-color: rgba(40, 167, 69, 0.8);
  color: white;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 1.1rem;
}

.bus-distance {
  background-color: rgba(255, 255, 255, 0.3);
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: bold;
}

/* Responsive Design */
@media (max-width: 768px) {
  .navbar-brand {
    font-size: 1.2rem;
  }

  #mapContainer {
    height: calc(100vh - 180px) !important;
  }

  .form-select-sm {
    font-size: 0.95rem;
  }

  .bus-status-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .bus-status-item > div:last-child {
    margin-top: 5px;
    width: 100%;
    display: flex;
    justify-content: space-between;
  }
}

@media (max-width: 576px) {
  .container-fluid .row .col-6 {
    margin-bottom: 0.5rem;
  }

  #statusBar {
    font-size: 0.95rem;
  }
}

/* Animation for refresh button */
.rotating {
  animation: rotate 1s linear infinite;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Custom Select Styles */
.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Button Styles */
.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.95rem;
}

/* Offline Banner */
#offlineBanner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  border-radius: 0;
}

/* Map Layer Control */
.leaflet-control-layers {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

/* Custom Marker Styles */
.custom-div-icon {
  background: transparent;
  border: none;
}

.marker-pin {
  width: 40px;
  height: 40px;
  border-radius: 50% 50% 50% 0;
  position: absolute;
  transform: rotate(-45deg);
  left: 50%;
  top: 50%;
  margin: -20px 0 0 -20px;
  animation: bounce 2s infinite;
}

.marker-pin.bus {
  background: #007bff;
  z-index: 100;
}

.marker-pin.parent {
  background: #28a745;
  z-index: 90;
}

.marker-pin::after {
  content: "";
  width: 24px;
  height: 24px;
  margin: 8px 0 0 8px;
  background: white;
  position: absolute;
  border-radius: 50%;
}

.marker-icon {
  position: absolute;
  font-size: 16px;
  width: 40px;
  height: 40px;
  text-align: center;
  line-height: 40px;
  margin-top: -40px;
  margin-left: -20px;
  z-index: 101;
}

.marker-label {
  position: absolute;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid #007bff;
  color: #007bff;
  font-weight: bold;
  padding: 2px 6px;
  font-size: 12px;
  border-radius: 4px;
  white-space: nowrap;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 102;
}

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0) rotate(-45deg);
  }
  40% {
    transform: translateY(-10px) rotate(-45deg);
  }
  60% {
    transform: translateY(-5px) rotate(-45deg);
  }
}

/* Speed Indicator */
.speed-indicator {
  background: linear-gradient(45deg, #28a745, #20c997);
  color: white;
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 1rem;
  font-weight: bold;
  display: inline-block;
  margin-top: 5px;
}

/* Distance Badge */
.distance-badge {
  background: linear-gradient(45deg, #17a2b8, #20c997);
  color: white;
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 1rem;
  font-weight: bold;
}

/* Update Timer */
#updateTimer {
  font-size: 0.95rem;
  padding: 5px 10px;
}

/* Select2 Customization */
.select2-container--default .select2-selection--multiple {
  border-color: #ced4da;
  border-radius: 0.25rem;
}

.select2-container--default.select2-container--focus .select2-selection--multiple {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
  background-color: var(--primary-color);
  color: white;
  border: none;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  color: white;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
  color: #f8f9fa;
}

/* ETA Display */
.eta-display {
  background-color: #28a745;
  color: white;
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 1rem;
  font-weight: bold;
}
