body { margin: 0; overflow: hidden; font-family: sans-serif; background: #222; }
a { text-decoration: none; }

/* --- LAYOUT GENERALE --- */
.container { max-width: 1000px; margin: 0 auto; padding: 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 25px; }

.card { background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 4px 10px rgba(0,0,0,0.2); transition: transform 0.2s; }
.card:hover { transform: translateY(-5px); }
.card-body { padding: 15px; }

/* BOTTONI */
.btn { display: inline-block; padding: 8px 14px; border-radius: 4px; border: none; cursor: pointer; color: white; font-size: 14px; text-align: center; }
.btn-green { background: #28a745; }
.btn-blue { background: #007bff; }
.btn-red { background: #dc3545; }
.btn-gray { background: #6c757d; }

/* --- CANVAS 3D & UI OVERLAYS --- */
#canvas-container { width: 100vw; height: 100vh; display: block; position: absolute; top: 0; left: 0; z-index: 0; }

#ui-overlay { position: absolute; top: 20px; left: 20px; z-index: 20; pointer-events: none; }
#ui-overlay a, #ui-overlay button { pointer-events: auto; }
.back-btn { background: rgba(0,0,0,0.6); color: white; padding: 8px 12px; border-radius: 4px; margin-bottom: 10px; display: inline-block; backdrop-filter: blur(4px); }

/* CONTENITORE STRUMENTI (LIL-GUI) - NUOVO */
#gui-wrapper {
    position: absolute; 
    top: 10px; 
    right: 10px; 
    z-index: 4000; /* Molto alto */
}
/* Forza lil-gui ad avere dimensioni corrette */
.lil-gui { 
    --width: 280px; 
    font-size: 13px !important;
}

/* LOADING SCREEN */
#loader-container {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: #1a1a1a; z-index: 5000;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    transition: opacity 0.5s ease;
}
.loader-spinner {
    border: 5px solid #333; border-top: 5px solid #007bff; border-radius: 50%;
    width: 50px; height: 50px; animation: spin 1s linear infinite; margin-bottom: 15px;
}
.loader-text { color: white; font-family: monospace; font-size: 18px; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* TOOLBAR SEMPLICE */
#toolbar {
    position: absolute; right: 20px; top: 50%; transform: translateY(-50%);
    display: flex; flex-direction: column; gap: 10px;
    background: rgba(0,0,0,0.6); padding: 10px; border-radius: 8px;
    backdrop-filter: blur(5px); z-index: 20;
}
.tool-btn {
    background: transparent; border: 1px solid rgba(255,255,255,0.3);
    color: white; width: 40px; height: 40px; border-radius: 5px;
    cursor: pointer; font-size: 20px; display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; pointer-events: auto;
}
.tool-btn:hover { background: rgba(255,255,255,0.3); border-color: white; }

/* LISTA HOTSPOT LATERALE */
#hotspot-list-panel {
    position: absolute; left: 20px; top: 150px; /* Spostato più in basso per non coprire il titolo */
    background: rgba(255,255,255,0.95); width: 220px;
    border-radius: 8px; padding: 10px; max-height: 50vh; overflow-y: auto;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3); z-index: 20;
}
.hidden { display: none !important; }
.hs-item { padding: 10px; border-bottom: 1px solid #eee; cursor: pointer; display: flex; align-items: center; gap: 10px; font-size: 14px; }
.hs-item:hover { background: #f0f4f8; }

/* HOTSPOT 3D (Pallini) */
.hotspot-label {
    background: rgba(255, 230, 0, 0.9); border: 2px solid white; border-radius: 50%;
    width: 24px; height: 24px; text-align: center; line-height: 20px; font-weight: bold;
    cursor: pointer; font-size: 16px; color: #333;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3); transition: transform 0.2s;
    pointer-events: auto !important; z-index: 1000;
}
.hotspot-label:hover { transform: scale(1.3); background: #fff; }

/* MODALI */
.modal {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); display: flex; justify-content: center; align-items: center; z-index: 2000;
}
.modal-content {
    background: white; padding: 25px; width: 350px; border-radius: 8px;
    display: flex; flex-direction: column; gap: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.modal-content input, .modal-content textarea { padding: 10px; border: 1px solid #ddd; border-radius: 4px; width: 100%; box-sizing: border-box; }
.buttons-row { display: flex; gap: 10px; margin-top: 10px; }

/* INFO POPUP */
.info-card {
    position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%);
    width: 300px; background: white; padding: 20px; border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3); z-index: 1500; text-align: center;
}
.info-card img { width: 100%; max-height: 200px; object-fit: cover; border-radius: 6px; margin: 10px 0; }
.close-btn { position: absolute; top: 10px; right: 10px; background: none; border:none; font-size: 20px; cursor: pointer; }