/* Tavolozza Colori Giaccheverdi */
:root {
    --primary: #5d4037;    /* Marrone */
    --secondary: #2e7d32;  /* Verde */
    --bg: #f0f2f5;
    --white: #ffffff;
    --danger: #c62828;
    --info: #0288d1;
    --text: #333;
}

body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: var(--bg); color: var(--text); margin: 0; padding: 20px; }

/* Layout Contenitori */
.container { max-width: 1100px; margin: auto; background: var(--white); padding: 25px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }

/* Barra Superiore */
.top-bar { 
    background: #333; color: white; padding: 15px 30px; 
    display: flex; justify-content: space-between; align-items: center;
    border-radius: 8px; margin-bottom: 25px;
}
.top-bar a { color: white; text-decoration: none; font-size: 0.9rem; margin-left: 15px; }

/* Tabelle */
table { width: 100%; border-collapse: collapse; margin-top: 20px; background: var(--white); }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid #eee; }
th { background: var(--primary); color: white; }
tr:hover { background: #f9f9f9; }


    .table-email {
        table-layout: fixed; 
        width: 100%;
    }
    .table-email td {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        padding: 12px;
    }
    /* Assegna larghezze esplicite per evitare che le azioni spariscano */
    .table-email th:nth-child(1) { width: 15%; } /* Data */
    .table-email th:nth-child(2) { width: 25%; } /* Destinatario */
    .table-email th:nth-child(3) { width: 35%; } /* Oggetto */
    .table-email th:nth-child(4) { width: 10%; } /* Allegato */
    .table-email th:nth-child(5) { width: 15%; } /* Azioni (Ora è più larga!) */


/* Pulsanti */
.btn { 
    padding: 8px 15px; border: none; border-radius: 5px; cursor: pointer; 
    color: white; text-decoration: none; font-weight: bold; 
    display: inline-block; font-size: 13px; transition: 0.3s;
}
.btn-main { background: var(--primary); }
.btn-add { background: var(--secondary); }
.btn-del { background: var(--danger); }
.btn-edit { background: var(--info); }
.btn:hover { opacity: 0.8; transform: translateY(-1px); }
.btn-edit, .btn-del {
    width: 35px;
    height: 35px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0; /* Rimuove il padding per farli perfettamente tondi/quadrati */
}

.btn-edit i, .btn-del i {
    font-size: 1.1rem;
}

.green-btn {
    background-color: #20c997;
    color: white;
    /*border: none;
    /*transition: background 0.3s ease;*/
    width: 35px;
    height: 35px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0; /* Rimuove il padding per farli perfettamente tondi/quadrati */
}

.green-btn:hover {
    background-color: #1aa179; /* Un verde leggermente più scuro al passaggio del mouse */
    color: white;
}

/* Form e Input */
.form-card { background: #f9f9f9; padding: 20px; border-radius: 10px; border: 1px solid #ddd; margin-bottom: 30px; }
input, select, textarea { 
    width: 100%; padding: 10px; margin: 8px 0; 
    border: 1px solid #ccc; border-radius: 6px; box-sizing: border-box; 
}

/* Badge e Stati */
.badge { padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: bold; text-transform: uppercase; }
.status-on { color: var(--secondary); font-weight: bold; }
.status-off { color: var(--danger); font-weight: bold; }

/* Dashboard Grid */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 25px; }
.dash-card {
    background: white; padding: 30px; border-radius: 15px;
    text-decoration: none; color: var(--text); box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    transition: 0.3s; border-top: 5px solid var(--primary); text-align: center;
}
.dash-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0,0,0,0.1); }

.password-wrapper input {
    /* Assicurati che i bordi e il raggio siano uguali al campo username */
    box-sizing: border-box; 
}

#togglePassword:hover {
    color: var(--secondary) !important; /* Diventa verde al passaggio del mouse */
}
/* Contenitore per le pillole */
    .permissions-grid {
        display: grid; 
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); 
        gap: 12px;
        margin-top: 10px;
    }

    /* Stile della singola etichetta (pillola) */
    .permission-item {
        display: flex;
        align-items: center;
        gap: 10px;
        background: #f1f3f5;
        padding: 10px 15px;
        border-radius: 8px;
        border: 2px solid transparent;
        cursor: pointer;
        transition: all 0.2s ease;
        user-select: none;
    }

    /* Effetto hover */
    .permission-item:hover {
        background: #e9ecef;
        border-color: #dee2e6;
    }

    /* Quando il checkbox è selezionato (cambia bordo e sfondo) */
    .permission-item.active {
        background: #e7f5ff;
        border-color: #339af0;
        color: #1971c2;
    }

    /* Nascondiamo il checkbox originale per un look più pulito (opzionale) 
       o lo lasciamo piccolo a lato */
    .permission-item input[type="checkbox"] {
        width: 18px;
        height: 18px;
        cursor: pointer;
    }

.ck-editor__editable_inline {
        min-height: 300px; /* Qui decidi l'altezza minima */
    }



/*POP ALERT*/
/* Sfondo oscurato */
#custom-alert-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    align-items: center; justify-content: center;
}

/* Scatola dell'alert */
.custom-alert-box {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    max-width: 400px;
    width: 90%;
    text-align: center;
    font-family: sans-serif;
}

.alert-success-icon { color: #20c997; font-size: 3em; margin-bottom: 15px; }
.alert-stats { text-align: left; background: #f8f9fa; padding: 15px; border-radius: 10px; margin: 15px 0; }
.alert-btn { background: #20c997; color: white; border: none; padding: 10px 25px; border-radius: 50px; cursor: pointer; font-weight: bold; }
