/* Full-screen overlay wrapper — identical pattern to Go to Places overlay */
.tour-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 50000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 70px 16px 10px;
  box-sizing: border-box;
}

.tour-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

/* The panel itself — fills the padded overlay box, equal gap on all 4 sides */
.tour-panel {
  --primary-bg: #0e1011;
  --secondary-bg: #333333;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0a0;
  --accent1: #444444;
  position: relative !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  margin: 0 !important;
  width: 100%;
  max-width: 600px;
  height: calc(100dvh - 20px);
  max-height: calc(100vh - 20px);
  background: rgba(18, 18, 18, 0.98);
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.05) inset;
  border: 1px solid rgba(128, 128, 128, 0.3);
  z-index: 50001;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.92);
  opacity: 0;
  pointer-events: none;
  color: #e0e0e0;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.tour-overlay.visible .tour-panel {
  transform: scale(1) !important;
  opacity: 1 !important;
  pointer-events: auto;
}

/* When collapsed (not inside visible overlay), completely hide the panel
   so it cannot block clicks on the map or any other UI elements */
.tour-panel.collapsed {
  display: none !important;
}


.tour-panel .panel-header {
  padding: 16px;
  background: rgba(68, 68, 68, 0.3);
  border-bottom: 1px solid rgba(128, 128, 128, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.tour-panel .panel-header h3 {
  margin: 0;
  flex: 1;
  text-align: center;
  font-family: 'Anton SC', sans-serif !important;
  font-size: 34px;
  color: #e0e0e0;
  font-weight: 600;
  letter-spacing: -0.5px;
}
/* Remove only the 'Tour Planner' words from layout while audio is playing */
.tour-panel .tour-audio-btn.playing ~ h3 .panel-title-word {
  display: none;
}

/* Routes manager (select + add + clear) */
.tour-panel .routes-manager {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-right: 8px;
}

.tour-panel .route-select {
  background: rgba(26, 26, 26, 0.9);
  color: #e0e0e0;
  border: 1px solid rgba(128, 128, 128, 0.3);
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 13px;
}

.tour-panel .small-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
  color: #e0e0e0;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.tour-panel .small-btn.danger {
  background: var(--secondary-bg, #333);
  border: 1px solid rgba(128, 128, 128, 0.4);
  color: var(--text-primary, #e0e0e0);
  box-shadow: 0 0 10px rgba(128, 128, 128, 0.3);
}

.tour-panel .small-btn.danger:hover {
  background: rgba(128, 128, 128, 0.2);
  box-shadow: 0 0 15px rgba(128, 128, 128, 0.4);
  transform: scale(1.05);
}

.tour-panel .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 100, 200, 0.2);
  color: #ffffff;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(100, 150, 255, 0.5);
  font-size: 14px;
  font-weight: 600;
  margin-left: 8px;
  box-shadow: 0 0 8px rgba(100, 150, 255, 0.3);
  vertical-align: middle;
  position: relative;
  top: -2px;
}

.tour-panel .close-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10;
  padding: 0;
  line-height: 1;
}

.tour-panel .close-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  border-color: #666;
}

/* Tour planner play audio button — matches close-btn style, sits to its left */
.tour-panel .tour-audio-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 10;
  padding: 0;
  line-height: 1;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.tour-panel .tour-audio-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: #666;
}
.tour-panel .tour-audio-btn i.fa-pause {
  display: none;
}
.tour-panel .tour-audio-btn .fa-spinner {
  display: none;
  font-size: 14px;
}
.tour-panel .tour-audio-btn .tour-spin-wrap {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  line-height: 1;
}
.tour-panel .tour-audio-btn.loading .tour-spin-wrap {
  display: block !important;
}
.tour-panel .tour-audio-btn.playing i.fa-play {
  display: none;
}
.tour-panel .tour-audio-btn.playing i.fa-pause {
  display: inline-block;
}
.tour-panel .tour-audio-btn.loading i.fa-play,
.tour-panel .tour-audio-btn.loading i.fa-pause {
  display: none !important;
}
.tour-panel .tour-audio-btn.loading .fa-spinner {
  display: inline-block !important;
}
/* Sheen on tour planner play button */
.tour-panel .tour-audio-btn::before {
  content: '';
  position: absolute;
  bottom: -75%;
  left: -75%;
  width: 45%;
  height: 200%;
  background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.18) 50%, rgba(255,255,255,0) 100%);
  transform: rotate(-45deg);
  animation: tourBtnShine 2s ease-in-out infinite;
  pointer-events: none;
}
.tour-panel .tour-audio-btn.playing::before,
.tour-panel .tour-audio-btn.loading::before {
  animation: none;
  display: none;
}
@keyframes tourBtnShine {
  0%   { left: -75%; bottom: -75%; }
  28%  { left: 130%; bottom: 130%; }
  100% { left: 130%; bottom: 130%; }
}

/* Tour planner skip buttons — pop LEFT from the play button */
.tour-panel .tour-skip-back,
.tour-panel .tour-skip-forward {
  position: absolute;
  top: 15px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 0, 0, 0.3);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 0;
  overflow: hidden;
  touch-action: manipulation;
  /* Start hidden on top of the play button */
  right: 12px;
  opacity: 0;
  transform: scale(0);
  transition: right 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
}
/* CSS sibling selector: show when play button has .playing class */
.tour-panel .tour-audio-btn.playing ~ .tour-skip-forward {
  right: 52px;
  opacity: 1;
  transform: scale(1);
}
.tour-panel .tour-audio-btn.playing ~ .tour-skip-back {
  right: 92px;
  opacity: 1;
  transform: scale(1);
}
.tour-panel .tour-skip-back:hover,
.tour-panel .tour-skip-forward:hover {
  background: rgba(0, 0, 0, 0.85);
  border-color: #666;
}

.tour-panel .panel-content {
  padding: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  max-height: none;
  /* Hide scrollbars but keep scrolling functional */
  scrollbar-width: none;
  /* Firefox */
}

/* Highlighted empty state message */
.tour-panel .stops-empty-hint {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(128, 128, 128, 0.05));
  box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.02);
}

.tour-panel .stops-empty-hint .no-stops-message {
  margin: 0;
  color: #f5f5f5;
  font-weight: 600;
  letter-spacing: 0.2px;
  font-size: 15px;
  text-align: center;
  display: block;
  line-height: 1.4;
  font-family: 'Inter', sans-serif;
  font-style: normal;
}

.tour-panel .stops-empty-hint .no-stops-message .red-dot {
  color: #ffffff;
}

/* Chrome, Edge, Safari */
.tour-panel .panel-content::-webkit-scrollbar {
  display: none;
}

.tour-panel .poi-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px 0;
}

.tour-panel .poi-list li {
  background: rgba(68, 68, 68, 0.3);
  border: 1px solid rgba(128, 128, 128, 0.3);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  cursor: move;
  transition: background 0.2s, transform 0.1s, border-color 0.2s;
}

.tour-panel .poi-list li:hover {
  background: rgba(68, 68, 68, 0.5);
  border-color: rgba(128, 128, 128, 0.5);
}

.tour-panel .poi-list li.dragging {
  opacity: 0.5;
  transform: scale(0.98);
}

.tour-panel .poi-list li.empty-state {
  cursor: default;
  text-align: center;
  color: rgba(160, 160, 160, 0.8);
  padding: 24px 12px;
  border-color: rgba(128, 128, 128, 0.2);
}

.tour-panel .poi-number {
  background: rgba(0, 0, 0, 0.5);
  color: #ffffff;
  border: 1px solid rgba(0, 100, 255, 0.5);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.tour-panel .poi-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.tour-panel .poi-name {
  color: #e0e0e0;
  font-weight: 500;
  word-break: break-word;
}

.tour-panel .poi-category {
  color: rgba(160, 160, 160, 0.9);
  font-size: 12px;
}

.tour-panel .remove-btn {
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid #444;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
  padding: 0;
}

.tour-panel .remove-btn:hover {
  background: rgba(0, 0, 0, 0.8);
  border-color: #666;
  color: #fff;
}

.tour-panel .prefs-section {
  margin-bottom: 16px;
}

.tour-panel .prefs-section label {
  display: block;
  color: rgba(224, 224, 224, 0.8);
  font-size: 14px;
  margin-bottom: 8px;
}

.tour-panel .prefs {
  width: 100%;
  padding: 10px;
  background: rgba(26, 26, 26, 0.9);
  border: 1px solid rgba(128, 128, 128, 0.4);
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.tour-panel .prefs:hover {
  background: rgba(26, 26, 26, 1);
  border-color: rgba(128, 128, 128, 0.6);
}

.tour-panel .prefs option {
  background: #1a1a1a;
  color: #e0e0e0;
  padding: 8px;
}

.tour-panel .prefs:focus {
  outline: none;
  border-color: rgba(128, 128, 128, 0.7);
  box-shadow: 0 0 0 2px rgba(128, 128, 128, 0.3);
}

.tour-panel .generate-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, rgba(255, 0, 0, 0.3) 0%, rgba(255, 0, 0, 0.2) 100%);
  border: 1px solid rgba(255, 0, 0, 0.4);
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  margin-bottom: 16px;
}

.tour-panel .generate-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.6);
  background: linear-gradient(135deg, rgba(255, 0, 0, 0.4) 0%, rgba(255, 0, 0, 0.3) 100%);
}

.tour-panel .generate-btn:active {
  transform: translateY(0);
}

.tour-panel .route-output {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 0, 0, 0.2);
}

.tour-panel .route-output .loading {
  text-align: center;
  color: rgba(160, 160, 160, 0.9);
  padding: 20px;
}

.tour-panel .route-output .error {
  color: #ff0000;
  margin-bottom: 8px;
}

.tour-panel .route-output .fallback {
  color: rgba(160, 160, 160, 0.9);
  font-size: 14px;
}

.tour-panel .route-summary {
  margin-bottom: 16px;
}

.tour-panel .justification {
  color: rgba(224, 224, 224, 0.9);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 12px;
  padding: 12px;
  background: rgba(255, 0, 0, 0.1);
  border-radius: 6px;
  border-left: 3px solid rgba(255, 0, 0, 0.6);
}

.tour-panel .stats {
  color: rgba(224, 224, 224, 0.8);
  font-size: 14px;
  font-weight: 500;
}

.tour-panel .route-steps {
  margin-top: 12px;
}

.tour-panel .route-steps summary {
  color: rgba(224, 224, 224, 0.9);
  font-weight: 500;
  cursor: pointer;
  padding: 8px;
  background: rgba(68, 68, 68, 0.3);
  border-radius: 6px;
  transition: background 0.2s;
}

.tour-panel .route-steps summary:hover {
  background: rgba(68, 68, 68, 0.5);
}

.tour-panel .route-steps ol {
  margin: 12px 0 0 0;
  padding-left: 20px;
  color: rgba(224, 224, 224, 0.8);
}

.tour-panel .route-steps li {
  margin-bottom: 8px;
  font-size: 13px;
  line-height: 1.5;
}

/* Tour Icon Styles - Matches floating-qr and floating-ai pattern */
.tour-icon {
  position: absolute !important;
  top: 288px;
  left: 10px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background-color: rgba(30, 30, 30, 0.9);
  border: 1px solid rgba(255, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #999;
  z-index: 100 !important;
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.3);
}

.tour-icon:hover {
  background-color: rgba(50, 50, 50, 0.95);
  border-color: rgba(255, 0, 0, 0.5);
  transform: scale(1.05);
  box-shadow: 0 0 15px rgba(255, 0, 0, 0.5);
  color: #fff;
}

.tour-icon svg {
  width: 20px;
  height: 20px;
  transition: color 0.3s;
}

.tour-icon:hover svg {
  color: #ff0000;
}

.tour-icon .count-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #4db8ff;
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(30, 30, 30, 0.9);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* POI Popup Tour Icon Toggle */
.popup-tour-toggle {
  cursor: pointer;
  font-size: 20px;
  color: #e0e0e0;
  background-color: var(--primary-bg);
  border: 1px solid rgba(255, 0, 0, 0.3);
  padding: 8px;
  border-radius: 50%;
  transition: all 0.3s ease-in-out;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.popup-tour-toggle svg {
  width: 18px;
  height: 18px;
  transition: all 0.3s ease;
}

.popup-tour-toggle .tour-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: rgba(255, 0, 0, 0.9);
  color: white;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  border: 2px solid var(--primary-bg);
  line-height: 1;
}

.popup-tour-toggle.saved {
  color: #ff0000;
  border-color: rgba(255, 0, 0, 0.6);
}

.popup-tour-toggle.saved svg {
  color: #ff0000;
}

.popup-tour-toggle.saved .tour-badge {
  background: #0066ff;
}

.popup-tour-toggle:hover {
  background-color: var(--accent1);
  border-color: #ff0000;
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.8);
}

/* Pre-trip Planner Suggestions */
.tour-panel .section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tour-panel .section:last-child {
  border-bottom: none;
}

.tour-panel .section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 6px 0;
}

.tour-panel .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 0, 0, 0.3);
  border-radius: 50%;
  font-size: 15px;
  font-weight: 600;
  color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.3);
}

.tour-panel .section-header h4 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #e0e0e0;
  line-height: 1;
}

.tour-panel .ai-badge {
  display: inline-block;
  padding: 2px 8px;
  background: linear-gradient(135deg, rgba(0, 150, 255, 0.2), rgba(138, 43, 226, 0.2));
  border: 1px solid rgba(0, 150, 255, 0.4);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  color: #4db8ff;
  margin-left: 4px;
}

.tour-panel .poi-count-hint {
  margin-left: auto;
  font-size: 12px;
  color: rgba(224, 224, 224, 0.5);
  font-style: italic;
}

.tour-panel .routes-section .routes-manager {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tour-panel .planner-inputs {
  margin-bottom: 12px;
}

.tour-panel .planner-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}

.tour-panel .planner-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: rgba(224, 224, 224, 0.8);
}

.tour-panel .planner-row input[type="number"] {
  width: 100%;
  padding: 8px;
  background: rgba(26, 26, 26, 0.8);
  border: 1px solid rgba(255, 0, 0, 0.3);
  border-radius: 4px;
  color: #e0e0e0;
  font-size: 14px;
}

.tour-panel .planner-row .unit {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: rgba(224, 224, 224, 0.4);
  pointer-events: none;
}

.tour-panel .ai-toggle {
  display: flex;
  flex-direction: row !important;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.tour-panel .ai-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.tour-panel .planner-run-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, rgba(0, 150, 255, 0.3), rgba(138, 43, 226, 0.2));
  border: 1px solid rgba(0, 150, 255, 0.5);
  border-radius: 8px;
  color: #4db8ff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 12px;
  margin-bottom: 12px;
}

.tour-panel .planner-run-btn:hover {
  background: linear-gradient(135deg, rgba(0, 150, 255, 0.4), rgba(138, 43, 226, 0.3));
  border-color: rgba(0, 150, 255, 0.7);
  transform: translateY(-1px);
}

.tour-panel .planner-run-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.tour-panel .planner-run-btn.loading {
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.tour-panel .suggestions-container h5 {
  margin: 0 0 10px 0;
  font-size: 13px;
  font-weight: 600;
  color: rgba(224, 224, 224, 0.7);
}

.tour-panel .suggestion-hint {
  padding: 12px;
  text-align: center;
  color: rgba(224, 224, 224, 0.4);
  font-size: 12px;
  font-style: italic;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.tour-panel .suggestion-list {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  overflow-y: hidden;
}

.tour-panel .suggestion-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: rgba(26, 26, 26, 0.6);
  border: 1px solid rgba(255, 0, 0, 0.2);
  border-radius: 6px;
  transition: background 0.2s, border-color 0.2s;
}

.tour-panel .suggestion-item:hover {
  background: rgba(26, 26, 26, 0.9);
  border-color: rgba(255, 0, 0, 0.4);
}

.tour-panel .suggestion-text {
  color: #e0e0e0;
  font-size: 13px;
  line-height: 1.4;
  word-break: break-word;
  white-space: normal; /* Allow text wrapping */
  overflow-wrap: break-word; /* Break long words if needed */
}

.tour-panel .suggestion-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  color: inherit;
}

.tour-panel .suggestion-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.tour-panel .suggestion-btn {
  padding: 6px 12px;
  border-radius: 4px;
  border: 1px solid;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.tour-panel .suggestion-btn.primary {
  background: rgba(0, 150, 255, 0.2);
  border-color: rgba(0, 150, 255, 0.5);
  color: #4db8ff;
}

.tour-panel .suggestion-btn.primary:hover {
  background: rgba(0, 150, 255, 0.3);
  border-color: rgba(0, 150, 255, 0.7);
  transform: translateY(-1px);
}

.tour-panel .suggestion-btn.danger {
  background: rgba(255, 0, 0, 0.2);
  border-color: rgba(255, 0, 0, 0.5);
  color: #ff6666;
}

.tour-panel .suggestion-btn.danger:hover {
  background: rgba(255, 0, 0, 0.3);
  border-color: rgba(255, 0, 0, 0.7);
  transform: translateY(-1px);
}

.tour-panel .suggestion-summary {
  padding: 12px;
  background: rgba(0, 150, 255, 0.1);
  border: 1px solid rgba(0, 150, 255, 0.3);
  border-radius: 6px;
  color: #4db8ff;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 12px;
  font-style: italic;
}

.tour-panel .suggestion-loading {
  padding: 16px;
  text-align: center;
  color: rgba(224, 224, 224, 0.6);
  font-size: 13px;
  font-style: italic;
}

.tour-panel .suggestion-empty {
  padding: 16px;
  text-align: center;
  color: rgba(224, 224, 224, 0.5);
  font-size: 13px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 6px;
}

.tour-panel .suggestion-error {
  padding: 12px;
  background: rgba(255, 0, 0, 0.1);
  border: 1px solid rgba(255, 0, 0, 0.3);
  border-radius: 6px;
  color: #ff6666;
  font-size: 13px;
}

/* ========== NEW SIMPLIFIED LAYOUT ========== */

/* Days Section */
.tour-panel .days-section .days-setup {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.tour-panel .days-setup label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e0e0e0;
  font-size: 14px;
}

.tour-panel .days-setup input[type="number"] {
  width: 60px;
  padding: 6px 8px;
  background: rgba(26, 26, 26, 0.9);
  border: 1px solid rgba(128, 128, 128, 0.4) !important;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 14px;
  text-align: center;
  -moz-appearance: textfield;
}

.tour-panel .days-setup input[type="number"]:focus {
  outline: none;
  border-color: rgba(128, 128, 128, 0.6) !important;
  box-shadow: 0 0 8px rgba(128, 128, 128, 0.3);
}

.tour-panel .days-setup input[type="number"]:hover {
  border-color: rgba(128, 128, 128, 0.5) !important;
}

.tour-panel .days-setup input[type="number"]::-webkit-outer-spin-button,
.tour-panel .days-setup input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.tour-panel .auto-organize-btn {
  padding: 10px 18px;
  background: rgba(68, 68, 68, 0.3);
  border: 1px solid rgba(128, 128, 128, 0.4);
  border-radius: 8px;
  color: var(--text-primary, #e0e0e0);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0 10px rgba(128, 128, 128, 0.3);
}

.tour-panel .auto-organize-btn:hover {
  background: rgba(80, 80, 80, 0.4);
  box-shadow: 0 0 8px rgba(128, 128, 128, 0.3);
  transform: scale(1.02);
}

.tour-panel .auto-organize-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Day Cards */
.tour-panel .days-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tour-panel .day-card {
  background: rgba(26, 26, 26, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

.tour-panel .day-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.3);
  color: #e0e0e0;
}

.tour-panel .day-stop-count {
  font-size: 12px;
  color: rgba(224, 224, 224, 0.6);
}

.tour-panel .day-card-stops {
  padding: 8px;
  min-height: 40px;
}

.tour-panel .day-card-stops .empty-day {
  display: block;
  padding: 8px;
  text-align: center;
  color: rgba(224, 224, 224, 0.4);
  font-size: 12px;
  font-style: italic;
}

.tour-panel .day-stop-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  margin-bottom: 10px;
  background: rgba(30, 30, 30, 0.9);
  border: 1px solid rgba(0, 120, 255, 0.3);
  border-radius: 8px;
  font-size: 13px;
  color: #9dd6ff;
  box-shadow: 0 0 10px rgba(0, 120, 255, 0.25);
}

.tour-panel .day-stop-item:last-child {
  margin-bottom: 0;
}

.tour-panel .remove-from-day {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  line-height: 1;
  margin: 0;
}

.tour-panel .remove-from-day:hover {
  color: #cccccc;
}

/* AI Advice Box */
.tour-panel .ai-advice-box {
  margin-top: 12px;
}

.tour-panel .ai-advice {
  padding: 12px;
  background: rgba(0, 150, 255, 0.1);
  border: 1px solid rgba(0, 150, 255, 0.3);
  border-radius: 8px;
  font-size: 13px;
}

.tour-panel .ai-advice strong {
  color: #4db8ff;
}

.tour-panel .ai-advice p {
  margin: 6px 0 0 0;
  color: #e0e0e0;
  line-height: 1.4;
}

.tour-panel .ai-advice.warning {
  background: rgba(255, 193, 7, 0.1);
  border-color: rgba(255, 193, 7, 0.3);
}

.tour-panel .ai-advice.warning strong {
  color: #ffc107;
}

/* Piggyback suggestions */
/* Hide piggyback section when empty */
.tour-panel .piggyback-list:empty,
.tour-panel .piggyback-list-header:empty {
  display: none;
}

.tour-panel .piggyback-list-header {
  margin: 8px 0 4px 0;
  font-weight: 600;
  color: #9dd6ff;
  font-size: 13px;
}

.tour-panel .piggyback-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tour-panel .piggyback-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px;
  background: rgba(0, 150, 255, 0.08);
  border: 1px solid rgba(0, 150, 255, 0.25);
  border-radius: 8px;
}

.tour-panel .piggyback-pill {
  background: #1a6fb5;
  color: #e9f5ff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.tour-panel .piggyback-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tour-panel .piggyback-name {
  color: #eaf6ff;
  font-weight: 700;
  font-size: 14px;
}

.tour-panel .piggyback-reason {
  color: #cfe9ff;
  font-size: 12px;
  line-height: 1.3;
}

.tour-panel .piggyback-meta {
  color: #9ccaf2;
  font-size: 12px;
}

.tour-panel .piggyback-open {
  background: rgba(0, 150, 255, 0.15);
  border: 1px solid rgba(0, 150, 255, 0.4);
  color: #d9f0ff;
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.tour-panel .piggyback-open:hover {
  background: rgba(0, 150, 255, 0.25);
  transform: translateY(-1px);
}

/* Piggyback items inside day cards */
.tour-panel .piggyback-divider {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0, 150, 255, 0.3);
  font-size: 11px;
  color: #7ac4ff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tour-panel .day-piggyback-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin-top: 6px;
  background: rgba(0, 120, 220, 0.12);
  border: 1px dashed rgba(0, 150, 255, 0.4);
  border-radius: 6px;
  color: #b8e0ff;
}

.tour-panel .day-piggyback-item .piggyback-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: #9dd6ff;
}

.tour-panel .day-piggyback-item .piggyback-actions {
  display: flex;
  gap: 6px;
}

.tour-panel .day-piggyback-item .piggyback-preview,
.tour-panel .day-piggyback-item .piggyback-add {
  background: rgba(0, 150, 255, 0.15);
  border: 1px solid rgba(0, 150, 255, 0.4);
  color: #d9f0ff;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tour-panel .day-piggyback-item .piggyback-preview:hover {
  background: rgba(0, 150, 255, 0.25);
}

.tour-panel .day-piggyback-item .piggyback-add {
  background: rgba(0, 100, 200, 0.15);
  border-color: rgba(100, 150, 255, 0.4);
  color: #a8d8ff;
  font-weight: 700;
}

.tour-panel .day-piggyback-item .piggyback-add:hover {
  background: rgba(0, 100, 200, 0.3);
}

.tour-panel .day-piggyback-item .piggyback-preview svg {
  stroke: currentColor;
}

/* Map Section */
.tour-panel .map-section .day-selector-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.tour-panel .draw-route-btn {
  flex: 1;
  padding: 12px 18px;
  background: rgba(68, 68, 68, 0.3);
  border: 1px solid rgba(128, 128, 128, 0.4);
  border-radius: 8px;
  color: var(--text-primary, #e0e0e0);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0 10px rgba(128, 128, 128, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tour-panel .draw-route-btn:hover {
  background: rgba(80, 80, 80, 0.4);
  box-shadow: 0 0 8px rgba(128, 128, 128, 0.3);
  transform: scale(1.02);
}

/* Clear route button (danger variant) */
.tour-panel #clear-route-btn {
  width: 100%;
  margin-top: 8px;
  background: rgba(68, 68, 68, 0.3);
  border: 1px solid rgba(128, 128, 128, 0.4);
  color: var(--text-primary, #e0e0e0);
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  box-shadow: 0 0 10px rgba(128, 128, 128, 0.3);
  transition: all 0.3s ease;
}

.tour-panel #clear-route-btn:hover {
  background: rgba(80, 80, 80, 0.4);
  box-shadow: 0 0 8px rgba(128, 128, 128, 0.3);
  transform: scale(1.02);
}

/* ── Next-step glow: pulses the dropdown or Show Route button ─────────────── */
@keyframes glowNextStep {
  0%, 100% {
    box-shadow: 0 0 6px rgba(77,184,255,0.45), 0 0 0 1px rgba(77,184,255,0.25);
    border-color: rgba(77,184,255,0.6);
  }
  50% {
    box-shadow: 0 0 16px rgba(77,184,255,0.85), 0 0 0 2px rgba(77,184,255,0.5);
    border-color: rgba(77,184,255,1);
  }
}

.tour-panel .route-select.glow-next-step {
  animation: glowNextStep 1.6s ease-in-out infinite;
  border-color: rgba(77,184,255,0.6) !important;
}

.tour-panel .draw-route-btn.glow-next-step {
  animation: glowNextStep 1.6s ease-in-out infinite;
  border-color: rgba(77,184,255,0.7) !important;
  background: rgba(77,184,255,0.12) !important;
}

/* ── Floating route-time HUD (top-right of map, below chips) ──────────────── */
#route-time-hud {
  position: fixed;
  top: 140px;
  right: 12px;
  z-index: 190;
  background: rgba(12,12,12,0.88);
  border: 1px solid rgba(77,184,255,0.35);
  border-radius: 12px;
  padding: 10px 14px;
  min-width: 90px;
  font-size: 13px;
  font-weight: 600;
  color: #e0e0e0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 14px rgba(0,0,0,0.55);
  pointer-events: auto;
  cursor: pointer;
  white-space: normal;
  display: none;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  transition: opacity 0.25s ease, box-shadow 0.2s ease;
}

#route-time-hud:hover,
#route-time-hud:active {
  box-shadow: 0 2px 18px rgba(77,184,255,0.35);
  border-color: rgba(77,184,255,0.65);
}

#route-time-hud.visible {
  display: flex;
}

/* Close (×) button — inline with km on the bottom line */
#route-time-hud .hud-close {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.5);
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  margin-left: 10px;
}

#route-time-hud .hud-close:hover,
#route-time-hud .hud-close:active {
  background: rgba(220,60,60,0.35);
  border-color: rgba(220,60,60,0.55);
  color: #fff;
}

/* Each mode row inside the HUD — column: icon+time on top, km+× on bottom */
#route-time-hud .hud-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.3;
}

#route-time-hud .hud-row .hud-top {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
}

#route-time-hud .hud-row .hud-bottom {
  display: flex;
  align-items: center;
  gap: 0;
}

#route-time-hud .hud-row .hud-dist {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255,255,255,0.5);
}

#route-time-hud .hud-divider {
  height: 1px;
  background: rgba(255,255,255,0.12);
  margin: 0 -4px;
}

/* Responsive */
@media (max-width: 768px) {
  .tour-panel {
    width: 100%;
    max-width: 400px;
    height: calc(100dvh - 20px);
    max-height: calc(100dvh - 20px);
  }

  .tour-icon {
    width: 38px;
    height: 38px;
  }

  .tour-panel .days-setup {
    flex-direction: column;
    align-items: stretch;
  }
  
  .tour-panel .auto-organize-btn {
    width: 100%;
  }
}
/* ============================================ */
/* Save & Share Section Styles */
/* ============================================ */

.tour-panel .save-share-section {
  margin-top: 12px;
}

.tour-panel .save-share-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tour-panel #tour-name-input {
  width: 100%;
  padding: 12px;
  background: rgba(26, 26, 26, 0.9);
  border: 1px solid rgba(128, 128, 128, 0.3);
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 14px;
  transition: all 0.3s ease;
}

.tour-panel #tour-name-input:focus {
  outline: none;
  border-color: rgba(128, 128, 128, 0.5);
  box-shadow: 0 0 8px rgba(128, 128, 128, 0.3);
}

.tour-panel #tour-name-input::placeholder {
  color: rgba(224, 224, 224, 0.4);
}

.tour-panel .button-row {
  display: flex;
  gap: 8px;
}

.tour-panel .save-tour-btn,
.tour-panel .share-tour-btn {
  flex: 1;
  padding: 12px 18px;
  background: rgba(68, 68, 68, 0.3);
  border: 1px solid rgba(128, 128, 128, 0.4);
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0 10px rgba(128, 128, 128, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tour-panel .save-tour-btn:hover,
.tour-panel .share-tour-btn:hover {
  background: rgba(80, 80, 80, 0.4);
  box-shadow: 0 0 15px rgba(128, 128, 128, 0.4);
  transform: scale(1.02);
}

.tour-panel .save-tour-btn:disabled,
.tour-panel .share-tour-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.tour-panel #share-link-container {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: rgba(26, 26, 26, 0.9);
  border-radius: 8px;
  border: 1px solid rgba(128, 128, 128, 0.3);
}

.tour-panel #share-link-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #e0e0e0;
  font-size: 12px;
  padding: 4px;
  outline: none;
}

.tour-panel .copy-link-btn {
  padding: 8px 12px;
  background: rgba(68, 68, 68, 0.5);
  border: 1px solid rgba(255, 0, 0, 0.3);
  border-radius: 6px;
  color: #e0e0e0;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.tour-panel .copy-link-btn:hover {
  background: rgba(80, 80, 80, 0.6);
  box-shadow: 0 0 8px rgba(255, 0, 0, 0.3);
}

/* ============================================ */
/* Saved Routes Section Styles */
/* ============================================ */

.tour-panel .saved-routes-section {
  margin-top: 12px;
}

.tour-panel .saved-routes-list {
  max-height: 300px;
  overflow-y: auto;
}

.tour-panel .no-saved-routes {
  text-align: center;
  color: rgba(224, 224, 224, 0.5);
  font-style: italic;
  padding: 20px;
  margin: 0;
}

.tour-panel .saved-route-card {
  background: rgba(26, 26, 26, 0.9);
  border: 1px solid rgba(255, 0, 0, 0.2);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  transition: all 0.3s ease;
}

.tour-panel .saved-route-card:hover {
  border-color: rgba(255, 0, 0, 0.4);
  box-shadow: 0 0 8px rgba(255, 0, 0, 0.3);
}

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

.tour-panel .route-card-header strong {
  color: #e0e0e0;
  font-size: 14px;
}

.tour-panel .route-poi-count {
  color: rgba(224, 224, 224, 0.6);
  font-size: 12px;
}

.tour-panel .route-card-actions {
  display: flex;
  gap: 6px;
}

.tour-panel .load-route-btn,
.tour-panel .share-route-btn,
.tour-panel .delete-route-btn {
  padding: 6px 12px;
  background: rgba(68, 68, 68, 0.3);
  border: 1px solid rgba(255, 0, 0, 0.2);
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tour-panel .load-route-btn {
  flex: 1;
}

.tour-panel .load-route-btn:hover,
.tour-panel .share-route-btn:hover {
  background: rgba(80, 80, 80, 0.4);
  box-shadow: 0 0 6px rgba(255, 0, 0, 0.3);
}

.tour-panel .delete-route-btn:hover {
  background: rgba(255, 0, 0, 0.2);
  border-color: rgba(255, 0, 0, 0.5);
  box-shadow: 0 0 8px rgba(255, 0, 0, 0.4);
}

/* Notification styles */
.tour-notification {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}
