/* Réinitialisation et style de base */
:root {
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --primary-text-color: #e0e0e0;
    --secondary-text-color: #b0b0b0;
    --border-color: #333;
    --accent-color: #03a9f4;
    --secours-color: #e67e22; /* Orange */
    --fdo-color: #3498db;     /* Bleu */
    --civil-color: #2ecc71;   /* Vert */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-color);
    color: var(--primary-text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

a {
    text-decoration: none;
    color: var(--accent-color);
}

/* Style de l'en-tête */
header {
    background-color: var(--surface-color);
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

header .container {
    display: flex;
    /* CORRIGÉ : Aligne le logo à gauche et le bouton à droite */
    justify-content: space-between;
    align-items: center;
}

.header-logo {
    max-height: 60px;
    width: auto;
}

.button-login-civil {
    background-color: var(--civil-color);
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.button-login-civil:hover {
    background-color: #27ae60;
}


/* --- AMÉLIORATION DE L'ACCUEIL CIVIL (index.php) --- */

.welcome-section {
    text-align: center;
    margin-bottom: 60px; /* Plus d'espace */
}

.welcome-section h2 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 0 15px rgba(3, 169, 244, 0.2); /* Lueur subtile */
}

.welcome-section p {
    font-size: 18px;
    color: var(--secondary-text-color);
    max-width: 700px;
    margin: 0 auto; /* Centrer le paragraphe */
}

.presentation-section {
    background: linear-gradient(135deg, #2a2a2a, var(--surface-color));
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--accent-color);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    padding: 40px;
    margin: 60px 0;
    border-radius: 8px;
    text-align: center;
}
.presentation-section h3 {
    margin-bottom: 15px;
    font-size: 26px;
    color: var(--accent-color);
}
.presentation-button {
    display: inline-block;
    background-color: var(--accent-color);
    color: white;
    padding: 15px 30px;
    border-radius: 5px;
    font-weight: bold;
    text-decoration: none;
    margin-top: 20px;
    transition: background-color 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
    border: 2px solid transparent;
}
.presentation-button:hover {
    background-color: transparent;
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: scale(1.05);
}
.presentation-button i {
    margin-right: 10px;
}

.tools-section {
    text-align: center;
    margin-top: 60px;
}
.tools-section h3 {
    font-size: 32px;
    margin-bottom: 40px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    display: inline-block;
}

.portals-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.portal-card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 320px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s;
    text-align: left;
}
.portal-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
    border-color: var(--civil-color);
}

.portal-card .card-content {
    padding: 25px;
}
.portal-card h4 {
    font-size: 20px;
    margin-bottom: 10px;
}
.portal-card p {
    color: var(--secondary-text-color);
    font-size: 16px;
}
.portal-card .card-footer {
    padding: 15px 25px;
    font-weight: 700;
    font-size: 16px;
    text-align: center;
}

/* unification des cartes outils avec la couleur verte */
.tools-section .portal-card {
    border-bottom: 4px solid var(--civil-color);
}
.tools-section .portal-card i {
    font-size: 28px;
    margin-bottom: 15px;
    color: var(--civil-color);
}
.tools-section .portal-card h4 {
    color: var(--civil-color);
}
.tools-section .portal-card .card-footer {
    background-color: rgba(46, 204, 113, 0.1);
    color: var(--civil-color);
}


/* --- STYLES DES AUTRES PAGES CIVILES --- */

/* ... (tous les autres styles que nous avons définis précédemment restent ici) ... */

/* Page Emotes (emotes.php) */
.emotes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}
.emote-card {
    background-color: var(--surface-color);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease;
}
.emote-card:hover {
    transform: translateY(-5px);
}
.emote-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background-color: var(--bg-color);
}
.emote-info {
    padding: 15px;
}
.emote-title {
    font-size: 18px;
    margin-bottom: 10px;
}
.emote-command-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-color);
    padding: 10px;
    border-radius: 5px;
}
.emote-command {
    font-family: monospace;
    font-size: 16px;
    color: var(--civil-color);
}
.copy-btn {
    background-color: var(--border-color);
    color: var(--primary-text-color);
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.copy-btn:hover {
    background-color: var(--civil-color);
}

.category-section {
    margin-bottom: 40px;
}

.category-title {
    font-size: 26px;
    color: var(--accent-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 25px;
}


/* Page Intervention (intervention.php) */
.intervention-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.share-code {
    background-color: var(--surface-color);
    padding: 10px 15px;
    border-radius: 8px;
    font-weight: bold;
}
.share-code span {
    color: var(--accent-color);
    font-family: monospace;
    font-size: 1.2em;
}

.personnages-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}
.personnage-card {
    background-color: var(--surface-color);
    border-radius: 8px;
    border-left: 4px solid var(--civil-color);
    overflow: hidden;
}
.personnage-role {
    padding: 20px;
    background-color: rgba(0,0,0,0.2);
    border-bottom: 1px solid var(--border-color);
    /* NOUVEAU : Curseur pour indiquer que c'est cliquable */
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.personnage-role:hover {
    background-color: rgba(0,0,0,0.3);
}

.role-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.role-header > div {
    display: flex;
    align-items: center;
    gap: 15px;
}
/* NOUVEAU : Style pour l'icône de déploiement */
.toggle-icon {
    font-size: 18px;
    color: var(--secondary-text-color);
    transition: transform 0.4s ease;
}
/* NOUVEAU : Rotation de l'icône quand la fiche est ouverte */
.collapsible.open .toggle-icon {
    transform: rotate(180deg);
}
.collapsible.open .personnage-form {
    padding: 20px;
    max-height: 2000px; /* Assez grand pour ne jamais couper le contenu */
    transition: max-height 1s ease-in, padding 0.5s ease-in;
}
.personnage-role h4 {
    font-size: 20px;
    color: var(--civil-color);
    margin: 0;
}
.personnage-role p {
    color: var(--secondary-text-color);
    font-style: italic;
    margin: 0;
}
.regenerate-personnage-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
}
.regenerate-personnage-btn:hover {
    background-color: #0288d1;
}
.regenerate-personnage-btn i {
    margin-right: 5px;
}
.personnage-role h4 {
    font-size: 20px;
    color: var(--civil-color);
    margin: 0;
}
.personnage-role p {
    color: var(--secondary-text-color);
    font-style: italic;
    margin: 0;
}

.regenerate-personnage-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
}
.regenerate-personnage-btn:hover {
    background-color: #0288d1;
}
.regenerate-personnage-btn i {
    margin-right: 5px;
}

.personnage-form {
    padding: 0 20px; /* Padding horizontal uniquement pour l'animation */
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease-out, padding 0.5s ease-out;
}
.personnage-form fieldset {
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
}
.personnage-form legend {
    padding: 0 10px;
    font-weight: bold;
    color: var(--accent-color);
}
.personnage-form .form-row {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}
.personnage-form .form-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 15px;
}
.personnage-form .form-group label {
    font-weight: 500;
    color: var(--secondary-text-color);
    margin-bottom: 5px;
    font-size: 14px;
    display: block;
}
.personnage-form input[type="text"],
.personnage-form textarea {
    width: 100%;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--primary-text-color);
    padding: 10px;
    border-radius: 5px;
    font-size: 15px;
    font-family: 'Roboto', sans-serif;
    transition: background-color 0.2s, border-color 0.2s;
}
.personnage-form input[type="text"]:focus,
.personnage-form textarea:focus {
    border-color: var(--accent-color);
    background-color: #2a2a2a;
    outline: none;
}
.personnage-form textarea {
    min-height: 80px;
    resize: vertical;
}

.save-personnage-btn {
    background-color: var(--civil-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 15px;
    font-weight: bold;
    transition: background-color 0.3s ease;
    margin-top: 20px;
    float: right;
}
.save-personnage-btn:hover {
    background-color: #27ae60;
}
.save-personnage-btn:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
}
.save-feedback {
    display: inline-block;
    margin-top: 25px;
    margin-right: 15px;
    font-weight: bold;
    float: right;
    color: var(--civil-color);
}

/* Pied de page général */
footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 40px;
    border-top: 1px solid var(--border-color);
    color: var(--secondary-text-color);
}

/* ... (tout le code CSS précédent reste le même) ... */

/* --- STYLES POUR LA GESTION DE PERSONNAGES --- */

.login-form-container {
    max-width: 450px;
    margin: 40px auto;
    padding: 30px;
    background-color: var(--surface-color);
    border-radius: 8px;
    border-left: 4px solid var(--civil-color);
}
.login-form .form-group {
    margin-bottom: 20px;
}
.login-form label {
    display: block;
    margin-bottom: 5px;
    text-align: left;
    color: var(--secondary-text-color);
}
.login-form input {
    width: 100%;
    padding: 10px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--primary-text-color);
    border-radius: 5px;
    font-size: 16px;
}
/* CORRECTION : Style manquant pour le bouton de connexion */
.login-form .submit-button {
    width: 100%;
}
.error-message {
    color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.1);
    border: 1px solid #e74c3c;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.gestion-container {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 30px;
    margin-top: 40px;
}
@media (max-width: 992px) {
    .gestion-container {
        grid-template-columns: 1fr;
    }
}

.content-section {
    background-color: var(--surface-color);
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
}
.content-section h3 {
    font-size: 22px;
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--civil-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}
.personnage-creation-form .form-group {
    margin-bottom: 15px;
}
.personnage-creation-form label {
    display: block;
    margin-bottom: 5px;
    color: var(--secondary-text-color);
}
.personnage-creation-form input,
.personnage-creation-form textarea,
.personnage-creation-form select { /* Ajout du select */
    width: 100%;
    padding: 10px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--primary-text-color);
    border-radius: 5px;
    font-size: 16px;
}
.personnage-creation-form textarea {
    resize: vertical;
}
.cancel-edit-btn {
    display: block;
    text-align: center;
    margin-top: 15px;
    color: var(--secondary-text-color);
}

.personnage-list-item {
    display: flex;
    flex-direction: column; /* Changement pour afficher l'historique en dessous */
    align-items: stretch;
    padding: 15px;
    border-radius: 5px;
    background-color: var(--bg-color);
    margin-bottom: 10px;
    border-left: 3px solid var(--civil-color);
}
.personnage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.personnage-info strong {
    display: block;
    font-size: 18px;
}
.personnage-info span {
    font-size: 14px;
    color: var(--secondary-text-color);
}
.personnage-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0; /* Empêche les boutons de passer à la ligne */
}
.btn-action {
    padding: 5px 10px;
    border-radius: 5px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
}
.btn-edit { background-color: var(--fdo-color); }
.btn-delete { background-color: #c0392b; }

/* NOUVEAU : Style pour l'historique des interventions */
.personnage-history {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}
.personnage-history h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: var(--secondary-text-color);
    font-weight: 500;
}
.personnage-history ul {
    list-style: none;
    padding-left: 10px;
}
.personnage-history li {
    margin-bottom: 5px;
}
.personnage-history a {
    text-decoration: none;
    color: var(--accent-color);
    font-size: 15px;
}
.personnage-history a:hover {
    text-decoration: underline;
}
.btn-action {
    padding: 5px 10px;
    border-radius: 5px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
}
.btn-edit { background-color: var(--fdo-color); }
.btn-delete { background-color: #c0392b; }