* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #111b21;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
    background: #222e35;
}

/* Sidebar de Chats */
.chats-sidebar {
    width: 350px;
    background: #111b21;
    border-right: 1px solid #2a3942;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    background: #202c33;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    color: #e9edef;
    font-size: 24px;
}

.icon-btn {
    background: transparent;
    border: none;
    color: #aebac1;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: #2a3942;
}

.search-bar {
    padding: 10px;
    background: #111b21;
}

.search-bar input {
    width: 100%;
    padding: 10px 15px;
    background: #202c33;
    border: none;
    border-radius: 8px;
    color: #e9edef;
    font-size: 14px;
}

.search-bar input:focus {
    outline: none;
    background: #2a3942;
}

.chats-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    cursor: pointer;
    border-bottom: 1px solid #2a3942;
    transition: background 0.2s;
}

.chat-item:hover {
    background: #202c33;
}

.chat-item.active {
    background: #2a3942;
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 20px;
    flex-shrink: 0;
}

.chat-item-info {
    flex: 1;
    min-width: 0;
}

.chat-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.chat-item-name {
    color: #e9edef;
    font-weight: 500;
    font-size: 16px;
}

.chat-item-time {
    color: #8696a0;
    font-size: 12px;
}

.chat-item-preview {
    color: #8696a0;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread-badge {
    background: #25d366;
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: bold;
}

/* Área de Chat */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0b141a;
}

.chat-header {
    padding: 15px 20px;
    background: #202c33;
    border-bottom: 1px solid #2a3942;
}

.chat-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-info h3 {
    color: #e9edef;
    font-size: 18px;
}

.status {
    color: #8696a0;
    font-size: 13px;
}

.status.online {
    color: #25d366;
}

/* Mensajes */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><rect fill="%230b141a" width="100" height="100"/><circle fill="%23202c33" fill-opacity="0.1" cx="50" cy="50" r="30"/></svg>');
}

.message {
    display: flex;
    margin-bottom: 15px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.sent {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 65%;
    padding: 8px 12px;
    border-radius: 8px;
    position: relative;
}

.message.received .message-bubble {
    background: #202c33;
    color: #e9edef;
}

.message.sent .message-bubble {
    background: #005c4b;
    color: #e9edef;
}

.message-sender {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
    opacity: 0.9;
}

.message.received .message-sender {
    color: #25d366;
}

.message.sent .message-sender {
    color: #a8c7c7;
}

.message-content {
    word-wrap: break-word;
    margin-bottom: 5px;
}

.message-image {
    max-width: 100%;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 5px;
}

.message-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin-bottom: 5px;
}

.file-icon {
    font-size: 32px;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    margin-bottom: 3px;
}

.file-size {
    font-size: 12px;
    opacity: 0.7;
}

.download-btn {
    background: transparent;
    border: 1px solid currentColor;
    color: inherit;
    padding: 5px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
}

.download-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.message-location {
    width: 300px;
    height: 200px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 5px;
    cursor: pointer;
}

.message-location iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.message-time {
    font-size: 11px;
    color: #8696a0;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
}

.message.sent .message-time {
    color: #a8c7c7;
}

/* Área de Input */
.input-area {
    padding: 15px 20px;
    background: #202c33;
    display: flex;
    gap: 10px;
    align-items: center;
}

#messageInput {
    flex: 1;
    padding: 12px 15px;
    background: #2a3942;
    border: none;
    border-radius: 8px;
    color: #e9edef;
    font-size: 15px;
}

#messageInput:focus {
    outline: none;
    background: #3b4a54;
}

.send-btn {
    padding: 12px 24px;
    background: #25d366;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.send-btn:hover {
    background: #20bd5a;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #202c33;
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    position: relative;
}

.modal-content.image-preview {
    max-width: 90%;
    max-height: 90%;
    padding: 20px;
}

.modal-content.image-preview img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 8px;
}

.close {
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #8696a0;
    cursor: pointer;
}

.close:hover {
    color: #e9edef;
}

.modal-content h2 {
    color: #e9edef;
    margin-bottom: 20px;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    background: #2a3942;
    border: none;
    border-radius: 8px;
    color: #e9edef;
    font-size: 15px;
    margin-bottom: 20px;
}

.modal-content input:focus {
    outline: none;
    background: #3b4a54;
}

.modal-content button {
    width: 100%;
    padding: 12px;
    background: #25d366;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    font-size: 15px;
}

.modal-content button:hover {
    background: #20bd5a;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #374045;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4a5a62;
}

/* Responsive */
@media (max-width: 768px) {
    .chats-sidebar {
        width: 100%;
        position: absolute;
        z-index: 10;
    }
    
    .chats-sidebar.hidden {
        display: none;
    }
    
    .message-bubble {
        max-width: 85%;
    }
}
