* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.messenger-container {
    width: 1200px;
    height: 800px;
    background: white;
    border-radius: 20px;
    display: flex;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* Левая панель */
.contacts-panel {
    width: 350px;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
}

.user-profile {
    padding: 20px;
    display: flex;
    align-items: center;
    background: white;
    border-bottom: 1px solid #e9ecef;
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 15px;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    color: #2d3436;
    margin-bottom: 3px;
}

.user-status {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.user-status.online {
    color: #00b894;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00b894;
    display: inline-block;
}

.user-actions {
    display: flex;
    gap: 15px;
    color: #b2bec3;
    cursor: pointer;
}

.user-actions i:hover {
    color: #6c5ce7;
}

.search-box {
    padding: 15px 20px;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 35px;
    top: 28px;
    color: #b2bec3;
}

.search-box input {
    width: 100%;
    padding: 12px 20px 12px 45px;
    border: 1px solid #e9ecef;
    border-radius: 30px;
    outline: none;
    font-size: 14px;
    transition: all 0.3s;
}

.search-box input:focus {
    border-color: #6c5ce7;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.contacts-tabs {
    padding: 0 20px 20px;
    display: flex;
    gap: 10px;
}

.tab {
    flex: 1;
    padding: 8px;
    border: none;
    background: transparent;
    border-radius: 20px;
    cursor: pointer;
    color: #636e72;
    font-weight: 500;
    transition: all 0.3s;
}

.tab:hover {
    background: #e9ecef;
}

.tab.active {
    background: #6c5ce7;
    color: white;
}

.contacts-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 15px;
}

.contact-item {
    display: flex;
    padding: 15px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 5px;
}

.contact-item:hover {
    background: #e9ecef;
}

.contact-item.active {
    background: #e9ecef;
}

.contact-avatar {
    position: relative;
    margin-right: 15px;
}

.contact-avatar img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
}

.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #00b894;
    border: 2px solid white;
}

.online-indicator.offline {
    background: #b2bec3;
}

.contact-info {
    flex: 1;
}

.contact-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.contact-name {
    font-weight: 600;
    color: #2d3436;
}

.contact-time {
    font-size: 11px;
    color: #b2bec3;
}

.contact-message {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.message-preview {
    font-size: 13px;
    color: #636e72;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.unread-badge {
    background: #6c5ce7;
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

/* Правая панель */
.chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

.chat-header {
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
    background: white;
}

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

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

.chat-user-name {
    font-weight: 600;
    color: #2d3436;
    margin-bottom: 3px;
}

.chat-user-status {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chat-user-status.online {
    color: #00b894;
}

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

.chat-actions i {
    cursor: pointer;
    font-size: 18px;
    transition: color 0.3s;
}

.chat-actions i:hover {
    color: #6c5ce7;
}

.messages-container {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    display: flex;
    max-width: 60%;
    margin-bottom: 10px;
}

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

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

.message-bubble {
    padding: 12px 16px;
    border-radius: 20px;
    position: relative;
    word-wrap: break-word;
}

.message.sent .message-bubble {
    background: #6c5ce7;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.received .message-bubble {
    background: white;
    color: #2d3436;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.message-time {
    font-size: 10px;
    margin-top: 5px;
    color: #b2bec3;
    text-align: right;
}

.message.sent .message-time {
    color: rgba(255,255,255,0.7);
}

/* Стили для разных типов сообщений */
.message.system {
    align-self: center;
    max-width: 80%;
}

.message.system .message-bubble {
    background: #e9ecef;
    color: #636e72;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 15px;
}

/* Анимация для новых сообщений */
@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: messageAppear 0.3s ease;
}

.message-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 15px;
}

.message-attachments {
    display: flex;
    gap: 15px;
    color: #b2bec3;
}

.message-attachments i {
    cursor: pointer;
    font-size: 18px;
    transition: color 0.3s;
}

.message-attachments i:hover {
    color: #6c5ce7;
}

.message-input {
    flex: 1;
    padding: 12px 20px;
    border: 1px solid #e9ecef;
    border-radius: 30px;
    outline: none;
    font-size: 14px;
    transition: all 0.3s;
}

.message-input:focus {
    border-color: #6c5ce7;
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.1);
}

.send-button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #6c5ce7;
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-button:hover {
    background: #5b4bc4;
    transform: scale(1.05);
}

.send-button i {
    font-size: 18px;
}

/* Скроллбар */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #b2bec3;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6c5ce7;
}