/* ── map.css — World Map page styles ──────────────────────────────────────── */

/* Override base <main> constraints for full-bleed map layout */
main:has(.map-page-wrapper) {
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100%;
}

/* ── Page wrapper ──────────────────────────────────────────────────────────── */
.map-page-wrapper {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 60px); /* fallback; JS overrides with measured value */
    background: #1a1a1a;
    overflow: hidden;
}

/* Hide footer and back-to-top on the map page */
body.map-page footer,
body.map-page #back-to-top {
    display: none !important;
}

/* ── Map column ────────────────────────────────────────────────────────────── */
.map-column {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

#map {
    flex: 1;
    min-height: 0;
    background: #a8c4d4;
}

/* ── Era filter bar ────────────────────────────────────────────────────────── */
.era-bar {
    flex-shrink: 0;
    background: #1e1e1e;
    border-top: 1px solid #333;
    padding: 8px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* Search input */
.map-search {
    background: #141414;
    border: 1px solid #3a3a3a;
    color: #ccc;
    font-size: 0.72rem;
    font-family: var(--font-mono, monospace);
    padding: 5px 10px;
    border-radius: 3px;
    outline: none;
    width: 180px;
    transition: border-color 0.15s, background 0.15s;
}
.map-search::placeholder { color: #555; }
.map-search:focus {
    border-color: #d4a84b;
    background: #1a1a1a;
}

/* Filter section label */
.filter-label {
    font: 600 0.6rem var(--font-mono, monospace);
    color: #555;
    text-transform: uppercase;
    letter-spacing: .1em;
    white-space: nowrap;
    padding: 0 2px;
    align-self: center;
}

/* Map result count */
.map-count {
    font: 400 0.65rem var(--font-mono, monospace);
    color: #555;
    white-space: nowrap;
}

/* Divider between search and era buttons */
.era-divider {
    width: 1px;
    height: 20px;
    background: #333;
    flex-shrink: 0;
}

.era-btn {
    background: #2a2a2a;
    border: 1px solid #444;
    color: #aaa;
    padding: 5px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.72rem;
    font-family: var(--font-head, 'Courier New', monospace);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.era-btn:hover {
    background: #333;
    color: #ddd;
    border-color: #666;
}

.era-btn.active {
    background: #2d2200;
    border-color: #d4a84b;
    color: #d4a84b;
}

/* ── Category filter buttons ───────────────────────────────────────────────── */
.cat-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    color: #888;
    padding: 4px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.68rem;
    font-family: var(--font-mono, monospace);
    letter-spacing: 0.05em;
    transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
    white-space: nowrap;
}
.cat-btn:hover  { background: #333; color: #ccc; }
.cat-btn.active { background: #1c1c1c; color: #ccc; border-color: #555; opacity: 1; }
.cat-btn:not(.active) { opacity: 0.35; }

.cat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.2);
}

/* ── Content toggle (With Books/Games  ·  All Events) ────────────────────── */
.content-toggle {
    display: flex;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}
.content-toggle-btn {
    background: #1e1e1e;
    border: none;
    color: #666;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 0.72rem;
    font-family: var(--font-mono, monospace);
    letter-spacing: 0.04em;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.content-toggle-btn + .content-toggle-btn { border-left: 1px solid #3a3a3a; }
.content-toggle-btn:hover { background: #2a2a2a; color: #aaa; }
.content-toggle-btn.active {
    background: #0d1e0d;
    border-color: #4a9e4a;
    color: #6dbd6d;
}

/* ── Detail panel ──────────────────────────────────────────────────────────── */
.detail-panel {
    width: 340px;
    flex-shrink: 0;
    background: #1e1e1e;
    border-left: 1px solid #333;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Placeholder */
.detail-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    text-align: center;
    color: #666;
}

.placeholder-icon {
    font-size: 2.5rem;
    margin-bottom: 16px;
    color: #444;
}

.detail-placeholder p {
    font-size: 0.85rem;
    line-height: 1.6;
    margin: 4px 0;
}

/* Content area */
.detail-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Category color bar */
.detail-cat-bar {
    height: 4px;
    width: 100%;
    flex-shrink: 0;
}

/* Header */
.detail-header {
    padding: 14px 16px 10px;
    border-bottom: 1px solid #2a2a2a;
    position: relative;
}

.detail-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    color: #666;
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 3px;
    transition: color 0.15s, background 0.15s;
}

.detail-close:hover {
    color: #ccc;
    background: #2a2a2a;
}

.detail-category {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
    margin: 0 0 4px;
}

.detail-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #e8e8e0;
    margin: 0 0 8px;
    padding-right: 24px;
    line-height: 1.3;
}

.detail-meta {
    font-size: 0.75rem;
    color: #888;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-meta span {
    display: flex;
    gap: 6px;
}

.meta-label {
    color: #555;
    min-width: 52px;
}

/* Description */
.detail-description {
    padding: 12px 16px;
    font-size: 0.82rem;
    color: #aaa;
    line-height: 1.6;
    border-bottom: 1px solid #2a2a2a;
}

/* Section headings */
.detail-section {
    padding: 12px 16px 4px;
}

.detail-section-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #666;
    margin: 0 0 8px;
    font-weight: 600;
}

/* Book cards */
.detail-book {
    display: flex;
    gap: 10px;
    padding: 8px 16px;
    border-bottom: 1px solid #222;
    text-decoration: none;
    transition: background 0.15s;
}

.detail-book:hover {
    background: #252525;
}

.book-thumb {
    width: 36px;
    height: 52px;
    object-fit: cover;
    border-radius: 2px;
    background: #333;
    flex-shrink: 0;
}

.book-thumb-placeholder {
    width: 36px;
    height: 52px;
    background: #2a2a2a;
    border-radius: 2px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #444;
}

.book-info {
    flex: 1;
    min-width: 0;
}

.book-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-author {
    font-size: 0.72rem;
    color: #777;
    margin-top: 2px;
}

.book-year {
    font-size: 0.7rem;
    color: #555;
    margin-top: 2px;
}

/* Game cards */
.detail-game {
    display: flex;
    gap: 10px;
    padding: 8px 16px;
    border-bottom: 1px solid #222;
    text-decoration: none;
    transition: background 0.15s;
}

.detail-game:hover {
    background: #252525;
}

.game-thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 3px;
    background: #333;
    flex-shrink: 0;
}

.game-thumb-placeholder {
    width: 44px;
    height: 44px;
    background: #2a2a2a;
    border-radius: 3px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #444;
}

.game-info {
    flex: 1;
    min-width: 0;
}

.game-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.game-meta {
    font-size: 0.7rem;
    color: #666;
    margin-top: 3px;
}

.empty-note {
    padding: 6px 16px 12px;
    font-size: 0.75rem;
    color: #555;
    font-style: italic;
}

/* ── Leaflet marker overrides ──────────────────────────────────────────────── */
.map-marker {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.8);
    box-shadow: 0 1px 6px rgba(0,0,0,0.5);
    cursor: pointer;
    transition: transform 0.15s;
}

.map-marker:hover,
.map-marker.active {
    transform: scale(1.6);
    box-shadow: 0 3px 12px rgba(0,0,0,0.7);
}

/* ── Cluster overrides ─────────────────────────────────────────────────────── */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background-clip: padding-box;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    font-family: var(--font-mono, monospace);
    font-size: 0.7rem;
    font-weight: 700;
}

/* ── Category legend ───────────────────────────────────────────────────────── */
.map-legend {
    background: rgba(18, 18, 18, 0.92);
    border: 1px solid #333;
    border-radius: 3px;
    padding: 8px 10px;
    backdrop-filter: blur(4px);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-mono, monospace);
    font-size: 0.65rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 0;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.25);
}

/* ── Hover tooltip ─────────────────────────────────────────────────────────── */
.map-tooltip {
    background: rgba(14, 14, 14, 0.92) !important;
    border: 1px solid #444 !important;
    border-radius: 3px !important;
    color: #ddd !important;
    font-family: var(--font-head, sans-serif) !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    letter-spacing: 0.04em !important;
    padding: 4px 8px !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.6) !important;
    white-space: nowrap !important;
}
.map-tooltip::before {
    border-top-color: #444 !important;
}

/* ── Mobile ────────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .map-page-wrapper {
        flex-direction: column;
        height: auto;
    }

    .map-column {
        height: 55vh;
    }

    .detail-panel {
        width: 100%;
        height: 45vh;
        border-left: none;
        border-top: 1px solid #333;
    }

    .era-bar {
        padding: 6px 8px;
        gap: 4px;
    }

    .era-btn {
        font-size: 0.65rem;
        padding: 4px 8px;
    }

    .map-search {
        width: 140px;
        font-size: 0.65rem;
    }
}
