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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #111b21;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
}

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

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

.user-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.sidebar-actions {
    display: flex;
    gap: 10px;
}

.icon-btn {
    background: none;
    border: none;
    color: #aebac1;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.icon-btn:hover {
    background: #2a3942;
}

/* ===== BÚSQUEDA ===== */
.search-container {
    padding: 8px 16px;
    background: #111b21;
}

.search-input {
    width: 100%;
    padding: 10px 12px;
    background: #202c33;
    border: none;
    border-radius: 8px;
    color: #e9edef;
    font-size: 14px;
    outline: none;
}

.search-input::placeholder {
    color: #667781;
}

/* ===== LISTA DE CHATS ===== */
.chat-list {
    flex: 1;
    overflow-y: auto;
    background: #111b21;
}

.chat-item {
    display: flex;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #2a3942;
    transition: background 0.2s;
    align-items: center;
    gap: 12px;
}

.chat-item:hover {
    background: #202c33;
}

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

.chat-item-avatar img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

.chat-item-info {
    flex: 1;
    min-width: 0;
}

.chat-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

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

.chat-item-time {
    color: #667781;
    font-size: 12px;
}

.chat-item-preview {
    color: #667781;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-unread {
    background: #00a884;
    color: #111b21;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 12px;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

/* ===== CHAT PANEL ===== */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #222e35;
}

/* Pantalla de bienvenida */
.chat-welcome {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #222e35;
    border-bottom: 6px solid #00a884;
}

.welcome-content {
    text-align: center;
    color: #e9edef;
}

.welcome-content h1 {
    font-size: 48px;
    margin-bottom: 20px;
}

.welcome-content p {
    color: #8696a0;
    font-size: 18px;
}

/* Chat activo */
.chat-active {
    flex: 1;
    display: flex;
    flex-direction: column;
}

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

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

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.chat-header-info h3 {
    color: #e9edef;
    font-size: 16px;
    font-weight: 400;
}

.chat-status {
    color: #667781;
    font-size: 13px;
}

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

/* ===== MENSAJES ===== */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 8%;
    background: #0b141a;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" opacity="0.05"><text x="10" y="50" font-size="40">💬</text></svg>');
}

.message {
    display: flex;
    margin-bottom: 12px;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    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-text {
    font-size: 14px;
    line-height: 1.4;
    margin-bottom: 4px;
}

.message-time {
    font-size: 11px;
    color: #8696a0;
    text-align: right;
}

/* ===== INPUT DE MENSAJE ===== */
.message-input-container {
    background: #202c33;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.message-input {
    flex: 1;
    padding: 10px 12px;
    background: #2a3942;
    border: none;
    border-radius: 8px;
    color: #e9edef;
    font-size: 15px;
    outline: none;
}

.message-input::placeholder {
    color: #667781;
}

.send-btn {
    background: #00a884;
    border: none;
    color: #111b21;
    font-size: 20px;
    cursor: pointer;
    padding: 10px 16px;
    border-radius: 50%;
    transition: background 0.2s;
}

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

/* ===== SCROLLBAR ===== */
.chat-list::-webkit-scrollbar,
.messages-container::-webkit-scrollbar {
    width: 6px;
}

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

.chat-list::-webkit-scrollbar-thumb:hover,
.messages-container::-webkit-scrollbar-thumb:hover {
    background: #485a63;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar {
        width: 350px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
    }
    
    .chat-panel {
        display: none;
    }
    
    .chat-panel.show {
        display: flex;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 10;
    }
}
