/* ==========================================================================
   Route Tab Stop-Chain, Batch Modes, Multi-Photo Strip & Autocomplete UX
   ========================================================================== */

/* Clear route button in Route tab header */
.clear-route-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(240, 90, 104, 0.4);
  background: rgba(240, 90, 104, 0.1);
  color: #ff8c97;
  font: 600 12px/1 var(--font-sans, Inter, sans-serif);
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.clear-route-btn:hover:not(:disabled) {
  background: rgba(240, 90, 104, 0.22);
  border-color: rgba(240, 90, 104, 0.7);
  color: #fff;
}

.clear-route-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* TRAVEL MODE FOR ALL LEGS collapsible batch switcher */
.batch-mode-box {
  margin: 4px 0 14px;
  padding: 6px 0 6px 12px;
  border-left: 2px solid var(--accent, #6366f1);
}

.batch-mode-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  background: transparent;
  border: 0;
  color: var(--muted, #8b94b2);
  font: 600 10.5px/1.2 var(--font-sans, Inter, sans-serif);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
}

.batch-mode-toggle:hover {
  color: var(--text, #eef1fb);
}

.batch-mode-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  margin-top: 8px;
}

/* Non-destructive legacy non-travel scene notice (P0-1) */
.legacy-scenes-banner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  margin: 0 0 12px;
  border-radius: 10px;
  background: rgba(245, 184, 46, 0.09);
  border: 1px solid rgba(245, 184, 46, 0.35);
  color: #fde3a4;
  font-size: 12px;
  line-height: 1.4;
}

.legacy-scenes-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.legacy-scenes-actions button {
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
}

/* Linear stop chain container */
.stop-chain {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 12px;
}

.stop-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 10px 10px 8px;
  overflow: visible;
  background: #232844;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, opacity 0.15s, box-shadow 0.15s;
}

.stop-card:hover {
  border-color: rgba(107, 118, 255, 0.65);
  background: #282e4e;
}

.stop-card:focus-within {
  z-index: 25;
  border-color: var(--cyan, #34e3e0);
  box-shadow: 0 0 0 1px rgba(52, 227, 224, 0.35);
  background: #262c4b;
}

.stop-card.is-draft {
  border-style: dashed;
  border-color: rgba(52, 227, 224, 0.72);
  background: rgba(52, 227, 224, 0.06);
}

.stop-card.is-draft .stop-num {
  background: rgba(99, 102, 241, 0.55);
  color: #fff;
}

.stop-card.dragging {
  opacity: 0.45;
}

.stop-card.drop-before {
  box-shadow: 0 -3px 0 var(--cyan, #34e3e0);
}

.stop-card.drop-after {
  box-shadow: 0 3px 0 var(--cyan, #34e3e0);
}

.stop-card-main {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

/* Drag handle + accessible up/down reorder buttons */
.stop-handle {
  cursor: grab;
  color: var(--muted, #8b94b2);
  font-size: 13px;
  line-height: 1;
  padding: 4px 2px;
  user-select: none;
  flex-shrink: 0;
  letter-spacing: -1px;
  opacity: 0.65;
  transition: opacity 0.15s, color 0.15s;
}

.stop-handle:hover {
  opacity: 1;
  color: #fff;
}

.stop-handle:active {
  cursor: grabbing;
}

.stop-move-btns {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
}

.stop-move-btn {
  width: 18px;
  height: 14px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted, #8b94b2);
  font-size: 9px;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background 0.12s, color 0.12s;
}

.stop-move-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.stop-move-btn:disabled {
  opacity: 0.25;
}

/* Circular numbered stop badge */
.stop-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #3b4269;
  color: #eef1fb;
  font: 700 11px/1 var(--font-mono, monospace);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.stop-card:first-child .stop-num,
.stop-card.is-active .stop-num {
  background: linear-gradient(135deg, #6b76ff, #525ef5);
  color: #fff;
}

/* Inline search / stop name input */
.stop-search {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stop-flag {
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
}

.stop-name {
  font: 600 13.5px/1.25 var(--font-sans, Inter, sans-serif);
  color: #f4f6fc;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stop-input {
  width: 100%;
  min-width: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 5px 7px;
  font: 600 13.5px/1.2 var(--font-sans, Inter, sans-serif);
  color: #f4f6fc;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.stop-input::placeholder {
  color: var(--muted, #8b94b2);
  font-weight: 400;
}

.stop-input:hover {
  background: rgba(255, 255, 255, 0.05);
}

.stop-input:focus {
  background: var(--input-bg, #131728);
  border-color: var(--accent-bright, #5e6bff);
}

.stop-coord-hint {
  font-size: 11px;
  color: var(--amber, #f5b82e);
  margin-top: 3px;
  padding-left: 34px;
}

/* Inline Rename & Remove buttons */
.stop-rename-btn,
.stop-del {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted, #8b94b2);
  font-size: 13px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.14s, color 0.14s;
}

.stop-rename-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.stop-del:hover {
  background: rgba(240, 90, 104, 0.18);
  color: #ff8a95;
}

/* Multi-Photo Row (up to 3 thumbnails + visible × remove badge + Photos button) */
.stop-photos-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding-left: 34px;
}

.stop-photo-thumb {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  overflow: visible;
  border: 1.5px solid rgba(255, 255, 255, 0.18);
  background: #131728;
  flex-shrink: 0;
}

.stop-photo-thumb img,
.stop-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.stop-photo-rm {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 50%;
  border: 1.5px solid #181c2e;
  background: #2b3250;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
  transition: background 0.14s;
}

.stop-photo-rm:hover {
  background: #e11d48;
}

.stop-photo-add,
.stop-photo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-2, #c5cde3);
  font: 500 12px/1 var(--font-sans, Inter, sans-serif);
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.stop-photo-add:hover,
.stop-photo-btn:hover {
  border-color: rgba(107, 118, 255, 0.72);
  background: rgba(99, 102, 241, 0.15);
  color: #fff;
}

.stop-photo-add.icon-only {
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: 15px;
}

.stop-photo-btn.has-media {
  border-style: solid;
  border-color: var(--cyan, #34e3e0);
}

.stop-photo-btn.loading {
  opacity: 0.5;
  pointer-events: none;
}

/* Per-leg TRAVEL MODE 6-Icon Strip between Stops (and inside Transport Leg Cards) */
.leg-modes-wrap {
  margin: 0 0 0 18px;
  padding: 8px 0 10px 16px;
  border-left: 1.5px dashed rgba(255, 255, 255, 0.16);
}

.leg-modes-label {
  font: 600 10px/1 var(--font-sans, Inter, sans-serif);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted, #8b94b2);
  margin-bottom: 6px;
}

.leg-modes {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  max-width: 286px;
}

.leg-mode-btn {
  height: 36px;
  padding: 2px;
  border-radius: 9px;
  border: 1.5px solid rgba(255, 255, 255, 0.09);
  background: #14182a;
  color: var(--text-2, #c5cde3);
  font-size: 16px;
  display: grid;
  place-items: center;
  transition: border-color 0.14s, background 0.14s, transform 0.1s;
}

.leg-mode-btn img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  display: block;
}

.leg-mode-btn:hover {
  border-color: rgba(107, 118, 255, 0.55);
  background: #1d233d;
}

.leg-mode-btn.active {
  border-color: #6b76ff;
  background: rgba(99, 102, 241, 0.24);
  box-shadow: 0 0 0 1px rgba(107, 118, 255, 0.35);
}

/* + Add stop, Guard Hint & Return to Origin */
.add-stop-btn {
  width: 100%;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text, #eef1fb);
  font: 600 13px/1 var(--font-sans, Inter, sans-serif);
  margin-top: 8px;
  transition: border-color 0.15s, background 0.15s;
}

.add-stop-btn:hover:not(:disabled) {
  border-color: var(--accent-bright, #5e6bff);
  background: rgba(99, 102, 241, 0.12);
}

.add-stop-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.add-stop-guard {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line, rgba(255, 255, 255, 0.085));
  color: var(--muted, #8b94b2);
  font-size: 12px;
  line-height: 1.35;
}

.return-origin-btn {
  width: 100%;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 8px;
  border-radius: 10px;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.085));
  background: var(--panel-2, #222740);
  color: var(--text, #eef1fb);
  font: 600 12.5px/1 var(--font-sans, Inter, sans-serif);
  transition: border-color 0.15s, background 0.15s;
}

.return-origin-btn:hover {
  border-color: rgba(107, 118, 255, 0.6);
  background: #29304f;
}

.route-extra-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}

.stop-pending-hint {
  font-size: 12px;
  color: var(--muted, #8b94b2);
  padding: 6px 10px 2px 34px;
  line-height: 1.4;
}

/* Autocomplete Dropdown (.stop-dd) with Upward Opening Support */
.stop-search .dropdown,
.stop-dd,
.dropdown {
  position: absolute;
  z-index: 60;
  top: calc(100% + 6px);
  left: -28px;
  right: -12px;
  min-width: 240px;
  background: #1b2038;
  border: 1px solid rgba(107, 118, 255, 0.42);
  border-radius: 11px;
  padding: 5px;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.62);
  max-height: 240px;
  overflow-y: auto;
}

.stop-dd.open-up,
.dropdown.open-up {
  top: auto;
  bottom: calc(100% + 6px);
  box-shadow: 0 -14px 36px rgba(0, 0, 0, 0.62);
}

.dd-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  text-align: left;
  color: var(--text, #eef1fb);
  font-size: 13px;
  transition: background 0.12s;
}

.dd-item strong,
.dd-item b {
  font-weight: 600;
}

.dd-item small {
  color: var(--muted, #8b94b2);
  font-size: 11.5px;
}

.dd-item:hover,
.dd-item.active,
.stop-dd .dd-item.active,
.stop-dd .dd-item:hover {
  background: rgba(99, 102, 241, 0.24);
}

.dd-empty {
  padding: 9px 10px;
  color: var(--muted, #8b94b2);
  font-size: 12px;
}

/* Mobile Autocomplete & Touch Sizing */
@media (max-width: 767px) {
  .stop-card {
    padding: 9px 8px;
  }

  .stop-photos-row {
    padding-left: 28px;
  }

  .stop-dd,
  .stop-search .dropdown {
    left: -24px;
    right: -8px;
    max-height: 175px;
    z-index: 75;
  }

  .leg-modes-wrap {
    margin-left: 14px;
    padding-left: 12px;
  }

  .leg-mode-btn {
    height: 38px;
  }
}
