/* WhatsApp-like Chat Styles */
.whatsapp-chat-modal {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.chat-header {
    background: linear-gradient(135deg, #128C7E, #075E54) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 60px;
}

.chat-header-info h6 {
    font-size: 1.1rem;
}

.chat-header-actions .btn {
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chat-header-actions .btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-body {
    height: 400px;
    overflow-y: auto;
    padding: 20px;
    background-color: #e5ddd5;
    position: relative;
    display: flex;
    flex-direction: column;
}

.chat-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.06;
    pointer-events: none;
}

.chat-input-area {
    background: #f0f0f0;
    border-top: 1px solid #e0e0e0;
    padding: 12px 16px;
}

.chat-input-area .btn-link {
    color: #666;
    border: none;
    padding: 8px 12px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.chat-input-area .btn-link:hover {
    background-color: #e0e0e0;
    color: #128C7E;
}

.message-input {
    border: none !important;
    box-shadow: none !important;
    background: white;
    border-radius: 20px !important;
    padding: 12px 20px !important;
    font-size: 0.95rem;
}

.message-input:focus {
    border: none !important;
    box-shadow: 0 0 0 2px rgba(18, 140, 126, 0.2) !important;
}

#sendMessageBtn {
    background: #128C7E;
    border: none;
    transition: all 0.2s ease;
}

#sendMessageBtn:hover:not(:disabled) {
    background: #075E54;
    transform: scale(1.05);
}

#sendMessageBtn:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

/* Message Bubbles - FIXED ALIGNMENT */
.message-item {
    display: flex;
    margin-bottom: 8px;
    animation: fadeInUp 0.3s ease-out;
}

.current-user-message {
    justify-content: flex-end;
}

.other-user-message {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 70%;
    display: flex;
}

.current-user-message .message-bubble {
    justify-content: flex-end;
}

.other-user-message .message-bubble {
    justify-content: flex-start;
}

.current-user-message .message-content {
    background: #dcf8c6;
    color: #000;
    border-radius: 8px 8px 0 8px;
    padding: 8px 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
    margin-left: auto;
}

.current-user-message .message-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -8px;
    width: 0;
    height: 0;
    border-left: 8px solid #dcf8c6;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.other-user-message .message-content {
    background: white;
    color: #333;
    border-radius: 8px 8px 8px 0;
    padding: 8px 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
    margin-right: auto;
}

.other-user-message .message-content::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -8px;
    width: 0;
    height: 0;
    border-right: 8px solid white;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.message-header {
    margin-bottom: 4px;
}

.message-sender {
    font-size: 0.85em;
    font-weight: 600;
    color: #128C7E;
}

.message-text {
    font-size: 0.95rem;
    line-height: 1.4;
    word-wrap: break-word;
    margin-bottom: 4px;
}

.message-footer {
    font-size: 0.75em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.message-time {
    opacity: 0.7;
    color: rgba(0, 0, 0, 0.6);
}

.read-status .fa-check-double {
    color: #34b7f1;
}

.read-status .fa-check {
    color: #666;
}

/* File Preview */
.file-preview {
    border-top: 1px solid #e0e0e0;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Emoji Picker */
.emoji-picker {
    max-height: 200px;
    overflow-y: auto;
}

.emoji-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    max-height: 140px;
    overflow-y: auto;
    padding: 5px;
}

.emoji-btn {
    border: none;
    background: none;
    font-size: 1.5em;
    padding: 6px 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    margin: 2px;
}

.emoji-btn:hover {
    background-color: #e0e0e0;
    transform: scale(1.1);
}

.emoji-categories {
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 8px;
    margin-bottom: 8px;
    display: flex;
    justify-content: center;
    gap: 4px;
}

.emoji-categories .btn {
    padding: 6px 12px;
    font-size: 1.2em;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.emoji-categories .btn.active {
    background-color: #128C7E;
    color: white;
    border-color: #128C7E;
}

/* Message Attachments */
.message-attachment {
    margin-top: 8px;
}

.chat-attachment-image {
    max-height: 200px;
    cursor: pointer;
    transition: transform 0.2s ease;
    border-radius: 8px;
}

.chat-attachment-image:hover {
    transform: scale(1.02);
}

.chat-file-link {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.chat-file-link:hover {
    background-color: #f8f9fa;
    text-decoration: none;
    border-color: #128C7E;
}

/* Scrollbar Styling */
.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.chat-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.chat-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .message-bubble {
        max-width: 85%;
    }
    
    .chat-body {
        height: 400px;
        padding: 15px;
    }
    
    .chat-input-area {
        padding: 10px;
    }
    
    .message-input {
        padding: 10px 16px !important;
    }
}

@media (max-width: 576px) {
    .message-bubble {
        max-width: 90%;
    }
    
    .chat-body {
        height: 350px;
        padding: 10px;
    }
    
    .emoji-picker {
        max-height: 150px;
    }
    
    .emoji-btn {
        font-size: 1.3em;
        padding: 4px 6px;
    }
}

/* Notification Styles */
.new-message-notification {
    animation: slideInRight 0.3s ease-out;
}

.new-message-notification .toast {
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Chat Button Notification */
.chat-btn.has-new-messages {
    position: relative;
    animation: pulse 2s infinite;
}

.chat-btn.has-new-messages::after {
    content: '';
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background-color: #dc3545;
    border-radius: 50%;
    border: 2px solid white;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(220, 53, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

/* Alert Styles */
.chat-alert {
    border-radius: 8px;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin: 10px;
}

/* Auto-resize textarea */
.message-input {
    resize: none;
    min-height: 40px;
    max-height: 120px;
}

/* Utility Classes */
.opacity-75 {
    opacity: 0.75 !important;
}

.bg-success {
    background-color: #128C7E !important;
}

.text-success {
    color: #128C7E !important;
}

.btn-success {
    background-color: #128C7E !important;
    border-color: #128C7E !important;
}

.btn-success:hover {
    background-color: #075E54 !important;
    border-color: #075E54 !important;
}

.badge.bg-secondary {
    background-color: #6c757d !important;
}

/* Loading States */
.fa-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* File Type Icons */
.fa-file-pdf {
    color: #dc3545 !important;
}

.fa-file-word {
    color: #2b579a !important;
}

.fa-file-image {
    color: #28a745 !important;
}

.fa-file-archive {
    color: #fd7e14 !important;
}

.fa-file-alt {
    color: #17a2b8 !important;
}

.fa-file {
    color: #6c757d !important;
}