/* Stile per il fascione superiore */
nav {
    background: #49AB33;
    color: #fff;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 1rem;
}

nav a {
    color: #fff;
    text-decoration: none;
    font-weight: bold;
}

nav a:hover {
    text-decoration: underline;
}

/* Stile generale */
body {
	font-size: 0.8rem;
    font-family: sans-serif;
    margin: 0;
    padding: 0;
    background: #f4f4f9;
    color: #333;
}

main {
    padding: 2rem;
}

button {
    background: #49AB33;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    margin-right: 2%;
    width: 20%;
    min-width: 90px;
    border-radius: 5px;
    cursor: pointer;
}

button:hover {
    background: #399B23;
}

/* Stile per le tabelle */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

table, th, td {
    border: 1px solid #ddd; /* Bordo sottile */
}

th, td {
    padding: 10px; /* Spaziatura interna */
    text-align: left; /* Allineamento del testo */
}

th {
    background-color: #49AB33; /* Sfondo per l'intestazione */
    color: white; /* Colore del testo */
}

tr:nth-child(even) {
    background-color: #f9f9f9; /* Riga pari con colore chiaro */
}

tr:hover {
    background-color: #f1f1f1; /* Evidenziazione riga al passaggio del mouse */
}

#filters {
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

#filters select,
#filters input {
    padding: 10px;
    font-size: 0.8rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    min-width: 180px;
    background-color: white;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

#filters select:focus,
#filters input:focus {
    outline: none;
    border-color: #49AB33;
    box-shadow: 0 0 5px rgba(73, 171, 51, 0.4);
}

table thead select,
table thead input {
    width: 100%;
    padding: 6px 8px;
    font-size: 0.75rem;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
}

#new-project-button {
    background-color: #49AB33;
    border: none;
    color: white;
    width: 160px;
    padding: 0.6rem 1.4rem;
    border-radius: 999px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s ease;
}

#new-project-button:hover {
    background-color: #399B23;
}

#export-projects-button {
    background-color: #1976d2;
    border: none;
    color: white;
    width: 140px;
    padding: 0.6rem 1.4rem;
    border-radius: 999px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s ease;
}

#export-projects-button:hover {
    background-color: #1565c0;
}

/* ============================== */
/* Pulsanti di azione tondi (modifica/elimina) */
/* ============================== */
td button {
    background: none;
    border: none;
    height: 0px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 2px;
    padding: 0;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    position: relative;
}

td button:hover {
    transform: scale(1.1);
}

/* Modifica - verde chiaro */
td button[title="Modifica"] {
    background-color: #e8f5e9;
}

td button[title="Modifica"] i {
    color: #2e7d32;
    font-size: 14px;
}

/* Elimina - rosso chiaro */
td button[title="Elimina"] {
    background-color: #ffebee;
}

td button[title="Elimina"] i {
    color: #c62828;
    font-size: 14px;
}

/* ============================== */
/* Tooltip personalizzato */
/* ============================== */
td button::after {
    content: attr(title);
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 4px 8px;
    font-size: 0.6rem;
    white-space: nowrap;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-in-out;
    z-index: 10;
}

td button:hover::after {
    opacity: 1;
}

/* ============================== */
/* Pulsanti normali arrotondati (pill shape) */
/* ============================== */
button:not(td button) {
    background: #49AB33;
    color: white;
    border: none;
    padding: 0.6rem 1.4rem;
    border-radius: 999px; /* pill shape */
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s ease-in-out;
    min-width: 100px;
}

button:not(td button):hover {
    background: #399B23;
}

#projects-table {
    width: 100%;
    border-collapse: collapse;
}

#projects-table th,
#projects-table td {
    padding: 8px;
    text-align: left;
    border: 1px solid #ddd;
}

/* Esempio: larghezze percentuali per ogni colonna */
#projects-table th:nth-child(1),
#projects-table td:nth-child(1) {
    width: 10%;
}

#projects-table th:nth-child(2),
#projects-table td:nth-child(2) {
    width: 12%;
}

#projects-table th:nth-child(3),
#projects-table td:nth-child(3) {
    width: 17%;
}

#projects-table th:nth-child(4),
#projects-table td:nth-child(4) {
    width: 9%;
}

#projects-table th:nth-child(5),
#projects-table td:nth-child(5) {
    width: 9%;
}

#projects-table th:nth-child(6),
#projects-table td:nth-child(6) {
    width: 13%;
}

#projects-table th:nth-child(7),
#projects-table td:nth-child(7),
#projects-table th:nth-child(8),
#projects-table td:nth-child(8) {
    width: 7%;
    text-align: right;
}

#projects-table th:nth-child(9),
#projects-table td:nth-child(9) {
    width: 16%;
    text-align: center;
}

th.sorted-asc::after {
    content: " ▲";
}
th.sorted-desc::after {
    content: " ▼";
}

#file-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#file-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    border: 1px solid #ccc;
    padding: 10px 14px;
    margin-bottom: 8px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

#file-list li a {
    color: #1976d2;
    text-decoration: none;
    font-weight: 500;
}

#file-list li a:hover {
    text-decoration: underline;
}

.delete-file {
    background: none;
    border: none;
    cursor: pointer;
    color: #c62828;
    font-size: 1.1rem;
    transition: transform 0.2s ease;
}

.delete-file:hover {
    transform: scale(1.2);
    background: none;
}

form {
    max-width: 1024px;
    margin: 2rem auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 15px;
    background: #ffffff;
    padding: 2rem 2.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

form label {
    font-weight: bold;
    margin-bottom: 1px;
    display: block;
}

form input,
form select,
form textarea {
    width: 100%;
    padding: 10px;
    font-size: 0.9rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fefefe;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
}

form input:focus,
form select:focus,
form textarea:focus {
    border-color: #49AB33;
    outline: none;
}

textarea {
    grid-column: span 2;
    resize: vertical;
}

#attachment,
#attached-files,
#attachment-warning {
    grid-column: span 2;
}

#upload-button  {
    grid-column: span 2;
    font-size: 1em; 
    width: 8em; 
}

/* Pulsanti interni al form */
#upload-button,
button[type="submit"] {
    max-width: 200px;
    margin: 0 auto;
    justify-self: center;
}

/* Sezione "File Allegati" */
#attached-files {
    margin-top: 20px;
}

#attached-files h3 {
    margin-bottom: 10px;
    color: #444;
    font-size: 1rem;
}

/* Spazio per il messaggio di avviso (rosso) */
#attachment-warning {
    color: red;
    font-weight: bold;
    font-size: 0.9rem;
    text-align: center;
}
