/* =============================================
   Widget Chat Privé - Style X/Twitter
   ============================================= */

/* Bouton flottant */
.private-chat-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #3498db;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(52, 152, 219, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.private-chat-btn:hover {
    transform: scale(1.1);
}

.private-chat-btn.support-mode {
    background: #27ae60;
    box-shadow: 0 4px 20px rgba(39, 174, 96, 0.4);
}

.private-chat-btn.support-mode:hover {
    background: #219a52;
}

.private-chat-btn .unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

/* Fenêtre du chat */
.private-chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 500px;
    background: #1a1a2e;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    display: none;
    flex-direction: column;
    z-index: 999;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.private-chat-window.active {
    display: flex;
}

/* Header fenêtre */
.pc-header {
    display: flex;
    flex-direction: column;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Header en ligne pour les vues recherche, conversation et création groupe */
.pc-new-conv .pc-header,
.pc-conversation-view .pc-header,
.pc-create-group .pc-header,
.pc-group-details .pc-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
}

.pc-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 12px;
}

.pc-header h3 {
    margin: 0;
    font-size: 18px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.pc-header h3 i {
    color: #3498db;
}

.pc-header-actions {
    display: flex;
    justify-content: center;
    width: 100%;
}

.pc-header-actions .pc-header-btn {
    background: rgba(52, 152, 219, 0.2);
    border: 1px solid #3498db;
    color: #3498db;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pc-header-actions .pc-header-btn:hover {
    background: #3498db;
    color: #fff;
}

.pc-header-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s;
}

.pc-header-btn:hover {
    color: #fff;
}

/* Liste des conversations */
.pc-list-view {
    display: none;
    flex-direction: column;
    height: 100%;
}

.pc-list-view.active {
    display: flex;
}

.pc-conversations {
    flex: 1;
    overflow-y: auto;
}

.pc-conv-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.pc-conv-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.pc-conv-item.unread {
    background: rgba(52, 152, 219, 0.1);
}

.pc-conv-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db, #2980b9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    flex-shrink: 0;
}

.pc-conv-info {
    flex: 1;
    min-width: 0;
}

.pc-conv-name {
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pc-conv-name .unread-dot {
    width: 8px;
    height: 8px;
    background: #3498db;
    border-radius: 50%;
}

.pc-conv-preview {
    font-size: 13px;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pc-conv-time {
    font-size: 12px;
    color: #666;
    flex-shrink: 0;
}

/* Message "pas de conversations" */
.pc-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
    text-align: center;
    padding: 40px;
}

.pc-empty i {
    font-size: 48px;
    margin-bottom: 15px;
    color: #3498db;
    opacity: 0.5;
}

.pc-empty p {
    margin: 0;
    font-size: 14px;
}

/* Vue conversation */
.pc-conversation-view {
    display: none;
    flex-direction: column;
    height: 100%;
}

.pc-conversation-view.active {
    display: flex;
}

.pc-conv-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.pc-back-btn {
    background: none;
    border: none;
    color: #3498db;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
}

.pc-conv-header-info {
    flex: 1;
}

.pc-conv-header-name {
    font-weight: 600;
    color: #fff;
    font-size: 15px;
}

/* Zone des messages */
.pc-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pc-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.pc-message.sent {
    align-self: flex-end;
    background: #3498db;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.pc-message.received {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-bottom-left-radius: 4px;
}

.pc-message-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
    display: block;
}

.pc-message.sent .pc-message-time {
    text-align: right;
}

/* Zone de saisie */
.pc-input-area {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.pc-input {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.pc-input:focus {
    border-color: #3498db;
}

.pc-input::placeholder {
    color: #666;
}

.pc-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #3498db;
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pc-send-btn:hover {
    background: #2980b9;
}

/* Modal nouvelle conversation */
.pc-new-conv {
    display: none;
    flex-direction: column;
    height: 100%;
}

.pc-new-conv.active {
    display: flex;
}

.pc-search-container {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.pc-search-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 14px;
    outline: none;
}

.pc-search-input:focus {
    border-color: #3498db;
}

.pc-search-input::placeholder {
    color: #666;
}

.pc-search-results {
    flex: 1;
    overflow-y: auto;
}

.pc-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.pc-user-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.pc-user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #27ae60, #219a52);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
}

.pc-user-name {
    color: #fff;
    font-size: 15px;
}

.pc-search-empty {
    text-align: center;
    color: #666;
    padding: 40px 20px;
}

/* Responsive */
@media (max-width: 500px) {
    .private-chat-window {
        bottom: 0;
        right: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }
    
    .private-chat-btn {
        bottom: 20px;
        right: 20px;
    }
}

/* =============================================
   GROUPES
   ============================================= */

/* Boutons header côte à côte */
.pc-header-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    width: 100%;
}

/* Item groupe dans la liste */
.pc-conv-item.group .pc-conv-avatar {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
}

.pc-conv-item .pc-conv-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.pc-conv-item .member-count {
    font-size: 11px;
    color: #888;
    margin-left: 5px;
}

/* Vue création de groupe */
.pc-create-group {
    display: none;
    flex-direction: column;
    height: 100%;
}

.pc-create-group.active {
    display: flex;
}

.pc-group-form {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pc-group-name-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 14px;
    outline: none;
}

.pc-group-name-input:focus {
    border-color: #9b59b6;
}

.pc-group-name-input::placeholder {
    color: #666;
}

.pc-selected-members {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
}

.pc-selected-member {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(155, 89, 182, 0.3);
    border: 1px solid #9b59b6;
    border-radius: 20px;
    font-size: 13px;
    color: #fff;
}

.pc-selected-member .remove-member {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 12px;
    padding: 0;
    line-height: 1;
}

.pc-create-group-btn {
    padding: 12px 20px;
    background: #9b59b6;
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

.pc-create-group-btn:hover {
    background: #8e44ad;
}

.pc-create-group-btn:disabled {
    background: #555;
    cursor: not-allowed;
}

/* Liste des membres à sélectionner */
.pc-members-list {
    flex: 1;
    overflow-y: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.pc-member-select-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.pc-member-select-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.pc-member-select-item.selected {
    background: rgba(155, 89, 182, 0.2);
}

.pc-member-select-item .checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid #666;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.pc-member-select-item.selected .checkbox {
    background: #9b59b6;
    border-color: #9b59b6;
}

.pc-member-select-item.selected .checkbox::after {
    content: '✓';
    color: #fff;
    font-size: 12px;
}

/* Vue détails groupe (gestion membres) */
.pc-group-details {
    display: none;
    flex-direction: column;
    height: 100%;
}

.pc-group-details.active {
    display: flex;
}

.pc-group-info {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.pc-group-avatar-container {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
}

.pc-group-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #fff;
    overflow: hidden;
}

.pc-group-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pc-avatar-upload-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #3498db;
    border: 2px solid #1a1a2e;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pc-group-avatar-container input[type="file"] {
    display: none;
}

.pc-group-name-display {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 5px;
}

.pc-group-member-count {
    font-size: 13px;
    color: #888;
}

/* Liste des membres du groupe */
.pc-group-members-list {
    flex: 1;
    overflow-y: auto;
}

.pc-group-members-list h4 {
    padding: 12px 20px;
    margin: 0;
    font-size: 13px;
    color: #888;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.03);
}

.pc-group-member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.pc-group-member-item .member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db, #2980b9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    font-weight: bold;
}

.pc-group-member-item .member-info {
    flex: 1;
}

.pc-group-member-item .member-name {
    color: #fff;
    font-size: 14px;
}

.pc-group-member-item .member-role {
    font-size: 11px;
    color: #9b59b6;
}

.pc-group-member-item .member-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
}

.pc-group-member-item .member-status.muted {
    background: rgba(241, 196, 15, 0.2);
    color: #f1c40f;
}

.pc-group-member-item .member-status.banned {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.pc-member-actions {
    display: flex;
    gap: 5px;
}

.pc-member-actions button {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #888;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.pc-member-actions button:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.pc-member-actions button.danger:hover {
    background: rgba(231, 76, 60, 0.3);
    color: #e74c3c;
}

.pc-member-actions button.warning:hover {
    background: rgba(241, 196, 15, 0.3);
    color: #f1c40f;
}

/* Actions groupe en bas */
.pc-group-actions {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pc-leave-group-btn,
.pc-delete-group-btn {
    padding: 10px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

.pc-leave-group-btn {
    background: rgba(241, 196, 15, 0.2);
    color: #f1c40f;
}

.pc-leave-group-btn:hover {
    background: rgba(241, 196, 15, 0.3);
}

.pc-delete-group-btn {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.pc-delete-group-btn:hover {
    background: rgba(231, 76, 60, 0.3);
}

/* Header groupe avec bouton settings */
.pc-group-header-actions {
    display: flex;
    gap: 10px;
}

.pc-settings-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 16px;
    cursor: pointer;
    padding: 5px;
}

.pc-settings-btn:hover {
    color: #fff;
}

/* =============================================
   SUPPORT VISITEUR
   ============================================= */

/* Vue demande de pseudo */
.pc-support-pseudo {
    display: none;
    flex-direction: column;
    height: 100%;
}

.pc-support-pseudo.active {
    display: flex;
}

.pc-support-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
}

.pc-support-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #27ae60, #219a52);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.pc-support-icon i {
    font-size: 36px;
    color: #fff;
}

.pc-support-welcome h4 {
    margin: 0 0 10px;
    font-size: 20px;
    color: #fff;
}

.pc-support-welcome p {
    margin: 0 0 25px;
    color: #888;
    font-size: 14px;
    line-height: 1.5;
}

.pc-pseudo-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pc-pseudo-input {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 15px;
    outline: none;
    text-align: center;
}

.pc-pseudo-input:focus {
    border-color: #27ae60;
}

.pc-pseudo-input::placeholder {
    color: #666;
}

.pc-start-chat-btn {
    padding: 14px 20px;
    background: #27ae60;
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s;
}

.pc-start-chat-btn:hover {
    background: #219a52;
}

/* Vue chat support visiteur */
.pc-support-chat {
    display: none;
    flex-direction: column;
    height: 100%;
}

.pc-support-chat.active {
    display: flex;
}

.pc-support-visitor-name {
    font-size: 11px;
    color: #888;
}

.pc-support-visitor-name span {
    color: #27ae60;
}

/* =============================================
   SUPPORT ADMIN
   ============================================= */

/* Bouton support dans le header */
.pc-admin-support-btn {
    padding: 0 16px 10px;
}

.pc-support-btn-full {
    width: 100%;
    justify-content: center;
    background: rgba(39, 174, 96, 0.15) !important;
    border-color: #27ae60 !important;
    color: #27ae60 !important;
    position: relative;
    border-radius: 50px;
    margin-top: 20px;
}

.pc-support-btn-full:hover {
    background: rgba(39, 174, 96, 0.25) !important;
}

.support-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: #fff;
    font-size: 10px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

/* Liste des chats support */
.pc-admin-support {
    display: none;
    flex-direction: column;
    height: 100%;
}

.pc-admin-support.active {
    display: flex;
}

.pc-support-chats {
    flex: 1;
    overflow-y: auto;
}

.pc-conv-item.closed {
    opacity: 0.6;
}

.pc-conv-item .status-closed {
    font-size: 10px;
    padding: 2px 6px;
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border-radius: 10px;
    margin-left: 8px;
}

.pc-conv-avatar.support-avatar {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
}

/* Vue chat support admin */
.pc-admin-support-chat {
    display: none;
    flex-direction: column;
    height: 100%;
}

.pc-admin-support-chat.active {
    display: flex;
}

.pc-support-status {
    font-size: 11px;
    color: #27ae60;
}

/* Barre des membres (avatars superposés style X) */
.pc-group-members-bar {
    display: none;
    align-items: center;
    padding: 10px 16px;
    background: rgba(155, 89, 182, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    gap: 12px;
}

.pc-group-members-bar.active {
    display: flex;
}

.pc-members-avatars {
    display: flex;
    align-items: center;
}

.pc-members-avatars .member-mini-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db, #2980b9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid #1a1a2e;
    margin-left: -10px;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s, z-index 0.2s;
}

.pc-members-avatars .member-mini-avatar:first-child {
    margin-left: 0;
}

.pc-members-avatars .member-mini-avatar:hover {
    transform: scale(1.15);
    z-index: 10;
}

.pc-members-avatars .member-mini-avatar.admin {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
}

.pc-members-avatars .member-mini-avatar.creator {
    background: linear-gradient(135deg, #f1c40f, #d4ac0d);
}

.pc-members-avatars .member-mini-avatar .avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.pc-members-avatars .more-members {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid #1a1a2e;
    margin-left: -10px;
}

.pc-group-members-bar .members-info {
    font-size: 13px;
    color: #aaa;
}

.pc-group-members-bar .members-info span {
    color: #9b59b6;
    font-weight: 600;
}