/**
 * SparkleTour Routing Styles
 * Styles for the routing panel and tour planning interface
 */

/* Routing Panel */
.routing-panel {
  position: fixed;
  right: -400px;
  top: 0;
  width: 400px;
  max-width: 90vw;
  height: 100vh;
  background: white;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
  z-index: 1001;
  transition: right 0.3s ease, width 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.routing-panel.active {
  right: 0;
}

/* Expanded state (desktop only) */
.routing-panel.expanded {
  width: 800px;
  max-width: 95vw;
}

/* Mobile: always full width */
@media (max-width: 767px) {
  .routing-panel {
    width: 100vw;
    max-width: 100vw;
  }
  
  .routing-panel.expanded {
    width: 100vw;
  }
}

/* Tab Trigger */
.routing-tab-trigger {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 300px;
  background: linear-gradient(to bottom, #a01828, #dc3545);
  color: white;
  border-radius: 8px 0 0 8px;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-transition: width 0.3s ease, box-shadow 0.3s ease;
  -moz-transition: width 0.3s ease, box-shadow 0.3s ease;
  -o-transition: width 0.3s ease, box-shadow 0.3s ease;
  transition: width 0.3s ease, box-shadow 0.3s ease;
  user-select: none;
}

.routing-tab-trigger:hover {
  width: 52px;
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.3);
}

.routing-tab-trigger.hidden {
  right: -60px;
}

.routing-tab-trigger .tab-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  height: 100%;
}

.routing-tab-trigger .tab-text {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.4;
  text-align: center;
  white-space: normal;
  max-width: 100%;
  padding: 8px 0;
}

.routing-tab-trigger .tab-badge {
  position: absolute;
  top: -12px;
  left: -12px;
  background: #ffd700;
  color: #333;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: bold;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.routing-tab-trigger .tab-badge.pulse {
  animation: badgePulse 0.6s ease-out;
}

/* Saved route indicator */
.routing-tab-trigger.has-saved-route {
  animation: tabPulse 2s ease-in-out infinite;
}

@keyframes tabPulse {
  0%, 100% {
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.2);
  }
  50% {
    box-shadow: -4px 0 16px rgba(255, 215, 0, 0.6);
  }
}

@keyframes badgePulse {
  0%, 100% {
    transform: scale(1);
    background: #ffd700;
  }
  50% {
    transform: scale(1.3);
    background: #ffed4e;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
  }
}

/* Tablet: medium screens */
@media (min-width: 600px) and (max-width: 770px) {
  .routing-tab-trigger .tab-text {
    line-height: 1.5;
    padding: 10px 0;
  }
}

/* Mobile: larger touch target */
@media (max-width: 767px) {
  .routing-tab-trigger {
    width: 56px;
  }
  
  .routing-tab-trigger:hover {
    width: 56px;
  }
  
  .routing-tab-trigger .tab-content {
    padding: 20px 0;
  }
  
  .routing-tab-trigger .tab-text {
    font-size: 14px;
    line-height: 1.4;
  }
}

/* Panel Header */
.routing-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  color: white;
  background: linear-gradient(140deg,rgba(196, 30, 58, 1) 0%, rgba(30, 121, 44, 1) 100%);
  flex-shrink: 0;
}

.routing-panel-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.routing-panel-title i {
  font-size: 1.5rem;
}

.routing-panel-controls {
  display: flex;
  gap: 0.5rem;
}

.routing-panel-minimize,
.routing-panel-maximize,
.routing-panel-help,
.routing-panel-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.routing-panel-minimize:hover,
.routing-panel-maximize:hover,
.routing-panel-help:hover,
.routing-panel-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.routing-panel-help i {
  font-size: 1.25rem;
}

/* Hide maximize button on mobile and tablet */
@media (max-width: 1024px) {
  .routing-panel-maximize {
    display: none;
  }
}

/* Panel Content */
.routing-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Two-Column Layout (Expanded State - Desktop Only) */
.routing-panel.expanded .routing-panel-content {
  flex-direction: row;
  gap: 1.5rem;
  padding: 1.5rem;
}

.routing-left-column,
.routing-right-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Collapsed: single column, both columns stack */
.routing-left-column {
  flex: 1;
}

.routing-right-column {
  flex: 1;
}

/* Expanded: two equal columns side by side */
.routing-panel.expanded .routing-left-column,
.routing-panel.expanded .routing-right-column {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}

/* Mobile: always single column */
@media (max-width: 1024px) {
  .routing-panel-content {
    flex-direction: column !important;
  }
  
  .routing-left-column,
  .routing-right-column {
    flex: 1 !important;
  }
}

/* Old restore button animations - kept for compatibility */
@keyframes addStopNotification {
  0% {
    transform: scale(1) translateY(0);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
  25% {
    transform: scale(1.15) translateY(-8px);
    box-shadow: 0 8px 24px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.6);
  }
  50% {
    transform: scale(1.2) translateY(-10px);
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.9), 0 0 40px rgba(255, 215, 0, 0.7);
  }
  75% {
    transform: scale(1.15) translateY(-8px);
    box-shadow: 0 8px 24px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.6);
  }
  100% {
    transform: scale(1) translateY(0);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
}

/* Mode Toggle */
.routing-mode-toggle {
  display: flex;
  gap: 0.5rem;
  background: #f5f5f5;
  padding: 0.25rem;
  border-radius: 8px;
}

.routing-mode-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.2s;
  color: #666;
}

.routing-mode-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

.routing-mode-btn.active {
  background: white;
  color: #2e7d32;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.routing-mode-btn i {
  font-size: 1.1rem;
}

/* Location Button */
.routing-location-btn {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e0e0e0;
}

.btn-location {
  width: 100%;
  padding: 0.875rem 1rem;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-location:hover:not(:disabled) {
  background: #c82333;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-location:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-location i {
  font-size: 1.1rem;
}

.btn-location {
  flex-direction: column;
  gap: 0.25rem;
}

.btn-location .btn-main-text {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-location .btn-subtitle {
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.9;
  line-height: 1.2;
  margin-top: 0.125rem;
}

/* Waypoints Section */
.routing-waypoints {
  background: #f9f9f9;
  border-radius: 8px;
  padding: 1rem;
}

.waypoints-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.waypoints-header h4 {
  margin: 0;
  font-size: 1rem;
  color: #333;
}

.waypoint-count {
  color: #2e7d32;
  font-weight: 600;
}

.btn-optimize {
  background: #ffd700;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
  font-size: 0.875rem;
}

.btn-optimize:hover {
  background: #ffed4e;
  transform: translateY(-1px);
}

.btn-optimize i {
  font-size: 1rem;
}

/* Waypoints List */
.waypoints-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.waypoints-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: #999;
}

.waypoints-empty i {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

.waypoints-empty p {
  margin: 0;
  font-size: 0.875rem;
}

/* Waypoint Item */
.waypoint-item {
  background: white;
  border-radius: 8px;
  padding: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  transition: all 0.2s;
}

.waypoint-item:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.waypoint-marker {
  width: 32px;
  height: 32px;
  background: #dc3545;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.waypoint-info {
  flex: 1;
  min-width: 0;
}

.waypoint-address {
  font-weight: 500;
  color: #333;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.waypoint-coords {
  font-size: 0.75rem;
  color: #999;
  margin-top: 0.25rem;
}

.waypoint-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.waypoint-action-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: #f5f5f5;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  color: #666;
}

.waypoint-action-btn:hover:not(:disabled) {
  background: #e0e0e0;
  color: #333;
}

.waypoint-action-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.waypoint-action-btn.waypoint-remove {
  color: #c41e3a;
}

.waypoint-action-btn.waypoint-remove:hover {
  background: #ffe0e0;
}

/* Route Summary */
.route-summary {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: #f0f8f0;
  border-radius: 8px;
  border-left: 4px solid #2e7d32;
}

.summary-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  color: #2e7d32;
}

.summary-item i {
  font-size: 1.25rem;
}

/* Google Maps Warning */
.routing-warning {
  margin-bottom: 1rem;
}

.routing-warning .alert {
  margin-bottom: 0;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background-color: #fff3cd;
  border: 1px solid #ffc107;
  color: #856404;
}

.routing-warning .alert-warning {
  background-color: #fff3cd;
  border-color: #ffc107;
}

.routing-warning .alert i {
  color: #ffc107;
  margin-top: 0.125rem;
}

.routing-warning .alert strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.routing-warning .alert p {
  font-size: 0.85rem;
  line-height: 1.4;
}

/* Action Buttons */
.routing-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-routing {
  flex: 1;
  min-width: 120px;
  padding: 0.75rem 1rem;
  border: 2px solid;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  font-size: 0.875rem;
  background: white;
}

.btn-routing i {
  font-size: 1rem;
}

.btn-routing:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Clear Route Button - Red theme */
.btn-routing.btn-secondary {
  color: #c41e3a;
  border-color: #c41e3a;
}

.btn-routing.btn-secondary:hover {
  background: #c41e3a;
  color: white;
  border-color: #c41e3a;
}

/* Start Navigation Button - Green theme */
.btn-routing.btn-primary {
  color: #2e7d32;
  border-color: #2e7d32;
}

.btn-routing.btn-primary:hover {
  background: #2e7d32;
  color: white;
  border-color: #2e7d32;
}

/* Disabled state for Start Navigation button */
.btn-routing.btn-primary:disabled,
.btn-routing.btn-primary.disabled {
  background: #f5f5f5;
  color: #999;
  border-color: #ddd;
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.btn-routing.btn-primary:disabled:hover,
.btn-routing.btn-primary.disabled:hover {
  background: #f5f5f5;
  color: #999;
  border-color: #ddd;
  transform: none;
  box-shadow: none;
}

/* Share Route Button - Green theme */
.btn-routing.btn-success {
  background: white;
  color: #2e7d32;
  border: 2px solid #2e7d32;
}

.btn-routing.btn-success:hover {
  background: #2e7d32;
  color: white;
  border: 2px solid #2e7d32;
}

/* Print Route Button - Gold theme */
.btn-routing.btn-print {
  background: white;
  color: #ffd700;
  border: 2px solid #ffd700;
}

.btn-routing.btn-print:hover {
  background: #ffd700;
  color: #333;
  border: 2px solid #ffd700;
}

/* Directions List */
.routing-directions {
  background: #f9f9f9;
  border-radius: 8px;
  padding: 1rem;
}

.routing-directions h4 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  color: #333;
}

.directions-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.direction-step {
  display: flex;
  gap: 0.75rem;
  background: white;
  padding: 0.75rem;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.direction-number {
  width: 28px;
  height: 28px;
  background: #c41e3a;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.direction-text {
  flex: 1;
}

.direction-instruction {
  font-size: 0.875rem;
  color: #333;
  margin-bottom: 0.25rem;
}

.direction-distance {
  font-size: 0.75rem;
  color: #999;
}

/* Tour Stop Markers in Directions */
.direction-tour-stop {
  display: flex;
  gap: 0.75rem;
  background: linear-gradient(135deg, #fff5f5, #f0f8f0);
  padding: 1rem;
  border-radius: 8px;
  border-left: 4px solid #c41e3a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  margin: 0.5rem 0;
}

.direction-stop-icon {
  width: 36px;
  height: 36px;
  background: #dc3545;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.direction-tour-start .direction-stop-icon {
  background: #2e7d32;
}

.direction-stop-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.direction-stop-label {
  font-weight: 700;
  color: #2e7d32;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.direction-stop-address {
  color: #333;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
}

/* Custom Route Waypoint Markers */
.route-waypoint-marker {
  width: 30px;
  height: 30px;
  background: #dc3545;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  border: 3px solid white;
  /* DEBUG: Ensure pointer events are enabled */
  pointer-events: auto !important;
  cursor: pointer !important;
  /* DEBUG: Add visual indicator when hovering */
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.route-waypoint-marker:hover {
  /* DEBUG: Visual feedback on hover to confirm interactivity */
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  background: #ff4757 !important;
}

.route-waypoint-icon {
  background: transparent !important;
  border: none !important;
  /* DEBUG: Ensure parent container doesn't block clicks */
  pointer-events: auto !important;
}

/* Hide default Leaflet Routing Machine container */
.leaflet-routing-container {
  display: none !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .routing-panel {
    width: 100vw;
    right: -100vw;
  }
  
  .routing-panel.active {
    right: 0;
  }
  
  /* Ensure minimize button is large enough for mobile touch */
  .routing-panel-minimize,
  .routing-panel-close {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
  }
  
  .routing-mode-btn {
    font-size: 0.875rem;
    padding: 0.625rem 0.75rem;
  }
  
  .routing-mode-btn span {
    display: none;
  }
  
  .routing-mode-btn i {
    font-size: 1.25rem;
  }
  
  .waypoint-item {
    padding: 0.625rem;
  }
  
  .waypoint-address {
    font-size: 0.8125rem;
  }
  
  .btn-routing {
    min-width: 100px;
    padding: 0.625rem 0.875rem;
    font-size: 0.8125rem;
  }
}

/* Tablet */
@media (max-width: 1024px) and (min-width: 769px) {
  .routing-panel {
    width: 350px;
  }
}

/* Touch-friendly tap targets */
@media (hover: none) and (pointer: coarse) {
  .waypoint-action-btn {
    width: 36px;
    height: 36px;
  }
  
  .routing-panel-close {
    width: 44px;
    height: 44px;
  }
  
  .btn-routing {
    padding: 1rem;
    min-height: 44px;
  }
}

/* Print styles */
@media print {
  .routing-panel {
    display: none;
  }
}
/* Direct Route Origin Section */
.routing-origin-section {
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px solid #e0e0e0;
}

.routing-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #2e7d32;
  margin: 0 0 1rem 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.routing-origin-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.routing-origin-options .btn-location {
  width: 100%;
  padding: 0.875rem 1rem;
  background: white;
  color: #2e7d32;
  border: 2px solid #2e7d32;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.routing-origin-options .btn-location:hover {
  background: #2e7d32;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}

.routing-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: #999;
  font-size: 0.85rem;
  font-weight: 500;
}

.routing-divider::before,
.routing-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid #ddd;
}

.routing-divider span {
  padding: 0 0.75rem;
}

.routing-address-input {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.routing-address-input .form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  margin: 0;
}

.routing-address-input .form-control {
  padding: 0.75rem;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 0.9rem;
  transition: border-color 0.3s ease;
}

.routing-address-input .form-control:focus {
  outline: none;
  border-color: #2e7d32;
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

.routing-address-input .text-muted {
  font-size: 0.75rem;
  color: #999;
  margin: 0;
}

/* Mode Switch Action Sheet */
.mode-switch-action-sheet .action-sheet-content {
  padding: 1.5rem;
}

.mode-switch-action-sheet .btn {
  padding: 0.875rem 1.5rem;
  font-weight: 600;
  border-radius: 50px;
  transition: all 0.3s ease;
}

.mode-switch-action-sheet .btn-success {
  background: white;
  color: #2e7d32;
  border: 2px solid #2e7d32;
}

.mode-switch-action-sheet .btn-success:hover {
  background: #2e7d32;
  color: white;
  transform: translateY(-2px);
}

.mode-switch-action-sheet .btn-outline-secondary {
  background: white;
  color: #c41e3a;
  border: 2px solid #c41e3a;
}

.mode-switch-action-sheet .btn-outline-secondary:hover {
  background: #c41e3a;
  color: white;
  border-color: #c41e3a;
  transform: translateY(-2px);
}

/* Disabled Add to Tour Button */
.add-to-tour-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.add-to-tour-btn:disabled:hover {
  transform: none;
}

/* Generate Route Button */
.btn-generate-route {
  background: #dc3545;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin-bottom: 0.5rem;
}

.btn-generate-route:hover {
  background: #c82333;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}

.btn-generate-route:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-generate-route.needs-update {
  background: linear-gradient(135deg, #ff9800, #f57c00);
  animation: buttonPulse 2s ease-in-out infinite;
}

.btn-generate-route.needs-update:hover {
  background: linear-gradient(135deg, #f57c00, #ff9800);
}

@keyframes buttonPulse {
  0%, 100% {
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
  }
  50% {
    box-shadow: 0 4px 16px rgba(255, 152, 0, 0.6);
  }
}

.btn-generate-route .btn-badge {
  background: white;
  color: #f57c00;
  padding: 0.125rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-left: 0.25rem;
}

.optimize-option {
  margin-bottom: 0.75rem;
  padding: 0.5rem;
  background: #f5f5f5;
  border-radius: 6px;
}

.optimize-option label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  cursor: pointer;
  font-size: 0.9rem;
  color: #333;
}

.optimize-option .form-check-input {
  cursor: pointer;
  width: 18px;
  height: 18px;
}

.optimize-option i {
  color: #ff9800;
}

.waypoint-marker-numbered {
  width: 32px;
  height: 32px;
  background: #dc3545;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  border: 3px solid white;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.route-marker-outdated {
  opacity: 0.5;
  filter: grayscale(50%);
}

/* Pulse animation for update button */
.pulse-update {
  animation: buttonPulse 2s ease-in-out infinite !important;
}

/* Red border for outdated waypoint items */
.waypoint-item.waypoint-outdated {
  border: 2px solid #ff6b6b !important;
  box-shadow: 0 0 8px rgba(255, 107, 107, 0.3);
  animation: waypoint-outdated-pulse 2s ease-in-out infinite;
}

@keyframes waypoint-outdated-pulse {
  0%, 100% {
    border-color: #ff6b6b;
    box-shadow: 0 0 8px rgba(255, 107, 107, 0.3);
  }
  50% {
    border-color: #ff4444;
    box-shadow: 0 0 12px rgba(255, 68, 68, 0.5);
  }
}

.route-waypoint-marker {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, #c41e3a, #8b1429);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/**
 * Route Toggle Control Button
 * Leaflet control for showing/hiding route lines and waypoint markers
 */
.route-toggle-control {
  margin-top: 8px;
  animation: slideInDown 0.3s ease-out;
}

.route-toggle-button {
  width: 48px;
  height: 48px;
  line-height: 48px;
  background: linear-gradient(135deg, #2e7d32, #1b5e20) !important;
  color: white !important;
  border: none;
  border-radius: 12px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  animation: routePulse 2s ease-in-out infinite;
  text-decoration: none;
}

.route-toggle-button:hover {
  background: #c82333 !important;
  transform: scale(1.05);
}

.route-toggle-button:active {
  transform: scale(0.98);
}

/* Active state - route visible */
.route-toggle-button.active {
  background: linear-gradient(135deg, #2e7d32, #1b5e20) !important;
  animation: routePulse 2s ease-in-out infinite;
}

/* Inactive state - route hidden */
.route-toggle-button.inactive {
  background: linear-gradient(135deg, #666, #444) !important;
  animation: none;
  opacity: 0.7;
}

.route-toggle-button.inactive:hover {
  opacity: 1;
}

@keyframes routePulse {
  0%, 100% {
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.3);
  }
  50% {
    box-shadow: 0 2px 12px rgba(46, 125, 50, 0.6);
  }
}

/* Icon inside button */
.route-toggle-icon {
  font-size: 24px;
  color: white;
  line-height: 1;
}

/* Status badge - similar to follow me badge */
.route-status-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #ffd700;
  color: #333;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  line-height: 1;
}

.route-toggle-button.inactive .route-status-badge {
  background: #999;
  color: white;
}

/* Slide in animation */
@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile adjustments */
@media (max-width: 767px) {
  .route-toggle-control {
    margin-top: 8px !important;
  }
  
  .route-toggle-button {
    width: 40px;
    height: 40px;
  }
  
  .route-toggle-button i {
    font-size: 20px;
  }
}


/* ============================================
   LANDSCAPE MODE OPTIMIZATIONS
   ============================================ */

/* Landscape mode optimizations for routing panel */
@media (max-width: 768px) and (orientation: landscape) {
  /* Routing panel - use less width in landscape */
  .routing-panel {
    width: 50vw;
    max-width: 400px;
  }
  
  /* Reduce padding in content area */
  .routing-panel-content {
    padding: 0.75rem;
    gap: 0.75rem;
  }
  
  /* Keep tab trigger at consistent height */
  .routing-tab-trigger {
    height: 300px;
    width: 32px;
  }
  
  .routing-tab-trigger .tab-text {
    font-size: 11px;
  }
  
  /* Compact header */
  .routing-panel-header {
    padding: 0.75rem;
  }
  
  .routing-panel-title {
    font-size: 1.125rem;
  }
  
  .routing-panel-title i {
    font-size: 1.25rem;
  }
  
  /* Compact control buttons */
  .routing-panel-minimize,
  .routing-panel-maximize,
  .routing-panel-help,
  .routing-panel-close {
    width: 36px;
    height: 36px;
  }
  
  /* Compact waypoint items */
  .waypoint-item {
    padding: 0.5rem;
    gap: 0.5rem;
  }
  
  .waypoint-marker {
    width: 28px;
    height: 28px;
    font-size: 0.8125rem;
  }
  
  .waypoint-address {
    font-size: 0.8125rem;
  }
  
  .waypoint-coords {
    font-size: 0.6875rem;
  }
  
  .waypoint-action-btn {
    width: 24px;
    height: 24px;
  }
  
  /* Compact route summary */
  .route-summary {
    padding: 0.75rem;
    gap: 0.75rem;
  }
  
  .summary-item {
    font-size: 0.875rem;
  }
  
  .summary-item i {
    font-size: 1.125rem;
  }
  
  /* Compact directions */
  .direction-step {
    padding: 0.5rem;
    gap: 0.5rem;
  }
  
  .direction-number {
    width: 24px;
    height: 24px;
    font-size: 0.8125rem;
  }
  
  .direction-instruction {
    font-size: 0.8125rem;
  }
  
  .direction-distance {
    font-size: 0.6875rem;
  }
  
  /* Compact tour stop markers */
  .direction-tour-stop {
    padding: 0.75rem;
    gap: 0.5rem;
  }
  
  .direction-stop-icon {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }
  
  .direction-stop-label {
    font-size: 0.6875rem;
  }
  
  .direction-stop-address {
    font-size: 0.8125rem;
  }
  
  /* Compact action buttons */
  .btn-routing {
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    min-width: 100px;
  }
  
  .btn-routing i {
    font-size: 0.875rem;
  }
  
  /* Compact mode toggle */
  .routing-mode-btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
  
  .routing-mode-btn i {
    font-size: 1rem;
  }
  
  /* Compact location button */
  .btn-location {
    padding: 0.75rem 0.875rem;
    font-size: 0.875rem;
  }
  
  .btn-location i {
    font-size: 1rem;
  }
  
  /* Compact optimize button */
  .btn-optimize {
    padding: 0.4rem 0.75rem;
    font-size: 0.8125rem;
  }
  
  .btn-optimize i {
    font-size: 0.875rem;
  }
  
  /* Compact waypoints section */
  .routing-waypoints {
    padding: 0.75rem;
  }
  
  .waypoints-header h4 {
    font-size: 0.9375rem;
  }
  
  /* Compact directions section */
  .routing-directions {
    padding: 0.75rem;
  }
  
  .routing-directions h4 {
    font-size: 0.9375rem;
    margin-bottom: 0.75rem;
  }
  
  /* Compact origin section */
  .routing-origin-section {
    padding: 0.75rem;
  }
  
  .routing-section-title {
    font-size: 0.8125rem;
    margin-bottom: 0.75rem;
  }
  
  .routing-address-input .form-control {
    padding: 0.5rem;
    font-size: 0.875rem;
  }
  
  /* Compact generate route button */
  .btn-generate-route {
    padding: 0.625rem 1.25rem;
    font-size: 0.9375rem;
  }
  
  /* Compact optimize options */
  .optimize-option {
    padding: 0.4rem;
    margin-bottom: 0.5rem;
  }
  
  .optimize-option label {
    font-size: 0.8125rem;
  }
}
