/* =========================================
   1. RESET E IMPOSTAZIONI BASE
   ========================================= */
:root {
    --primary-color: #00d4ff;       /* Blu Neon */
    --secondary-color: #005577;     /* Blu Scuro per bordi */
    --bg-panel: rgba(5, 15, 25, 0.90); /* Sfondo semi-trasparente scuro */
    --text-main: #e0f7ff;           /* Bianco ghiaccio */
    --text-muted: #88aabb;          /* Grigio azzurro per etichette */
    --accent-red: #ff4444;          /* Per errori o stop */
    --font-ui: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

body { 
    margin: 0; 
    overflow: hidden; 
    background-color: #000; 
    font-family: var(--font-ui);
    color: var(--text-main); 
    user-select: none; /* Previene la selezione del testo trascinando */
    -webkit-tap-highlight-color: transparent;
}

canvas { 
    display: block; 
    outline: none; 
}

/* =========================================
   2. PANNELLI PRINCIPALI (DASHBOARD & INFO)
   ========================================= */
#dashboard, #info-panel {
    position: absolute;
    width: 300px;
    background: var(--bg-panel);
    border: 1px solid var(--secondary-color);
    border-radius: 8px;
    padding: 15px;
    z-index: 100;
    backdrop-filter: blur(10px); /* Effetto vetro sfocato */
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8), 
                inset 0 0 0 1px rgba(0, 212, 255, 0.1); /* Sottile luce interna */
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-height: 90vh;
    overflow-y: auto;
    scrollbar-width: thin; /* Firefox */
    scrollbar-color: var(--secondary-color) #00111a;
}

/* Posizionamento Desktop */
#dashboard { 
    top: 20px; 
    left: 20px; 
    border-left: 3px solid var(--primary-color); /* Bordo sinistro evidenziato */
}

#info-panel { 
    top: 20px; 
    right: 20px; 
    border-right: 3px solid var(--primary-color); /* Bordo destro evidenziato */
}

/* =========================================
   3. TIPOGRAFIA E HEADER
   ========================================= */
h2 { 
    margin: 0 0 15px 0; 
    color: #fff; 
    font-size: 14px; 
    font-weight: 700;
    text-transform: uppercase; 
    letter-spacing: 2px;
    border-bottom: 1px solid var(--secondary-color); 
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

h2::before {
    /* Piccolo pallino decorativo prima del titolo */
    content: '';
    display: inline-block;
    width: 8px; 
    height: 8px;
    background: var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--primary-color);
}

label { 
    display: block; 
    font-size: 10px; 
    font-weight: 600;
    margin-bottom: 5px; 
    color: var(--text-muted); 
    text-transform: uppercase; 
    letter-spacing: 1px;
}

p {
    line-height: 1.6;
    font-size: 13px;
    color: #ccddee;
}

/* =========================================
   4. FORM ELEMENTS (INPUT, SELECT, BUTTONS)
   ========================================= */
.control-group { 
    margin-bottom: 15px; 
    position: relative;
}

/* Stile comune per Input e Select */
select, input[type="text"] {
    width: 100%; 
    padding: 10px 12px; 
    background: #02121c; /* Molto scuro */
    color: #fff; 
    border: 1px solid var(--secondary-color); 
    border-radius: 4px;
    font-size: 13px;
    font-family: var(--font-ui);
    outline: none;
    transition: all 0.3s ease;
}

select:hover, input[type="text"]:hover {
    border-color: #0088aa;
}

select:focus, input[type="text"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.2);
    background: #051a26;
}

/* Bottoni Standard */
button { 
    width: 100%;
    padding: 12px; 
    margin-top: 5px;
    font-size: 12px; 
    font-weight: bold; 
    text-transform: uppercase; 
    letter-spacing: 1px;
    cursor: pointer; 
    border: 1px solid var(--secondary-color);
    border-radius: 4px;
    background: linear-gradient(180deg, rgba(0, 68, 102, 0.8) 0%, rgba(0, 34, 51, 0.8) 100%);
    color: var(--primary-color);
    transition: all 0.2s ease;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

button:hover { 
    background: var(--primary-color); 
    color: #000; 
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.4);
    text-shadow: none;
}

button:active { 
    transform: translateY(1px); 
}

/* Stili specifici per i pulsanti */
button#btnVoice {
    background: transparent;
    border: 1px solid var(--secondary-color);
    color: var(--text-muted);
}
button#btnVoice:hover {
    color: #fff;
    border-color: #fff;
    background: rgba(255,255,255,0.1);
    box-shadow: none;
}

/* Pulsante Reset Camera (Grigio/Scuro come nell'immagine) */
details button:last-child {
    background: #2a2a2a;
    border-color: #444;
    color: #aaa;
    margin-top: 15px;
}
details button:last-child:hover {
    background: #444;
    color: #fff;
    border-color: #666;
    box-shadow: none;
}

/* =========================================
   5. COMPONENTI SPECIALI
   ========================================= */

/* Risultati Ricerca (Dropdown flottante) */
.search-results-box {
    position: absolute;
    top: 100%; /* Subito sotto l'input */
    left: 0; 
    width: 100%;
    background: #001a26;
    border: 1px solid var(--primary-color);
    border-top: none;
    max-height: 180px;
    overflow-y: auto;
    display: none;
    z-index: 200;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.8);
}

.search-results-box div { 
    padding: 10px; 
    border-bottom: 1px solid #003344; 
    font-size: 13px; 
    cursor: pointer;
    transition: background 0.2s;
}

.search-results-box div:hover { 
    background: var(--secondary-color); 
    color: #fff; 
    padding-left: 15px; /* Effetto slide */
}

/* Accordion (Details/Summary) */
details {
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

summary {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    outline: none;
    padding: 5px 0;
    list-style: none; /* Rimuove il triangolino di default */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

summary::-webkit-details-marker { display: none; } /* Fix per Chrome vecchio */

summary::after {
    content: '+'; 
    font-size: 14px;
    font-weight: bold;
}

details[open] summary::after {
    content: '-';
    color: var(--primary-color);
}

details[open] summary {
    color: var(--primary-color);
    margin-bottom: 10px;
}

/* Risultati Testuali (Viaggio/Distanza) */
#travelResult, #distResult {
    margin-top: 10px;
    padding: 10px;
    background: rgba(0, 212, 255, 0.05);
    border-left: 3px solid var(--primary-color);
    font-size: 13px;
    border-radius: 0 4px 4px 0;
    line-height: 1.4;
    display: none; /* Nascosto di default se vuoto */
}

#travelResult:not(:empty), #distResult:not(:empty) {
    display: block; /* Mostra solo se c'è testo */
    animation: fadeIn 0.5s;
}

/* Etichette Flottanti sui pianeti */
.planet-label {
    position: absolute;
    color: var(--primary-color);
    background: rgba(0, 0, 0, 0.8);
    padding: 4px 8px;
    border: 1px solid var(--secondary-color);
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    pointer-events: none;
    white-space: nowrap;
    transform: translate(-50%, -150%);
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    text-shadow: 0 0 5px var(--primary-color);
}

/* Tabelle Dati */
table { 
    width: 100%; 
    border-collapse: collapse; 
    font-size: 12px; 
    margin-bottom: 10px; 
}
td { 
    padding: 8px 5px; 
    border-bottom: 1px solid rgba(255,255,255,0.05); 
    color: #ccddee;
}
td:first-child { 
    color: var(--primary-color); 
    font-weight: bold; 
    width: 45%; 
    text-transform: uppercase;
    font-size: 10px;
    letter-spacing: 0.5px;
}

/* =========================================
   6. SCROLLBAR PERSONALIZZATA (Webkit)
   ========================================= */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: #000; 
}
::-webkit-scrollbar-thumb {
    background: #003344; 
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color); 
}

/* =========================================
   7. ANIMAZIONI
   ========================================= */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   8. MEDIA QUERIES (MOBILE OPTIMIZATION)
   ========================================= */
@media (max-width: 768px) {
    #dashboard, #info-panel {
        width: auto;
        left: 10px; 
        right: 10px;
        max-height: 35vh;
        padding: 12px;
    }

    /* Su mobile il pannello comandi sta in alto */
    #dashboard {
        top: 10px;
        border-left: 1px solid var(--secondary-color); /* Rimuove bordo spesso laterale per spazio */
    }

    /* Su mobile il pannello info sta in basso */
    #info-panel {
        top: auto;
        bottom: 10px;
        border-right: 1px solid var(--secondary-color);
    }

    /* Elementi touch friendly */
    select, input, button {
        padding: 14px; /* Area tocco più grande */
        font-size: 16px; /* Evita zoom automatico su iOS */
    }

    h2 { font-size: 12px; }
    
    /* Nasconde dettagli meno utili su schermi piccoli */
    .planet-label { font-size: 10px; padding: 2px 4px; }
}