/* ===== CHAT SIDEBAR MODERNE - VERSION CORRIGÉE ===== */

/* Overlay fond sombre */
.chat-panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.chat-panel-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Panel chat côté droit */
.chat-panel-sidebar {
    position: fixed;
    top: 0;
    right: -450px;
    width: 450px;
    height: 100vh;
    background: linear-gradient(135deg, 
        rgba(10, 10, 10, 0.98) 0%,
        rgba(0, 0, 0, 0.98) 50%,
        rgba(10, 10, 10, 0.98) 100%
    );
    backdrop-filter: blur(30px);
    border-left: 2px solid rgba(212, 175, 55, 0.3);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transition: right 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: -10px 0 60px rgba(0, 0, 0, 0.9);
}

.chat-panel-sidebar.active {
    right: 0;
}

/* Orbe lumineux */
.chat-panel-sidebar::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.12) 0%, transparent 70%);
    border-radius: 50%;
    filter: blur(60px);
    animation: orbFloat 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-30px, 30px); }
}

/* Header */
.chat-panel-header {
    background: linear-gradient(135deg, 
        rgba(212, 175, 55, 0.12) 0%,
        rgba(10, 10, 10, 0.9) 100%
    );
    backdrop-filter: blur(20px);
    padding: 25px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 2;
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-header-icon {
    font-size: 36px;
    filter: drop-shadow(0 0 20px rgba(212, 175, 55, 0.6));
    animation: iconPulse 3s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.chat-header-info {
    flex: 1;
}

.chat-panel-title {
    font-size: 22px;
    font-weight: 900;
    background: linear-gradient(135deg, #fff 0%, #d4af37 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 5px 0;
    letter-spacing: 1px;
}

.chat-users-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-users-count::before {
    content: '🟢';
    font-size: 10px;
    animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.chat-panel-close {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 50%;
    color: var(--gold);
    font-size: 22px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-panel-close:hover {
    background: rgba(212, 175, 55, 0.15);
    border-color: var(--gold);
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

/* Body (messages) */
.chat-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    position: relative;
    z-index: 1;
    background: rgba(0, 0, 0, 0.5); /* FOND SOMBRE */
}

.chat-panel-body::-webkit-scrollbar {
    width: 8px;
}

.chat-panel-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.chat-panel-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--gold), var(--dark-gold));
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.chat-panel-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--light-gold), var(--gold));
}

/* Container messages */
.chat-messages-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Message bienvenue */
.chat-welcome-message {
    text-align: center;
    padding: 60px 20px;
}

.chat-welcome-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: wave 2s ease-in-out infinite;
}

@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(20deg); }
    75% { transform: rotate(-20deg); }
}

.chat-welcome-message h4 {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--gold), var(--light-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 0 0 10px 0;
}

.chat-welcome-message p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
    font-weight: 500;
}

/* Message item */
.chat-message-item {
    background: rgba(255, 255, 255, 0.03); /* FOND TRÈS SOMBRE */
    backdrop-filter: blur(10px);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 15px;
    padding: 14px 16px;
    animation: messageSlideIn 0.4s ease;
    position: relative;
    overflow: hidden;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.chat-message-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: linear-gradient(180deg, var(--gold), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chat-message-item:hover::before {
    opacity: 1;
}

.chat-message-item:hover {
    background: rgba(212, 175, 55, 0.08);
    border-color: rgba(212, 175, 55, 0.4);
}

/* Message de l'utilisateur actuel */
.chat-message-item.own-message {
    background: linear-gradient(135deg, 
        rgba(212, 175, 55, 0.12) 0%,
        rgba(212, 175, 55, 0.05) 100%
    );
    border-color: rgba(212, 175, 55, 0.4);
    margin-left: 30px;
}

.chat-message-item.own-message::before {
    opacity: 1;
    background: linear-gradient(180deg, var(--gold), var(--light-gold));
}

/* Header message */
.chat-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.chat-message-username {
    font-size: 13px;
    font-weight: 800;
    color: var(--gold);
    letter-spacing: 0.3px;
}

.chat-message-item.own-message .chat-message-username {
    color: var(--light-gold);
}

.chat-message-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

/* Texte message */
.chat-message-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.5;
    word-wrap: break-word;
    font-weight: 500;
}

/* Footer (input) */
.chat-panel-footer {
    background: linear-gradient(180deg, 
        rgba(10, 10, 10, 0.8) 0%,
        rgba(0, 0, 0, 0.95) 100%
    );
    backdrop-filter: blur(20px);
    padding: 20px;
    border-top: 1px solid rgba(212, 175, 55, 0.3);
    position: relative;
    z-index: 2;
}

.chat-input-container {
    display: flex;
    gap: 12px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(212, 175, 55, 0.25);
    border-radius: 14px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.chat-input:focus {
    outline: none;
    border-color: var(--gold);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 25px rgba(212, 175, 55, 0.2);
}

.chat-send-button {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--dark-gold) 100%);
    border: none;
    border-radius: 14px;
    color: var(--primary-black);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 25px rgba(212, 175, 55, 0.4);
    position: relative;
    overflow: hidden;
}

.chat-send-button::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.3));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chat-send-button:hover {
    transform: scale(1.08) rotate(-5deg);
    box-shadow: 0 8px 35px rgba(212, 175, 55, 0.6);
}

.chat-send-button:hover::before {
    opacity: 1;
}

.chat-send-button:active {
    transform: scale(1.02);
}

.chat-send-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

.chat-send-button:hover .chat-send-icon {
    transform: translateX(3px);
}

/* Responsive */
@media (max-width: 768px) {
    .chat-panel-sidebar {
        width: 100%;
        right: -100%;
        border-left: none;
        border-top: 2px solid rgba(212, 175, 55, 0.3);
    }
    
    .chat-panel-sidebar.active {
        right: 0;
    }
}

@media (max-width: 480px) {
    .chat-panel-header {
        padding: 20px;
    }
    
    .chat-header-icon {
        font-size: 32px;
    }
    
    .chat-panel-title {
        font-size: 20px;
    }
    
    .chat-panel-body {
        padding: 15px;
    }
    
    .chat-panel-footer {
        padding: 15px;
    }
    
    .chat-input {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .chat-send-button {
        width: 44px;
        height: 44px;
    }
}