/* Frontend styles for Vidalium Chatting plugin */

.vidalium-chat-container {
    display: flex;
    flex-direction: column;
    height: 600px;
    max-height: 100vh;
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Header */
.vidalium-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #fff;
    border-bottom: 1px solid #e9ecef;
    min-height: 68px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.room-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.room-name {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.online-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #666;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #adb5bd;
}

.status-dot.online {
    background: #40c057;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.user-selector-container {
    min-width: 200px;
}

.user-selector {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    color: #495057;
    outline: none;
    cursor: pointer;
}

.user-selector:focus {
    border-color: #339af0;
    box-shadow: 0 0 0 3px rgba(51, 154, 240, 0.1);
}

/* Messages Container */
.vidalium-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.messages-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: #666;
    font-size: 14px;
}

/* Message Styles */
.vidalium-message {
    display: flex;
    flex-direction: column;
    max-width: 70%;
    position: relative;
}

.vidalium-message-incoming {
    align-self: flex-start;
}

.vidalium-message-outgoing {
    align-self: flex-end;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    line-height: 1.4;
}

.vidalium-message-incoming .message-bubble {
    background: #fff;
    border: 1px solid #e9ecef;
    border-top-left-radius: 4px;
}

.vidalium-message-outgoing .message-bubble {
    background: #339af0;
    color: white;
    border-bottom-right-radius: 4px;
}

.message-content {
    margin-bottom: 4px;
    font-size: 14.5px;
}

.message-content.text {
    white-space: pre-wrap;
}

/* File Messages */
.file-message {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    text-decoration: none;
    color: #495057;
    transition: all 0.2s ease;
}

.file-message:hover {
    background: #f8f9fa;
    border-color: #339af0;
}

.file-icon {
    font-size: 24px;
    color: #339af0;
    display: flex;
    align-items: center;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    font-size: 12px;
    color: #868e96;
}

.download-btn {
    padding: 6px 12px;
    background: #339af0;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.download-btn:hover {
    background: #228be6;
}

/* Media Messages */
.media-message {
    max-width: 300px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e9ecef;
}

.image-message img,
.video-message video {
    width: 100%;
    height: auto;
    display: block;
    max-height: 300px;
    object-fit: contain;
    background: #000;
}

.video-message video {
    max-height: 250px;
}

.audio-message audio {
    width: 100%;
    max-width: 300px;
}

/* Message Meta */
.message-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 11px;
    color: #868e96;
}

.message-sender {
    font-weight: 500;
    color: #495057;
}

.message-time {
    opacity: 0.8;
    color:#000;
}

.vidalium-message-outgoing .message-meta  .message-time, .vidalium-message-outgoing .message-meta .message-status{
   color:#fff; 
}
.message-status {
    display: flex;
    align-items: center;
    gap: 2px;
}

.status-icon {
    font-size: 12px;
}

.status-icon.read {
    color: #339af0;
}

/* Reply Preview */
.message-reply {
    margin-bottom: 8px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.05);
    border-left: 3px solid #339af0;
    border-radius: 6px;
    font-size: 12px;
    max-width: 80%;
}

.message-reply .reply-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.message-reply .reply-header i {
    font-size: 10px;
    color: #4CAF50;
}

.reply-sender {
    font-weight: 600;
    color: #495057;
    margin-bottom: 2px;
}

.reply-content {
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.message-reply .reply-content i {
    margin-right: 5px;
    color: #666;
}

.reply-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f0f8ff;
    border-right: 3px solid #2196F3;
    border-radius: 4px;
    padding: 8px 12px;
    margin-bottom: 8px;
}

.reply-preview .reply-info {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-grow: 1;
    flex-direction: column;
}

.reply-preview .reply-info strong {
    font-size: 12px;
    color: #2196F3;
    display: flex;
    align-items: center;
    gap: 5px;
}

.reply-preview .reply-content {
    font-size: 13px;
    color: #555;
    font-style: italic;
}

.reply-preview .cancel-reply-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
}

.reply-preview .cancel-reply-btn:hover {
    color: #f44336;
    background: rgba(244, 67, 54, 0.1);
    border-radius: 3px;
}
/* Message Actions */
.message-actions {
    position: absolute;
    bottom: 0;
    right: -35px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
}
.vidalium-message-incoming .message-actions {
    left: -50px;
    right: inherit ;
}
/*
.vidalium-message:hover .message-actions {
    display: flex;
}*/

.message-action-btn {
    padding: 6px 10px;
    background: none;
    border: none;
    border-radius: 4px;
    color: #495057;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.message-action-btn:hover {
    background: #f8f9fa;
    color: #339af0;
}

.message-action-btn.delete:hover {
    color: #fa5252;
}

/* Input Area */
.vidalium-chat-input-area {
    border-top: 1px solid #e9ecef;
    background: #fff;
}

.user-selection-screen {
    padding: 30px 20px;
    text-align: center;
    background: #f8f9fa;
}

.user-selection-screen h4 {
    margin: 0 0 16px;
    color: #495057;
    font-size: 16px;
    font-weight: 500;
}

.user-selection {
    width: 100%;
    max-width: 300px;
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 16px;
    background: #fff;
}

.user-select-btn {
    padding: 12px 32px;
    background: #339af0;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.user-select-btn:hover {
    background: #228be6;
}

/* Chat Input */
.chat-input-wrapper {
    padding: 16px 20px;
}

/* Voice Recorder */
.voice-recorder-bar {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 12px;
}

.recorder-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.record-btn {
    padding: 10px 16px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s ease;
}

.record-btn:hover {
    background: #fa5252;
}

.record-icon {
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    animation: recording-pulse 1.5s infinite;
}

@keyframes recording-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.stop-record-btn {
    padding: 8px 16px;
    background: #495057;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.recording-timer {
    font-family: monospace;
    font-size: 14px;
    color: #495057;
    font-weight: 600;
}

.recording-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e9ecef;
}

.voice-preview {
    flex: 1;
    max-width: 200px;
}

.send-voice-btn,
.cancel-voice-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.send-voice-btn {
    background: #40c057;
    color: white;
}

.cancel-voice-btn {
    background: #868e96;
    color: white;
}

/* Reply Preview */
.reply-preview {
    background: #f8f9fa;
    border-left: 3px solid #339af0;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reply-info {
    flex: 1;
    min-width: 0;
}

.reply-info strong {
    display: block;
    font-size: 12px;
    color: #495057;
    margin-bottom: 2px;
}

.reply-content {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cancel-reply-btn {
    background: none;
    border: none;
    color: #868e96;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.cancel-reply-btn:hover {
    color: #495057;
}

/* Input Controls */
.input-controls {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.voice-toggle-btn,
.attach-file-btn,
.send-message-btn {
    padding: 12px;
    background: none;
    border: none;
    border-radius: 8px;
    color: #495057;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.voice-toggle-btn:hover,
.attach-file-btn:hover {
    background: #f8f9fa;
    color: #339af0;
}

.voice-toggle-btn.active {
    background: #339af0;
    color: white;
}

.send-message-btn {
    background: #339af0;
    color: white;
}

.send-message-btn:hover {
    background: #228be6;
}

.send-message-btn:disabled {
    background: #adb5bd;
    cursor: not-allowed;
}

.text-input-container {
    flex: 1;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 10px 14px;
}

.message-input {
    width: 100%;
    border: none;
    background: none;
    resize: none;
    font-size: 14px;
    font-family: inherit;
    color: #495057;
    outline: none;
    line-height: 1.4;
    max-height: 120px;
    min-height: 22px;
}

.message-input::placeholder {
    color: #adb5bd;
}

/* File Upload Progress */
.file-upload-progress {
    margin-top: 12px;
}

.progress-bar {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #40c057;
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    font-size: 12px;
    color: #495057;
    margin-top: 4px;
}

/* Deleted Message */
.message-deleted {
    opacity: 0.6;
    font-style: italic;
}

.deleted-text {
    color: #868e96;
}

/* Online User Badge */
.online-badge {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: #40c057;
    border-radius: 50%;
    margin-left: 4px;
    vertical-align: middle;
}

/* Error States */
.vidalium-chat-error {
    padding: 20px;
    background: #fff5f5;
    border: 1px solid #ffc9c9;
    border-radius: 8px;
    color: #c92a2a;
    text-align: center;
}

/* Empty State */
.empty-messages {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #adb5bd;
    font-size: 14px;
    padding: 40px 20px;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .vidalium-chat-container {
        height: 80vh;
        border-radius: 0;
    }
    
    .vidalium-chat-header {
        padding: 12px 16px;
    }
    
    .room-name {
        font-size: 16px;
    }
    
    .vidalium-chat-messages {
        padding: 16px;
    }
    
    .vidalium-message {
        max-width: 85%;
    }
    
    .chat-input-wrapper {
        padding: 12px 16px;
    }
    
    .user-selector-container {
        min-width: 150px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .vidalium-chat-container {
        background: #1a1a1a;
        color: #e9ecef;
    }
    
    .vidalium-chat-header {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .room-name {
        color: #f8f9fa;
    }
    
    .vidalium-chat-messages {
        background: #1a1a1a;
    }
    
    .vidalium-message-incoming .message-bubble {
        background: #2d2d2d;
        border-color: #404040;
        color: #e9ecef;
    }
    
    .message-meta {
        color: #adb5bd;
    }
    
    .message-sender {
        color: #dee2e6;
    }
    
    .user-selection-screen {
        background: #2d2d2d;
    }
    
    .user-selection-screen h4 {
        color: #e9ecef;
    }
    
    .user-selection {
        background: #2d2d2d;
        border-color: #404040;
        color: #e9ecef;
    }
    
    .text-input-container {
        background: #2d2d2d;
        border-color: #404040;
    }
    
    .message-input {
        color: #e9ecef;
    }
    
    .voice-recorder-bar {
        background: #2d2d2d;
        border-color: #404040;
    }
}