/* Tour Route Planner — page-specific styles. Inherits vars from /css/styles.css. */

.tour-shell {
    display: grid;
    grid-template-columns: 400px 1fr;
    height: calc(100vh - 64px);
    overflow: hidden;
}

.tour-panel {
    background: var(--bg-elev);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.tour-form {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.tour-title { margin: 0 0 4px; font-size: 22px; }
.tour-sub { margin: 0 0 16px; font-size: 14px; }

.tour-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; position: relative; }
.tour-field-label { font-size: 12px; color: var(--text-muted); }
.tour-field input[type='text'], .tour-field input[type='range'] {
    width: 100%; background: var(--bg-elev-2); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 14px; outline: none;
}
.tour-field input[type='text']:focus { border-color: var(--accent); }
.tour-field input[type='range'] { padding: 0; accent-color: var(--accent); }
.tour-tip { font-size: 12px; margin: 4px 0 0; }

.autocomplete {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 10;
    background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
    list-style: none; margin: 4px 0 0; padding: 4px 0; max-height: 220px; overflow-y: auto; box-shadow: var(--shadow);
}
.autocomplete li { padding: 8px 12px; cursor: pointer; font-size: 13px; }
.autocomplete li:hover, .autocomplete li.is-active { background: var(--accent); color: #fff; }

.waypoints { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.waypoint-chip {
    display: flex; align-items: center; gap: 8px; padding: 6px 10px;
    background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px;
}
.waypoint-chip .wp-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.waypoint-chip .wp-remove {
    background: transparent; border: 0; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 2px 6px; border-radius: 999px;
}
.waypoint-chip .wp-remove:hover { background: var(--accent); color: #fff; }

.tour-go {
    width: 100%; padding: 12px; background: var(--accent); color: #fff;
    border: 0; border-radius: 999px; font-weight: 600; font-size: 15px; cursor: pointer;
    margin-top: 6px;
}
.tour-go:hover { filter: brightness(1.08); }
.tour-go:disabled { opacity: 0.5; cursor: progress; }
.tour-status { margin: 10px 0 0; font-size: 13px; min-height: 18px; }
.tour-status.is-error { color: var(--accent); }

.tour-field select[multiple] {
    width: 100%; background: var(--bg-elev-2); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 8px; font-size: 13px; outline: none;
}
.tour-field select[multiple]:focus { border-color: var(--accent); }
.tour-field-checkbox { flex-direction: row; align-items: center; gap: 8px; }
.tour-field-checkbox input[type='checkbox'] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

.tour-actions {
    display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border);
}
.tour-action-btn {
    flex: 1; min-width: 130px; padding: 8px 10px;
    background: var(--bg-elev-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.tour-action-btn:hover { background: var(--accent-2); color: #0b0b10; border-color: var(--accent-2); }
.tour-action-btn.tour-action-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.tour-action-btn.tour-action-primary:hover { filter: brightness(1.08); background: var(--accent); color: #fff; }
.tour-action-btn.is-copied { background: var(--accent-2); color: #0b0b10; border-color: var(--accent-2); }

.tour-results { flex: 1; padding: 16px 20px 32px; }

.state-strip {
    display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px;
    padding: 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.state-strip .state-strip-title { width: 100%; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.state-chip {
    padding: 4px 10px; border-radius: 999px; background: var(--bg-elev-2); border: 1px solid var(--border);
    color: var(--text); font-size: 12px; cursor: pointer; font-family: var(--font-mono);
}
.state-chip:hover, .state-chip.is-active { background: var(--accent-2); color: #0b0b10; border-color: var(--accent-2); }
.state-chip-count { color: var(--text-muted); margin-left: 4px; }
.state-chip:hover .state-chip-count, .state-chip.is-active .state-chip-count { color: #0b0b10; }

.days-list { display: flex; flex-direction: column; gap: 16px; }
.day-block { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); padding: 12px 14px; }
.day-header { display: flex; align-items: baseline; gap: 8px; margin: 0 0 8px; font-size: 14px; flex-wrap: wrap; }
.day-num { font-weight: 700; color: var(--accent); }
.day-route { font-size: 13px; flex: 1; min-width: 140px; }
.day-hours { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.day-copy {
    background: transparent; border: 1px solid var(--border); color: var(--text-muted);
    padding: 3px 8px; border-radius: 999px; font-size: 11px; cursor: pointer;
}
.day-copy:hover { background: var(--accent-2); color: #0b0b10; border-color: var(--accent-2); }
.day-copy.is-copied { background: var(--accent-2); color: #0b0b10; border-color: var(--accent-2); }

.venue-row {
    display: flex; flex-direction: column; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--border); cursor: pointer;
}
.venue-row:last-child { border-bottom: 0; }
.venue-row:hover { background: var(--bg-elev-2); }
.venue-row-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.venue-row-name { font-size: 14px; font-weight: 600; margin: 0; }
.venue-row-dist { font-size: 11px; color: var(--text-muted); white-space: nowrap; font-family: var(--font-mono); }
.venue-row-loc { font-size: 12px; color: var(--text-muted); margin: 0; }
.venue-row-chips { display: flex; gap: 4px; flex-wrap: wrap; }

.empty { padding: 32px; text-align: center; color: var(--text-muted); border: 1px dashed var(--border); border-radius: var(--radius); }

.tour-map-wrap { position: relative; }
.tour-map { width: 100%; height: 100%; background: var(--bg-elev-2); }

/* Leaflet overrides for dark theme */
.leaflet-container { background: var(--bg); font-family: var(--font-body); }
html[data-theme='light'] .leaflet-container { background: var(--bg-elev); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    background: var(--bg-elev); color: var(--text); border: 1px solid var(--border);
}
.leaflet-popup-content { margin: 12px 14px; font-size: 13px; }
.leaflet-control-attribution {
    background: rgba(0,0,0,0.6); color: var(--text); font-size: 10px;
}
.leaflet-control-attribution a { color: var(--link); }

.map-legend {
    position: absolute; bottom: 12px; right: 12px; z-index: 400;
    display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 24px);
    background: rgba(11,11,16,0.85); backdrop-filter: blur(8px);
    padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm);
}
html[data-theme='light'] .map-legend { background: rgba(248,248,251,0.92); }
.legend-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend-from { background: #2dd4bf; }
.legend-to { background: #fb7185; }
.legend-via { background: #fbbf24; }
.legend-venue { background: #818cf8; }
.legend-confirmed { background: var(--accent-2); border: 2px solid var(--accent-2); box-shadow: 0 0 0 1px var(--bg); }

.tour-marker-venue, .tour-marker-confirmed {
    border-radius: 50%; box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

/* Pitch composer modal */
.pitch-form { display: grid; gap: 10px; margin: 14px 0; }
.pitch-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.pitch-field span { color: var(--text-muted); font-size: 12px; }
.pitch-field input, .pitch-field textarea {
    background: var(--bg-elev-2); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px;
    font-size: 13px; font-family: var(--font-body); outline: none; resize: vertical;
}
.pitch-field input:focus, .pitch-field textarea:focus { border-color: var(--accent); }
.pitch-preview { margin: 14px 0; padding: 12px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.pitch-preview h3 { margin: 0 0 8px; font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.pitch-preview p { margin: 4px 0; font-size: 13px; }
.pitch-preview-body {
    margin: 8px 0 0; padding: 10px 12px;
    background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-family: var(--font-mono); font-size: 12px; line-height: 1.5; white-space: pre-wrap; max-height: 240px; overflow-y: auto;
}
.pitch-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 8px; }
.btn-secondary { background: var(--bg-elev-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--accent-2); color: #0b0b10; border-color: var(--accent-2); }
.small { font-size: 11px; }

/* Mobile — stack vertically: form ↑ map (60vh) ↓ list */
@media (max-width: 880px) {
    .tour-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto 60vh auto;
        height: auto;
    }
    .tour-panel { border-right: 0; border-bottom: 1px solid var(--border); max-height: none; }
    .tour-map-wrap { min-height: 60vh; }
    .map-legend { font-size: 10px; padding: 6px 8px; }
}
