* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: linear-gradient(180deg, #1a1a1a 0%, #252525 100%);
  min-height: 100vh;
  color: #f0f0f0;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  padding: 40px 0;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  color: #fff;
}

header p {
  color: #888;
  font-size: 1.1rem;
}

header nav {
  margin-top: 15px;
}

header nav a {
  color: #60a5fa;
  margin: 0 15px;
  text-decoration: none;
}

header nav a:hover {
  color: #93c5fd;
  text-decoration: underline;
}

.search-box {
  display: flex;
  gap: 10px;
  margin-bottom: 30px;
}

.search-box input {
  flex: 1;
  padding: 15px 20px;
  border: 1px solid #444;
  border-radius: 10px;
  background: #2a2a2a;
  color: #fff;
  font-size: 1rem;
}

.search-box input:focus {
  outline: none;
  border-color: #3b82f6;
}

.search-box button, button {
  padding: 15px 30px;
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  border: none;
  border-radius: 10px;
  color: #fff;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

button:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
  box-shadow: 0 4px 12px rgba(37,99,235,0.4);
}

.result-card {
  background: linear-gradient(145deg, #2a2a2a 0%, #323232 100%);
  border-radius: 15px;
  padding: 30px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  border: 1px solid #3a3a3a;
}

.status-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 25px;
  flex-wrap: wrap;
}

.status-badge {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: bold;
  text-transform: uppercase;
}

.status-pending { background: #3498db; }
.status-in_transit { background: #f39c12; }
.status-delivered { background: #27ae60; }
.status-failed { background: #e74c3c; }
.status-in_progress { background: #9b59b6; }
.status-completed { background: #27ae60; }

.route-completed {
  border-left: 4px solid #27ae60;
}

.completed-banner {
  background: #27ae60;
  color: white;
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: bold;
  font-size: 0.95rem;
  margin: 8px 0;
  text-align: center;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.info-item {
  background: #333;
  padding: 15px;
  border-radius: 10px;
}

.info-item label {
  display: block;
  color: #888;
  font-size: 0.85rem;
  margin-bottom: 5px;
}

.info-item span {
  font-size: 1.1rem;
  font-weight: 500;
}

.info-item.highlight {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
  border: 1px solid #3b82f6;
}

.info-item.highlight label {
  color: #aaa;
}

.progress-section h3, .driver-location h3 {
  margin-bottom: 15px;
  color: #fff;
}

.progress-bar {
  height: 10px;
  background: #333;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2563eb 0%, #60a5fa 100%);
  border-radius: 5px;
  transition: width 0.5s ease;
}

.driver-location {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #444;
}

.hidden {
  display: none !important;
}

.error-message {
  background: #e74c3c;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
}

footer {
  text-align: center;
  padding: 30px;
  color: #666;
}

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.tab {
  padding: 10px 20px;
  background: #333;
  border: none;
  border-radius: 8px;
  color: #888;
  cursor: pointer;
}

.tab.active {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.form-inline {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.form-inline input, .form-inline select {
  padding: 12px;
  border: 1px solid #444;
  border-radius: 8px;
  background: #2a2a2a;
  color: #fff;
  font-size: 1rem;
}

.form-inline input:focus, .form-inline select:focus {
  outline: none;
  border-color: #3b82f6;
}

.list-item {
  background: linear-gradient(145deg, #2a2a2a 0%, #323232 100%);
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 10px;
  border: 1px solid #3a3a3a;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.driver-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.driver-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.driver-actions {
  display: flex;
  gap: 10px;
}

.driver-actions button {
  padding: 8px 15px;
  font-size: 0.85rem;
}

.delete-btn {
  background: #e74c3c !important;
}

.delete-btn:hover {
  background: #c0392b !important;
}

.route-item {
  padding: 20px;
}

.route-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.route-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.route-actions button {
  padding: 8px 15px;
  font-size: 0.9rem;
}

.stops-list {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #444;
}

.stop-item {
  background: #333;
  padding: 10px 15px;
  border-radius: 8px;
  margin-bottom: 8px;
  border-left: 4px solid #3b82f6;
}

.stop-item.status-delivered {
  border-left-color: #27ae60;
  opacity: 0.7;
}

.stop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 8px;
}

.eta-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.eta-input-group label {
  color: #aaa;
  font-size: 0.9rem;
}

.eta-input-group input[type="time"] {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #444;
  background: #2a2a2a;
  color: #fff;
  font-size: 0.9rem;
}

.optimize-btn {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%) !important;
}

.optimize-btn:hover {
  background: linear-gradient(135deg, #16a34a 0%, #15803d 100%) !important;
}

.map-btn {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%) !important;
}

.map-btn:hover {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%) !important;
}

.stop-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.edit-stop-btn {
  background: #3b82f6 !important;
  padding: 4px 12px !important;
  font-size: 0.8rem !important;
  border-radius: 6px !important;
}

.delete-stop-btn {
  background: #ef4444 !important;
  padding: 4px 12px !important;
  font-size: 0.8rem !important;
  border-radius: 6px !important;
}

.route-stats {
  color: #22c55e;
  font-weight: 600;
  font-size: 0.95rem;
}

.route-map {
  margin-top: 15px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid #3b82f6;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: linear-gradient(145deg, #2a2a2a 0%, #323232 100%);
  padding: 30px;
  border-radius: 15px;
  width: 90%;
  max-width: 500px;
  border: 1px solid #3a3a3a;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.modal-content h3 {
  margin-bottom: 20px;
  color: #fff;
}

.modal-content input, .modal-content textarea {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  border: 1px solid #444;
  border-radius: 8px;
  background: #333;
  color: #fff;
  font-size: 1rem;
}

.modal-content textarea {
  min-height: 80px;
  resize: vertical;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.driver-select {
  text-align: center;
  padding: 40px;
}

.driver-select select {
  padding: 15px;
  margin: 20px 0;
  border: 1px solid #444;
  border-radius: 10px;
  background: #2a2a2a;
  color: #fff;
  font-size: 1rem;
  min-width: 200px;
}

.driver-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
  gap: 15px;
}

.location-btn {
  background: #27ae60 !important;
}

.location-btn:hover {
  background: #219a52 !important;
}

.stops-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.driver-stop {
  display: flex;
  gap: 15px;
  background: linear-gradient(145deg, #2a2a2a 0%, #323232 100%);
  padding: 20px;
  border-radius: 12px;
  align-items: flex-start;
  border: 1px solid #3a3a3a;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.driver-stop.delivered {
  opacity: 0.6;
  background: #222;
}

.stop-number {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

.stop-info {
  flex: 1;
}

.stop-info strong {
  color: #fff;
}

.stop-info p {
  margin-top: 5px;
  color: #aaa;
}

.stop-info .notes {
  background: #333;
  padding: 8px;
  border-radius: 5px;
  margin-top: 10px;
  font-style: italic;
}

.stop-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.deliver-btn {
  background: #27ae60 !important;
  padding: 10px 15px;
  font-size: 0.9rem;
}

.deliver-btn:hover {
  background: #219a52 !important;
}

.eta-btn {
  background: #3498db !important;
  padding: 10px 15px;
  font-size: 0.9rem;
}

.eta-btn:hover {
  background: #2980b9 !important;
}

.delivered-badge {
  background: #27ae60;
  padding: 10px 15px;
  border-radius: 8px;
  font-weight: bold;
}

.photo-btn {
  background: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
  padding: 10px 15px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: bold;
  color: #fff;
  cursor: pointer;
  text-align: center;
  transition: transform 0.2s, background 0.2s;
}

.photo-btn:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
}

.photo-badge {
  background: #8b5cf6;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  margin-top: 5px;
}

.no-route {
  text-align: center;
  padding: 40px;
  background: #2a2a2a;
  border-radius: 15px;
  color: #888;
}

@media (max-width: 600px) {
  header h1 {
    font-size: 1.8rem;
  }
  
  .search-box {
    flex-direction: column;
  }
  
  .driver-stop {
    flex-direction: column;
  }
  
  .stop-actions {
    flex-direction: row;
    width: 100%;
  }
  
  .stop-actions button {
    flex: 1;
  }
}
