* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: #111b21;
    color: #e9edef;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    background-color: #111b21;
}

/* SIDEBAR */
.sidebar {
    width: 400px;
    background-color: #111b21;
    border-right: 1px solid #2a3942;
    display: flex;
    flex-direction: column;
    min-width: 320px;
}

.sidebar-header {
    background-color: #2a3942;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.profile-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.profile-pic {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-section h3 {
    color: #e9edef;
    font-size: 16px;
    font-weight: 400;
}

.header-actions {
    display: flex;
    gap: 20px;
}

.action-btn {
    color: #aebac1;
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.action-btn:hover {
    color: #e9edef;
}

.search-container {
    padding: 8px 12px;
    background-color: #111b21;
}

.search-box {
    background-color: #2a3942;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
}

.search-box i {
    color: #8696a0;
    font-size: 14px;
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: #e9edef;
    flex: 1;
    font-size: 14px;
}

.search-box input::placeholder {
    color: #8696a0;
}

.contacts-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #374045 transparent;
}

.contacts-list::-webkit-scrollbar {
    width: 6px;
}

.contacts-list::-webkit-scrollbar-track {
    background: transparent;
}

.contacts-list::-webkit-scrollbar-thumb {
    background-color: #374045;
    border-radius: 3px;
}

.contact-item {
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    transition: background-color 0.1s ease;
    border-bottom: 1px solid #2a3942;
}

.contact-item:hover {
    background-color: #2a3942;
}

.contact-item.active {
    background-color: #2a3942;
}

.contact-pic {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.contact-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.contact-name {
    color: #e9edef;
    font-size: 16px;
    font-weight: 400;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    width: 100%;
}

.contact-message {
    color: #8696a0;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    width: 100%;
}

.contact-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.contact-time {
    color: #8696a0;
    font-size: 12px;
}

.message-count {
    background-color: #00a884;
    color: white;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* CHAT AREA */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #0b141a;
    position: relative;
}

.chat-header {
    background-color: #2a3942;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    border-bottom: 1px solid #374045;
}

.chat-contact-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-contact-pic {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-contact-name {
    color: #e9edef;
    font-size: 16px;
    font-weight: 400;
}

.chat-contact-status {
    color: #8696a0;
    font-size: 13px;
}

.chat-actions {
    display: flex;
    gap: 20px;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-image: 
        radial-gradient(circle at 25% 25%, #0f2027 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, #203a43 0%, transparent 50%);
    background-attachment: fixed;
    scrollbar-width: thin;
    scrollbar-color: #374045 transparent;
    display: flex;
    flex-direction: column;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background-color: #374045;
    border-radius: 3px;
}

.message {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    max-width: 65%;
    animation: fadeIn 0.3s ease;
}

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

.message.sent {
    align-self: flex-end;
    align-items: flex-end;
}

.message.received {
    align-self: flex-start;
    align-items: flex-start;
}

.message-content {
    background-color: #005c4b;
    color: #e9edef;
    padding: 8px 12px;
    border-radius: 8px;
    word-wrap: break-word;
    position: relative;
    margin-bottom: 4px;
    white-space: pre-wrap;
}

.message.received .message-content {
    background-color: #202c33;
    border-radius: 8px 8px 8px 2px;
}

.message.sent .message-content {
    background-color: #005c4b;
    border-radius: 8px 8px 2px 8px;
}

.message-time {
    font-size: 11px;
    color: #8696a0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.message-status {
    font-size: 12px;
    color: #53bdeb;
}

.message-status.read {
    color: #53bdeb;
}

/* 🔗 Estilos para enlaces clicables */
.message-link {
    color: #53bdeb;
    text-decoration: underline;
    transition: color 0.2s ease;
    word-break: break-all;
}

.message-link:hover {
    color: #7bc5e8;
    text-decoration: underline;
}

.message-link:visited {
    color: #8696a0;
}

/* 😊 Estilos para indicador de reacciones */
.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
    align-items: center;
}

.reaction-item {
    background-color: rgba(134, 150, 160, 0.15);
    color: #e9edef;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 10px;
    border: 1px solid rgba(134, 150, 160, 0.2);
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    transition: all 0.2s ease;
}

.reaction-item:hover {
    background-color: rgba(134, 150, 160, 0.25);
    transform: scale(1.05);
}

/* Marcar mensajes con reacciones con un borde sutil */
.message-has-reactions .message-content {
    border-left: 3px solid #00a884;
    padding-left: 10px;
}

.message.sent.message-has-reactions .message-content {
    border-right: 3px solid #00a884;
    border-left: none;
    padding-right: 10px;
    padding-left: 12px;
}

.chat-input-container {
    background-color: #2a3942;
    padding: 10px 16px;
}

.chat-input {
    background-color: #2a3942;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
}

.emoji-btn, .attach-btn {
    color: #8696a0;
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.emoji-btn:hover, .attach-btn:hover {
    color: #e9edef;
}

.chat-input input {
    background: transparent;
    border: none;
    outline: none;
    color: #e9edef;
    flex: 1;
    font-size: 15px;
    padding: 8px 0;
}

.chat-input input::placeholder {
    color: #8696a0;
}

.send-btn {
    background-color: #00a884;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.send-btn:hover {
    background-color: #06cf9c;
}

.send-btn i {
    color: white;
    font-size: 16px;
}

/* MODAL */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: #2a3942;
    border-radius: 8px;
    width: 400px;
    max-width: 90%;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: scale(0.7);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid #374045;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    color: #e9edef;
    font-size: 18px;
    font-weight: 500;
}

.close-modal {
    color: #8696a0;
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-modal:hover {
    color: #e9edef;
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modal-body input {
    background-color: #111b21;
    border: 1px solid #374045;
    border-radius: 8px;
    padding: 12px;
    color: #e9edef;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.modal-body input:focus {
    border-color: #00a884;
}

.modal-body input::placeholder {
    color: #8696a0;
}

.btn-primary {
    background-color: #00a884;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-primary:hover {
    background-color: #06cf9c;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        max-width: 100%;
    }
    
    .chat-container {
        display: none;
    }
    
    .app-container.chat-open .sidebar {
        display: none;
    }
    
    .app-container.chat-open .chat-container {
        display: flex;
    }
    
    .message {
        max-width: 85%;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 100%;
        min-width: unset;
    }
    
    .sidebar-header {
        padding: 10px 12px;
    }
    
    .contact-item {
        padding: 10px 12px;
    }
    
    .chat-messages {
        padding: 12px;
    }
    
    .message {
        max-width: 90%;
    }
}

/* Estado de carga */
.loading {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #8696a0;
    border-radius: 50%;
    border-top-color: #00a884;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Efectos adicionales */
.message-content:hover {
    background-color: #005c4b;
}

.message.received .message-content:hover {
    background-color: #2d3943;
}

.contact-item:active {
    background-color: #374045;
}

/* Indicador de escritura */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #8696a0;
    font-size: 13px;
    font-style: italic;
    padding: 8px 0;
}

.typing-dots {
    display: flex;
    gap: 2px;
}

.typing-dots span {
    width: 4px;
    height: 4px;
    background-color: #8696a0;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* QR CODE STYLES */
.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px 20px;
    text-align: center;
}

.qr-header {
    margin-bottom: 30px;
}

.qr-icon {
    font-size: 48px;
    color: #00a884;
    margin-bottom: 20px;
}

.qr-header h3 {
    color: #e9edef;
    font-size: 24px;
    font-weight: 400;
    margin-bottom: 8px;
}

.qr-header p {
    color: #8696a0;
    font-size: 16px;
    margin: 0;
}

.qr-code-display {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#qr-code {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 256px;
    min-width: 256px;
}

.qr-text-fallback {
    background-color: #000;
    color: #fff;
    padding: 10px;
    border-radius: 8px;
    font-family: monospace;
    text-align: left;
    overflow: hidden;
}

.qr-instructions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 30px;
    max-width: 300px;
}

.instruction-step {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #e9edef;
    font-size: 14px;
    text-align: left;
}

.step-number {
    background-color: #00a884;
    color: #ffffff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    flex-shrink: 0;
}

.connection-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    padding: 20px;
    text-align: center;
}

.status-icon i {
    font-size: 48px;
    color: #8696a0;
    margin-bottom: 16px;
}

.status-text h3 {
    color: #e9edef;
    font-size: 18px;
    font-weight: 400;
    margin-bottom: 8px;
}

.status-text p {
    color: #8696a0;
    font-size: 14px;
    margin: 0;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #374045;
    border-top: 4px solid #00a884;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

/* Responsive QR */
@media (max-width: 768px) {
    .qr-container {
        padding: 20px 16px;
    }
    
    .qr-icon {
        font-size: 36px;
    }
    
    .qr-header h3 {
        font-size: 20px;
    }
    
    .qr-code-display {
        padding: 16px;
    }
    
    #qr-code {
        min-height: 200px;
        min-width: 200px;
    }
    
    .qr-instructions {
        max-width: 280px;
    }
}

/* Estados de carga y bienvenida */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.loading-spinner-large {
    width: 60px;
    height: 60px;
    border: 4px solid #374045;
    border-top: 4px solid #00a884;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-text h3 {
    color: #e9edef;
    font-size: 18px;
    font-weight: 400;
    margin-bottom: 8px;
}

.loading-text p {
    color: #8696a0;
    font-size: 14px;
    margin: 0;
}

.welcome-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px 20px;
    text-align: center;
}

.welcome-icon {
    margin-bottom: 24px;
}

.welcome-icon i {
    font-size: 80px;
    color: #00a884;
    opacity: 0.8;
}

.welcome-message h3 {
    color: #e9edef;
    font-size: 24px;
    font-weight: 300;
    margin-bottom: 12px;
}

.welcome-message p {
    color: #8696a0;
    font-size: 16px;
    margin: 0;
}

/* Mensajes de media */
.message-media .message-content {
    background-color: rgba(0, 168, 132, 0.1);
    border-left: 3px solid #00a884;
}

.message.received.message-media .message-content {
    background-color: rgba(42, 57, 66, 0.5);
    border-left: 3px solid #8696a0;
}

.media-content {
    font-style: italic;
    opacity: 0.9;
}

/* 🎵 Mensajes de audio */
.message-audio .message-content {
    padding: 0;
    background-color: transparent;
    border: none;
}

.audio-player-container {
    background-color: #2a3942;
    border-radius: 12px;
    padding: 12px;
    margin: 2px 0;
    max-width: 280px;
    border: 1px solid #374045;
}

.message.sent .audio-player-container {
    background-color: rgba(0, 168, 132, 0.15);
    border-color: rgba(0, 168, 132, 0.3);
}

.audio-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding: 4px 0;
}

.audio-icon {
    color: #00a884;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.audio-text {
    font-size: 13px;
    color: #e9edef;
    font-weight: 500;
}

.audio-player {
    width: 100%;
    height: 32px;
    background-color: transparent;
    border-radius: 6px;
    outline: none;
}

/* Personalizar controles de audio */
.audio-player::-webkit-media-controls-panel {
    background-color: #374045;
    border-radius: 6px;
}

.audio-player::-webkit-media-controls-play-button,
.audio-player::-webkit-media-controls-pause-button {
    background-color: #00a884;
    border-radius: 50%;
}

.audio-player::-webkit-media-controls-timeline {
    background-color: #8696a0;
    border-radius: 3px;
    margin: 0 8px;
}

.audio-player::-webkit-media-controls-current-time-display,
.audio-player::-webkit-media-controls-time-remaining-display {
    color: #e9edef;
    font-size: 11px;
    font-family: inherit;
}

.audio-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background-color: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    border-radius: 6px;
    color: #ff3b30;
    font-size: 13px;
}

.audio-error i {
    font-size: 14px;
}

/* Adaptaciones móviles para audio */
@media (max-width: 768px) {
    .audio-player-container {
        max-width: 250px;
        padding: 10px;
    }
    
    .audio-player {
        height: 28px;
    }
    
    .audio-text {
        font-size: 12px;
    }
}

/* Estados de mensajes mejorados */
.message-status.sent {
    color: #8696a0;
}

.message-status.delivered {
    color: #8696a0;
}

.message-status.read {
    color: #53bdeb;
}

.message-status.pending {
    color: #8696a0;
    animation: pulse 1s infinite;
}

/* Fotos de perfil con fallback */
.contact-pic, .chat-contact-pic {
    border-radius: 50%;
    object-fit: cover;
    background-color: #374045;
    border: 2px solid transparent;
    transition: border-color 0.2s ease;
}

.contact-pic:hover, .chat-contact-pic:hover {
    border-color: rgba(0, 168, 132, 0.3);
}

/* Círculos con iniciales para contactos sin foto */
.contact-pic-initials, .chat-contact-pic-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 500;
    color: #ffffff;
    text-transform: uppercase;
    flex-shrink: 0;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
}

.contact-pic-initials {
    width: 50px;
    height: 50px;
    font-size: 18px;
}

.chat-contact-pic-initials {
    width: 40px;
    height: 40px;
    font-size: 14px;
}

.contact-pic-initials:hover, .chat-contact-pic-initials:hover {
    border-color: rgba(0, 168, 132, 0.3);
    transform: scale(1.05);
}

/* Variaciones de color para las iniciales */
.contact-pic-initials:nth-of-type(odd) {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
}

.contact-pic-initials:nth-of-type(3n) {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
}

.contact-pic-initials:nth-of-type(4n) {
    background: linear-gradient(135deg, #dc3545 0%, #bd2130 100%);
}

.contact-pic-initials:nth-of-type(5n) {
    background: linear-gradient(135deg, #fd7e14 0%, #e55a00 100%);
}

.contact-pic-initials:nth-of-type(6n) {
    background: linear-gradient(135deg, #6f42c1 0%, #553d91 100%);
}

.contact-pic-initials:nth-of-type(7n) {
    background: linear-gradient(135deg, #e83e8c 0%, #c73667 100%);
}

.contact-pic-initials span, .chat-contact-pic-initials span {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Animaciones de carga */
@keyframes fadeInSlide {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.contact-item {
    animation: fadeInSlide 0.3s ease;
}

.contact-item:nth-child(1) { animation-delay: 0.1s; }
.contact-item:nth-child(2) { animation-delay: 0.2s; }
.contact-item:nth-child(3) { animation-delay: 0.3s; }
.contact-item:nth-child(4) { animation-delay: 0.4s; }
.contact-item:nth-child(5) { animation-delay: 0.5s; }

/* Mejoras en responsive */
@media (max-width: 768px) {
    .loading-spinner-large {
        width: 50px;
        height: 50px;
        border-width: 3px;
    }
    
    .welcome-icon i {
        font-size: 60px;
    }
    
    .welcome-message h3 {
        font-size: 20px;
    }
    
    .loading-text h3 {
        font-size: 16px;
    }
}

/* 🖼️ MENSAJES DE IMAGEN */
.message-image .message-content {
    padding: 0;
    background-color: transparent;
}

.image-container {
    border-radius: 8px;
    overflow: hidden;
    max-width: 300px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.image-container:hover {
    transform: scale(1.02);
}

.image-thumbnail {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    max-height: 200px;
    object-fit: cover;
}

.media-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background-color: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    border-radius: 8px;
    color: #ff3b30;
    font-size: 14px;
}

/* 🎥 MENSAJES DE VIDEO */
.message-video .message-content {
    padding: 0;
    background-color: transparent;
}

.video-container {
    border-radius: 8px;
    overflow: hidden;
    max-width: 300px;
    cursor: pointer;
}

.video-thumbnail {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    position: relative;
    transition: all 0.3s ease;
}

.video-thumbnail:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

.play-icon {
    font-size: 48px;
    color: white;
    margin-bottom: 12px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
    transition: transform 0.2s ease;
}

.video-thumbnail:hover .play-icon {
    transform: scale(1.1);
}

.video-info {
    color: white;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.video-info i {
    font-size: 16px;
}

/* 📄 MENSAJES DE DOCUMENTO */
.message-document .message-content {
    padding: 0;
    background-color: transparent;
}

.document-container {
    background-color: #2a3942;
    border-radius: 12px;
    padding: 8px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #374045;
    max-width: 320px;
}

.message.sent .document-container {
    background-color: rgba(0, 168, 132, 0.15);
    border-color: rgba(0, 168, 132, 0.3);
}

.document-container:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.document-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.doc-icon {
    font-size: 24px;
    min-width: 32px;
    text-align: center;
}

.doc-details {
    flex: 1;
    min-width: 0;
}

.doc-name {
    font-weight: 500;
    color: #e9edef;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.doc-size {
    color: #8696a0;
    font-size: 12px;
}

.doc-action {
    color: #00a884;
    font-size: 18px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(0, 168, 132, 0.1);
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.document-container:hover .doc-action {
    background-color: rgba(0, 168, 132, 0.2);
}

/* 😄 MENSAJES DE STICKER */
.message-sticker .message-content {
    padding: 0;
    background-color: transparent;
}

.message-sticker .image-container {
    max-width: 150px;
}

.message-sticker .image-thumbnail {
    max-height: 150px;
}

/* 👤 MENSAJES DE CONTACTO (vCard) */
.message-vcard .message-content {
    padding: 0;
    background-color: transparent;
}

.contact-container {
    display: flex;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    max-width: 280px;
    min-width: 200px;
}

.contact-container:hover {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.contact-info {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 8px;
}

.contact-icon {
    background-color: #00a884;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.contact-details {
    flex: 1;
    min-width: 0;
}

.contact-name {
    font-weight: 600;
    color: #e9edef;
    font-size: 13px;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-label {
    color: #8696a0;
    font-size: 12px;
    font-weight: 400;
}

.contact-action {
    color: #8696a0;
    font-size: 14px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.contact-container:hover .contact-action {
    color: #00a884;
    background-color: rgba(0, 168, 132, 0.1);
}

/* Variación para mensajes recibidos */
.message.received .contact-container {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

.message.received .contact-container:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* 🎨 LIGHTBOX */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.lightbox-video {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

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

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Adaptaciones móviles para media */
@media (max-width: 768px) {
    .image-container {
        max-width: 250px;
    }
    
    .image-thumbnail {
        max-height: 180px;
    }
    
    .video-container {
        max-width: 250px;
    }
    
    .video-thumbnail {
        min-height: 120px;
        padding: 16px;
    }
    
    .play-icon {
        font-size: 36px;
    }
    
    .document-container {
        max-width: 280px;
    }
    
    .lightbox-content {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .lightbox-close {
        top: -40px;
        font-size: 20px;
        width: 40px;
        height: 40px;
    }
    
    .message-sticker .image-container {
        max-width: 120px;
    }
    
    .message-sticker .image-thumbnail {
        max-height: 120px;
    }
}

/* Animaciones para media */
@keyframes mediaFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.image-container,
.video-container,
.document-container {
    animation: mediaFadeIn 0.3s ease;
}

/* Estados de carga para media */
.media-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #8696a0;
}

.media-loading i {
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

/* Indicadores de tipo de archivo mejorados */
.doc-icon i {
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.1));
}

/* Efectos hover mejorados */
.image-thumbnail,
.video-thumbnail,
.document-container {
    transform: translateZ(0); /* Optimización para animaciones */
}

/* 😊 Soporte para reacciones mejorado */
.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
    padding-top: 4px;
    min-height: 20px;
}

.reaction-item {
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 3px 8px;
    font-size: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #e9edef;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.reaction-item:hover {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.emoji-reaction {
    font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif;
    font-weight: normal;
    min-width: 24px;
    justify-content: center;
}

.message-has-reactions {
    margin-bottom: 8px;
}

/* 🚫 Estilos para mensajes eliminados */
.message.revoked .message-content {
    font-style: italic;
    color: #8696a0;
    opacity: 0.8;
    border-left: 3px solid #dc3545;
    padding-left: 8px;
    background-color: rgba(220, 53, 69, 0.1);
    border-radius: 6px;
}

.message.notification .message-content {
    font-style: italic;
    color: #8696a0;
    opacity: 0.9;
    text-align: center;
    background-color: rgba(134, 150, 160, 0.1);
    border-radius: 6px;
    padding: 8px;
}

.message.group_notification .message-content {
    font-style: italic;
    color: #00a884;
    opacity: 0.9;
    text-align: center;
    background-color: rgba(0, 168, 132, 0.1);
    border-radius: 6px;
    padding: 6px;
}

/* Tipos de mensaje específicos */
.message-revoked,
.message-notification,
.message-group_notification {
    margin: 4px 0;
}

.message-revoked .message-time {
    opacity: 0.6;
}

/* Indicador visual para mensajes eliminados */
.message.revoked::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: #dc3545;
    border-radius: 0 3px 3px 0;
}

/* 📅 SEPARADORES DE FECHA */
.date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    position: relative;
}

.date-separator::before,
.date-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(to right, transparent, #374045, transparent);
}

.date-separator-text {
    background-color: #2a3942;
    color: #8696a0;
    padding: 6px 16px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    margin: 0 16px;
    border: 1px solid #374045;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Variación para hoy/ayer */
.date-separator.today .date-separator-text {
    background-color: rgba(0, 168, 132, 0.1);
    color: #00a884;
    border-color: rgba(0, 168, 132, 0.3);
}

.date-separator.yesterday .date-separator-text {
    background-color: rgba(255, 193, 7, 0.1);
    color: #ffc107;
    border-color: rgba(255, 193, 7, 0.3);
}

/* 🍞 Notificaciones Toast */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    pointer-events: none;
}

.toast-notification {
    background: #2a3942;
    color: #e9edef;
    padding: 0;
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 300px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
    pointer-events: auto;
    border-left: 4px solid #00a884;
}

.toast-notification.toast-success {
    border-left-color: #00a884;
}

.toast-notification.toast-error {
    border-left-color: #dc3545;
}

.toast-notification.toast-warning {
    border-left-color: #ffc107;
}

.toast-notification.toast-info {
    border-left-color: #17a2b8;
}

.toast-notification.toast-show {
    opacity: 1;
    transform: translateX(0);
}

.toast-notification.toast-hide {
    opacity: 0;
    transform: translateX(100%);
}

.toast-content {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
}

.toast-content i:first-child {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-success .toast-content i:first-child {
    color: #00a884;
}

.toast-error .toast-content i:first-child {
    color: #dc3545;
}

.toast-warning .toast-content i:first-child {
    color: #ffc107;
}

.toast-info .toast-content i:first-child {
    color: #17a2b8;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: #8696a0;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.toast-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #e9edef;
}

/* 📱 Responsive para toast */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .toast-notification {
        min-width: auto;
        max-width: none;
    }
}

/* 🔧 Estados de carga mejorados */
.loading-content {
    text-align: center;
    padding: 40px 20px;
}

.loading-content p {
    margin-top: 20px;
    color: #8696a0;
    font-size: 16px;
}

.chat-loading,
.chat-empty,
.chat-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    text-align: center;
    color: #8696a0;
}

.chat-loading p,
.chat-empty p,
.chat-error p {
    margin: 10px 0;
}

.chat-empty i,
.chat-error i {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.chat-error i {
    color: #dc3545;
}

.btn-retry {
    background-color: #00a884;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 15px;
    transition: background-color 0.2s ease;
}

.btn-retry:hover {
    background-color: #008a73;
}

.btn-retry i {
    margin-right: 5px;
    font-size: 12px;
}

/* Adaptación móvil */
@media (max-width: 768px) {
    .date-separator {
        margin: 16px 0;
    }
    
    .date-separator-text {
        font-size: 11px;
        padding: 4px 12px;
        margin: 0 12px;
    }
}