/* =====================================================
   INTERNAL CHAT SYSTEM STYLES
   ===================================================== */

/* Floating Action Button (FAB) */
.chat-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9998;
}

.chat-fab:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

.chat-fab i {
    font-size: 28px;
    color: white;
}

.chat-fab-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Chat Window Container */
.chat-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-window.active {
    display: flex;
}

.chat-window.minimized {
    height: 60px;
    overflow: hidden;
}

.chat-window.minimized .chat-conversations,
.chat-window.minimized .chat-messages-view,
.chat-window.minimized .chat-new-modal,
.chat-window.minimized #chatNewBtn {
    display: none !important;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chat-header-title {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-header-actions {
    display: flex;
    gap: 10px;
}

.chat-header-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-header-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Conversation List */
.chat-conversations {
    flex: 1;
    overflow-y: auto;
    background: #f8f9fa;
}

.chat-conversation-item {
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.chat-conversation-item:hover {
    background: #e9ecef;
}

/* Conversaciones con mensajes no leídos - Destacadas */
.chat-conversation-item.has-unread {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.08) 0%, rgba(255, 255, 255, 0) 100%);
    border-left: 4px solid #667eea;
    padding-left: 16px;
}

.chat-conversation-item.has-unread:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.12) 0%, rgba(255, 255, 255, 0) 100%);
}

/* Wrapper del avatar con indicador */
.chat-conversation-avatar-wrapper {
    position: relative;
    flex-shrink: 0;
}

/* Indicador pulsante para mensajes no leídos */
.chat-conversation-unread-indicator {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 16px;
    height: 16px;
    background: #ff4757;
    border: 3px solid white;
    border-radius: 50%;
    animation: pulse-unread 2s infinite;
    z-index: 1;
}

@keyframes pulse-unread {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7);
    }

    50% {
        transform: scale(1.1);
        box-shadow: 0 0 0 6px rgba(255, 71, 87, 0);
    }
}

.chat-conversation-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

/* Avatar con borde para mensajes no leídos */
.chat-conversation-item.has-unread .chat-conversation-avatar {
    border: 3px solid #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.chat-conversation-info {
    flex: 1;
    min-width: 0;
}

.chat-conversation-name {
    font-weight: 600;
    font-size: 15px;
    color: #2d3748;
    margin-bottom: 4px;
}

/* Nombre en negrita para mensajes no leídos */
.chat-conversation-item.has-unread .chat-conversation-name {
    font-weight: 700;
    color: #1a202c;
}

.chat-conversation-preview {
    font-size: 13px;
    color: #718096;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Vista previa en negrita para mensajes no leídos */
.chat-conversation-preview.unread-preview {
    font-weight: 600;
    color: #4a5568;
}

.chat-conversation-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.chat-conversation-time {
    font-size: 11px;
    color: #a0aec0;
}

/* Tiempo en color destacado para mensajes no leídos */
.chat-conversation-item.has-unread .chat-conversation-time {
    color: #667eea;
    font-weight: 600;
}

.chat-conversation-unread {
    background: linear-gradient(135deg, #ff4757 0%, #ff6b81 100%);
    color: white;
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
    animation: bounce-in 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounce-in {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* Messages View */
.chat-messages-view {
    display: none;
    flex-direction: column;
    height: 100%;
}

.chat-messages-view.active {
    display: flex;
}

.chat-messages-header {
    background: #f8f9fa;
    padding: 12px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-back-btn {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    font-size: 20px;
    padding: 4px;
}

.chat-contact-name {
    font-weight: 600;
    font-size: 16px;
    color: #2d3748;
}

.chat-messages-container {
    flex: 1;
    overflow-y: overlay;
    padding: 20px 20px 80px 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Message Bubbles */
.chat-message {
    display: flex;
    gap: 8px;
    max-width: 75%;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.sent {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.received {
    align-self: flex-start;
}

.chat-message-bubble {
    padding: 10px 14px;
    border-radius: 16px;
    word-wrap: break-word;
}

.chat-message.sent .chat-message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.received .chat-message-bubble {
    background: white;
    color: #2d3748;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chat-message-text {
    font-size: 14px;
    line-height: 1.5;
}

.chat-message-time {
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.7;
}

/* File Message */
.chat-file-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
}

.chat-message.received .chat-file-message {
    background: #f8f9fa;
}

.chat-file-icon {
    font-size: 32px;
}

.chat-file-info {
    flex: 1;
    min-width: 0;
}

.chat-file-name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-file-download {
    color: inherit;
    text-decoration: none;
    font-size: 12px;
    opacity: 0.8;
}

/* Message Input */
.chat-input-container {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-shrink: 0;
    /* No se encoge nunca */
    position: sticky;
    /* Se mantiene fijo en la parte inferior */
    bottom: 0;
    z-index: 10;
}

.chat-input-wrapper {
    flex: 1;
    position: relative;
}

.chat-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 14px;
    resize: none;
    font-family: inherit;
    min-height: 42px;
    /* Altura mínima (1 línea) */
    max-height: 150px;
    /* Altura máxima (aprox 6 líneas) */
    overflow-y: auto;
    /* Scroll cuando excede max-height */
    transition: border-color 0.2s;
    line-height: 1.5;
}

.chat-input:focus {
    outline: none;
    border-color: #667eea;
}

.chat-input-actions {
    display: flex;
    gap: 8px;
}

.chat-input-btn {
    background: #f8f9fa;
    border: none;
    color: #667eea;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s;
}

.chat-input-btn:hover {
    background: #e9ecef;
}

.chat-send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.chat-send-btn:hover {
    transform: scale(1.05);
}

/* Emoji Picker */
.chat-emoji-picker {
    position: absolute;
    bottom: 55px;
    right: 10px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    padding: 12px;
    display: none;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
    max-width: 320px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 100;
    border: 1px solid #e9ecef;
}

.chat-emoji-picker.active {
    display: grid;
}

.chat-emoji {
    font-size: 22px;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: all 0.2s;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
}

.chat-emoji:hover {
    background: #f3f4f6;
    transform: scale(1.2);
}

.chat-emoji:active {
    transform: scale(1.1);
}

/* Scrollbar para emoji picker */
.chat-emoji-picker::-webkit-scrollbar {
    width: 6px;
}

.chat-emoji-picker::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.chat-emoji-picker::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

.chat-emoji-picker::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* New Chat Modal */
.chat-new-modal {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 10;
    display: none;
    flex-direction: column;
}

.chat-new-modal.active {
    display: flex;
}

.chat-new-header {
    background: #f8f9fa;
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-new-title {
    font-weight: 600;
    font-size: 16px;
    color: #2d3748;
}

.chat-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    font-size: 13px;
    margin: 12px 20px;
    width: calc(100% - 40px);
    background: #f8f9fa;
    color: #6b7280;
}

.chat-search-input::placeholder {
    color: #9ca3af;
    font-size: 12px;
}

.chat-search-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
}

.chat-users-list {
    flex: 1;
    overflow-y: auto;
    padding-top: 8px;
}

.chat-user-item {
    padding: 14px 20px;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s;
}

.chat-user-item:hover {
    background: #f8f9fa;
}

.chat-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
    position: relative;
}

.chat-user-avatar .online-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #10b981;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Estado: Disponible (Verde) */
.chat-user-avatar .online-indicator.available {
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.3);
}

/* Estado: Ocupado (Naranja) */
.chat-user-avatar .online-indicator.busy {
    background: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.3);
}

/* Estado: Desconectado (Rojo) */
.chat-user-avatar .online-indicator.offline {
    background: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.3);
}

.chat-user-info {
    flex: 1;
}

.chat-user-name {
    font-weight: 600;
    font-size: 14px;
    color: #2d3748;
}

.chat-user-email {
    font-size: 12px;
    color: #718096;
}

.chat-user-status {
    font-size: 11px;
    font-weight: 600;
    margin-top: 2px;
}

/* Colores de texto para cada estado */
.chat-user-status.available {
    color: #10b981;
}

.chat-user-status.busy {
    color: #f59e0b;
}

.chat-user-status.offline {
    color: #ef4444;
}

.chat-online-count {
    background: #10b981;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.chat-online-count i {
    font-size: 10px;
}

.chat-user-info {
    flex: 1;
}

.chat-user-name {
    font-weight: 600;
    font-size: 14px;
    color: #2d3748;
}

.chat-user-email {
    font-size: 12px;
    color: #718096;
}

.chat-user-status {
    font-size: 11px;
    color: #10b981;
    font-weight: 600;
    margin-top: 2px;
}

.chat-online-count {
    background: #10b981;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.chat-online-count i {
    font-size: 10px;
}

/* Toast Notification */
.chat-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    padding: 16px 20px;
    display: none;
    align-items: center;
    gap: 12px;
    max-width: 350px;
    z-index: 10000;
    cursor: pointer;
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-toast.active {
    display: flex;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.chat-toast-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
}

.chat-toast-content {
    flex: 1;
}

.chat-toast-name {
    font-weight: 600;
    font-size: 14px;
    color: #2d3748;
    margin-bottom: 2px;
}

.chat-toast-message {
    font-size: 13px;
    color: #718096;
}

/* Empty State */
.chat-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px;
    text-align: center;
    color: #a0aec0;
}

.chat-empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.chat-empty-text {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.chat-empty-subtext {
    font-size: 14px;
}

/* Scrollbar Styling */
.chat-conversations::-webkit-scrollbar,
.chat-messages-container::-webkit-scrollbar,
.chat-users-list::-webkit-scrollbar {
    width: 6px;
}

.chat-conversations::-webkit-scrollbar-track,
.chat-messages-container::-webkit-scrollbar-track,
.chat-users-list::-webkit-scrollbar-track {
    background: transparent;
}

.chat-conversations::-webkit-scrollbar-thumb,
.chat-messages-container::-webkit-scrollbar-thumb,
.chat-users-list::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.chat-conversations::-webkit-scrollbar-thumb:hover,
.chat-messages-container::-webkit-scrollbar-thumb:hover,
.chat-users-list::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        border-radius: 0;
    }

    .chat-fab {
        bottom: 20px;
        right: 20px;
    }

    .chat-toast {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* Loading Spinner */
.chat-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.chat-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e9ecef;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* =====================================================
   POP-UP ALERT FOR NEW MESSAGES
   ===================================================== */

/* Overlay oscuro de fondo */
.chat-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: fadeInOverlay 0.3s ease-out;
}

.chat-popup-overlay.active {
    display: flex;
}

@keyframes fadeInOverlay {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Contenedor de la alerta */
.chat-popup-alert {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    max-width: 480px;
    width: 90%;
    padding: 40px;
    text-align: center;
    animation: popIn 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    display: flex;
    /* Added for strict centering logic if needed, though text-align works */
    flex-direction: column;
    align-items: center;
    /* Ensure items like buttons are centered */
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.7) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Icono animado */
.chat-popup-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 32px;
    /* Aumentado de 24px a 32px para más espacio abajo */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.chat-popup-icon i {
    font-size: 40px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 5px;
    /* Push icon slightly down for visual centering */
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 12px 32px rgba(102, 126, 234, 0.6);
    }
}

/* Contenido del pop-up */
.chat-popup-content {
    margin-bottom: 32px;
}

.chat-popup-title {
    font-size: 28px;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.chat-popup-sender {
    font-size: 20px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 12px;
}

.chat-popup-message {
    font-size: 16px;
    color: #718096;
    line-height: 1.6;
    max-height: 100px;
    overflow-y: auto;
    padding: 12px 20px;
    background: #f7fafc;
    border-radius: 12px;
    margin: 0 auto;
    max-width: 100%;
}

/* Botones de acción */
.chat-popup-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.chat-popup-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 140px;
    justify-content: center;
}

.chat-popup-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chat-popup-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.5);
}

.chat-popup-btn-primary:active {
    transform: translateY(0);
}

.chat-popup-btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.chat-popup-btn-secondary:hover {
    background: #cbd5e0;
    transform: translateY(-2px);
}

.chat-popup-btn-secondary:active {
    transform: translateY(0);
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .chat-popup-alert {
        padding: 32px 24px;
        max-width: 95%;
    }

    .chat-popup-icon {
        width: 70px;
        height: 70px;
        margin-bottom: 20px;
    }

    .chat-popup-icon i {
        font-size: 36px;
    }

    .chat-popup-title {
        font-size: 24px;
    }

    .chat-popup-sender {
        font-size: 18px;
    }

    .chat-popup-message {
        font-size: 14px;
    }

    .chat-popup-actions {
        flex-direction: column;
    }

    .chat-popup-btn {
        width: 100%;
    }
}

/* Status Indicator in Conversation List */
.chat-conversation-status-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    border: 2px solid white;
    border-radius: 50%;
    z-index: 2;
    display: none;
    /* Hidden by default (offline) */
}

.chat-conversation-status-dot.available {
    display: block;
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.chat-conversation-status-dot.busy {
    display: block;
    background: #f59e0b;
}

/* Ensure wrapper allows positioning */
.chat-conversation-avatar-wrapper {
    position: relative;
    display: inline-block;
    /* Ensure it wraps the avatar tight */
}

/* Date Separator */
.chat-date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    position: relative;
}

.chat-date-separator span {
    background: rgba(0, 0, 0, 0.05);
    /* Light gray background */
    color: #718096;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Ensure text wrapping works correctly */
.chat-message-text {
    white-space: pre-wrap;
    /* Preserve whitespace and newlines, but wrap text */
    word-break: break-word;
    /* Break long words if necessary */
    overflow-wrap: break-word;
    /* Standard property */
    max-width: 100%;
    /* Ensure it doesn't overflow container */
}

/* Adjust bubble width flexibility */
.chat-message-bubble {
    width: fit-content;
    /* Fit usage */
    max-width: 100%;
    /* Relative to the message container */
}