﻿:root {
    --primary-color: #336699;
    --background-color: #f4f7f9;
    --container-bg: #ffffff;
    --border-color: #e0e0e0;
    --text-color: #333;
    --text-light: #777;
    --accent-color: #007bff;
    --hover-bg: rgba(0,0,0,0.03);
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    /* Couleurs des départements */
    --dept-comptabilite-bg: #d1e7fd;
    --dept-site_web-bg: #d1f2e1;
    --dept-reseaux_sociaux-bg: #e9d8fd;
    --dept-contenus-bg: #fff3cd;
    --dept-devis-bg: #ffeedd; /* Orange Pastel */
    --dept-general-bg: #f0f2f5;
    --dept-important-bg: #dc3545;
    /* --- AJOUT COULEURS BOUTONS --- */
    --btn-orange-pastel: #ffe0b2; /* Orange pastel */
    --btn-orange-pastel-hover: #ffcc80;
    --btn-green-validate: #a5d6a7; /* Vert pour validation */
    --btn-green-validate-hover: #81c784;
    --btn-blue-send: #90caf9; /* Bleu pour envoi */
    --btn-blue-send-hover: #64b5f6;
    /* --- NOUVELLE COULEUR APPROBATION --- */
    --btn-orange-request: #fd7e14; /* Orange pour demande approbation */
    --btn-orange-request-hover: #f48c06;
}
* { box-sizing: border-box; }
html { height: 100%; }
body {
    font-family: var(--font-family);
    margin: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    height: 100%;
    overflow: hidden;
}

/* ================================================ */
/* STYLES DE BASE (Login, Modals...)                */
/* ================================================ */
.login-container {
    background-color: var(--container-bg);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 400px;
    text-align: center;
    margin: auto;
}
.login-container img { max-width: 150px; margin-bottom: 20px; }
.form-group { margin-bottom: 15px; text-align: left; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 14px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 12px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 16px; font-family: var(--font-family); }
.btn { width: 100%; padding: 12px; border: none; border-radius: 8px; background-color: var(--primary-color); color: white; font-size: 16px; font-weight: 600; cursor: pointer; transition: background-color 0.2s; position: relative; }
.btn:hover { opacity: 0.9; }
.btn-sm { padding: 5px 12px; font-size: 13px; width: auto; }
.alert { padding: 15px; margin-bottom: 20px; border-radius: 8px; text-align: left; }
.alert-danger { background-color: #f8d7da; color: #721c24; }
.alert-success { background-color: #d4edda; color: #155724; }
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: none; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: white; padding: 30px; border-radius: 12px; width: 90%; max-width: 500px; max-height: 90vh; overflow-y: auto;}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h2 { margin: 0; font-size: 20px; }
.close-modal { font-size: 24px; cursor: pointer; border: none; background: none; }
.empty-list-message, .no-conversation-message { text-align:center; color: #777; padding: 20px; font-style: italic; font-size: 14px; }

/* Styles pour le formulaire de devis */
.modal-content.devis-mode { background-color: var(--dept-devis-bg); }
#admin-upload-options { display: flex; gap: 20px; margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid #eee; }
#admin-upload-options label { font-weight: 500; cursor: pointer; }

#tfa_code {
    text-align: center;
    font-size: 24px;
    letter-spacing: 10px;
    padding-left: 20px; /* Compense le letter-spacing */
}

/* ================================================ */
/* STRUCTURE GLOBALE & VUE DESKTOP                  */
/* ================================================ */
.app-container { display: flex; width: 100vw; height: 100vh; background-color: var(--container-bg); }

.app-column {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    overflow: hidden;
}

.app-column.sidebar { width: 340px; min-width: 260px; max-width: 600px; border-right: 1px solid var(--border-color); flex-shrink: 0; }
.app-column.middle-column { flex: 1 1 50%; min-width: 300px; }
.app-column.right-column { flex: 1 1 0; min-width: 300px; } /* Correction pour le redimensionnement */

#resizer-v, #resizer-h { width: 5px; cursor: col-resize; background: #e0e0e0; flex-shrink: 0; user-select: none; z-index: 10; }
#resizer-h { border-left: 1px solid var(--border-color); border-right: 1px solid var(--border-color); }

.main-content-wrapper { display: none; flex-grow: 1; flex-direction: column; min-height: 0; }
.main-content-wrapper-placeholder { flex-grow: 1; background-color: #f8f9fa; }

.announcement-container-top { height: 160px; min-height: 80px; max-height: 50vh; border-bottom: 1px solid var(--border-color); flex-shrink: 0; overflow: auto;}
.resizer-h-announcement { height: 5px; cursor: row-resize; background: #e0e0e0; user-select: none; flex-shrink: 0;}
.announcements-container { display: flex; gap: 20px; width: 100%; height: 100%; padding: 15px; box-sizing: border-box; }
.announcement-card { display: flex; flex: 1; border: 1px solid #ddd; border-radius: 8px; overflow: hidden; background: #fff; min-width: 0; }
/* CORRECTION: Limiter la taille de l'image et permettre au texte de prendre le reste */
.announcement-thumb { flex-shrink: 0; max-width: 150px; /* Ou une autre valeur fixe si préféré */ width: 30%; /* Pourcentage pour s'adapter un peu */ }
.announcement-thumb img { height: 100%; width: 100%; object-fit: cover; /* cover plutôt que contain */ display: block; }
.announcement-content { flex-grow: 1; padding: 15px; font-size: 14px; min-width: 0; /* Important pour flexbox */ overflow-wrap: break-word; /* Permet au texte de passer à la ligne */ }
.announcement-placeholder { width: 100%; height: 100%; background-color: #f8f9fa; }

/* ================================================ */
/* SIDEBAR                                          */
/* ================================================ */
.sidebar-header { padding: 15px 20px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.logo-container { display: flex; align-items: center; gap: 10px; }
.logo { width: 90px !important; height: auto !important; }
.app-title { font-size: 24px; font-weight: bold; color: #333; }

/* Correction alignement Accueil / Déconnexion */
.header-actions { display: flex; align-items: center; gap: 10px; }
.logout-link { color: var(--text-light); text-decoration: none; font-size: 14px;}
.header-btn { background: none; border:none; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; color: var(--text-color); padding: 5px 10px; border-radius: 6px; }
.header-btn svg { color: var(--text-light); transition: color 0.2s; }
.header-btn:hover { background-color: var(--hover-bg); }
.header-btn:hover, .header-btn:hover svg { color: var(--primary-color); }
.logout-link.header-btn { text-decoration: none; }
.home-button-styled {
    background-color: var(--primary-color);
    color: white !important;
    padding: 8px 15px;
    border-radius: 8px;
    transition: background-color 0.2s;
}
.home-button-styled:hover {
    background-color: #2a5279; /* A darker shade of primary */
    color: white !important;
}
.home-button-styled svg {
    color: white !important;
}


.nav-tabs { display: flex; border-bottom: 1px solid var(--border-color); padding: 0 20px; }
.nav-tab { padding: 15px 20px; cursor: pointer; color: var(--text-light); font-weight: 500; display: flex; align-items: center; }
.nav-tab .icon { margin-right: 8px; height: 24px; width: 24px; }
.nav-tab.active { color: var(--primary-color); border-bottom: 2px solid var(--primary-color); }
.nav-tab.active .icon, .nav-tab:hover .icon { filter: none; }

#sidebar-content { flex-grow: 1; overflow-y: auto; display: flex; flex-direction: column; }
.top-action-container { padding: 15px 20px; border-bottom: 1px solid var(--border-color); }
.new-item-btn { width: 100%; padding: 10px; border: none; border-radius: 8px; background-color: var(--primary-color); color: white; font-size: 15px; font-weight: 600; cursor: pointer; text-align: center; }
.new-item-btn:hover { opacity: 0.9; }
#global-payment-request-btn { margin-top: 10px; background-color: #f48c06; }

#department-legend { padding: 8px 20px; font-size: 11px; border-bottom: 1px solid var(--border-color); display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; background-color: #f8f9fa;}
#department-legend b { margin-right: 5px; }
.legend-item { padding: 2px 6px; border-radius: 4px; }

.conversations-list { flex-grow: 1; overflow-y: auto; }
.client-group-header { padding: 15px 20px; cursor: pointer; font-weight: bold; background-color: #f0f2f5; border-bottom: 1px solid var(--border-color); display: flex; align-items: center;}
.client-group-header:hover { background-color: #e9ecef; }
.client-conversations { display: none; padding-left: 15px; border-bottom: 1px solid var(--border-color); }
.conversation-item { padding: 15px 20px; cursor: pointer; border-bottom: 1px solid var(--border-color); }
.conversation-item:last-child { border-bottom: none; }
.conversation-item-inner { display: flex; justify-content: space-between; align-items: center; width: 100%;}
.conversation-details { flex-grow: 1; overflow: hidden; display: flex; align-items: center; }
.subject { font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.action-icon { opacity: 0; transition: opacity 0.2s; flex-shrink: 0; }
.conversation-item:hover .action-icon { opacity: 0.7; }
.conversation-icon { flex-shrink: 0; margin-right: 12px; color: var(--text-light); height: 20px; width: 20px; }
.conversation-item.active { box-shadow: inset 4px 0 0 0 var(--primary-color); background-color: #e9ecef !important; }
.conversation-item.active:hover { background-color: #e9ecef !important; }
.unread-client-icon { display: inline-block; color: #28a745; margin-left: 8px; font-size: 16px; vertical-align: middle; }
.unread-badge { font-size: 12px; color: var(--primary-color); margin-left: 8px; }
.conversation-item.unread .subject { font-weight: bold; color: var(--primary-color); }

.sidebar-footer { padding: 10px 20px; border-top: 1px solid var(--border-color); background-color: #f8f9fa; }
.install-app-btn { display: none; width: 100%; padding: 12px; border: none; border-radius: 8px; background-color: #28a745; color: white; font-size: 15px; font-weight: 600; cursor: pointer; }
.install-app-btn:hover { opacity: 0.9; }

/* ================================================ */
/* ADMIN DASHBOARD                                  */
/* ================================================ */
#dashboard-content { padding: 20px; overflow-y: auto; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; }
.kpi-card { background-color: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.kpi-card.clickable { cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; }
.kpi-card.clickable:hover { transform: translateY(-5px); box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.kpi-header { display: flex; align-items: center; gap: 15px; margin-bottom: 15px; }
.kpi-icon { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.kpi-icon.payments { background-color: #007bff; }
.kpi-icon.messages { background-color: #28a745; }
.kpi-icon.tasks { background-color: #ffc107; }
.kpi-icon.manage-tasks { background-color: #6f42c1; }
.kpi-icon.ratings-new { background-color: #fd7e14; }
.kpi-icon.templates-new { background-color: #17a2b8; }
.kpi-icon svg { width: 20px; height: 20px; }
.kpi-title { font-size: 16px; margin: 0; color: #555; }
.kpi-value { font-size: 28px; font-weight: 600; margin: 0; }
.kpi-value-small { font-size: 14px; color: #777; margin: 10px 0 0 0; }
.kpi-body { margin-top: 15px; font-size: 14px; max-height: 150px; overflow-y: auto; }
.kpi-list { list-style: none; padding-left: 0; margin: 0; }
.kpi-list li { padding: 5px 0; }
.payment-details-list { list-style: none; padding: 0; margin: 0; }
.payment-details-list li { display: flex; justify-content: space-between; padding: 5px 0; }
.payment-details-list a { text-decoration: none; color: var(--primary-color); font-weight: 500; }

.kpi-task-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.kpi-task-item:last-child { border-bottom: none; }
.kpi-task-item .task-details { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.kpi-task-item .task-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-task-item .task-meta { font-size: 12px; color: #777; }
.kpi-task-item .task-client { font-weight: 600; }
.kpi-task-item .delete-dashboard-task { flex-shrink: 0; margin-left: 10px; }

/* ================================================ */
/* ADMIN TASK MANAGER                               */
/* ================================================ */
#tasks-manager-content { padding: 20px; }
.back-btn { background: none; border: none; color: var(--primary-color); cursor: pointer; font-size: 14px; margin-bottom: 15px; padding: 0; }
#new-task-form { display: flex; gap: 10px; margin-bottom: 20px; }
#new-task-form input { flex-grow: 1; }
#new-task-form button { width: auto; }
#tasks-list { list-style: none; padding: 0; margin: 0; }
#tasks-list li { display: flex; align-items: center; padding: 10px; background: #fff; border-radius: 8px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
#tasks-list li.completed .task-title { text-decoration: line-through; color: #aaa; }
.task-title { flex-grow: 1; }
.task-date { font-size: 12px; color: #777; margin: 0 15px; }
.task-actions { display: flex; gap: 5px; }

/* ================================================ */
/* ADMIN TEMPLATES MANAGER                          */
/* ================================================ */
#templates-manager-container {
    padding: 20px;
}
.item-list { list-style: none; padding: 0; margin: 0; }
.item-list li { display: flex; justify-content: space-between; align-items: center; padding: 10px; background: #fff; border-radius: 8px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.item-list li span { flex-grow: 1; padding-right: 15px; }
.item-list li div { display: flex; gap: 5px; }

/* ================================================ */
/* CHAT & MESSAGES                                  */
/* ================================================ */
#chat-wrapper { flex-grow: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-header { padding: 15px 20px; border-bottom: 1px solid var(--border-color); font-weight: 600; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
#chat-header-title-container { display: flex; align-items: center; gap: 10px; overflow: hidden; }
#chat-header-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#chat-header-client-info { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
#chat-header-client-info span { white-space: nowrap; }
#chat-header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.messages-container { flex-grow: 1; padding: 20px; overflow-y: auto; }
.message-form-container { display: flex; align-items: flex-end; gap: 10px; padding: 10px 15px; border-top: 1px solid var(--border-color); background-color: #f8f9fa; flex-shrink: 0; }
#message-form { flex-grow: 1; display: flex; border: 1px solid #ddd; border-radius: 22px; padding: 0; background-color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
#attachment-btn, #template-btn { align-self: center; padding: 8px; font-size: 20px; background: none; border: none; cursor: pointer; color: var(--text-light); }
#template-btn { padding-left: 15px; }
#message-input {
    border: none;
    outline: none;
    resize: none; /* Allow vertical resize */
    background: transparent;
    padding: 10px 15px;
    font-size: 16px;
    line-height: 1.4;
    width: 100%;
    box-sizing: border-box;
    /* --- DEBUT CORRECTION BUG 1 : Hauteur Textarea --- */
    min-height: calc(1.4em + 20px); /* Hauteur minimale basée sur la police + padding */
    max-height: 250px; /* Limite la hauteur maximale */
    overflow-y: auto; /* Ajoute une scrollbar si le contenu dépasse max-height */
    /* --- FIN CORRECTION BUG 1 --- */
}
#send-btn-container { padding: 0; }
#send-btn { width: auto; padding: 8px 15px; }
#attachment-preview { display: none; align-items: center; gap: 8px; font-size: 13px; margin: 8px 15px 8px 45px; }
#preview-cancel-btn { background: none; border: none; cursor: pointer; font-size: 16px; }

/* --- AJOUT STYLE BOUTON "SUJET RESOLU" (Bug 3) --- */
#close-conversation-btn {
    background-color: var(--btn-orange-pastel);
    color: var(--text-color); /* Couleur de texte sombre pour contraste */
    border: 1px solid #ffcc80; /* Bordure légèrement plus foncée */
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: 600;
    transition: background-color 0.2s;
}
#close-conversation-btn:hover {
    background-color: var(--btn-orange-pastel-hover);
}
#close-conversation-btn svg {
    color: var(--text-color); /* Assurer que l'icône a la bonne couleur */
}
/* --- FIN AJOUT STYLE --- */

.client-avatar, .message-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #ddd;
    cursor: pointer;
    flex-shrink: 0;
}
.client-group-header .client-avatar { margin-right: 8px; }
.message { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.message.sent { flex-direction: row-reverse; }
.message-content { max-width: 80%; width: fit-content; background-color: #ffffff; border-radius: 12px; padding: 10px 15px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); color: #1f1f1f; }
.message.sent .message-content { background-color: #e1f5fe; color: #1f1f1f; }
.message-meta { font-size: 0.75em; margin-top: 5px; color: #555; text-align: right; }
.message.received .message-meta { text-align: left; }
.message .attachment-link { display: block; margin-top: 8px; padding: 8px 12px; background-color: rgba(0,0,0,0.05); border-radius: 8px; text-decoration: none; color: inherit; }
.message.sent .attachment-link { background-color: rgba(255,255,255,0.1); }
.attachment-image { max-width: 100px; border-radius: 8px; margin-top: 5px; border: 1px solid #ddd; }

/* --- DEBUT AJOUT STYLES HISTORIQUE ADMIN --- */
.history-toggle-btn {
    padding: 10px 20px;
    cursor: pointer;
    background-color: #f8f9fa; /* Léger fond pour le distinguer */
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-light);
    font-weight: 500;
    text-align: center;
}
.history-toggle-btn:hover {
    background-color: #e9ecef;
    color: var(--text-color);
}
.client-history-conversations {
    /* Styles pour le conteneur déplié, s'il faut */
    /* Par exemple, une bordure ou un fond légèrement différent */
    /* border-left: 3px solid #ced4da; */
    /* background-color: #fafafa; */
    padding-left: 5px; /* Petite indentation si souhaité */
}
/* Optionnel: griser un peu plus les conversations dans l'historique déplié */
.client-history-conversations .conversation-item.closed {
    opacity: 0.8;
}
/* --- FIN AJOUT STYLES HISTORIQUE ADMIN --- */

/* ================================================ */
/* CLIENT SPACE & PAYMENTS                          */
/* ================================================ */
#client-space-wrapper { flex-grow: 1; display: flex; flex-direction: column; background-color: #f8f9fa; }
.client-space-header { padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); background: #fff; flex-shrink: 0; gap: 10px; }
#client-space-header-avatar img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
#client-space-header-title { flex-grow: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600; }
.client-space-header .header-btn, .client-space-header .btn-sm { padding: 5px 10px; flex-shrink: 0; }
#client-payment-requests { padding: 20px; overflow-y: auto; flex-grow: 1; }
.payment-request-card { border-radius: 12px; padding: 15px; margin-bottom: 15px; border: 1px solid rgba(0,0,0,0.08); overflow: hidden; display: flex; gap: 15px; align-items: flex-start; }
.payment-request-card.status-pending { background-color: #fff3cd; border-left: 5px solid #ffc107; }
.payment-request-card.status-processing { background-color: #ffedd5; border-left: 5px solid #fd7e14; }
.payment-request-card.status-paid { background-color: #d1f2e1; border-left: 5px solid #28a745; }
.pr-image { flex-shrink: 0; width: 120px; height: 120px; }
.pr-image img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.pr-content { flex-grow: 1; display: flex; flex-direction: column; justify-content: space-between; min-height: 120px; }
.pr-content-top { display: flex; justify-content: space-between; align-items: flex-start; width: 100%; }
.pr-main-info { flex-grow: 1; padding-right: 10px; }
.pr-title { font-weight: bold; margin: 0 0 5px 0; font-size: 1.1em; }
.pr-amount { font-size: 1.1em; font-weight: 600; color: var(--primary-color); margin: 0 0 5px 0; }
.pr-date { font-size: 0.8em; color: #666; }
.pr-status-wrapper { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; }
.pr-status { font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 20px; color: #333; text-transform: uppercase; flex-shrink: 0; }
.status-pending .pr-status { background-color: #ffc107; }
.status-processing .pr-status { background-color: #fd7e14; color: white; }
.status-paid .pr-status { background-color: #28a745; color: white; }
.invoice-thumbnail-container { margin-top: 8px; position: relative; }
.invoice-thumbnail { width: 100px; height: 100px; cursor: pointer; }
.invoice-thumbnail.not-clickable { cursor: default; filter: grayscale(1); opacity: 0.7; }
.invoice-thumbnail-container .delete-invoice-btn { position: absolute; top: -5px; right: -5px; background: #dc3545; color: white; border: none; border-radius: 50%; width: 18px; height: 18px; font-size: 12px; line-height: 18px; text-align: center; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; }
.pr-description { font-size: 14px; margin: 5px 0; -webkit-box-orient: vertical; display: -webkit-box; -webkit-line-clamp: 2; overflow: hidden; text-overflow: ellipsis; }
.pr-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.admin-controls { display: flex; gap: 10px; align-items: center; }

/* ================================================ */
/* DOCUMENTS & RGPD                                 */
/* ================================================ */
#documents-list-container, #security-container, #settings-container, #announcements-settings-container { padding: 20px; overflow-y: auto; }
#rgpd-download-section { text-align: center; padding: 10px; margin-bottom: 20px; background-color: #f8f9fa; border-radius: 8px; }
#rgpd-download-section span { margin-right: 10px; color: #666; font-size: 14px; }
#rgpd-download-btn { width: auto; padding: 8px 15px; font-size: 14px; background-color: #6c757d; }
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 20px; }
.file-item { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--text-color); padding: 10px; border-radius: 8px; transition: background-color 0.2s; position: relative; }
.file-item:hover { background-color: #f0f2f5; }
.file-thumbnail { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid #ddd; }
.file-icon { width: 80px; height: 80px; display: flex; align-items: center; justify-content: center; background-color: #e9ecef; border-radius: 8px; font-size: 36px; color: #6c757d; }
.fa-file-pdf { color: #dc3545; }
.fa-file-word { color: #0d6efd; }
.fa-file-excel { color: #198754; }
.file-name { font-size: 13px; font-weight: 500; margin-top: 8px; text-align: center; word-break: break-all; }
.file-date { font-size: 11px; color: #777; margin-top: 4px; }
.file-item .delete-client-file { position: absolute; top: 0; right: 0; display: none; }
.file-item:hover .delete-client-file { display: block; }


/* ================================================ */
/* TABLES & ADMIN                                   */
/* ================================================ */
.table-container { padding: 20px; flex-grow: 1; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
th { font-size: 14px; color: var(--text-light); }
.action-btn { background: none; border: none; cursor: pointer; font-size: 18px; padding: 5px; opacity: 0.7; }
.action-btn:hover { opacity: 1; }
.btn-danger { color: #dc3545; }

/* Ajoute cette règle juste après pour cibler le bouton spécifique */
#reset-ratings-btn {
    color: white; /* Ou #ffffff */
}
.announcement-form-wrapper { display: flex; gap: 20px; margin-bottom: 20px; }
.announcement-form { flex: 1; border: 1px solid #ccc; padding: 15px; border-radius: 8px; min-width: 250px; }
.current-announcement-img { display: block; width: 100%; max-width: 100%; height: auto; max-height: 150px; margin-bottom: 10px; border-radius: 4px; object-fit: contain; border: 1px solid #ddd; background-color: #f9f9f9; }

/* --- DEBUT CORRECTION AVATAR ADMIN --- */
.client-logo-thumbnail {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    margin-right: 8px;
    border: 1px solid #ddd;
}
/* --- FIN CORRECTION AVATAR ADMIN --- */


/* ================================================ */
/* DEVIS & MAQUETTES                                */
/* ================================================ */
#mockup-zone-container { padding: 10px 20px 0; flex-shrink: 0; }
.mockup-zone { display: flex; justify-content: space-around; gap: 20px; padding: 10px; background-color: #e9ecef; border-radius: 12px; }
.mockup-item { text-align: center; position: relative; }
.mockup-item img { width: 100%; max-width: 200px; height: auto; border: 2px solid #ccc; border-radius: 8px; }
.mockup-label { font-size: 13px; font-weight: 500; margin-top: 5px; }
.mockup-validated .mockup-item-content { position: relative; }
.mockup-validated img { filter: grayscale(80%); opacity: 0.6; }
.mockup-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) rotate(-15deg); background: rgba(40, 167, 69, 0.8); color: white; padding: 10px 20px; font-weight: bold; border-radius: 8px; font-size: 1.2em; pointer-events: none; }
#mockup-previews { display: flex; justify-content: space-around; margin-bottom: 15px; }
.mockup-preview-item { position: relative; width: 45%; }
.mockup-preview-item img { width: 100%; border-radius: 8px; border: 1px solid #ddd; }
.delete-mockup-btn { position: absolute; top: 5px; right: 5px; background: rgba(255,0,0,0.7); color: white; border: none; border-radius: 50%; width: 24px; height: 24px; font-size: 16px; line-height: 24px; text-align: center; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* Zone des fichiers joints dans le chat "Devis" */
.devis-attachment-zone {
    background-color: rgba(0,0,0,0.03);
    border: 1px solid rgba(0,0,0,0.07);
    padding: 15px;
    margin: 15px 0;
    border-radius: 12px;
}
.devis-attachment-zone h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    color: var(--text-light);
}
.attachments-grid {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}
.attachment-item,
.attachment-item-placeholder {
    width: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
}
.attachment-item img,
.attachment-item-placeholder img,
.attachment-item .file-icon {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #ddd;
    background-color: #fff;
    margin-bottom: 5px;
}
.attachment-item span,
.attachment-item-placeholder span {
    font-size: 12px;
    text-align: center;
    word-break: break-all;
    line-height: 1.2;
}

/* --- DEBUT CORRECTION AVATARS --- */
.logo-display-wrapper {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    position: relative;
}
.logo-display-wrapper h3 {
    margin-top: 0;
    font-size: 16px;
    color: var(--primary-color);
}
.current-client-logo {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 50%;
    margin-top: 10px;
    border: 3px solid var(--primary-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.delete-logo-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 20px;
    line-height: 30px;
    text-align: center;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    transition: background 0.2s;
}
.delete-logo-btn:hover {
    background: #c82333;
}
.logo-preview-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    margin-bottom: 10px;
}
.current-logo-preview {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid #ddd;
}
#delete-client-logo-admin-btn,
#delete-admin-avatar-btn {
    width: 30px !important;
    height: 30px !important;
    font-size: 20px !important;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}
/* --- FIN CORRECTION AVATARS --- */

/* --- DEBUT STYLES MAQUETTES (MODAL ADMIN & CLIENT) --- */

/* Mise en page 2 colonnes Modal Admin */
.mockup-validation-columns {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}
.mockup-validation-column {
    flex: 1;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}
.mockup-validation-separator {
    width: 1px;
    background-color: var(--border-color);
    flex-shrink: 0;
}
.mockup-validation-column h3 {
    font-size: 16px;
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* Bouton Envoyer Maquette (Bleu) */
#upload-mockup-form .btn {
    background-color: var(--btn-blue-send);
    color: var(--text-color);
    border: 1px solid #64b5f6;
}
#upload-mockup-form .btn:hover {
    background-color: var(--btn-blue-send-hover);
    opacity: 1; /* Override default opacity change */
}

/* Bouton Valider Admin (Vert) */
.btn-validate-admin {
    background-color: var(--btn-green-validate);
    color: var(--text-color);
    border: 1px solid #81c784;
}
.btn-validate-admin:hover {
    background-color: var(--btn-green-validate-hover);
    opacity: 1; /* Override default opacity change */
}

/* Bouton Demander Approbation (Orange) */
.btn-request-approval {
    background-color: var(--btn-orange-request);
    color: white;
    border: 1px solid var(--btn-orange-request-hover);
}
.btn-request-approval:hover {
    background-color: var(--btn-orange-request-hover);
    opacity: 1;
}
.btn-request-approval:disabled {
    background-color: #ccc;
    border-color: #bbb;
    color: #777;
    opacity: 0.7;
}

/* Bouton Validation Client (Vert, sous les maquettes) */
.btn-validate-client {
    display: block; /* Prend toute la largeur */
    width: auto; /* Ajuste la largeur au contenu */
    max-width: 400px; /* Limite la largeur max */
    margin: 15px auto; /* Centrer horizontalement */
    padding: 12px 20px;
    font-size: 16px;
    font-weight: 600;
    background-color: var(--btn-green-validate);
    color: var(--text-color);
    border: 1px solid #81c784;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s;
}
.btn-validate-client:hover {
    background-color: var(--btn-green-validate-hover);
}

/* Modal de confirmation client */
#client-mockup-approval-modal .modal-content {
    max-width: 400px; /* Plus petit modal */
    text-align: center;
}
#client-mockup-approval-modal p {
    font-size: 16px;
    line-height: 1.5;
    margin-bottom: 25px;
}
.client-approval-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}
.client-approval-buttons .btn {
    width: auto; /* Taille auto pour les boutons */
    flex-grow: 1;
}
/* Bouton "Oui, valider" (Vert) */
#client-approval-confirm-btn {
    background-color: var(--btn-green-validate);
    color: var(--text-color);
    border: 1px solid #81c784;
}
#client-approval-confirm-btn:hover {
    background-color: var(--btn-green-validate-hover);
    opacity: 1;
}
/* Bouton "Annuler" (Gris) */
#client-approval-cancel-btn {
    background-color: #6c757d;
    border: 1px solid #5a6268;
}
#client-approval-cancel-btn:hover {
    background-color: #5a6268;
    opacity: 1;
}

/* --- FIN STYLES MAQUETTES --- */


/* ================================================ */
/* MISC & RESPONSIVE                                */
/* ================================================ */
.mobile-nav-btn { display: none; }
.star-rating {
    color: #ffc107;
    font-size: 28px;
}

.star-rating-modal {
    direction: rtl;
    display: inline-block;
    padding: 0;
    margin: 0;
}
.star-rating-modal input[type=radio] {
    display: none;
}
.star-rating-modal label {
    color: #ddd;
    font-size: 40px;
    padding: 0 5px;
    cursor: pointer;
    transition: color 0.2s;
}
.star-rating-modal input[type="radio"]:checked ~ label,
.star-rating-modal label:hover,
.star-rating-modal label:hover ~ label {
    color: #ffc107;
}

/* Spinner pour les boutons */
.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
  margin: 0 auto;
}
/* Spinner pour boutons sombres (si nécessaire) */
.btn-validate-admin .spinner,
.btn-request-approval .spinner,
.btn-validate-client .spinner,
#client-approval-confirm-btn .spinner {
    border: 2px solid rgba(0,0,0,0.2);
    border-top-color: var(--text-color);
}
.btn-request-approval .spinner {
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
}


@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1024px) {
    .app-column.sidebar { width: 280px; min-width: 240px; }
    .announcement-form-wrapper { flex-direction: column; }
}

@media (max-width: 768px) {
    body { overflow: auto; }
    .app-container { flex-direction: column; height: auto; width: 100%; }
    .app-column { width: 100% !important; height: auto; min-width: 0 !important; border: none !important; overflow: visible; }
    .app-column.sidebar { height: 100vh; max-width: 100%; }
    .app-column.middle-column, .app-column.right-column { display: none; }
    .app-container.show-chat .sidebar { display: none; }
    .app-container.show-chat .middle-column { display: flex; height: 100vh; }
    .app-container.show-chat .right-column { display: none; }
    .app-container.show-client-space .sidebar { display: none; }
    .app-container.show-client-space .middle-column { display: none; }
    .app-container.show-client-space .right-column { display: flex; height: 100vh; }
    #resizer-v, #resizer-h, .resizer-h-announcement { display: none; }
    .login-container { padding: 20px; box-shadow: none; max-width: 100%; margin: 0; border-radius: 0; height: 100vh; display: flex; flex-direction: column; justify-content: center; }
    .nav-tabs { justify-content: space-around; padding: 0; }
    .nav-tab { flex-grow: 1; justify-content: center; padding: 15px 10px; }
    .tab-text { display: none; }
    .icon { margin-right: 0; }
    .main-content-wrapper { display: flex; }
    .main-content-wrapper-placeholder { display: none; }
    .modal-content { width: 95%; margin: auto; max-width: 95%; max-height: 95vh; padding: 20px; }
    .payment-request-card { flex-direction: column; }
    .pr-image { width: 100%; height: 150px; }
    .mobile-nav-btn { display: inline-flex; background: none; border: 2px solid #333; color: #333; cursor: pointer; width: 40px; height: 40px; border-radius: 50%; align-items: center; justify-content: center; transition: background-color 0.2s, color 0.2s; }
    .mobile-nav-btn:hover, .mobile-nav-btn:active { background-color: #333; color: #fff; }
    .mobile-nav-btn svg { width: 22px; height: 22px; }

    /* CORRECTION: Header Mobile */
    .chat-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 10px;
    }
    .client-space-header {
        display: flex;
        justify-content: space-between; /* Change pour mieux espacer les éléments restants */
        align-items: center;
        padding: 8px 10px;
        gap: 10px;
    }

    #chat-header-title-container,
    #client-space-header-title { display: none; } /* Cacher les conteneurs de titre */
    #chat-header-client-info span { display: none; } /* Cacher le nom à côté de l'avatar dans le chat */
    #chat-header-client-info .client-avatar { margin-right: 0; } /* Supprimer marge si nom caché */

    #change-logo-btn span { display: none; } /* Cacher le texte des boutons */
    #change-logo-btn { padding: 8px; /* Ajuster padding si besoin */ }

    /* Réorganiser les éléments restants */
    .chat-header { order: 0; } /* Retour à gauche */
    #chat-header-client-info { order: 1; /* Avatar au centre gauche (après retour) */ }
    #chat-header-actions { order: 2; margin-left: auto; /* Pousse les actions à droite */ display: flex; align-items: center; gap: 5px; } /* Pour Sujet Résolu */
    #mobile-nav-to-client-space { order: 3; } /* Icône espace client tout à droite */

    .client-space-header { order: 0; } /* Retour à gauche */
    #client-space-header-avatar { order: 1; /* Avatar au centre gauche (après retour) */ flex-shrink: 0; }
    #change-logo-btn { order: 2; margin-left: auto; /* Pousse le bouton avatar à droite */ }

    .mockup-zone { flex-direction: column; }
    .mockup-item { max-width: 100%; }
    .attachments-grid { gap: 10px; flex-wrap: wrap; }
    .attachment-item, .attachment-item-placeholder { width: calc(33.33% - 10px); min-width: 80px; }
    .attachment-item img, .attachment-item-placeholder img, .attachment-item .file-icon { height: 60px; }
    
    /* === LA RÈGLE QUI CACHE LE TEXTE SUR MOBILE === */
    .header-actions .header-btn span { display: none; }
    /* ============================================== */
    
    .client-avatar, .message-avatar img {
        width: 36px;  /* Tu peux mettre la taille que tu veux pour le mobile ici */
        height: 36px;
    }

    /* Styles approbation maquette mobile */
    .mockup-validation-columns { flex-direction: column; }
    .mockup-validation-separator { display: none; }
    .client-approval-buttons { flex-direction: column; }

}