/* CONTROLLI MAPPA DESKTOP - COMPATTI */
.map-controls {
    position: absolute;
    bottom: 15px;
    left: 15px;
    display: flex;
    gap: 10px;
    align-items: flex-end;
    z-index: 300;
}

/* Controlli principali (Zoom + Home) */
.main-controls {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px;
    border-radius: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(5px);
}






/* Controlli di navigazione */
.navigation-controls {
    display: grid;
    grid-template-areas:
        ". up ."
        "left center right"
        ". down .";
    gap: 5px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
}

.nav-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 2px solid #e74c3c;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 16px;
    color: #2c3e50;
    font-weight: bold;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: #e74c3c;
    color: white;
    transform: scale(1.1);
}

.nav-btn:active {
    transform: scale(0.95);
}

#nav-up { grid-area: up; }
#nav-down { grid-area: down; }
#nav-left { grid-area: left; }
#nav-right { grid-area: right; }

/* Centro (spazio vuoto) */
.nav-center {
    grid-area: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(52, 152, 219, 0.1);
    border: 2px dashed #3498db;
}




/* RIQUADRO INFO FISSO */
.fixed-info-box {
    position: absolute;
    top: 240px; /* Parzialmente sovrapposto al header */
    left: 740px;
    right: 20px;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 250;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.02);
    overflow: hidden;
    max-width: 400px;
    display: block;
}

.fixed-info-box-mobile {
        top: 60px;
        left: 10px;
        right: 10px;
        max-width: none;
        display: none;
    }

.info-header {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 12px 15px;
    border-radius: 15px 15px 0 0;
}

.info-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.info-content {
    padding: 15px;
}

.no-selection {
    color: #7f8c8d;
    font-style: italic;
    text-align: center;
    margin: 0;
    padding: 10px 0;
}

.room-info {
    margin-top: 5px;
}

.room-name {
    color: #2c3e50;
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    font-weight: 600;
    border-bottom: 2px solid #3498db;
    padding-bottom: 5px;
}

.room-details p {
    margin: 5px 0;
    font-size: 0.9rem;
    color: #34495e;
}

.room-details strong {
    color: #2c3e50;
}

/* Responsive per il riquadro info */
@media (max-width: 768px) {
    .fixed-info-box {
        top: 60px;
        left: 10px;
        right: 10px;
        max-width: none;
        display: none;
    }

    .fixed-info-box-mobile {
        top: 60px;
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .info-header h3 {
        font-size: 0.9rem;
    }
    
    .info-content {
        padding: 12px;
    }
    
    .room-name {
        font-size: 1rem;
    }
    
    .room-details p {
        font-size: 0.85rem;
    }
}

#map-2d-container-secondo {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: grab;
    overflow: hidden;
}

#map-2d-secondo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    user-select: none;
    cursor: inherit;
    position: relative; /* CRUCIALE: Permette il posizionamento % dei figli */
}




.mobile-only-message {
    display: none;
}

/* Migliora il panning per desktop */
#map-2d-container, #map-2d-container-secondo {
    cursor: grab;
}

#map-2d-container:active, #map-2d-container-secondo:active {
    cursor: grabbing;
}

/* ===== CONTROLLI MOBILE CON JOYSTICK ===== */
.map-controls-mobile {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 10px 0;
    padding: 12px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Controlli Zoom Mobile */
.mobile-zoom-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-control-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: white;
    border: 2px solid #3498db;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 16px;
    color: #2c3e50;
    transition: all 0.2s ease;
}

.mobile-control-btn:active {
    background: #3498db;
    color: white;
    transform: scale(0.95);
}

/* Joystick */
.joystick-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.joystick {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #e74c3c;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    touch-action: none;
}

.joystick-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(231, 76, 60, 0.3);
    border: 1px solid #e74c3c;
}

.joystick-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e74c3c;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s ease;
    touch-action: none;
}

/* Joystick attivo */
.joystick.active {
    background: rgba(255, 255, 255, 1);
    border-color: #c0392b;
}

.joystick-handle.active {
    background: #c0392b;
    transform: translate(-50%, -50%) scale(1.1);
}

/* Mobile-only per mappa mobile */
@media (max-width: 768px) {
    .map-controls {
        display: none !important;
    }
    
    .fixed-info-box {
        display: none !important;
    }
    
    .map-controls-mobile {
        display: flex;
    }
    
    /* Migliora la mappa per mobile */
    .map-content {
        height: 60vh !important;
        touch-action: pan-x pan-y;
    }
}

/* Desktop-only per mappa desktop */
@media (min-width: 769px) {
    .map-controls-mobile {
        display: none !important;
    }
}


/* INFO BOX MOBILE NEL CONTROLLO */
.mobile-info-box {
    flex: 1;
    margin: 0 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-height: 120px;
    overflow-y: auto;
    text-align: center;
}

.mobile-info-box .no-selection-mobile {
    margin: 0;
    color: #7f8c8d;
    font-style: italic;
    font-size: 0.9rem;
}

.mobile-info-box .room-info-mobile h4 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 5px;
}

.mobile-info-box .room-details-mobile p {
    margin: 4px 0;
    font-size: 0.8rem;
    color: #34495e;
}

.mobile-info-box .room-details-mobile strong {
    color: #2c3e50;
}
