/* ============================================================
   map-ui.css — Territory dialog, minimap, map canvas,
   biome legend, floating actions, menu icon bar, map overlay
   ============================================================ */

/* DIALOGO DE TERRITORIO */
#territory-dialog-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 100;
    pointer-events: none; /* Permitir cliques através do overlay */
}

#territory-dialog {
    background: rgba(10, 10, 30, 0.90);
    border: 1px solid rgba(240, 192, 64, 0.4);
    border-radius: 12px;
    padding: 15px;
    margin: 10px;
    min-width: auto;
    max-width: 280px;
    overflow-y: auto;
    box-shadow: none;
    position: fixed;
    top: 49px; /* Embaixo do player panel */
    left: 5px;
    pointer-events: auto; /* Ativar cliques no diálogo */
}

#territory-dialog-close {
    width: 30px;
    height: 30px;
}

#territory-dialog h3 {
    color: #f0c040;
    margin-bottom: 12px;
    font-size: 16px;
    padding-right: 30px;
    word-break: break-word;
    overflow-wrap: break-word;
}

.owned-badge-inline {
    background: #2d6e2d;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#territory-dialog .territory-id {
    color: #888;
    font-size: 12px;
    margin-bottom: 4px;
}

#territory-dialog .info-row {
    display: flex;
    justify-content: space-between;
    margin: 6px 0;
    font-size: 12px;
    gap: 8px;
}

#territory-dialog .info-label {
    color: #888;
    flex-shrink: 0;
}

#territory-dialog .info-value {
    color: #e0e0e0;
    font-weight: 500;
    text-align: right;
    word-break: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}

#territory-dialog .action-btn {
    white-space: normal;
}

/* MINIMAP */
#minimap {
    position: fixed;
    bottom: 10px;
    left: 10px;
    width: 200px;
    height: 140px;
    border: 1px solid rgba(240, 192, 64, 0.3);
    border-radius: 8px;
    background: rgba(10, 10, 30, 0.92);
    z-index: 10;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

#minimap.expanded {
    z-index: 150;
    border: 2px solid rgba(240, 192, 64, 0.6);
    box-shadow: 0 8px 60px rgba(0, 0, 0, 0.9);
    cursor: crosshair;
}

#minimap.expanded canvas {
    width: 100% !important;
    height: 100% !important;
}

#minimap-close {
    display: none;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 151;
    padding: 0;
    transition: opacity 0.2s;
}

#minimap-close:hover {
    opacity: 0.8;
}

#minimap.expanded #minimap-close {
    display: block;
}

#minimap-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 140;
}

#minimap-canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#minimap-viewport {
    position: absolute;
    border: 2px solid #f0c040;
    pointer-events: none;
}

/* Loading screen antigo removido - novo splash tem barra de progresso propria */

canvas#map-canvas {
    display: block;
    cursor: grab;
    touch-action: pinch-zoom pan-x pan-y; /* Permite zoom e pan APENAS no mapa */
}

canvas#map-canvas:active {
    cursor: grabbing;
}

#biome-legend {
    position: fixed;
    top: 50px;
    left: 20px;
    background: rgba(10, 10, 30, 0.92);
    border: 1px solid rgba(240, 192, 64, 0.3);
    border-radius: 8px;
    padding: 10px 15px;
    z-index: 10;
    font-size: 11px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

#biome-legend h4 {
    color: #f0c040;
    margin-bottom: 6px;
    font-size: 12px;
}

/* BOTAO FLUTUANTE DE ACOES */
#floating-actions {
    position: fixed;
    bottom: 10px;
    right: 10px;
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 8px;

}

#actions-menu {
    position: relative;
    display: inline-block;
}

#action-timer-menu {
    position: relative;
    display: inline-block;
}

.actions-toggle-btn {
    background: linear-gradient(135deg, #c09030, #f0c040);
    color: #1a1a2e;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-size: 26px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 4px 15px rgba(240, 192, 64, 0.4);
}

.actions-toggle-btn:hover {
    transform: scale(1.1);
}

.actions-toggle-btn.open {
    transform: rotate(45deg);
}

.actions-dropdown {
    position: absolute;
    bottom: 0;
    right: calc(100% + 8px);
    display: none;
    flex-direction: column;
    gap: 5px;
    background: rgba(10, 10, 30, 0.98);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(240, 192, 64, 0.4);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    min-width: 180px;
    z-index: 100;
}

.actions-dropdown.open {
    display: flex;
}

.actions-dropdown .action-btn {
    white-space: nowrap;
    width: 100%;
    text-align: center;
    padding: 10px 15px;
}

/* MENU DE ÍCONES LATERAL */
#menu-icon-bar {
    position: fixed;
    top: 52px;
    right: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 998;
}

.menu-icon-btn {
    background: rgba(240, 192, 64, 0.7);
    border: 1px solid rgba(200, 160, 48, 0.85);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    transition: background 0.15s, border-color 0.15s;
    position: relative;
}

.menu-icon-btn img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.menu-icon-btn:hover {
    background: rgba(255, 212, 84, 0.85);
    border-color: rgba(212, 170, 64, 0.95);
}

/* ================================================
   EFEITO CLAREAMENTO DO MAPA
   ================================================ */

#map-fade-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    opacity: 1;
    transition: opacity 5s ease;
    z-index: 5;
    pointer-events: none;
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
    /* Minimap mobile */
    #minimap {
        width: 120px;
        height: 85px;
        left: 10px;
        bottom: 10px;
        margin-bottom: 10px;
    }

    #minimap canvas {
        width: 120px;
        height: 85px;
    }

    #minimap.expanded canvas {
        width: 100% !important;
        height: 100% !important;
    }

    /* Botao flutuante mobile */
    #floating-actions {
        bottom: 20px;
        right: 10px;
    }

    .actions-toggle-btn {
        width: 42px;
        height: 42px;
        font-size: 22px;

    }

    /* Menu dropdown mobile */
    .actions-dropdown {
        bottom: 0;
        right: calc(100% + 8px);
        min-width: 150px;
    }

    .actions-dropdown .action-btn {
        padding: 8px 12px;
        font-size: 11px;
    }
}
