/* style.css - Foglio di stile unico e uniformato (Versione Finale) */

/* --- 1. STILI GENERALI E LAYOUT --- */
body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f4f9; 
    margin: 0; 
    padding: 20px;
    color: #333;
}

/* Layout per pagine di gestione (Admin, Index, Log) */
.container { 
    background: #fff; 
    padding: 30px; 
    border-radius: 12px; /* Arrotondamento più morbido */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08); 
    max-width: 1200px; 
    margin: 0 auto; 
}

.container-wide { max-width: 1400px; }

h2 { color: #007bff; margin-top: 0; font-weight: 600; }
h3 { color: #333; margin-top: 25px; font-weight: 600; }
hr { border: 0; border-top: 1px solid #eee; margin: 25px 0; }

/* --- 2. HEADER E NAVIGAZIONE --- */
.header-controls { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 30px; 
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}
.header-controls h2 { margin: 0; font-size: 22px; }

/* Nuovi link di navigazione stile "Pillola" */
.nav-links a {
    text-decoration: none;
    color: #555;
    background-color: #f1f3f5;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    margin-left: 8px;
    transition: all 0.2s ease;
}
.nav-links a:hover {
    background-color: #007bff;
    color: white;
    transform: translateY(-1px);
}
.nav-links a.active {
    background-color: #e7f1ff;
    color: #007bff;
    border: 1px solid #b3d7ff;
}

/* --- 3. MESSAGGI --- */
.message { padding: 12px; border-radius: 6px; margin-bottom: 20px; font-weight: 500; }
.success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* --- 4. FORM E INPUT --- */
form { margin-bottom: 20px; }
label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 14px; color: #555; }

input[type="text"], input[type="password"], input[type="number"], select, textarea { 
    width: 100%; padding: 12px; margin-bottom: 20px; 
    border: 1px solid #ddd; border-radius: 6px; box-sizing: border-box; font-family: inherit; 
    transition: border-color 0.2s;
}
input:focus, textarea:focus, select:focus {
    border-color: #007bff; outline: none;
}

button { 
    background-color: #007bff; color: white; padding: 10px 20px; 
    border: none; border-radius: 6px; cursor: pointer; font-size: 15px; font-weight: 600;
    transition: background-color 0.2s, transform 0.1s; 
}
button:hover { background-color: #0056b3; transform: translateY(-1px); }

/* Pulsanti specifici */
.delete-btn { background-color: #dc3545; padding: 6px 12px; font-size: 13px; border-radius: 4px; }
.delete-btn:hover { background-color: #c82333; }

.reset-btn { background-color: #ffc107; color: #333; margin-right: 5px; padding: 6px 12px; font-size: 13px; border-radius: 4px; }
.reset-btn:hover { background-color: #e0a800; }

.show-btn { background-color: #6c757d; margin-left: 10px; width: auto; font-size: 13px; padding: 10px 15px; margin-bottom: 2px;}
.show-btn:hover { background-color: #5a6268; }

.btn-primary { /* Pulsante principale grande */
    background-color: #28a745; font-size: 18px; padding: 15px 30px; border-radius: 50px; width: 100%;
}
.btn-primary:hover { background-color: #218838; }

/* --- 5. TABELLE --- */
table { width: 100%; border-collapse: collapse; margin-top: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
th, td { border: 1px solid #eee; padding: 12px 15px; text-align: left; vertical-align: middle; font-size: 14px; }
th { background-color: #f8f9fa; font-weight: 600; color: #444; }
tr:hover { background-color: #fcfcfc; }
.admin-row { background-color: #fff8e1; } /* Evidenzia riga admin */

/* --- 6. UPLOAD PAGE SPECIFICI --- */
#drop-area { 
    border: 2px dashed #007bff; border-radius: 12px; padding: 60px 20px; 
    cursor: pointer; transition: all 0.3s; margin-bottom: 25px; text-align: center; background-color: #fdfdfd;
}
#drop-area.highlight { background-color: #e9f5ff; border-color: #0056b3; transform: scale(1.01); }
#file-input { display: none; }

.progress-bar-container { 
    background-color: #e9ecef; border-radius: 10px; margin-top: 25px; 
    height: 20px; overflow: hidden; display: none; 
}
#progress-bar { 
    height: 100%; width: 0; background-color: #28a745; text-align: center; 
    line-height: 20px; color: white; font-size: 12px; transition: width 0.4s ease; 
}

/* CELLE TABELLA INTERATTIVE */
.retention-cell form { display: flex; align-items: center; }
.retention-cell input[type="number"] { width: 70px; margin-right: 5px; margin-bottom: 0; padding: 5px; }
.retention-cell button { padding: 6px 10px; font-size: 12px; background-color: #28a745; margin-left: 5px; }

.notes-cell textarea { 
    width: 100%; border: 1px solid #e0e0e0; border-radius: 4px; padding: 8px; 
    resize: vertical; background: #fcfcfc; font-size: 13px; margin-bottom: 5px; font-family: inherit;
}
.notes-cell textarea:focus { background: #fff; border-color: #007bff; }
.notes-cell button { padding: 5px 10px; font-size: 11px; background-color: #17a2b8; border-radius: 4px; }

/* --- 7. LAYOUT CENTRALE (Login & Download) --- */
body.centered-layout {
    display: flex; justify-content: center; align-items: center; min-height: 100vh;
    background: #f0f2f5; margin: 0; padding: 20px; box-sizing: border-box;
}
.central-card {
    background: white; width: 100%; max-width: 450px; padding: 40px;
    border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.1); text-align: center;
}
.card-icon { font-size: 60px; margin-bottom: 20px; display: block; }
.central-card h2 { color: #333; font-size: 24px; margin-bottom: 20px; }
.btn-full { /* Pulsante per login/download */
    display: inline-block; background-color: #007bff; color: white; padding: 12px 30px;
    border-radius: 50px; text-decoration: none; font-size: 18px; font-weight: bold;
    transition: all 0.2s; border: none; cursor: pointer; width: 100%; box-sizing: border-box;
}
.btn-full:hover { background-color: #0056b3; transform: translateY(-2px); }

/* --- 8. MODALE (History) --- */
.modal { display: none; position: fixed; z-index: 999; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.5); }
.modal-content { background-color: #fff; margin: 10% auto; padding: 25px; width: 90%; max-width: 500px; border-radius: 12px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); }
.close { color: #aaa; float: right; font-size: 28px; font-weight: bold; cursor: pointer; }
.close:hover { color: #333; }
.download-list { max-height: 300px; overflow-y: auto; border: 1px solid #eee; padding: 10px; margin-top: 15px; background: #f9f9f9; border-radius: 6px;}

/* --- 9. LOADER --- */
.loader { display: none; margin-top: 20px; color: #007bff; font-weight: bold; }
.loader-bar { height: 4px; width: 100%; background: #e0e0e0; margin-top: 10px; border-radius: 2px; overflow: hidden; }
.loader-progress { height: 100%; background: #007bff; width: 0%; animation: progressAnim 2s infinite ease-in-out; }
@keyframes progressAnim {
    0% { width: 0%; margin-left: 0; }
    50% { width: 50%; margin-left: 25%; }
    100% { width: 0%; margin-left: 100%; }
}

/* --- 10. LOG VIEWER (Nuovo) --- */
.log-container {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 20px;
    border-radius: 8px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    height: 600px;
    overflow-y: scroll;
    white-space: pre-wrap;
    font-size: 13px;
    border: 1px solid #333;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
}
.log-entry {
    padding: 4px 0;
    border-bottom: 1px solid #333;
    display: block;
}
.log-entry:hover { background-color: #2a2d2e; }
