/* Custom styles for map components that Tailwind doesn't cover */

/* Leaflet popup customizations */
.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.leaflet-popup-tip {
  background: white;
}

/* Custom marker container */
.custom-marker-container {
  background: transparent !important;
  border: none !important;
}

/* Loading animation */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Ensure map renders properly */
#map {
  z-index: 1;
}

/* Sidebar overlay for mobile */
@media (max-width: 768px) {
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 35;
  }
}

/* Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
}

.header-content h1 {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.header-controls {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.btn-icon:active {
  transform: translateY(0);
  background: rgba(255, 255, 255, 0.4);
}

/* Progress bar */
.progress-bar {
  position: relative;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #4caf50;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  position: absolute;
  top: -30px;
  right: 16px;
  font-size: 12px;
  opacity: 0.9;
}

/* Map container */
#map {
  position: fixed;
  top: 70px;
  left: 0;
  right: 0;
  bottom: 80px;
  z-index: 1;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 70px;
  left: -100%;
  width: 90%;
  max-width: 400px;
  height: calc(100vh - 150px);
  background: white;
  z-index: 2000;
  transition: left 0.3s ease;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

.sidebar.open {
  left: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid #eee;
  background: #f8f9fa;
}

.sidebar-header h3 {
  margin: 0;
  font-size: 18px;
  color: #333;
}

.btn-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #666;
  cursor: pointer;
  padding: 4px;
  min-width: 32px;
  min-height: 32px;
}

.sidebar-search {
  padding: 16px;
  border-bottom: 1px solid #eee;
}

.sidebar-search input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.location-item {
  display: flex;
  align-items: center;
  padding: 12px;
  margin: 4px 0;
  background: white;
  border: 1px solid #eee;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.location-item:hover {
  background: #f8f9fa;
  border-color: #667eea;
}

.location-item.visited {
  background: #e8f5e8;
  border-color: #4caf50;
}

.location-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #667eea;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  margin-right: 12px;
  flex-shrink: 0;
}

.location-number.visited {
  background: #4caf50;
}

.location-info {
  flex: 1;
  min-width: 0;
}

.location-address {
  font-weight: 500;
  color: #333;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-name {
  font-size: 14px;
  color: #666;
  margin-bottom: 2px;
}

.location-distance {
  font-size: 12px;
  color: #999;
}

/* Navigation controls */
.nav-controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  padding: 12px 16px;
  display: flex;
  gap: 12px;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 1000;
}

.nav-btn {
  flex: 1;
  padding: 14px 20px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  min-height: 48px;
}

#prevLocation {
  background: #e9ecef;
  color: #6c757d;
}

#nextLocation {
  background: #667eea;
  color: white;
}

.nav-btn:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Custom map controls */
.leaflet-popup-content {
  margin: 16px;
  font-size: 14px;
  line-height: 1.4;
  min-width: 200px;
}

.popup-header {
  font-weight: bold;
  color: #333;
  margin-bottom: 8px;
  font-size: 16px;
}

.popup-address {
  color: #666;
  margin-bottom: 8px;
}

.popup-contact {
  margin-bottom: 8px;
}

.popup-phone {
  color: #667eea;
  text-decoration: none;
  font-weight: 500;
}

.popup-phone:hover {
  text-decoration: underline;
}

.popup-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.popup-btn {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-navigate {
  background: #4caf50;
  color: white;
}

.btn-complete {
  background: #ff9800;
  color: white;
}

.btn-navigate:hover {
  background: #45a049;
}

.btn-complete:hover {
  background: #f57c00;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.loading-overlay.hidden {
  display: none;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #667eea;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Custom marker styles */
.custom-marker {
  background: white;
  border: 3px solid #667eea;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #667eea;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.custom-marker.visited {
  background: #4caf50;
  border-color: #4caf50;
  color: white;
}

.custom-marker.current {
  background: #ff5722;
  border-color: #ff5722;
  color: white;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
  100% {
    transform: scale(1);
  }
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .header-content h1 {
    font-size: 18px;
  }

  .btn-icon {
    padding: 8px;
    min-width: 40px;
    min-height: 40px;
    font-size: 14px;
  }

  .sidebar {
    width: 95%;
  }

  .nav-btn {
    font-size: 14px;
    padding: 12px 16px;
  }

  .location-item {
    padding: 10px;
  }

  .location-number {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
}
