/* STYLE DASHBOARD ADMINISTRATION */

#adminPanel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f0f2f5;
    z-index: 500;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    padding: 20px;
}

.admin-header {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.admin-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 800;
    color: #386641;
    font-size: 1.8rem;
}

.admin-controls {
    display: flex;
    gap: 10px;
}

.btn-admin {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
}

.btn-back { background-color: #eee; color: #333; }
.btn-logout { background-color: #c5221f; color: white; }
.btn-refresh { background-color: #386641; color: white; }

/* ONGLETS MODERNES */
.admin-tabs-modern {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0;
}

.admin-tab-btn {
    background: none;
    border: none;
    padding: 12px 20px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
}

.admin-tab-btn:hover {
    color: #386641;
    background-color: #f0fdf4;
    border-radius: 6px 6px 0 0;
}

.admin-tab-btn.active {
    color: #386641;
    border-bottom-color: #386641;
}

.tab-icon { font-size: 1.2rem; }

.badge-count {
    background-color: #c5221f;
    color: white;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 5px;
}

/* MESSAGERIE (SPLIT VIEW) */
.messaging-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    height: 100%;
    min-height: 600px;
}

.msg-list-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.msg-list-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    gap: 5px;
}

.msg-filter-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid #eee;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
}

.msg-filter-btn.active {
    background-color: #386641;
    color: white;
    border-color: #386641;
}

.msg-list-items {
    overflow-y: auto;
    flex-grow: 1;
}

.msg-item {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
}

.msg-item:hover { background-color: #f9fafb; }
.msg-item.selected { background-color: #f0fdf4; border-left: 4px solid #386641; }
.msg-item.unread { font-weight: bold; background-color: #fff; }
.msg-item.unread .msg-subject { color: #386641; }

/* Style pour les messages envoyés par l'admin (onglet Envoyés) */
.msg-item.outgoing { border-left: 4px solid #ddd; }
.msg-item.outgoing .msg-subject { color: #666; }

.msg-meta { font-size: 0.8rem; color: #888; margin-bottom: 4px; display: flex; justify-content: space-between; }
.msg-subject { font-size: 1rem; margin-bottom: 4px; display: block; }
.msg-preview { font-size: 0.85rem; color: #666; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.msg-detail-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    padding: 30px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.msg-detail-header {
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.msg-detail-header h2 { margin: 0 0 10px 0; font-size: 1.5rem; color: #333; }

.msg-detail-body {
    font-family: 'Open Sans', sans-serif;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
    margin-bottom: 30px;
    flex-grow: 1;
}

.msg-reply-area {
    background: #f9fafb;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #eee;
}

.reply-option-btn {
    padding: 8px 15px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
}

.reply-option-btn.active {
    background-color: #386641;
    color: white;
    border-color: #386641;
}

.admin-reply-textarea {
    width: 100%;
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-family: inherit;
    margin-top: 10px;
    box-sizing: border-box;
}

/* STATS & USERS (Existant) */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}
.stat-card { background: white; padding: 20px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); text-align: center; }
.stat-number { font-size: 2.5rem; font-weight: 800; color: #386641; display: block; }
.stat-label { color: #666; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px; }

.users-container { background: white; border-radius: 12px; padding: 20px; box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.users-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.search-box input { padding: 10px; border: 1px solid #ccc; border-radius: 6px; width: 300px; font-family: 'Open Sans', sans-serif; }
.admin-table { width: 100%; border-collapse: collapse; font-family: 'Open Sans', sans-serif; }
.admin-table th { text-align: left; padding: 15px; background-color: #f8f9fa; color: #555; font-weight: 600; border-bottom: 2px solid #eee; }
.admin-table td { padding: 15px; border-bottom: 1px solid #eee; vertical-align: middle; }

.status-badge { padding: 5px 10px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; }
.status-active { background-color: #dcfce7; color: #166534; }
.status-inactive { background-color: #fee2e2; color: #991b1b; }
.status-expiring { background-color: #fef3c7; color: #92400e; }

.action-cell { display: flex; flex-direction: column; gap: 5px; }
.action-row { display: flex; gap: 5px; }
.btn-icon { padding: 5px 8px; font-size: 0.75rem; border: 1px solid #ddd; background: white; border-radius: 4px; cursor: pointer; font-weight: bold; }
.btn-icon:hover { background: #f5f5f5; }
.btn-icon.warning { color: #d97706; border-color: #d97706; }
.btn-icon.warning:hover { background: #fffbeb; }
.client-link { color: #2563eb; cursor: pointer; text-decoration: underline; }
.client-link:hover { color: #1d4ed8; }

.add-user-form { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr 1fr auto; gap: 10px; background: #f0f9f0; padding: 15px; border-radius: 8px; margin-bottom: 20px; align-items: end; }
.add-user-form input, .add-user-form select { padding: 8px; border: 1px solid #ccc; border-radius: 4px; width: 100%; }
.admin-toggle-btn { position: fixed; bottom: 20px; right: 20px; background-color: #333; color: white; width: 50px; height: 50px; border-radius: 50%; display: flex; justify-content: center; align-items: center; cursor: pointer; box-shadow: 0 4px 15px rgba(0,0,0,0.3); z-index: 400; font-size: 1.5rem; transition: transform 0.2s; }
.admin-toggle-btn:hover { transform: scale(1.1); }

/* --- STYLE FICHE CLIENT --- */
.client-modal-wide { max-width: 1000px !important; width: 95%; text-align: left; max-height: 90vh; overflow-y: auto; display: flex; flex-direction: column; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background-color: #fdfdfd; }
.client-modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 35px; margin-top: 20px; }
.client-modal-grid input, .client-modal-grid select, .client-modal-grid textarea { width: 100%; box-sizing: border-box; max-width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.95rem; transition: border-color 0.2s; background-color: white; }
.client-modal-grid input:focus, .client-modal-grid textarea:focus { border-color: #386641; outline: none; box-shadow: 0 0 0 3px rgba(56, 102, 65, 0.1); }
.client-modal-grid label { display: block; font-size: 0.85rem; font-weight: 600; color: #4b5563; margin-bottom: 6px; }
.client-modal-grid textarea { resize: vertical; }
.modal-section-title { font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 1.1rem; color: #1f2937; border-bottom: 2px solid #e5e7eb; padding-bottom: 10px; margin-bottom: 20px; display: flex; align-items: center; gap: 8px; }
.grid-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.control-group { margin-bottom: 15px; }
.input-prefix-group { display: flex; align-items: center; border: 1px solid #d1d5db; border-radius: 6px; overflow: hidden; width: 100%; background-color: white; }
.input-prefix-group:focus-within { border-color: #386641; box-shadow: 0 0 0 3px rgba(56, 102, 65, 0.1); }
.input-prefix-group span { background: #f3f4f6; padding: 10px 12px; color: #6b7280; font-size: 0.9rem; border-right: 1px solid #d1d5db; white-space: nowrap; font-weight: 500; }
.input-prefix-group input { border: none !important; border-radius: 0 !important; padding: 10px 12px !important; flex-grow: 1; width: auto; box-shadow: none !important; }
.modal-footer-actions { display: flex; gap: 12px; margin-top: 30px; padding-top: 20px; border-top: 1px solid #e5e7eb; justify-content: flex-end; background: #f9fafb; margin-left: -30px; margin-right: -30px; margin-bottom: -30px; padding: 20px 30px; border-radius: 0 0 8px 8px; }
@media (max-width: 900px) { .client-modal-grid { grid-template-columns: 1fr; gap: 20px; } .client-modal-wide { width: 100%; height: 100%; max-height: 100vh; border-radius: 0; padding: 15px; } .modal-footer-actions { margin: 20px -15px -15px -15px; padding: 15px; } }

/* MINI STATS DANS FICHE CLIENT */
.stat-box-mini {
    flex: 1;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
}

.stat-box-mini .stat-label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
}

.stat-box-mini .stat-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: #386641;
}