/* periodic_table.css */

/* --- OVERRIDE REVEAL.JS PER QUESTA SLIDE --- */
/* Forza la slide a usare tutto lo spazio e rimuove il centering verticale automatico */
.reveal .slides section.table-slide {
    height: 100vh !important;
    width: 100vw !important;
    max-width: 100vw !important;
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column;
}

/* Header più piccolo e compatto */
.table-header {
    background: #fff;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 0 0 auto;
}

.table-header h3 {
    font-size: 1.8rem !important; /* Titolo più piccolo */
    margin: 0 !important;
    color: #333;
}

.legend-btn {
    font-size: 0.9rem;
    padding: 8px 15px;
    background: white;
    border: 1px solid #333;
    border-radius: 4px;
    cursor: pointer;
}

/* --- GRIGLIA TAVOLA PERIODICA --- */
#app-container {
    width:120rem;
    height: 120rem;
    flex: 1;
    display: grid;
    /* Colonne fisse piccole (es. 12 colonne) o responsive */
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    padding: 20px;
    overflow-y: auto;
    align-content: start; /* Gli elementi partono dall'alto */
}

/* --- SINGOLO ELEMENTO (CELLA) --- */
/* Classe aggiunta da JS quando cambia categoria: FORZA L'A CAPO */
.element.new-row-start {
    grid-column-start: 1; 
}

/* --- ELEMENTI --- */
.element {
    aspect-ratio: 1/1;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 5px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    transition: transform 0.2s, z-index 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.element:hover {
    transform: scale(1.4);
    z-index: 50;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.element .number { font-size: 1rem; font-weight: bold; opacity: 0.6; }
.element .symbol { font-size: 2rem; font-weight: 800; text-align: center; margin: 0; line-height: 1; }
.element .name { font-size: 1.2rem; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Colori Categorie */
.generali { background-color: #b0bec5; }
.principi { background-color: #ef5350; color: white; }
.diritti { background-color: #42a5f5; color: white; }
.titolare { background-color: #66bb6a; color: white; }
.trasferimenti { background-color: #ffa726; }
.autorita { background-color: #ab47bc; color: white; }
.cooperazione { background-color: #5c6bc0; color: white; }
.sanzioni { background-color: #ffca28; }
.specifiche { background-color: #26c6da; }
.finali { background-color: #8d6e63; color: white; }

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 30px #00e676; }
    50% { transform: scale(1.1); box-shadow: 0 0 50px #00e676; }
    100% { transform: scale(1); box-shadow: 0 0 30px #00e676; }
}

/* --- MEDIA QUERY AGGIORNATA PER MOBILE --- */
@media (max-width: 768px) {
    .focus-slide { padding: 20px; height: auto; min-height: 100vh; }
    .focus-content { flex-direction: column; gap: 30px; }
    .reverse-layout { flex-direction: column; } /* Annulla il reverse su mobile */
    .focus-visual { width: 100%; height: 200px; order: -1; /* Mette l'immagine sempre sopra su mobile */ }
    .focus-text h2 { font-size: 2rem; }
    .split-box { flex-direction: column; }
}

/* --- PANNELLO DETTAGLI --- */
#details-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--panel-bg);
    border-top: 4px solid #333;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.2);
    z-index: 2000;
    background-color: #f4f4f9;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    
    display: flex;
    /* Altezza Desktop standard */
    height: 40vh; 
}

/* Stato Aperto */
#details-panel.open {
    transform: translateY(0);
}

/* Pulsante Chiudi */
.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: rgba(255,255,255,0.8);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #333;
    z-index: 2001;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.close-btn:hover { background: #eee; }

/* Layout Interno - Header Sinistro */
.detail-header {
    flex: 0 0 300px;
    background: #fafafa;
    border-right: 1px solid #ddd;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.big-symbol { font-size: 4rem; font-weight: bold; font-style: italic; margin: 0; line-height: 1;}
.detail-id { font-size: 1.2rem; color: #666; margin-bottom: 5px; }

/* Layout Interno - Contenuto Destro */
.detail-content {
    flex: 1;
    padding: 30px 40px;
    overflow-y: auto;
}

.detail-content h2 { margin-top: 0; color: #222; font-size: 1.5rem; }
.detail-content .summary { font-size: 1.1rem; line-height: 1.6; color: #444; margin-bottom: 20px; }
.detail-content .full-text { 
    font-size: 0.95rem; 
    color: #555; 
    background: #f4f4f9; 
    padding: 20px; 
    border-radius: 8px;
    border-left: 4px solid #ccc; /* Sarà sovrascritto dal JS col colore */
    font-style: italic; 
}

/* Barra Peso */
.weight-container { width: 100%; background: #ddd; height: 8px; border-radius: 4px; margin-top: 5px; overflow: hidden; }
.weight-bar { height: 100%; width: 0%; transition: width 0.5s ease-out; }


/* --- MOBILE RESPONSIVE --- */
@media (max-width: 768px) {
    /* Griglia Mobile: celle leggermente più piccole per farne stare di più */
    #app-container {
        grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
        padding: 10px;
    }

    /* Pannello Mobile: occupa 3/4 schermo */
    #details-panel {
        height: 75vh; 
        flex-direction: column;
        border-radius: 20px 20px 0 0;
    }

    .detail-header {
        flex: 0 0 auto;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #ddd;
        padding: 15px 20px;
        background: #fff;
        border-radius: 20px 20px 0 0;
        
        flex-direction: row; /* Elementi affiancati in alto */
        justify-content: flex-start;
        align-items: center;
        gap: 20px;
        text-align: left;
    }

    .big-symbol { font-size: 3rem; }
    .small-symbol { font-size: 1.2rem; margin-top: 5px; }
    
    /* Gruppo info (Id + barre) su mobile */
    .detail-info-group { flex: 1; } 

    .detail-content {
        padding: 20px;
        padding-bottom: 60px; /* Spazio per scrollare tutto in fondo */
    }
}