/* mapstudio.css - the Map Studio page (/maps, /datastudio/map).
   App-page layout (fills wf-main): left rail + map canvas. Theme-tokenized. */

.map-studio {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.map-studio__rail {
    width: 340px;
    flex: 0 0 340px;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem;
    border-right: 1px solid var(--theme-border, #dfe3e8);
    background: var(--theme-surface, #fff);
}

.map-studio__title {
    font-size: 1.1rem;
    margin: 0 0 0.15rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.map-studio__sub {
    font-size: 0.8rem;
    color: var(--theme-text-muted, #6b7280);
    margin: 0 0 1rem;
}

.map-studio__group {
    margin-bottom: 1.1rem;
}

.map-studio__label {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--theme-text-muted, #6b7280);
    margin-bottom: 0.4rem;
}

.map-studio__seg {
    display: flex;
    gap: 0;
    margin-bottom: 0.6rem;
    border: 1px solid var(--theme-border, #dfe3e8);
    border-radius: var(--theme-radius-button, 6px);
    overflow: hidden;
}

.map-studio__seg-btn {
    flex: 1;
    padding: 0.35rem 0.5rem;
    border: 0;
    background: var(--theme-surface, #fff);
    color: var(--theme-text, #1f2937);
    font-size: 0.8rem;
    cursor: pointer;
}

.map-studio__seg-btn--active {
    background: var(--theme-primary, #2f6fe0);
    color: var(--theme-on-primary, #fff);
    font-weight: 600;
}

.map-studio__mb { margin-bottom: 0.4rem; }

.map-studio__check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
    font-size: 0.82rem;
}

.map-studio__rule {
    display: flex;
    gap: 0.3rem;
    align-items: center;
    margin-bottom: 0.4rem;
}

.map-studio__rule .form-control { flex: 1; min-width: 0; }

.map-studio__actions {
    display: flex;
    gap: 0.5rem;
    margin: 0.5rem 0 1.2rem;
}

.map-studio__hint {
    font-size: 0.78rem;
    color: var(--theme-text-muted, #6b7280);
    margin: 0.2rem 0 0;
}

.map-studio__shortcuts {
    list-style: none;
    padding: 0;
    margin: 0.4rem 0 0;
}

.map-studio__shortcuts li {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.25rem;
}

.map-studio__shortcut-load {
    flex: 1;
    text-align: left;
    border: 1px solid var(--theme-border, #dfe3e8);
    background: var(--theme-surface-2, #f6f8fa);
    color: var(--theme-text, #1f2937);
    border-radius: var(--theme-radius-button, 6px);
    padding: 0.3rem 0.5rem;
    font-size: 0.82rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.map-studio__shortcut-load:hover { border-color: var(--theme-primary, #2f6fe0); }

.map-studio__poi-brands {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
}

.map-studio__poi-brands .btn { flex: 1; }

.map-studio__pick-active {
    background: var(--theme-primary, #2f6fe0) !important;
    color: var(--theme-on-primary, #fff) !important;
}

.map-studio__dir {
    margin-top: 0.5rem;
    border-top: 1px solid var(--theme-border, #dfe3e8);
    padding-top: 0.5rem;
}

.map-studio__dir-summary {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

.map-studio__dir-actions {
    display: flex;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
}

.map-studio__dir-steps {
    margin: 0;
    padding-left: 1.1rem;
    font-size: 0.8rem;
    max-height: 240px;
    overflow-y: auto;
}

.map-studio__dir-steps li {
    margin-bottom: 0.3rem;
}

.map-studio__linklike {
    border: 0;
    background: none;
    padding: 0;
    color: var(--theme-primary, #2f6fe0);
    cursor: pointer;
    font-size: inherit;
    text-decoration: underline;
}

.map-studio__main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.map-studio__stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 1rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--theme-border, #dfe3e8);
    font-size: 0.82rem;
    background: var(--theme-surface, #fff);
}

.map-studio__stat { color: var(--theme-text, #1f2937); }
.map-studio__stat--muted { color: var(--theme-text-muted, #6b7280); }
.map-studio__stat--err { color: var(--theme-danger, #c0392b); font-weight: 600; }
.map-studio__stat--warn { color: var(--theme-warning, #b8860b); cursor: help; }

.map-studio__canvas {
    flex: 1;
    min-height: 0;
    position: relative;
}

.map-studio__canvas .wf-map { height: 100%; border-radius: 0; }

/* ---- Dispatch Map ---- */

.dispatch {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.dispatch__panel {
    width: 360px;
    flex: 0 0 360px;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--theme-border, #dfe3e8);
    background: var(--theme-surface, #fff);
}

.dispatch__head {
    padding: 1rem 1rem 0.5rem;
}

.dispatch__title {
    font-size: 1.1rem;
    margin: 0 0 0.15rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.dispatch__sub {
    font-size: 0.8rem;
    color: var(--theme-text-muted, #6b7280);
    margin: 0;
}

.dispatch__config {
    padding: 0.25rem 1rem 0.75rem;
    border-bottom: 1px solid var(--theme-border, #dfe3e8);
}

.dispatch__refresh {
    width: 100%;
}

.dispatch__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--theme-border, #dfe3e8);
}

.dispatch__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border: 1px solid var(--theme-border, #dfe3e8);
    border-radius: 999px;
    background: var(--theme-surface, #fff);
    color: var(--theme-text, #1f2937);
    font-size: 0.78rem;
    cursor: pointer;
}

.dispatch__chip--active {
    background: var(--theme-primary, #2f6fe0);
    color: var(--theme-on-primary, #fff);
    border-color: var(--theme-primary, #2f6fe0);
}

.dispatch__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    flex: 0 0 auto;
}

.dispatch__list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.5rem;
}

.dispatch__job {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.6rem;
    border-radius: var(--theme-radius-md, 8px);
    cursor: pointer;
}

.dispatch__job:hover {
    background: var(--theme-surface-2, #f6f8fa);
}

.dispatch__job-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.dispatch__job-label {
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dispatch__job-status {
    font-size: 0.75rem;
    color: var(--theme-text-muted, #6b7280);
}

.dispatch__job-dir {
    color: var(--theme-primary, #2f6fe0);
    padding: 0.25rem 0.4rem;
    flex: 0 0 auto;
}

.dispatch__map {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dispatch__canvas {
    flex: 1;
    min-height: 0;
    position: relative;
}

.dispatch__canvas .wf-map {
    height: 100%;
    border-radius: 0;
}

/* ---- Answer Center map (/answer-center/map) ---- */

.ac-map {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.ac-map__bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--theme-border, #dfe3e8);
    background: var(--theme-surface, #fff);
}

.ac-map__back {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--theme-text-muted, #6b7280);
    text-decoration: none;
    font-size: 0.85rem;
}

.ac-map__back:hover { color: var(--theme-primary, #2f6fe0); }

.ac-map__title {
    font-size: 1.05rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ac-map__count {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--theme-text-muted, #6b7280);
}

.ac-map__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--theme-border, #dfe3e8);
    background: var(--theme-surface, #fff);
}

.ac-map__chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--theme-border, #dfe3e8);
    border-radius: 999px;
    background: var(--theme-surface, #fff);
    color: var(--theme-text, #1f2937);
    font-size: 0.78rem;
    cursor: pointer;
}

.ac-map__chip--active {
    background: var(--theme-primary, #2f6fe0);
    color: var(--theme-on-primary, #fff);
    border-color: var(--theme-primary, #2f6fe0);
}

.ac-map__canvas {
    flex: 1;
    min-height: 0;
    position: relative;
}

.ac-map__canvas .wf-map { height: 100%; border-radius: 0; }

/* Maps Center springboard - muted "coming soon" cards */
.maps-center__soon {
    opacity: 0.6;
    cursor: default;
}

.maps-center__soon-tag {
    color: var(--theme-text-muted, #6b7280) !important;
}

.map-studio__nokey {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 100%;
    color: var(--theme-text-muted, #6b7280);
    background: var(--theme-surface-2, #eef1f5);
}

/* ── Answer Map (/maps/answers) — runs + jobs plotted where they happened ── */

.ans-map {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.ans-map__rail {
    width: 340px;
    flex: 0 0 340px;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem;
    border-right: 1px solid var(--theme-border, #dfe3e8);
    background: var(--theme-surface, #fff);
}

.ans-map__canvas {
    flex: 1;
    min-width: 0;
    min-height: 0;
    position: relative;
}

.ans-map__canvas .wf-map {
    height: 100%;
    border-radius: 0;
}

.ans-map__mode {
    margin-bottom: 1rem;
}

.ans-map__stats {
    font-size: 0.82rem;
    color: var(--theme-text-muted, #6b7280);
    margin-bottom: 1rem;
}

.ans-map__chips {
    padding: 0;
    border: 0;
    flex-wrap: wrap;
}

.ans-map__wfs {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 14rem;
    overflow-y: auto;
}

.ans-map__wf {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    margin: 0;
    cursor: pointer;
}

.ans-map__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: 0 0 10px;
}

.ans-map__wf-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ans-map__wf-count {
    font-size: 0.75rem;
    color: var(--theme-text-muted, #6b7280);
}

.ans-map__locate {
    display: flex;
    gap: 0.4rem;
}

.ans-map__hint {
    font-size: 0.74rem;
    color: var(--theme-text-muted, #6b7280);
    margin-top: 0.35rem;
}

/* The story side panel — the CompanyCam-style rich rollover. */
.ans-map__panel {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    width: 340px;
    display: flex;
    flex-direction: column;
    background: var(--theme-surface, #fff);
    border: 1px solid var(--theme-border, #dfe3e8);
    border-radius: var(--theme-radius-card, 10px);
    box-shadow: var(--theme-shadow-lg, 0 12px 32px rgba(0, 0, 0, 0.18));
    z-index: 20;
    overflow: hidden;
}

.ans-map__panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.85rem 1rem 0.5rem;
}

.ans-map__panel-title {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.ans-map__panel-sub {
    font-size: 0.8rem;
    color: var(--theme-text-muted, #6b7280);
}

.ans-map__panel-close {
    border: 0;
    background: transparent;
    color: var(--theme-text-muted, #6b7280);
    cursor: pointer;
    padding: 0.15rem 0.3rem;
}

.ans-map__panel-close:hover {
    color: var(--theme-text, #111827);
}

.ans-map__panel-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    padding: 0 1rem 0.6rem;
    font-size: 0.8rem;
    color: var(--theme-text-muted, #6b7280);
    border-bottom: 1px solid var(--theme-border, #dfe3e8);
}

.ans-map__badge {
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--theme-surface-2, #eef1f5);
    color: var(--theme-text, #111827);
}

.ans-map__badge--3 {
    background: var(--theme-success-bg, #e7f6ec);
    color: var(--theme-success, #1e7e34);
}

.ans-map__badge--2 {
    background: var(--theme-info-bg, #e8f1fd);
    color: var(--theme-primary, #2f6fe0);
}

.ans-map__badge--4,
.ans-map__badge--5 {
    background: var(--theme-danger-bg, #fdecec);
    color: var(--theme-danger, #c0392b);
}

.ans-map__badge--geo {
    background: var(--theme-warning-bg, #fdf6e3);
    color: var(--theme-warning-text, #8a6d3b);
}

.ans-map__panel-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.75rem 1rem;
}

.ans-map__summary {
    font-size: 0.83rem;
    background: var(--theme-surface-2, #eef1f5);
    border-radius: var(--theme-radius-card, 10px);
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.75rem;
    white-space: pre-wrap;
}

.ans-map__photos {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
}

.ans-map__photos img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--theme-radius-button, 6px);
    border: 1px solid var(--theme-border, #dfe3e8);
    transition: transform 0.12s ease;
}

.ans-map__photos a:hover img {
    transform: scale(1.04);
}

.ans-map__panel-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.7rem 1rem;
    border-top: 1px solid var(--theme-border, #dfe3e8);
}

@media (max-width: 900px) {
    .ans-map {
        flex-direction: column;
    }

    .ans-map__rail {
        width: auto;
        flex: 0 0 auto;
        max-height: 45%;
        border-right: 0;
        border-bottom: 1px solid var(--theme-border, #dfe3e8);
    }

    .ans-map__panel {
        width: auto;
        left: 0.75rem;
    }
}
