/* ========================================
   INTERFACE CHAT - chat.css
   ======================================== */

/* Container principal */
.gcph-chat-interface {
    display: flex !important;
    height: 700px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Sidebar */
.gcph-chat-sidebar {
    width: 320px;
    border-right: 2px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
}

.gcph-chat-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 2px solid #e5e7eb;
    background: white;
}

.gcph-chat-sidebar-header h3 {
    margin: 0 !important;
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
}

.btn-new-conversation {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
    padding: 0 !important;
}

.btn-new-conversation:hover {
    transform: scale(1.1);
}

.btn-new-conversation svg {
    stroke: white;
}

.gcph-chat-search {
    padding: 16px;
    background: white;
}

.gcph-chat-search input {
    width: 100%;
    padding: 10px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
}

.gcph-conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.gcph-conversation-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 4px;
    position: relative;
}

.gcph-conversation-item:hover {
    background: #e5e7eb;
}

.gcph-conversation-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Bouton de suppression de conversation */
.gcph-delete-conversation {
    display: none;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    background: rgba(239, 68, 68, 0.1);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
}

.gcph-conversation-item:hover .gcph-delete-conversation {
    display: flex;
    padding: 0 !important;
}

.gcph-delete-conversation:hover {
    background: #ef4444;
}

.gcph-delete-conversation svg {
    stroke: #ef4444;
}

.gcph-delete-conversation:hover svg {
    stroke: white;
}

.gcph-conversation-item.active .gcph-delete-conversation {
    background: rgba(255, 255, 255, 0.2);
}

.gcph-conversation-item.active .gcph-delete-conversation svg {
    stroke: white;
}

.gcph-conversation-item.active .gcph-delete-conversation:hover {
    background: rgba(239, 68, 68, 0.9);
}

.gcph-conversation-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.gcph-conversation-info {
    flex: 1;
    min-width: 0;
}

.gcph-conversation-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.gcph-conversation-last-message {
    font-size: 13px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gcph-conversation-item.active .gcph-conversation-last-message {
    color: rgba(255, 255, 255, 0.8);
}

/* Zone de chat principale */
.gcph-chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

.gcph-chat-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
}

.gcph-chat-placeholder h3 {
    margin: 20px 0 8px 0;
    color: #6b7280;
}

.gcph-chat-active {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.gcph-chat-header {
    padding: 20px;
    border-bottom: 2px solid #e5e7eb;
    background: white;
}

.gcph-chat-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gcph-chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.gcph-chat-user-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.gcph-chat-status {
    font-size: 13px;
    color: #9ca3af;
}

.gcph-chat-messages {
    width: 100%;
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;

    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

.gcph-message {
    display: flex;
    margin-bottom: 16px;
    gap: 12px;
}

.gcph-message div {
    width: 75%;
}

.gcph-message img {
    width: 15%;
}

.gcph-message.outgoing {
    flex-direction: row-reverse !important;
    align-items: center !important;
    display: flex !important;
}

.gcph-message-avatar {
    width: 48px !important;
    height: 48px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
}

.gcph-message-content {
    max-width: 85%;

    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.gcph-message {
    width: 100%;
}

.gcph-message-avatar {
    flex-shrink: 0;
    /* ← Avatar ne rétrécit pas */
}

.gcph-message.incoming .gcph-message-content {
    background: white;
    color: #1f2937;
    border-radius: 12px 12px 12px 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);

}



.gcph-message.outgoing .gcph-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 4px 12px;
}

.gcph-message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
}

.gcph-chat-input {
    display: flex;
    gap: 12px;
    padding: 20px;
    border-top: 2px solid #e5e7eb;
    background: white;
}

.gcph-chat-input textarea {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    resize: none;
    font-family: inherit;
    outline: none;
}

.gcph-chat-input textarea:focus {
    border-color: #667eea;
}

.btn-send-message {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
    padding: 0 !important;
}

.btn-send-message:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.btn-send-message svg {
    stroke: white;
}

/* ✅ CORRECTION : Modal avec meilleure gestion */
.gcph-modal {
    display: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.75) !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 9999999 !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease, visibility 0.3s ease !important;
}

/* ✅ État visible du modal */
.gcph-modal[style*="display: flex"] {
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.gcph-modal-content {
    background: white !important;
    border-radius: 16px !important;
    width: 90% !important;
    max-width: 500px !important;
    max-height: 80vh !important;
    display: flex !important;
    flex-direction: column !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
    position: relative !important;
    z-index: 10000000 !important;
    transform: scale(0.9) !important;
    transition: transform 0.3s ease !important;
}

.gcph-modal[style*="display: flex"] .gcph-modal-content {
    transform: scale(1) !important;
}

.gcph-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 2px solid #e5e7eb;
    background: white;
    border-radius: 16px 16px 0 0;
}

.gcph-modal-header h3 {
    margin: 0 !important;
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
}

.gcph-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #6b7280;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    padding: 0;
    line-height: 1;
    transition: all 0.2s;
}

.gcph-modal-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.gcph-modal-body {
    padding: 20px;
    overflow-y: auto;
    background: white;
    flex: 1;
    border-radius: 0 0 16px 16px;
}

.gcph-modal-body input[type="text"] {
    width: 100%;
    padding: 10px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.gcph-modal-body input[type="text"]:focus {
    border-color: #667eea;
}

.gcph-users-list {
    margin-top: 16px;
}

.gcph-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    background: white;
}

.gcph-user-item:hover {
    background: #f3f4f6 !important;
    transform: translateX(4px);
}

.gcph-user-item img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.gcph-user-item .gcph-conversation-info {
    flex: 1;
}

.gcph-user-item .gcph-conversation-name {
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
}

.gcph-loading {
    text-align: center;
    padding: 40px;
    color: #9ca3af;
}

/* Responsive */
@media (max-width: 768px) {
    .gcph-chat-interface {
        height: 600px;
    }

    .gcph-chat-sidebar {
        width: 100%;
    }

    .gcph-chat-main {
        display: none;
    }

    .gcph-modal-content {
        width: 95% !important;
        max-height: 90vh !important;
    }
}


/* ========================================
   CORRECTION : Afficher l'image de la fiche
   ======================================== */

.gcph-prestataire-item {
    display: flex;
    align-items: flex-start;
    /* ✅ Changé */
    gap: 12px;
    padding: 14px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 8px;
}

.gcph-prestataire-item:hover {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateX(4px);
}

/* ✅ CHANGÉ : Image rectangulaire de la fiche au lieu d'avatar rond */
.gcph-prestataire-avatar {

    /* ✅ Carré */
    border-radius: 8px;
    /* ✅ Coins arrondis au lieu de rond */
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #e5e7eb;
}

.gcph-prestataire-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gcph-prestataire-name {
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gcph-prestataire-fiche {
    font-size: 16px;
    font-weight: 500;
    color: #667eea;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gcph-prestataire-meta {
    font-size: 16px;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gcph-prestataire-meta svg {
    flex-shrink: 0;
    opacity: 0.6;
}


.gcph-prestataire-avatar {
    width: 180px !important;
    height: 180px !important;
    border-radius: 24px;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #e5e7eb;
}




/* Tablettes (portrait) */
@media (max-width: 1024px) {
    .gcph-chat-interface {
        height: 650px;
    }

    .gcph-chat-sidebar {
        width: 280px;
    }

    .gcph-prestataire-avatar {
        width: 120px !important;
        height: 120px !important;
    }

    .gcph-modal-tree {
        max-width: 95% !important;
    }
}

/* Tablettes (landscape) et petits écrans */
@media (max-width: 968px) {

    /* MODAL ARBRE - Vue mobile */
    .gcph-modal-tree {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }

    .gcph-modal-body-split {
        flex-direction: column;
        height: calc(100vh - 70px);
    }

    .gcph-categories-tree {
        width: 100%;
        max-height: 40%;
        border-right: none;
        border-bottom: 2px solid #e5e7eb;
    }

    .gcph-prestataires-panel {
        max-height: 60%;
    }

    /* Images plus petites sur tablette */
    .gcph-prestataire-avatar {
        width: 100px !important;
        height: 100px !important;
    }

    .gcph-tree-label {
        font-size: 16px;
    }
}

/* Mobile (paysage) */
@media (max-width: 768px) {

    /* INTERFACE PRINCIPALE */
    .gcph-chat-interface {
        height: calc(100vh - 100px);
        min-height: 500px;
        border-radius: 8px;
    }

    /* SIDEBAR en pleine largeur */
    .gcph-chat-sidebar {
        width: 100%;
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 10;
        transition: transform 0.3s ease;
    }

    /* Masquer la sidebar quand le chat est actif */
    .gcph-chat-sidebar.hidden {
        transform: translateX(-100%);
    }

    /* ZONE CHAT en pleine largeur */
    .gcph-chat-main {
        width: 100%;
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        transform: translateX(100%);
        transition: transform 0.3s ease;
    }

    .gcph-chat-main.active {
        transform: translateX(0);
    }

    /* Bouton retour dans le header du chat */
    .gcph-chat-header {
        position: relative;
    }

    .gcph-chat-header::before {
        content: "←";
        position: absolute;
        left: 10px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 24px;
        cursor: pointer;
        color: #667eea;
        font-weight: bold;
        z-index: 5;
    }

    .gcph-chat-user-info {
        margin-left: 30px;
    }

    /* Messages */
    .gcph-chat-messages {
        padding: 15px;
    }

    .gcph-message {
        gap: 8px;
    }

    .gcph-message-avatar {
        width: 36px !important;
        height: 36px !important;
    }

    .gcph-message-content {
        font-size: 13px;
        padding: 10px 14px;
    }

    /* Input message */
    .gcph-chat-input {
        padding: 12px;
        gap: 8px;
    }

    .gcph-chat-input textarea {
        font-size: 14px;
        padding: 10px 12px;
    }

    .btn-send-message {
        width: 42px;
        height: 42px;
    }

    /* MODAL */
    .gcph-modal-content {
        width: 100% !important;
        max-height: 100vh !important;
        border-radius: 24px !important;
    }

    .gcph-modal-body-split {
        height: calc(100vh - 60px);
    }

    /* Prestataires */
    .gcph-prestataire-item {
        padding: 10px;
        gap: 10px;
    }

    .gcph-prestataire-avatar {
        width: 80px !important;
        height: 80px !important;
        border-radius: 12px;
    }

    .gcph-prestataire-name {
        font-size: 15px;
    }

    .gcph-prestataire-fiche {
        font-size: 14px;
    }

    .gcph-prestataire-meta {
        font-size: 13px;
    }

    /* Catégories */
    .gcph-tree-label {
        font-size: 15px;
    }

    .gcph-categories-tree {
        max-height: 35%;
    }
}

/* Mobile (portrait) */
@media (max-width: 480px) {

    /* Interface */
    .gcph-chat-interface {
        height: calc(100vh - 80px);
        border-radius: 0;
    }

    /* Sidebar header */
    .gcph-chat-sidebar-header {
        padding: 15px;
    }

    .gcph-chat-sidebar-header h3 {
        font-size: 16px;
    }

    .btn-new-conversation {
        width: 32px;
        height: 32px;
    }

    /* Search */
    .gcph-chat-search {
        padding: 12px;
    }

    .gcph-chat-search input {
        font-size: 13px;
        padding: 8px 12px;
    }

    /* Conversations */
    .gcph-conversation-item {
        padding: 10px;
        gap: 10px;
    }

    .gcph-conversation-avatar {
        width: 42px;
        height: 42px;
    }

    .gcph-conversation-name {
        font-size: 13px;
    }

    .gcph-conversation-last-message {
        font-size: 12px;
    }

    /* Chat header */
    .gcph-chat-header {
        padding: 12px 15px;
    }

    .gcph-chat-avatar {
        width: 40px;
        height: 40px;
    }

    .gcph-chat-user-info h4 {
        font-size: 14px;
    }

    .gcph-chat-status {
        font-size: 11px;
    }

    /* Messages */
    .gcph-chat-messages {
        padding: 12px;
    }

    .gcph-message {
        margin-bottom: 12px;
        gap: 6px;
    }

    .gcph-message-avatar {
        width: 32px !important;
        height: 32px !important;
    }

    .gcph-message-content {
        font-size: 13px;
        padding: 8px 12px;
        max-width: 90%;
    }

    .gcph-message-time {
        font-size: 10px;
    }

    /* Input */
    .gcph-chat-input {
        padding: 10px;
    }

    .gcph-chat-input textarea {
        font-size: 13px;
        padding: 8px 10px;
    }

    .btn-send-message {
        width: 38px;
        height: 38px;
    }

    /* MODAL */
    .gcph-modal-header {
        padding: 25px;
    }

    .gcph-modal-header h3 {
        font-size: 16px;
    }

    /* Arbre catégories */
    .gcph-tree-header {
        padding: 12px 15px;
    }

    .gcph-tree-header h4 {
        font-size: 14px;
    }

    .gcph-tree-search {
        padding: 10px 12px;
    }

    .gcph-tree-search input {
        font-size: 12px;
        padding: 6px 10px 6px 32px;
    }

    .gcph-tree-label {
        font-size: 14px;
    }

    .gcph-tree-count {
        font-size: 10px;
    }

    /* Panel prestataires */
    .gcph-panel-header {
        padding: 12px 15px;
    }

    .gcph-panel-title h4 {
        font-size: 14px;
    }

    .gcph-panel-header input {
        font-size: 12px;
        padding: 6px 10px;
    }

    .gcph-prestataires-list {
        padding: 8px;
    }

    .gcph-prestataire-item {
        padding: 8px;
        gap: 8px;
        border-radius: 8px;
    }

    .gcph-prestataire-avatar {
        width: 60px !important;
        height: 60px !important;
        border-radius: 8px;
    }

    .gcph-prestataire-name {
        font-size: 14px;
    }

    .gcph-prestataire-fiche {
        font-size: 12px;
    }

    .gcph-prestataire-meta {
        font-size: 11px;
    }

    .gcph-prestataire-meta svg {
        width: 12px;
        height: 12px;
    }

    /* Placeholder */
    .gcph-chat-placeholder svg {
        width: 60px;
        height: 60px;
    }

    .gcph-chat-placeholder h3 {
        font-size: 16px;
    }

    .gcph-chat-placeholder p {
        font-size: 13px;
    }

    .gcph-panel-placeholder svg {
        width: 60px;
        height: 60px;
    }

    .gcph-panel-placeholder h4 {
        font-size: 16px;
    }

    .gcph-panel-placeholder p {
        font-size: 13px;
    }
}

/* Très petits écrans */
@media (max-width: 360px) {
    .gcph-chat-interface {
        height: calc(100vh - 60px);
    }

    .gcph-prestataire-avatar {
        width: 50px !important;
        height: 50px !important;
    }

    .gcph-prestataire-name {
        font-size: 13px;
    }

    .gcph-prestataire-fiche,
    .gcph-prestataire-meta {
        font-size: 11px;
    }

    .gcph-message-content {
        font-size: 12px;
        padding: 6px 10px;
    }

    .gcph-tree-label {
        font-size: 13px;
    }
}


/* ========================================
   CORRECTIONS RESPONSIVE CHAT
   ======================================== */

/* ✅ CORRECTION 1 : Interface principale responsive */
.gcph-chat-interface {
    display: flex !important;
    height: 700px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    position: relative;
    /* ✅ AJOUT */
}

/* ✅ CORRECTION 2 : Messages qui débordent */
.gcph-chat-messages {
    width: 100%;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;

    padding: 20px;
    background: #f8f9fa;
    word-wrap: break-word;
    max-height: 500px;
}

.gcph-message {
    display: flex;
    margin-bottom: 16px;
    gap: 12px;
    max-width: 100%;
    /* ✅ AJOUT */
    overflow-wrap: break-word;
    /* ✅ AJOUT */
}

.gcph-message-content {
    max-width: calc(100% - 60px);
    /* ✅ CORRECTION : laisser place à l'avatar */
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    /* ✅ AJOUT */
    word-break: break-word;
    /* ✅ AJOUT : forcer la coupure des mots longs */
}

/* ✅ CORRECTION 3 : Avatar qui se coupe */
.gcph-message-avatar {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px;
    /* ✅ CRITIQUE : empêcher l'avatar de rétrécir */
    border-radius: 50% !important;
    object-fit: cover !important;
    flex-shrink: 0;
    /* ✅ CRITIQUE */
}

/* ✅ CORRECTION 4 : Structure des messages */
.gcph-message div {
    flex: 1;
    min-width: 0;
    /* ✅ CRITIQUE : permettre le rétrécissement */
}

.gcph-message.outgoing {
    flex-direction: row-reverse !important;

}

/* ========================================
   RESPONSIVE À 1400PX
   ======================================== */
@media (max-width: 1400px) {
    .gcph-chat-interface {
        height: 650px;
    }

    .gcph-chat-sidebar {
        width: 280px;
        /* ✅ Réduire la sidebar */
    }

    .gcph-message-avatar {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
    }

    .gcph-message-content {
        font-size: 13px;
        padding: 10px 14px;
    }

    .gcph-conversation-avatar {
        width: 42px;
        height: 42px;
    }
}

/* ========================================
   RESPONSIVE À 1140PX - PROBLÈME MAJEUR
   ======================================== */
@media (max-width: 1140px) {

    /* ✅ SOLUTION : Passer en mode mobile */
    .gcph-chat-interface {
        height: calc(100vh - 100px);
        min-height: 500px;
    }

    /* Sidebar en pleine largeur, cachée par défaut */
    .gcph-chat-sidebar {
        width: 100%;
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        z-index: 10;
        background: #f8f9fa;
        transform: translateX(0);
        /* Visible par défaut */
        transition: transform 0.3s ease;
    }

    /* Masquer la sidebar quand le chat est actif */
    .gcph-chat-sidebar.hidden {
        transform: translateX(-100%);
    }

    /* Chat en pleine largeur, caché par défaut */
    .gcph-chat-main {
        width: 100%;
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        transform: translateX(100%);
        /* Hors écran par défaut */
        transition: transform 0.3s ease;
        background: white;
    }

    .gcph-chat-main.active {
        transform: translateX(0);
        /* Visible quand actif */
    }

    /* Bouton retour dans le header */
    .gcph-chat-header {
        position: relative;
        padding-left: 50px;
        /* ✅ Faire de la place pour le bouton */
    }

    .gcph-chat-header::before {
        content: "←";
        position: absolute;
        left: 15px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 24px;
        cursor: pointer;
        color: #667eea;
        font-weight: bold;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #f3f4f6;
        border-radius: 8px;
    }

    /* Messages adaptés */
    .gcph-chat-messages {
        padding: 15px;
    }

    .gcph-message {
        gap: 8px;
    }

    .gcph-message-avatar {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
    }

    .gcph-message-content {
        font-size: 13px;
        padding: 10px 12px;
    }
}

/* ========================================
   RESPONSIVE À 968PX - MODAL
   ======================================== */
@media (max-width: 968px) {
    .gcph-modal-tree {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100vh !important;
        border-radius: 24px !important;
    }

    .gcph-modal-body-split {
        flex-direction: column;
        height: calc(100vh - 60px);
    }

    .gcph-categories-tree {
        width: 100%;
        max-height: 40%;
        border-right: none;
        border-bottom: 2px solid #e5e7eb;
    }
}

/* ========================================
   RESPONSIVE À 768PX - MOBILE
   ======================================== */
@media (max-width: 768px) {
    .gcph-chat-interface {
        height: calc(100vh - 80px);
        border-radius: 24px;
    }

    .gcph-chat-sidebar-header h3 {
        font-size: 16px;
    }

    .btn-new-conversation {
        width: 32px;
        height: 32px;
    }

    .gcph-conversation-item {
        padding: 10px;
        gap: 10px;
    }

    .gcph-conversation-avatar {
        width: 40px;
        height: 40px;
    }

    .gcph-conversation-name {
        font-size: 13px;
    }

    .gcph-message-avatar {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
    }

    .gcph-message-content {
        font-size: 13px;
        padding: 8px 12px;
    }

    .gcph-chat-input {
        padding: 12px;
        gap: 8px;
    }

    .btn-send-message {
        width: 42px;
        height: 42px;
    }
}

/* ========================================
   RESPONSIVE À 480PX - PETIT MOBILE
   ======================================== */
@media (max-width: 480px) {
    .gcph-chat-interface {
        height: calc(100vh - 60px);
        border-radius: 0;
    }

    .gcph-chat-header {
        padding: 12px 15px 12px 50px;
    }

    .gcph-chat-avatar {
        width: 36px;
        height: 36px;
    }

    .gcph-chat-user-info h4 {
        font-size: 14px;
    }

    .gcph-message-avatar {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
    }

    .gcph-message-content {
        font-size: 12px;
        padding: 8px 10px;
    }

    .gcph-chat-input textarea {
        font-size: 13px;
        padding: 8px 10px;
    }

    .btn-send-message {
        width: 38px;
        height: 38px;
    }
}

@media (max-width: 1140px) {

    .gcph-chat-main {
        width: 100% !important;
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        height: 100% !important;
        background: white !important;
        transform: translateX(0%) !important;

        transition: transform 0.3s ease !important;
        z-index: 5 !important;
        display: flex !important;
        flex-direction: column !important;
    }

    /* Chat Active doit être flex en mobile */
    #chat-active {
        display: flex !important;
        flex-direction: column !important;
        height: 100% !important;
        width: 100% !important;
        background: white !important;
    }

    /* Chat Main doit être visible et blanc */
    .gcph-chat-main {
        width: 100%;
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        background: white !important;
        /* ⚠️ CRITIQUE */
        transform: translateX(100%);
        transition: transform 0.3s ease;
        z-index: 5;
        display: flex !important;
        /* ⚠️ CRITIQUE */
        flex-direction: column !important;
    }

    .gcph-chat-main.active {
        transform: translateX(0);
        z-index: 15;
    }

    /* Forcer le header à être visible */
    .gcph-chat-header {
        display: flex !important;
        position: relative;
        padding: 20px 20px 20px 60px !important;
        background: white !important;
        border-bottom: 2px solid #e5e7eb;
        flex-shrink: 0;
    }

    /* Bouton retour */
    .gcph-chat-header::before {
        content: "←";
        position: absolute;
        left: 15px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 28px;
        cursor: pointer;
        color: white;
        font-weight: bold;
        width: 40px;
        height: 40px;
        display: flex !important;
        align-items: center;
        justify-content: center;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border-radius: 10px;
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
        z-index: 100;
    }

    /* Messages zone */
    .gcph-chat-messages {
        flex: 1 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        background: #f8f9fa !important;
        padding: 20px !important;
    }

    /* Input zone */
    .gcph-chat-input {
        display: flex !important;
        padding: 20px !important;
        background: white !important;
        border-top: 2px solid #e5e7eb;
        flex-shrink: 0;
    }

    /* Placeholder caché en mobile */
    #chat-placeholder {
        display: none !important;
    }
}


.gcph-tree-node.disabled {
    cursor: not-allowed !important;
    opacity: 0.6;
    pointer-events: none;
    /* Empêche complètement le clic */
}

/* Alternative : Laisser le chevron cliquable mais pas le reste */
.gcph-tree-node.disabled {
    cursor: not-allowed !important;
    opacity: 0.7;
    background: #f9fafb !important;
}

.gcph-tree-node.disabled:hover {
    background: #f9fafb !important;
    /* Pas de hover */
}

.gcph-tree-node.disabled .gcph-tree-label {
    color: #9ca3af !important;
    font-weight: 700 !important;
    /* Plus gras pour montrer que c'est une catégorie parente */
    text-transform: uppercase !important;
    font-size: 12px !important;
    letter-spacing: 0.5px;
}

.gcph-tree-node.disabled .gcph-tree-count {
    opacity: 0.5;
}

/* Le chevron reste cliquable pour ouvrir/fermer */
.gcph-tree-node.disabled .gcph-tree-chevron {
    pointer-events: auto !important;
    cursor: pointer !important;
    opacity: 1 !important;
}

.gcph-tree-node.disabled {
    background: #f3f4f6 !important;
    border-radius: 6px;
    opacity: 0.8;
}

.gcph-tree-node.disabled .gcph-tree-label {
    color: #6b7280 !important;
    font-weight: 600 !important;
}


.gcph-unread-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
    animation: badge-pulse 2s infinite;
}

/* Animation du badge */
@keyframes badge-pulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
    }

    50% {
        transform: scale(1.1);
        box-shadow: 0 4px 8px rgba(239, 68, 68, 0.6);
    }
}


/* Badge Messages */
.gcph-badge-messages {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
    animation: badge-pulse 2s infinite;
}

/* Animation */
@keyframes badge-pulse {

    0%,
    100% {
        transform: translateY(-50%) scale(1);
        box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
    }

    50% {
        transform: translateY(-50%) scale(1.1);
        box-shadow: 0 4px 8px rgba(239, 68, 68, 0.6);
    }
}

/* Badge sur chaque conversation (optionnel) */
.gcph-conversation-badge {
    position: absolute;
    top: 12px;
    right: 40px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
}

/* Mise en évidence des conversations avec non-lus */
.gcph-conversation-item:has(.gcph-conversation-badge) {
    background: #fef2f2;
}

.gcph-conversation-item:has(.gcph-conversation-badge) .gcph-conversation-name {
    font-weight: 700;
}

/* Cacher le badge quand actif */
.gcph-conversation-item.active .gcph-conversation-badge {
    display: none;
}

/* Navigation item doit avoir position relative */
.gcph-nav-item {
    position: relative;
}

/* Responsive */
@media (max-width: 768px) {
    .gcph-badge-messages {
        right: 10px;
        font-size: 10px;
        min-width: 18px;
        height: 18px;
    }
}

.gcph-message.incoming div {
    justify-self: start;
}

.gcph-message.outgoing div {
    justify-self: end;
}











@media (max-width: 1600px) {
    .gcph-chat-messages {
        max-height: 520px;
        min-height: 280px;
        padding: 12px;
        gap: 12px;
    }
}

@media (max-width: 1400px) {
    .gcph-chat-messages {
        max-height: 470px;
        min-height: 470px;
        padding: 12px;
        gap: 12px;
    }
}

@media (max-width: 1140px) {
    .gcph-chat-messages {
        max-height: 100%;
        min-height: 280px;
        padding: 12px;
        gap: 12px;
    }
}

@media (max-width: 800px) {
    .gcph-chat-messages {
        max-height: 100%;
        min-height: 280px;
        padding: 12px;
        gap: 12px;
    }
}