/* RESET DI BASE: Rimuove i margini predefiniti del browser */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif; /* Un font pulito simile all'originale */
}

body {
    background-color: #f9f9f9;
}

/* CONTAINER PRINCIPALE: Usa Flexbox per mettere sidebar e main content affiancati */
.app-container {
    display: flex;
    min-height: 100vh; /* Altezza tutta la pagina */
}

/* SIDEBAR STILE */
.sidebar {
    width: 260px; /* Larghezza fissa */
    background-color: white;
    border-right: 1px solid #eaeaea;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.logo {
    font-size: 40px;
    font-weight: bold;
    margin-bottom: 40px;
    padding-left: 10px;
}

.p-logo {
    display: inline-block;
    border: 3px solid black;
    padding: 0 10px;
}

.nav-links {
    list-style: none;
}

.nav-links li {
    margin-bottom: 10px;
}

.nav-links a {
    text-decoration: none;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px; /* Spazio tra icona e testo */
    padding: 10px;
    border-radius: 8px;
    transition: background 0.3s;
}

/* Stile per la voce attiva (activities nell'immagine) */
.nav-links li.active a {
    background-color: #f0f0f0;
    font-weight: 600;
}

.nav-links a:hover {
    background-color: #f5f5f5;
}

/* MAIN CONTENT STILE */
.main-content {
    flex: 1; /* Prende tutto lo spazio rimanente */
    padding: 30px;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.main-header h1 {
    font-size: 32px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn-create-top {
    border: none;
    background: none;
    font-weight: bold;
    cursor: pointer;
}

/* AREA CONTROLLI (Ricerca e Pulsanti) */
.controls-area {
    margin-bottom: 30px;
}

.search-bar {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding: 5px 15px;
    width: 300px;
    margin-bottom: 20px;
}

.search-bar input {
    border: none;
    padding: 10px;
    width: 100%;
    outline: none; /* Rimuove il bordo blu al click */
}

.action-buttons {
    display: flex;
    gap: 15px;
}

/* Stili pulsanti simili all'immagine originale */
.btn-create {
    background-color: white;
    border: 2px solid #a855f7; /* Viola */
    color: #a855f7;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

.btn-folder {
    background-color: white;
    border: 2px solid #000;
    color: #000;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

/* TABELLA STILE */
.activities-table-container {
    background: white;
    border-radius: 8px;
    border: 1px solid #eaeaea;
    overflow: hidden;
}

.activities-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.activities-table thead {
    background-color: #f9f9f9;
}

.activities-table th {
    padding: 15px;
    font-size: 12px;
    color: #666;
    border-bottom: 1px solid #eaeaea;
}

.activities-table td {
    padding: 15px;
    border-bottom: 1px solid #eaeaea;
    font-size: 14px;
}

.btn-play {
    background-color: #22c55e; /* Verde */
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

/* --- MODALE SELECT FOLDER (Home) --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; z-index: 1000;
}

.modal-content {
    background: white; padding: 25px; border-radius: 12px; width: 350px; box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.modal-content h2 { margin-bottom: 20px; font-size: 18px; }

.modal-actions { display: flex; margin-top: 25px; }

.btn-cancel {
    background: #f3f4f6; border: 1px solid #ccc; padding: 8px 15px; border-radius: 6px; cursor: pointer; font-weight: 600;
}

.btn-confirm {
    background: #000; color: white; border: none; padding: 8px 15px; border-radius: 6px; cursor: pointer; font-weight: 600;
}

/* Lista cartelle nel popup */
.folder-list {
    list-style: none; max-height: 250px; overflow-y: auto; padding: 0; margin: 0;
}

.folder-list-item {
    padding: 12px 10px; border-bottom: 1px solid #eaeaea; cursor: pointer; display: flex; align-items: center; gap: 10px; font-size: 14px; transition: background 0.2s;
}

.folder-list-item:hover { background-color: #f9f9f9; }

.empty-message { text-align: center; color: #888; padding: 20px !important; font-style: italic; }

/* --- MODALE COMUNE (OVERLAY E CONTENUTO) --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5); display: flex; justify-content: center; align-items: center; z-index: 1000;
}

.modal-content {
    background: white; padding: 25px; border-radius: 12px; width: 350px; box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.modal-actions { display: flex; margin-top: 25px; }

/* Pulsanti d'azione Modale */
.btn-cancel {
    background: #f3f4f6; border: 1px solid #ccc; padding: 8px 15px; border-radius: 6px; cursor: pointer; font-weight: 600;
}
.btn-confirm {
    background: #000; color: white; border: none; padding: 8px 15px; border-radius: 6px; cursor: pointer; font-weight: 600;
}

/* --- MODALE SELECT FOLDER (Home) --- */
.modal-content h2 { margin-bottom: 20px; font-size: 18px; }
.folder-list { list-style: none; max-height: 250px; overflow-y: auto; padding: 0; margin: 0; }
.folder-list-item { padding: 12px 10px; border-bottom: 1px solid #eaeaea; cursor: pointer; display: flex; align-items: center; gap: 10px; font-size: 14px; transition: background 0.2s; }
.folder-list-item:hover { background-color: #f9f9f9; }
.empty-message { text-align: center; color: #888; padding: 20px !important; font-style: italic; }

/* --- MODALE CREATE ACTIVITY (NUOVA) --- */
.large-modal { width: 80%; max-width: 900px; height: 80%; display: flex; flex-direction: column; overflow: hidden; }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h2 { font-size: 24px; font-weight: 600; margin: 0; }
.close-icon { cursor: pointer; font-size: 28px; color: #aaa; }
.close-icon:hover { color: #000; }

.activity-search-area { display: flex; flex-direction: column; gap: 15px; margin-bottom: 20px; }
.activity-search-area .search-bar { width: 100%; }

.category-filters { display: flex; gap: 10px; font-size: 14px; }
.category-filters span { cursor: pointer; color: #666; border: 1px solid #ccc; padding: 5px 12px; border-radius: 20px; transition: all 0.2s; }
.category-filters span:hover { color: #000; border-color: #000; }
.category-filters span.active { background-color: #000; color: white; border-color: #000; }

.create-activity-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; flex: 1; min-height: 0; overflow: hidden; }

/* Griglia opzioni a sinistra */
/* Griglia opzioni a sinistra - Aggiornata per non allungare le card */
.activity-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
    overflow-y: auto;
    padding-right: 10px;
    align-content: start;
    min-height: 0;
}

/* Card attività - Rese più compatte e squadrate */
.activity-option-card { 
    border: 1px solid #eaeaea; 
    border-radius: 8px; 
    padding: 15px 10px; 
    text-align: center; 
    cursor: pointer; 
    transition: all 0.2s ease-in-out; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 120px; /* Altezza fissa per un aspetto a "bottone" */
}
.activity-option-card:hover { transform: translateY(-3px); border-color: #000; box-shadow: 0 4px 8px rgba(0,0,0,0.05); }
.activity-option-card.selected { border: 2px solid #ec4899; background-color: #fce7f3; } /* Rosa */

.option-visual { width: 100%; height: 60px; display: flex; justify-content: center; align-items: center; margin-bottom: 10px; }
.option-name { font-size: 13px; font-weight: 600; color: #333; }

/* Vista Dettagli a destra */
.activity-detail-view { display: flex; flex-direction: column; border: 1px solid #eaeaea; border-radius: 8px; padding: 20px; background-color: #fdf2f8; /* Rosa chiarissimo di fondo */ }
.detail-header h3 { margin: 0 0 15px 0; font-size: 18px; font-weight: 600; }
.detail-body { flex: 1; overflow-y: auto; }
.detail-body p { font-size: 13px; color: #4b5563; line-height: 1.5; margin: 0 0 20px 0; }
.detail-footer { display: flex; justify-content: flex-end; margin-top: auto; }

/* Pulsante rosa "create activity" */
.activity-detail-view .btn-confirm { background-color: #ec4899; }
.activity-detail-view .btn-confirm:hover { background-color: #db2777; }

/* --- STILE TABELLA AZIONI (COME IN FOTO) --- */
.activities-table td { color: #666; } /* Testo grigio per date e nomi */
.activities-table td:nth-child(2) { color: #000; font-weight: 600; } /* Nome attività nero e grassetto */
.activities-table td .activity-type { color: #333; font-weight: 600; } /* Tipo attività grassetto */

/* Icone azioni come in foto */
.activities-table td .action-icons { display: flex; gap: 10px; }
.activities-table td .action-icons img { cursor: pointer; width: 18px; height: 18px; opacity: 0.7; }
.activities-table td .action-icons img:hover { opacity: 1; }

/* --- MODALE AZIONI ATTIVITA' (COPY/EMBED/DELETE) --- */
.action-buttons-grid {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 10px;
}

.action-square-btn {
    background: white;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    width: 120px;
    height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #333;
    font-weight: 600;
    font-size: 14px;
}

.action-square-btn:hover {
    border-color: #000;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transform: translateY(-2px);
}

.action-square-btn svg {
    fill: #888;
    width: 32px;
    height: 32px;
    transition: fill 0.2s;
}

.action-square-btn:hover svg {
    fill: #000; /* L'icona diventa nera al passaggio del mouse */
}

/* --- SEZIONE STATISTICHE (stats.html) --- */

.stats-card {
    background: white;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.stats-card h2 {
    font-size: 18px;
    margin-bottom: 20px;
    color: #111;
}

.stats-split-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* Lista attività sulla sinistra */
.stats-sidebar {
    width: 280px;
    background: white;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    overflow: hidden;
    /* Rende la lista scrollabile se ci sono troppe attività */
    max-height: 600px; 
    overflow-y: auto;
}

.stats-list-item {
    padding: 15px 20px;
    border-bottom: 1px solid #eaeaea;
    cursor: pointer;
    font-size: 14px;
    color: #000;
    transition: background 0.2s;
    border-left: 4px solid transparent;
}

.stats-list-item:hover {
    background-color: #f9f9f9;
}

/* Elemento attivo nella lista (Bordo viola/rosa) */
.stats-list-item.active {
    background-color: #fcfcfc;
    border-left: 4px solid #a855f7; /* Viola */
    font-weight: 600;
}

/* Contenitore grafico specifico a destra */
.stats-detail-area {
    flex: 1;
}

.chart-container {
    position: relative;
    height: 400px;
    width: 100%;
}