/* ============================================
   DayZ Interactive Map v1.2.0
   M1 (Minimal HUD) + PM1 (Side Drawer)
   ============================================ */

/* ── Page Layout ── */
.map-page {
    position: relative;
    height: calc(100vh - 64px);
    overflow: hidden;
    background: #050505;
    user-select: none;
    font-family: var(--font-body);
}

#mapCanvas {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    z-index: 1;
    cursor: grab;
}
#mapCanvas:active { cursor: grabbing; }

/* ── Loading overlay ── */
.map-loading {
    position: absolute; inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #050505;
    transition: opacity 0.5s ease;
}
.map-loading-inner { text-align: center; }
.map-loading-spinner {
    width: 44px; height: 44px;
    border: 3px solid var(--line-2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: mapSpin 0.8s linear infinite;
    margin: 0 auto 14px;
}
@keyframes mapSpin { to { transform: rotate(360deg); } }
.map-loading-text {
    font-family: var(--font-display);
    font-size: 0.9rem;
    color: var(--text-sub);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.map-loading-progress {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--accent-bright, var(--accent));
    margin-top: 6px;
}

/* ── Atmospheric Overlays ── */
.map-vignette {
    position: absolute; inset: 0;
    pointer-events: none;
    z-index: 8;
    background: radial-gradient(ellipse at center, transparent 45%, rgba(5,5,5,0.7) 100%);
}
.map-scanlines {
    position: absolute; inset: 0;
    pointer-events: none;
    z-index: 7;
    background: repeating-linear-gradient(
        0deg, transparent, transparent 2px,
        rgba(0,0,0,0.03) 2px, rgba(0,0,0,0.03) 4px
    );
}

/* HUD corner brackets */
.map-hud-corner {
    position: absolute;
    width: 30px; height: 30px;
    z-index: 9;
    pointer-events: none;
    border: 1px solid rgba(59,130,246,0.25);
}
.map-hud-corner.tl { top: 16px; left: 16px; border-right:none; border-bottom:none; }
.map-hud-corner.tr { top: 16px; right: 16px; border-left:none; border-bottom:none; }
.map-hud-corner.bl { bottom: 16px; left: 16px; border-right:none; border-top:none; }
.map-hud-corner.br { bottom: 16px; right: 16px; border-left:none; border-top:none; }

/* ── Map title (top-left) ── */
.map-title {
    position: absolute;
    top: 22px; left: 28px;
    z-index: 20;
    pointer-events: none;
    text-shadow: 0 2px 8px rgba(0,0,0,0.9);
}
.map-title-main {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-hi);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    line-height: 1;
}
.map-title-sub {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--accent-bright, #60a5fa);
    letter-spacing: 0.18em;
    margin-top: 4px;
    text-transform: uppercase;
}

/* ── Filter Bar (top-center) ── */
.map-filters {
    position: absolute;
    top: 18px; left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px;
    background: rgba(8,8,8,0.78);
    border: 1px solid var(--line-2);
    border-radius: 14px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    max-width: calc(100vw - 320px);
    overflow-x: auto;
    scrollbar-width: none;
}
.map-filters::-webkit-scrollbar { display: none; }
.map-filters-title {
    display: none;
}
.map-filter-btn {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--font-body);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.map-filter-btn:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-hi);
}
.map-filter-btn.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 14px rgba(59,130,246,0.35);
}
.map-filter-btn .f-icon { font-size: 0.95rem; }
.map-filter-btn .f-count {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    opacity: 0.7;
    margin-left: 2px;
}
.map-filter-btn.active .f-count { opacity: 0.9; }

/* ── Control stack (right-middle) ── */
.map-controls {
    position: absolute;
    top: 50%; right: 22px;
    transform: translateY(-50%);
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.map-ctrl-btn {
    width: 42px; height: 42px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(8,8,8,0.78);
    border: 1px solid var(--line-2);
    color: var(--text-hi);
    font-size: 1.1rem;
    font-weight: 500;
    border-radius: 11px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    position: relative;
}
.map-ctrl-btn:hover {
    background: rgba(59,130,246,0.18);
    border-color: var(--accent);
    color: var(--accent-bright, #60a5fa);
}

/* ── Coordinates (bottom-center) ── */
.map-coords {
    position: absolute;
    bottom: 22px; left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--accent-bright, #60a5fa);
    background: rgba(8,8,8,0.78);
    padding: 7px 16px;
    border-radius: 9px;
    border: 1px solid var(--line-2);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    letter-spacing: 0.06em;
}

/* ====================================================
   PM1 — Side Drawer (marker details)
   ==================================================== */
.map-drawer-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    pointer-events: none;
}
.map-drawer {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 420px;
    max-width: 92vw;
    background: rgba(10,10,10,0.92);
    border-left: 1px solid var(--line-2);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: -20px 0 60px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
}
.map-drawer.open { transform: translateX(0); }

.map-drawer-cover {
    position: relative;
    height: 220px;
    background: linear-gradient(rgba(0,0,0,0.3), rgba(10,10,10,0.95)),
                linear-gradient(135deg, #2a3530 0%, #1a2018 100%);
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    overflow: hidden;
}
.map-drawer-cover.has-image::before { display: none; }
.map-drawer-cover-icon {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    opacity: 0.18;
    pointer-events: none;
}
.map-drawer-cat {
    position: absolute;
    top: 14px; left: 14px;
    padding: 6px 12px;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.map-drawer-cat::before {
    content: '';
    width: 8px; height: 8px; border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
}
.map-drawer-close {
    position: absolute;
    top: 14px; right: 14px;
    width: 36px; height: 36px;
    border-radius: 10px;
    background: rgba(0,0,0,0.55);
    border: 1px solid var(--line-2);
    color: var(--text-hi);
    font-size: 1.25rem;
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
    z-index: 2;
}
.map-drawer-close:hover {
    background: rgba(239,68,68,0.18);
    border-color: rgba(239,68,68,0.5);
    color: #fca5a5;
}

.map-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 22px 24px;
}
.map-drawer-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-hi);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1.15;
    margin-bottom: 8px;
}
.map-drawer-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}
.map-drawer-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-dim);
}
.map-drawer-meta-item strong {
    color: var(--accent-bright, #60a5fa);
    font-weight: 500;
}
.map-drawer-desc {
    color: var(--text);
    font-size: 0.92rem;
    line-height: 1.6;
    margin-bottom: 20px;
    white-space: pre-line;
}
.map-drawer-desc:empty { display: none; }

.map-drawer-section-title {
    font-family: var(--font-display);
    font-size: 0.74rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    margin-bottom: 10px;
}
.map-drawer-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.map-drawer-detail {
    background: var(--surface, #121212);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
}
.map-drawer-detail-k {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}
.map-drawer-detail-v {
    font-family: var(--font-mono);
    color: var(--text-hi);
    font-size: 0.84rem;
    display: flex;
    align-items: center;
    gap: 6px;
}
.map-drawer-detail-v .swatch {
    width: 12px; height: 12px;
    border-radius: 3px;
    border: 1px solid var(--line-2);
    flex-shrink: 0;
}

.map-drawer-foot {
    padding: 14px 24px;
    border-top: 1px solid var(--line);
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.map-drawer-btn {
    flex: 1;
    padding: 10px 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.map-drawer-btn:hover { background: var(--accent-bright, #60a5fa); }
.map-drawer-btn:active { transform: scale(0.98); }
.map-drawer-btn.sec {
    flex: 0 0 auto;
    width: 44px;
    background: var(--surface, #121212);
    color: var(--text-hi);
    border: 1px solid var(--line-2);
}
.map-drawer-btn.sec:hover {
    background: rgba(59,130,246,0.15);
    border-color: var(--accent);
}

/* Toast for "copied" feedback */
.map-toast {
    position: absolute;
    bottom: 80px; left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 70;
    background: rgba(34,197,94,0.95);
    color: #fff;
    padding: 10px 18px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}
.map-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .map-drawer { width: 100%; max-width: 100%; }
}
@media (max-width: 768px) {
    .map-page { height: calc(100vh - 56px); }
    .map-filters { left: 12px; right: 12px; transform: none; max-width: none; padding: 4px; }
    .map-filter-btn { font-size: 0.7rem; padding: 6px 10px; }
    .map-title { top: 14px; left: 14px; }
    .map-title-main { font-size: 0.9rem; }
    .map-title-sub { font-size: 0.6rem; }
    .map-controls { right: 12px; gap: 6px; }
    .map-ctrl-btn { width: 38px; height: 38px; }
    .map-coords { bottom: 14px; font-size: 0.66rem; padding: 5px 12px; }
    .map-drawer-cover { height: 180px; }
    .map-drawer-body { padding: 18px 18px; }
    .map-drawer-title { font-size: 1.25rem; }
}
