/*
 * LiveMap viewer styles — brutalist monochrome.
 * Uses the site's Cinzel + Cutive Mono typography with black-on-#eee.
 */

/* ── full-viewport layout ── */

.livemap-layout {
    display: flex;
    height: calc(100vh - 80px);  /* 80px accounts for the site header */
    position: relative;
    z-index: 1;
}

.livemap-main {
    flex: 0 0 75%;
    display: flex;
    flex-direction: column;
    position: relative;
    border-right: 3px solid var(--color-border, #000);
    background: var(--color-bg, #eee);
}

.livemap-sidebar {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--color-bg, #eee);
}

/* ── toolbar ── */

.livemap-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0.75rem;
    border-bottom: 2px solid var(--color-border, #000);
    background: var(--color-bg, #eee);
    gap: 0.5rem;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.renderer-select {
    font-family: 'Cutive Mono', monospace;
    font-size: 0.8rem;
    padding: 0.3rem 0.5rem;
    border: 2px solid var(--color-border, #000);
    background: var(--color-bg, #eee);
    color: var(--color-fg, #000);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 1.5rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath d='M0 2l4 4 4-4' fill='none' stroke='%23000' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.4rem center;
}

.renderer-select:focus {
    outline: none;
    border-color: var(--color-fg, #000);
}

.coord-display {
    font-family: 'Cutive Mono', monospace;
    font-size: 0.8rem;
    color: var(--color-fg, #000);
    white-space: nowrap;
}

.coord-x, .coord-z {
    font-weight: 700;
}

.coord-sep {
    margin: 0 0.2rem;
}

/* ── map viewport ── */

.map-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    cursor: grab;
    background: var(--color-bg, #eee);
}

.map-viewport:active {
    cursor: grabbing;
}

.map-viewport.panning {
    cursor: grabbing;
}

.map-inner {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.map-inner img {
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    -ms-interpolation-mode: nearest-neighbor;
    user-select: none;
    -webkit-user-select: none;
}

.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Cutive Mono', monospace;
    font-size: 0.9rem;
    color: var(--color-muted, #333);
    background: var(--color-bg, #eee);
    border: 2px solid var(--color-border, #000);
    padding: 0.5rem 1rem;
}

.map-loading.hidden {
    display: none;
}

/* ── zoom controls ── */

.zoom-controls {
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 5;
}

.zoom-btn {
    font-family: 'Cutive Mono', monospace;
    font-size: 1.1rem;
    width: 2rem;
    height: 2rem;
    border: 2px solid var(--color-border, #000);
    background: var(--color-bg, #eee);
    color: var(--color-fg, #000);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
}

.zoom-btn:hover {
    background: var(--color-fg, #000);
    color: var(--color-bg, #eee);
}

/* ── alert blip canvas overlay ── */

.alerts-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

/* ── alert error banner ── */

.alerts-error {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid var(--color-border, #000);
    background: #fdd;
    font-family: 'Cutive Mono', monospace;
    font-size: 0.75rem;
    color: #a00;
}

.alerts-error.hidden {
    display: none;
}

.alerts-error-msg {
    flex: 1;
    word-break: break-word;
}

.alerts-error-dismiss {
    flex-shrink: 0;
    font-family: 'Cutive Mono', monospace;
    font-size: 1rem;
    line-height: 1;
    border: 1px solid #a00;
    background: none;
    color: #a00;
    cursor: pointer;
    padding: 0 0.25rem;
}

.alerts-error-dismiss:hover {
    background: #a00;
    color: #fdd;
}

/* ── alert list ── */

.alerts-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.alerts-list.hidden {
    display: none;
}

.alert-entry {
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--color-border, #000);
    font-family: 'Cutive Mono', monospace;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.1s;
}

.alert-entry:hover {
    background: #ddd;
}

.alert-entry.highlighted {
    background: #ddd;
    border-left: 3px solid #c00;
}

.alert-entry-time {
    color: var(--color-muted, #555);
    margin-bottom: 0.15rem;
}

.alert-entry-body {
    margin-bottom: 0.15rem;
}

.alert-entry-snitch {
    font-weight: 700;
}

.alert-entry-action {
    color: #c00;
}

.alert-entry-group {
    color: var(--color-muted, #555);
    font-size: 0.95rem;
}

/* ── disconnected indicator ── */

.alerts-disconnected {
    padding: 0.3rem 0.75rem;
    border-top: 2px solid var(--color-border, #000);
    font-family: 'Cutive Mono', monospace;
    font-size: 0.95rem;
    color: #960;
    background: #ffc;
    text-align: center;
}

.alerts-disconnected.hidden {
    display: none;
}

/* ── responsive ── */

@media (max-width: 768px) {
    .livemap-layout {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 80px);
    }

    .livemap-main {
        flex: 0 0 70vh;
        border-right: none;
        border-bottom: 3px solid var(--color-border, #000);
    }

    .livemap-sidebar {
        flex: 1;
        min-height: 120px;
    }

    .livemap-toolbar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.3rem;
    }
}

/* ── sanctuary toggle ── */

.sanctuary-toggle {
    font-family: 'Cutive Mono', monospace;
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
    border: 2px solid var(--color-border, #000);
    background: var(--color-bg, #eee);
    color: var(--color-fg, #000);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.sanctuary-toggle:hover {
    background: var(--color-fg, #000);
    color: var(--color-bg, #eee);
}

.sanctuary-toggle--on {
    background: var(--color-fg, #000);
    color: var(--color-bg, #eee);
}

/* ── sanctuary canvas overlay ── */

.sanctuaries-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

/* ── sanctuary tooltip ── */

.sanctuary-tooltip {
    position: absolute;
    z-index: 10;
    font-family: 'Cutive Mono', monospace;
    font-size: 0.95rem;
    background: var(--color-bg, #eee);
    border: 2px solid var(--color-border, #000);
    padding: 0.4rem 0.6rem;
    max-width: 260px;
    pointer-events: none;
    color: var(--color-fg, #000);
    overflow-wrap: break-word;
}

.sanctuary-tooltip.hidden {
    display: none;
}

.sanctuary-tooltip-name {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

.sanctuary-tooltip-size {
    color: var(--color-muted, #555);
}

/* ── neutralize dreccan base bleed ────────────────────────
   style.css now imports dreccan, whose global element rules would
   otherwise break the livemap:
   - img { max-width:100% } would clamp the 6806px map to the container,
     breaking zoom/pan (the map must render at natural size);
   - button { margin: ... } adds 8px margins to toolbar/zoom buttons,
     pushing the sanctuary toggle off-centre from the renderer select. */
.map-inner img {
    max-width: none;
}
.livemap-toolbar select {
    margin: 0;
    width: auto;
}
.livemap-toolbar button,
.zoom-btn,
.alerts-error-dismiss {
    margin: 0;
}
