* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    background: #f0f2f5;
    height: 100vh;
}

/* Общие стили */
.container {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    background: #4682B4;
    color: white;
    text-align: center;
    padding: 20px;
    border-radius: 10px 10px 0 0;
}

.auth-box {
    background: white;
    padding: 30px;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.auth-box h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.form-group input:focus {
    border-color: #4682B4;
    outline: none;
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    text-decoration: none;
    transition: 0.3s;
}

.btn-primary {
    background: #4169E1;
    color: white;
}

.btn-primary:hover {
    background: #3154b4;
}

.btn-success {
    background: #32CD32;
    color: white;
}

.btn-success:hover {
    background: #28a428;
}

.auth-links {
    margin-top: 20px;
    text-align: center;
}

.auth-links a {
    color: #4169E1;
    text-decoration: none;
    margin: 0 10px;
}

.auth-links a:hover {
    text-decoration: underline;
}

.alert {
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

.buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Главный интерфейс чата */
.main-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-bar {
    background: #4682B4;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    font-size: 18px;
    font-weight: bold;
}

.logout-btn {
    background: #DC143C;
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    text-decoration: none;
}

.logout-btn:hover {
    background: #b01030;
}

.chat-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Левая панель */
.chats-sidebar {
    width: 300px;
    background: white;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.new-chat-btn {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: none;
    background: #4169E1;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

.new-chat-btn:hover {
    background: #3154b4;
}

.search-box {
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

.search-box input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
}

.chats-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: 0.3s;
}

.chat-item:hover {
    background: #f5f5f5;
}

.chat-item .chat-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.chat-item .chat-last {
    font-size: 12px;
    color: #666;
}

.chat-item .chat-time {
    font-size: 10px;
    color: #999;
    text-align: right;
}

/* Правая панель */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f0f2f5;
}

.chat-header {
    padding: 15px;
    background: #4682B4;
    color: white;
}

.messages-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.message {
    margin-bottom: 10px;
    padding: 10px;
    background: white;
    border-radius: 10px;
    max-width: 80%;
    align-self: flex-start;
}

.message.my-message {
    align-self: flex-end;
    background: #e3f2fd;
}

.msg-time {
    font-size: 10px;
    color: #666;
    margin-right: 5px;
}

.msg-sender {
    font-weight: bold;
    margin-right: 5px;
}

.msg-content {
    word-break: break-word;
}

.input-area {
    padding: 20px;
    background: white;
    border-top: 1px solid #ddd;
    display: flex;
    align-items: center;
    gap: 10px;
}

.media-buttons {
    display: flex;
    gap: 5px;
}

.media-btn {
    width: 35px;
    height: 35px;
    border: none;
    background: #f0f2f5;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
}

.media-btn:hover {
    background: #e0e2e5;
}

#messageInput {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 14px;
}

.send-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: #4169E1;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
}

.send-btn:hover {
    background: #3154b4;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
}

.modal-content {
    background: white;
    margin: 20% auto;
    padding: 20px;
    width: 300px;
    border-radius: 10px;
}

.modal-content h3 {
    margin-bottom: 15px;
}

.modal-content input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-buttons button {
    padding: 8px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.modal-buttons button:first-child {
    background: #4169E1;
    color: white;
}

.modal-buttons button:last-child {
    background: #ddd;
}

/* Панель эмодзи */
.emoji-picker {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(4, 40px);
    gap: 5px;
}

.emoji-item {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    border-radius: 5px;
}

.emoji-item:hover {
    background: #f0f2f5;
}