/* ============================================
   CHAT COMMUNAUTAIRE - DESIGN ÉPURÉ / CLEAN
   ============================================ */

/* Variables Clean */
:root {
    --primary-color: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --accent-color: #ec4899;
    --success-color: #10b981;
    --text-primary: #ffffff;
    --text-secondary: #9ca3af;
    --bg-dark: #1f2937;
    --bg-darker: #111827;
    --border-color: rgba(255, 255, 255, 0.1);
}

/* Section Chat Container - Clean & Simple */
.dashboard-chat-section {
    position: relative;
    margin-bottom: 40px;
}

.dashboard-chat-container {
    background: var(--bg-dark);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.dashboard-chat-container:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    border-color: rgba(99, 102, 241, 0.3);
}

/* Messages Container */
.dashboard-chat-messages {
    height: 550px;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-darker);
}

/* Scrollbar Minimal */
.dashboard-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.dashboard-chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.dashboard-chat-messages::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.dashboard-chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

/* Messages - Design Minimal */
.dashboard-message {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    animation: fadeIn 0.3s ease;
    align-items: flex-start;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-message.own-message {
    flex-direction: row-reverse;
}

.dashboard-message.system-message {
    justify-content: center;
    margin: 16px 0;
}

/* Avatar - Minimal Circle */
.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.75rem;
    color: white;
    flex-shrink: 0;
    background: var(--primary-color);
    transition: transform 0.2s ease;
}

.message-avatar:hover {
    transform: scale(1.05);
}

/* Message Content */
.message-content {
    max-width: 50%;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dashboard-message.own-message .message-content {
    align-items: flex-end;
}

/* Message Header */
.message-header {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 0 2px;
    margin-bottom: 2px;
}

.message-username {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.message-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

/* Message Bubble - Clean & Simple */
.message-bubble {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 12px;
    color: var(--text-primary);
    line-height: 1.4;
    word-wrap: break-word;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.message-bubble:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Own Message - Accent Color */
.dashboard-message.own-message .message-bubble {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.dashboard-message.own-message .message-bubble:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
}

/* System Messages */
.system-message-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--success-color);
}

.system-message-content i {
    color: var(--success-color);
}

/* Media in Messages */
.message-media {
    margin-top: 8px;
    border-radius: 12px;
    overflow: hidden;
    max-width: 100%;
}

.message-media img {
    max-width: 100%;
    max-height: 350px;
    width: auto;
    height: auto;
    display: block;
    cursor: pointer;
    transition: opacity 0.2s ease;
    border-radius: 12px;
}

.message-media img:hover {
    opacity: 0.9;
}

.message-media video,
.message-media audio {
    max-width: 100%;
    border-radius: 12px;
}

.message-media video {
    max-height: 350px;
    width: auto;
    display: block;
}

.message-media audio {
    width: 100%;
    max-width: 300px;
    display: block;
    margin-top: 6px;
}

/* Emoji Bar - Clean */
.dashboard-emoji-bar {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-dark);
    border-top: 1px solid var(--border-color);
    overflow-x: auto;
    scrollbar-width: thin;
}

.dashboard-emoji-bar::-webkit-scrollbar {
    height: 4px;
}

.dashboard-emoji-bar::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 2px;
}

/* Emoji Button - Minimal */
.emoji-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.emoji-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.emoji-btn:active {
    transform: scale(0.95);
}

/* Input Container */
.dashboard-chat-input-container {
    display: flex;
    gap: 10px;
    padding: 16px;
    background: var(--bg-dark);
    border-top: 1px solid var(--border-color);
}

/* Input Text - Clean */
.dashboard-chat-input-container input[type="text"] {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: white;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.dashboard-chat-input-container input[type="text"]::placeholder {
    color: var(--text-secondary);
}

#dashboardMessageInput {
    flex: 1;
}

.dashboard-chat-input-container input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.08);
}

/* Buttons - Minimal Style */
.dashboard-media-button,
.dashboard-voice-button {
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashboard-media-button:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary-color);
    color: var(--primary-light);
}

.dashboard-voice-button:hover {
    background: rgba(236, 72, 153, 0.2);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.dashboard-voice-button.recording {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    animation: pulseSimple 1.5s infinite;
}

@keyframes pulseSimple {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Send Button - Primary */
.dashboard-send-button {
    padding: 12px 24px;
    background: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 10px;
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dashboard-send-button:hover {
    background: var(--primary-light);
    border-color: var(--primary-light);
    transform: translateY(-1px);
}

.dashboard-send-button:active {
    transform: translateY(0);
}

.dashboard-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Recording Indicator - Clean */
.dashboard-recording-indicator {
    padding: 14px 20px;
    background: rgba(236, 72, 153, 0.1);
    border-top: 1px solid rgba(236, 72, 153, 0.3);
}

.recording-content {
    display: flex;
    align-items: center;
    gap: 14px;
    color: white;
}

.recording-pulse {
    width: 12px;
    height: 12px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: pulseSimple 1.5s infinite;
}

.recording-text {
    font-weight: 600;
    color: var(--accent-color);
}

.recording-timer {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    color: white;
    font-weight: 600;
}

.recording-stop-btn {
    margin-left: auto;
    padding: 8px 20px;
    background: var(--accent-color);
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recording-stop-btn:hover {
    background: #db2777;
    transform: translateY(-1px);
}

.recording-stop-btn:active {
    transform: translateY(0);
}

/* Media Preview - Clean */
.dashboard-media-preview {
    padding: 14px 20px;
    background: var(--bg-dark);
    border-top: 1px solid var(--border-color);
}

.media-preview-content {
    position: relative;
    display: inline-block;
    max-width: 250px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
}

.media-preview-content img,
.media-preview-content video {
    max-width: 100%;
    max-height: 180px;
    display: block;
    border-radius: 12px;
}

.media-preview-content audio {
    width: 100%;
    max-width: 250px;
    border-radius: 10px;
}

.media-remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    background: var(--accent-color);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 14px;
}

.media-remove-btn:hover {
    background: #db2777;
    transform: scale(1.1);
}

.media-remove-btn:active {
    transform: scale(0.95);
}

/* Lightbox - Clean */
.media-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    animation: fadeIn 0.2s ease;
}

.media-lightbox.active {
    display: flex;
}

.media-lightbox img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
}

.media-lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.media-lightbox-close:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-chat-messages {
        height: 400px;
        padding: 16px;
    }
    
    .message-content {
        max-width: 70%;
    }
    
    .message-avatar {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }
    
    .message-bubble {
        font-size: 0.9rem;
        padding: 8px 12px;
    }
    
    .dashboard-message {
        gap: 8px;
        margin-bottom: 10px;
    }
    
    .dashboard-media-button,
    .dashboard-voice-button {
        padding: 10px;
        font-size: 1.1rem;
    }
    
    .dashboard-send-button {
        padding: 10px 18px;
        font-size: 0.9rem;
    }
    
    .emoji-btn {
        font-size: 1.2rem;
        padding: 6px 10px;
    }
    
    .message-media img,
    .message-media video {
        max-height: 250px;
    }
    
    .message-media audio {
        max-width: 100%;
    }
    
    .recording-content {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .recording-stop-btn {
        margin-left: 0;
        width: 100%;
        justify-content: center;
    }
    
    .media-preview-content {
        max-width: 180px;
    }
    
    .media-preview-content img,
    .media-preview-content video {
        max-height: 140px;
    }
}
