/* /fr/mapping/assets/mapping.css */
:root {
    --map-bg:        #0d1117;
    --map-paper:     #1a212c;
    --map-grid:      rgba(232, 226, 210, 0.06);
    --map-grid-bold: rgba(232, 226, 210, 0.14);
    --map-floor:     #2a3340;
    --map-floor-ghost: #1f2632;
    --map-wall:      #e6e1d4;
    --map-door:      #c08a4a;
    --map-accent:    #c08a4a;
    --map-erase:     #d04a4a;
    --map-ink:       #d8d4c8;
    --map-ink-dim:   #7a7468;
    --map-panel:     #11161e;
    --map-panel-2:   #1a212c;
    --map-stroke:    rgba(232, 226, 210, 0.10);
    --map-stroke-2:  rgba(232, 226, 210, 0.20);

    --map-bar-h:     44px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--map-bg);
    color: var(--map-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 13px;
    overflow: hidden;
    overscroll-behavior: none;
}

body.map-app {
    display: grid;
    grid-template-rows: var(--map-bar-h) 1fr var(--map-bar-h);
    height: 100vh;
}

/* ── top + bottom bars ───────────────────────────────────────────────── */
.map-topbar,
.map-bottombar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    background: var(--map-panel);
    border-bottom: 1px solid var(--map-stroke);
    user-select: none;
}

.map-bottombar {
    border-bottom: none;
    border-top: 1px solid var(--map-stroke);
    justify-content: flex-start;
    gap: 16px;
}

.map-toolgroup,
.map-actions,
.map-mapbar,
.map-levelbar {
    display: flex;
    align-items: center;
    gap: 4px;
}

.map-toolgroup-aux {
    border-left: 1px solid var(--map-stroke);
    padding-left: 12px;
    margin-left: 4px;
}

.map-levelbar {
    border-left: 1px solid var(--map-stroke);
    padding-left: 12px;
    margin-left: 4px;
    gap: 6px;
}

.map-mapbar {
    margin-left: auto;
    gap: 6px;
}

.map-chip-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--map-ink-dim);
}

.map-title {
    margin-left: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: var(--map-ink-dim);
    letter-spacing: 0.04em;
    text-decoration: none;
    transition: color 80ms ease;
}

a.map-title:hover {
    color: var(--map-ink);
}

.map-zoom {
    margin-left: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: var(--map-ink-dim);
    min-width: 4ch;
    text-align: right;
}

/* ── tool & action buttons ───────────────────────────────────────────── */
.map-tool,
.map-toggle,
.map-btn {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: var(--map-ink);
    font: inherit;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1;
    transition: background 80ms ease, border-color 80ms ease, color 80ms ease;
}

.map-tool:hover,
.map-toggle:hover,
.map-btn:hover {
    background: var(--map-panel-2);
}

.map-tool:focus-visible,
.map-toggle:focus-visible,
.map-btn:focus-visible {
    outline: 1px solid var(--map-accent);
    outline-offset: 1px;
}

.map-tool.is-active,
.map-toggle.is-on {
    background: var(--map-panel-2);
    border-color: var(--map-accent);
    color: #f4efe2;
}

.map-tool-key {
    display: inline-grid;
    place-items: center;
    min-width: 16px;
    height: 16px;
    padding: 0 3px;
    border-radius: 3px;
    background: rgba(232, 226, 210, 0.06);
    color: var(--map-ink-dim);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 10px;
    line-height: 1;
}

.map-tool.is-active .map-tool-key,
.map-toggle.is-on .map-tool-key {
    color: var(--map-accent);
}

.map-btn-danger:hover {
    background: #2a1418;
    border-color: rgba(192, 138, 74, 0.3);
}

.map-btn-icon {
    padding: 6px 8px;
    min-width: 28px;
    justify-content: center;
}

.map-btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

/* ── select dropdowns (map + level) ──────────────────────────────────── */
.map-select {
    appearance: none;
    background: var(--map-panel-2);
    color: var(--map-ink);
    border: 1px solid var(--map-stroke);
    border-radius: 4px;
    padding: 5px 8px;
    font: inherit;
    min-width: 140px;
    cursor: pointer;
}

.map-select:focus-visible {
    outline: 1px solid var(--map-accent);
    outline-offset: 1px;
}

.map-select-level {
    min-width: 120px;
}

/* ── canvas stage ────────────────────────────────────────────────────── */
.map-stage {
    position: relative;
    overflow: hidden;
    background: var(--map-bg);
}

#map-canvas,
#map-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

#map-canvas {
    cursor: crosshair;
    touch-action: none;
}

#map-svg {
    pointer-events: none;
}

#map-canvas.is-pan { cursor: grab; }
#map-canvas.is-panning { cursor: grabbing; }
#map-canvas.is-erase { cursor: cell; }
#map-canvas.is-text  { cursor: text; }

/* ── right-side panel (Levels / Rooms / Display) ────────────────────── */
.map-panel {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 260px;
    max-height: calc(100% - 24px);
    overflow-y: auto;
    background: var(--map-panel);
    border: 1px solid var(--map-stroke);
    border-radius: 6px;
    user-select: none;
    box-shadow: 0 6px 16px rgba(0,0,0,0.35);
    z-index: 5;
}

.map-panel-section + .map-panel-section {
    border-top: 1px solid var(--map-stroke);
}

.map-panel-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 10px 12px 4px;
}

.map-panel-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--map-ink);
}

.map-panel-subtitle {
    font-size: 11px;
    color: var(--map-ink-dim);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.map-panel-body {
    padding: 4px 12px 12px;
}

.map-panel-empty {
    margin: 4px 0;
    color: var(--map-ink-dim);
    font-size: 12px;
    line-height: 1.4;
}

/* ── levels list ─────────────────────────────────────────────────────── */
.map-level-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.map-level-list,
.map-room-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.map-level-row,
.map-room-row {
    display: grid;
    grid-template-columns: 22px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
}

.map-level-row:hover,
.map-room-row:hover {
    background: var(--map-panel-2);
}

.map-level-row.is-active,
.map-room-row.is-selected {
    background: var(--map-panel-2);
    border: 1px solid var(--map-accent);
    padding: 3px 5px;
}

.map-level-eye,
.map-room-eye {
    appearance: none;
    border: 1px solid var(--map-stroke);
    background: transparent;
    color: var(--map-ink-dim);
    width: 22px;
    height: 22px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    display: grid;
    place-items: center;
}

.map-level-eye.is-on,
.map-room-eye.is-on {
    color: var(--map-accent);
    border-color: var(--map-stroke-2);
}

.map-level-name,
.map-room-name {
    color: var(--map-ink);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.map-level-elev {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: var(--map-ink-dim);
    font-size: 11px;
}

.map-room-shapes {
    color: var(--map-ink-dim);
    font-size: 11px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ── display channels ────────────────────────────────────────────────── */
.map-display-row {
    display: grid;
    grid-template-columns: 22px 1fr 80px;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}

.map-display-eye {
    appearance: none;
    border: 1px solid var(--map-stroke);
    background: transparent;
    color: var(--map-ink-dim);
    width: 22px;
    height: 22px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    line-height: 1;
    display: grid;
    place-items: center;
}

.map-display-eye.is-on {
    color: var(--map-accent);
    border-color: var(--map-stroke-2);
}

.map-display-name {
    color: var(--map-ink);
}

.map-display-opacity {
    width: 100%;
    accent-color: var(--map-accent);
}

/* ── label edit input ────────────────────────────────────────────────── */
.map-label-edit {
    position: absolute;
    z-index: 6;
    pointer-events: auto;
}

.map-label-edit input {
    appearance: none;
    background: rgba(13, 17, 23, 0.92);
    color: var(--map-ink);
    border: 1px solid var(--map-accent);
    border-radius: 3px;
    padding: 3px 6px;
    font: inherit;
    min-width: 100px;
    outline: none;
}

/* ── hint ────────────────────────────────────────────────────────────── */
.map-hint {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--map-ink-dim);
    font-size: 11px;
    pointer-events: none;
    background: rgba(13, 17, 23, 0.7);
    padding: 4px 10px;
    border-radius: 99px;
    border: 1px solid var(--map-stroke);
    white-space: nowrap;
    transition: opacity 200ms ease;
    z-index: 4;
}

.map-hint.is-hidden {
    opacity: 0;
}

/* ── narrow viewport ─────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .map-tool span:not(.map-tool-key),
    .map-toggle span:not(.map-tool-key) {
        display: none;
    }
    .map-btn { padding: 6px 8px; }
    .map-title { display: none; }
    .map-select { min-width: 100px; }
    .map-select-level { min-width: 90px; }
    .map-chip-label { display: none; }
    .map-panel { width: 240px; }
}
