* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Tahoma, Arial, sans-serif;
    background: #eef1f5;
    color: #222;
}

a {
    text-decoration: none;
    color: inherit;
}


/* AUTH */

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-box {
    width: 100%;
    max-width: 400px;
    background: white;
    padding: 35px;
    border-radius: 15px;
    box-shadow: 0 10px 35px rgba(0,0,0,.08);
    text-align: center;
}

.auth-box h1,
.auth-box h2 {
    margin-top: 0;
}

.auth-box p {
    color: #777;
}

.auth-box input {
    width: 100%;
    padding: 13px;
    margin-bottom: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    outline: none;
}

.auth-box input:focus {
    border-color: #4f46e5;
}

.btn {
    display: block;
    width: 100%;
    padding: 13px;
    margin-top: 10px;
    border: none;
    border-radius: 8px;
    background: #4f46e5;
    color: white;
    cursor: pointer;
}

.btn.secondary {
    background: #e5e7eb;
    color: #222;
}

.error {
    background: #fee2e2;
    color: #b91c1c;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
}


/* MESSENGER */

.messenger {
    height: 100vh;
    display: flex;
    background: white;
}


/* SIDEBAR */

.sidebar {
    width: 300px;
    border-left: 1px solid #ddd;
    background: #fafafa;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 18px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header strong {
    display: block;
}

.sidebar-header small {
    color: #16a34a;
}

.sidebar-header a {
    color: #dc2626;
    font-size: 13px;
}

.sidebar h3 {
    padding: 0 18px;
    font-size: 15px;
}


.users {
    overflow-y: auto;
}

.user {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    border: none;
    background: transparent;
    padding: 13px 18px;
    cursor: pointer;
    text-align: right;
    font-size: 14px;
}

.user:hover {
    background: #eee;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #4f46e5;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.empty {
    padding: 18px;
    color: #888;
    font-size: 13px;
}


/* CHAT */

.chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-header {
    height: 65px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #ddd;
    font-weight: bold;
}


/* MESSAGES */

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    background: #f4f5f7;
}

.welcome,
.no-message {
    text-align: center;
    color: #888;
    margin-top: 100px;
}

.message {
    width: fit-content;
    max-width: 70%;
    margin-bottom: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    display: flex;
    gap: 12px;
    align-items: end;
}

.message.sent {
    margin-right: auto;
    background: #4f46e5;
    color: white;
    border-bottom-right-radius: 3px;
}

.message.received {
    margin-left: auto;
    background: white;
    border: 1px solid #ddd;
    border-bottom-left-radius: 3px;
}

.message-text {
    word-break: break-word;
    line-height: 1.6;
}

.message-time {
    font-size: 10px;
    opacity: .65;
}


/* SEND */

.message-form {
    display: flex;
    gap: 10px;
    padding: 15px;
    border-top: 1px solid #ddd;
    background: white;
}

.message-form input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 12px;
    outline: none;
}

.message-form input:focus {
    border-color: #4f46e5;
}

.message-form button {
    border: none;
    background: #4f46e5;
    color: white;
    padding: 0 25px;
    border-radius: 10px;
    cursor: pointer;
}

.message-form button:disabled,
.message-form input:disabled {
    opacity: .5;
    cursor: not-allowed;
}


/* MOBILE */

@media (max-width: 700px) {

    .sidebar {
        width: 100px;
    }

    .sidebar-header strong,
    .sidebar-header small,
    .sidebar-header a,
    .sidebar h3,
    .user span:not(.avatar) {
        display: none;
    }

    .sidebar-header {
        justify-content: center;
    }

    .user {
        justify-content: center;
        padding: 12px;
    }

    .message {
        max-width: 85%;
    }

}