/* WorldMap Modal - Vertical Layout */

#worldMapModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.97);
    z-index: 999999;
    overflow: hidden;
}

/* Main container - vertical split */
.worldmap-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* ========= TOP: Grid Section (~70%) ========= */
.worldmap-grid-section {
    position: relative;
    flex: 0 0 70%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
}

/* Header overlay floating on top of grid */
.worldmap-header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 8px 15px;
    z-index: 10;
    background: linear-gradient(to bottom, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.5) 70%, transparent 100%);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}

.worldmap-header-overlay > * {
    pointer-events: auto;
}

/* Grid wrapper - fills available space */
.worldmap-grid-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

#worldMapModalGrid {
    border-radius: 6px;
    box-shadow: 0 0 20px rgba(78, 205, 196, 0.15);
}

/* Minimap overlay (top-right of grid, below header) */
.worldmap-minimap-overlay {
    position: absolute;
    top: 45px;
    right: 10px;
    z-index: 10;
    border: 2px solid rgba(78, 205, 196, 0.5);
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.85;
    transition: opacity 0.2s;
    overflow: hidden;
}

.worldmap-minimap-overlay:hover {
    opacity: 1;
    border-color: rgba(78, 205, 196, 0.9);
}

/* Zoom controls (bottom-left of grid) */
.worldmap-zoom-controls {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.worldmap-zoom-btn {
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(78, 205, 196, 0.5);
    border-radius: 6px;
    color: #4ecdc4;
    font-size: 1.2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.worldmap-zoom-btn:hover {
    background: rgba(78, 205, 196, 0.2);
    border-color: #4ecdc4;
}

/* Auto-walk indicator */
#autoWalkIndicator {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid #4ecdc4;
    border-radius: 6px;
    padding: 6px 15px;
    color: #4ecdc4;
    font-size: 0.85em;
    white-space: nowrap;
}

/* ========= BOTTOM: Info Section (~30%) ========= */
.worldmap-info-section {
    flex: 0 0 30%;
    overflow-y: auto;
    padding: 10px 20px;
    border-top: 2px solid rgba(78, 205, 196, 0.3);
    position: relative;
    background: rgba(10, 15, 20, 0.95);
}

/* Close/Exit button (below minimap, top-right) */
.worldmap-close-btn {
    position: absolute;
    top: 200px;
    right: 10px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border: none;
    border-radius: 8px;
    padding: 8px 18px;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
    font-size: 0.9em;
}

.worldmap-close-btn:hover {
    background: linear-gradient(135deg, #ff5f52, #d94639);
}

/* ========= Fullscreen Map Overlay ========= */
#worldMapFullscreenMap {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000001;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#worldMapFullscreenMap .fullmap-canvas-container {
    position: relative;
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

#worldMapFullscreenMap .fullmap-controls {
    position: absolute;
    bottom: 15px;
    left: 15px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 10;
}

#worldMapFullscreenMap .fullmap-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
    font-size: 1em;
}

#worldMapFullscreenMap .fullmap-close-btn:hover {
    background: linear-gradient(135deg, #ff5f52, #d94639);
}

/* Fullscreen map tooltip */
#fullmapTooltip {
    position: absolute;
    background: rgba(0,0,0,0.9);
    border: 1px solid #4ecdc4;
    border-radius: 6px;
    padding: 8px 12px;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
    font-size: 0.85em;
}

/* ========= Mobile Responsive ========= */
/* Small viewports OR touch devices */
@media (max-width: 768px), (max-height: 700px), (pointer: coarse) {
    #worldMapModal {
        overflow-y: auto;
    }

    .worldmap-container {
        height: auto;
        min-height: 100vh;
        overflow: visible;
    }

    .worldmap-grid-section {
        flex: none;
        height: 65vh;
    }

    .worldmap-info-section {
        flex: none;
        min-height: 35vh;
    }

    .worldmap-minimap-overlay {
        width: 80px !important;
        height: 80px !important;
        top: 5px;
        right: 5px;
    }

    .worldmap-minimap-overlay canvas {
        width: 80px !important;
        height: 80px !important;
    }

    .worldmap-header-overlay {
        padding: 6px 10px;
        font-size: 0.85em;
    }

    .worldmap-zoom-controls {
        bottom: 5px;
        left: 5px;
    }

    .worldmap-zoom-btn {
        width: 28px;
        height: 28px;
        font-size: 1em;
    }

    .worldmap-close-btn {
        top: 90px;
        right: 5px;
        padding: 6px 12px;
        font-size: 0.8em;
    }
}

/* Small portrait phones */
@media (max-width: 480px) {
    .worldmap-grid-section {
        height: 55vh;
    }

    .worldmap-info-section {
        min-height: 45vh;
        padding: 10px;
    }
}

/* Landscape phones */
@media (max-height: 700px) and (orientation: landscape) {
    .worldmap-grid-section {
        height: 70vh;
    }

    .worldmap-info-section {
        min-height: 50vh;
        padding: 10px;
    }
}
