/* src/styles/world-map-popout.css — World Map floating pop-out */

.wm-overlay {
    position: fixed;
    /* Sit below the sticky nav bar (same pattern as handbook + inventory) */
    top: var(--tab-nav-h, 0px);
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(100dvh - var(--tab-nav-h, 0px));
    box-sizing: border-box;
    background: transparent;
    z-index: 950;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2vh 1vw;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.wm-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.wm-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: transparent;
    border: none;
    cursor: default;
    width: 100%;
    height: 100%;
}

.wm-panel {
    position: relative;
    background: #1a2433;
    border: 1px solid rgba(96, 165, 250, 0.28);
    border-radius: 12px;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(96, 165, 250, 0.08);
    width: min(1100px, 96vw);
    height: min(820px, calc(100dvh - var(--tab-nav-h, 0px) - 4vh));
    max-height: calc(100dvh - var(--tab-nav-h, 0px) - 4vh);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(12px) scale(0.99);
    transition: transform 0.2s ease;
}

.wm-overlay.is-open .wm-panel {
    transform: translateY(0) scale(1);
}

.wm-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.85rem;
    background: linear-gradient(90deg, rgba(30, 58, 95, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
    border-bottom: 1px solid rgba(96, 165, 250, 0.22);
    flex-shrink: 0;
}

.wm-titlebar-left {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    min-width: 0;
}

.wm-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
}

.wm-title {
    margin: 0;
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    font-weight: 700;
    color: rgba(191, 219, 254, 0.95);
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.wm-close-btn {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.8);
    color: rgba(226, 232, 240, 0.95);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.wm-close-btn:hover {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(191, 219, 254, 0.45);
}

.wm-body {
    flex: 1;
    min-height: 0;
    background: #0f172a;
}

#world-map-iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Landscape tablet */
@media (max-width: 1024px) {
    .wm-panel {
        width: 98vw;
        height: min(84dvh, calc(100dvh - var(--tab-nav-h, 0px) - 4vh));
        max-height: min(84dvh, calc(100dvh - var(--tab-nav-h, 0px) - 4vh));
    }
}

/* Portrait tablet / large phone — bottom sheet below nav (matches handbook + inventory) */
@media (max-width: 768px) {
    .wm-overlay {
        align-items: flex-end;
        padding: 0.5rem 0 0;
    }

    .wm-panel {
        width: 100vw;
        max-width: 100vw;
        border-radius: 16px 16px 0 0;
        height: 100%;
        max-height: calc(100% - env(safe-area-inset-bottom, 0px));
        transform: translateY(40px);
    }

    .wm-overlay.is-open .wm-panel {
        transform: translateY(0);
    }

    .wm-title {
        font-size: 0.9rem;
    }
}

/* Small phone */
@media (max-width: 480px) {
    .wm-overlay {
        padding-top: 0.35rem;
    }

    .wm-titlebar {
        padding: 0.5rem 0.65rem;
    }
}
