/*
 * Route editing toolbar — shared by the route page's editor and the Premium
 * route planner. Dark-theme overrides live in dark.css.
 */

/* Edit mode toolbar */
.edit-toolbar {
    position: fixed; top: 70px; left: 50%;
    transform: translateX(-50%); z-index: 10000;
    display: none;
    background: rgba(255,255,255,.95); backdrop-filter: blur(8px);
    border: 1px solid #d1d5db; border-radius: 12px;
    padding: 8px 16px; gap: 10px; align-items: center;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    font-family: Inter, system-ui, sans-serif;
    max-width: calc(100vw - 24px);
}
.edit-toolbar.active { display: flex; }
.edit-toolbar .edit-hint {
    font-size: 12px; color: #64748b; margin-right: 2px;
}
.edit-toolbar .ors-calls {
    font-size: 12px; color: #64748b; white-space: nowrap;
}
.edit-toolbar .routing-error {
    font-size: 12px; font-weight: 600; color: #dc2626; max-width: 280px;
}
/* Confirms one edit was written back. Lives in the sidebar, not the toolbar,
   which closes on save — so it is deliberately not scoped to .edit-toolbar. */
.routing-saved {
    font-size: 12px; font-weight: 600; color: #059669;
}
.edit-toolbar button {
    font-size: 13px; font-weight: 600; border-radius: 8px;
    padding: 6px 16px; border: 1px solid #d1d5db; cursor: pointer;
    transition: all .15s; display: flex; align-items: center; gap: 5px;
    background: #fff; color: #64748b; white-space: nowrap;
}
.edit-toolbar button:hover { border-color: #2563eb; color: #2563eb; }
.edit-toolbar .btn-save {
    background: #2563eb; color: #fff; border-color: #2563eb;
}
.edit-toolbar .btn-save:hover { background: #1d4ed8; }
.edit-toolbar .btn-save:disabled { background: #93c5fd; border-color: #93c5fd; cursor: not-allowed; }
.edit-toolbar .btn-cancel:hover { background: #fef2f2; color: #dc2626; border-color: #fca5a5; }
@media (max-width: 640px) {
    .edit-toolbar {
        top: auto; bottom: 12px;
        flex-wrap: wrap; justify-content: center;
        padding: 6px 10px; gap: 6px;
    }
    .edit-toolbar .edit-hint { display: none; }
    .edit-toolbar button { font-size: 12px; padding: 5px 12px; }
}
/* Routing spinner */
.routing-indicator {
    display: none; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; color: #2563eb;
}
.routing-indicator.active { display: flex; }
@keyframes edit-spin { to { transform: rotate(360deg); } }
.routing-indicator svg { animation: edit-spin .8s linear infinite; }

/* Mobile: the route page's editor takes over the whole screen. */
@media (max-width: 1023px) {
    body.route-editing, body.map-fullscreen { overflow: hidden; }
    body.route-editing #map-pane, body.map-fullscreen #map-pane {
        position: fixed; inset: 0; z-index: 9999; width: 100%;
    }
    body.route-editing #map, body.map-fullscreen #map { height: 100dvh; }
}
/* Close (X) for the full-screen editor; hidden unless editing on mobile. */
.edit-close { display: none; }
@media (max-width: 1023px) {
    body.route-editing .edit-close, body.map-fullscreen .edit-close {
        display: flex; align-items: center; justify-content: center;
        position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
        z-index: 1000; width: 40px; height: 40px; border-radius: 9999px;
        background: rgba(255,255,255,.95); color: #475569;
        border: 1px solid #d1d5db; box-shadow: 0 2px 8px rgba(0,0,0,.15);
    }
}

/* POI legend: one row per type found, click to hide/show it on the map. */
.poi-legend {
    display: flex; flex-direction: column; gap: 4px; margin-top: 8px;
    max-height: 50vh; overflow-y: auto;
}
.poi-legend-actions { display: flex; gap: 4px; }
.poi-legend-actions button {
    flex: 1; padding: 3px 6px; border-radius: 8px; cursor: pointer;
    background: rgba(255,255,255,.95); border: 1px solid #d1d5db;
    box-shadow: 0 1px 4px rgba(0,0,0,.15);
    font: 600 11px Inter, system-ui, sans-serif; color: #475569;
}
.poi-legend-actions button:hover { border-color: #2563eb; color: #2563eb; }
.poi-legend-row {
    display: flex; align-items: center; gap: 6px; width: 100%;
    padding: 4px 8px 4px 4px; border-radius: 10px; cursor: pointer;
    background: rgba(255,255,255,.95); border: 1px solid #d1d5db;
    box-shadow: 0 1px 4px rgba(0,0,0,.15);
    font: 600 12px Inter, system-ui, sans-serif; color: #334155; text-align: left;
}
.poi-legend-chip {
    width: 24px; height: 24px; flex: none; border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
}
.poi-legend-count { margin-left: auto; padding-left: 4px; font-weight: 500; color: #64748b; }
.poi-legend-row.is-off { opacity: .5; }
.poi-legend-row.is-off .poi-legend-chip { filter: grayscale(1); }
.poi-legend-row.is-off .poi-legend-label { text-decoration: line-through; }
.poi-legend-info { display: none; }
@media (max-width: 640px) {
    /* Icon + count only on phones; the (i) button shows the names, and the label
       is always in the tooltip/aria-label. */
    .poi-legend-label { display: none; }
    .poi-legend.show-labels .poi-legend-label { display: inline; }
    .poi-legend-row { padding-right: 6px; }
    .poi-legend-info {
        display: flex; align-items: center; justify-content: center; align-self: flex-start;
        width: 30px; height: 30px; border-radius: 9999px; cursor: pointer; color: #475569;
        background: rgba(255,255,255,.95); border: 1px solid #d1d5db; box-shadow: 0 1px 4px rgba(0,0,0,.15);
    }
    .poi-legend-info[aria-pressed="true"] { color: #2563eb; border-color: #2563eb; }
}

/* Expand-to-full-screen button; phones only, hidden once expanded. */
.map-fs-btn {
    display: none; width: 36px; height: 36px; align-items: center; justify-content: center;
    background: #fff; color: #475569; border: 1px solid #d1d5db; border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,.2); cursor: pointer;
}
@media (max-width: 1023px) {
    .map-fs-btn { display: flex; }
    body.map-fullscreen .map-fs-btn, body.route-editing .map-fs-btn { display: none; }
}

/* Category spinner stays visible for the whole search, not just the POST. */
.htmx-indicator.research-running { display: inline-block; opacity: 1; }
button:disabled[aria-busy="true"] { cursor: progress; }

/* Compact layer control on phones: a bike icon replaces the Cycling Routes text. */
.leaflet-control-layers .lc-icon { display: none; }
@media (max-width: 1023px) {
    .leaflet-control-layers .lc-full { display: none; }
    .leaflet-control-layers .lc-icon { display: inline-block; vertical-align: middle; }
}
