@import url('fonts.css');

/* ===== BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow: hidden;
    font-family: 'Montserrat', 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
    font-weight: 400;
    background-color: rgb(31, 25, 60);
    height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ===== LAYOUT ===== */
.app-container {
    display: flex;
    height: 100vh;
    background-color: rgb(31, 25, 60);
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 350px;
    min-width: 300px;
    background-color: rgb(26, 21, 50);
    border-right: 2px solid rgb(45, 55, 89);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.settings-header {
    padding: 15px;
    border-bottom: 1px solid rgb(45, 55, 89);
}

.menu {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.menu:hover {
    background-color: rgb(43, 35, 82);
}

.settings-icon {
    width: 30px;
    height: 30px;
    object-fit: cover;
}

.chats-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 0;
}

/* ===== CHAT ITEM ===== */
.chat-elem {
    display: flex;
    align-items: center;
    padding: 15px;
    transition: background-color 0.3s ease;
    border-bottom: 1px solid rgba(45, 55, 89, 0.5);
}

.chat-elem:hover {
    background-color: rgb(43, 35, 82);
}

.avatar-image {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
    flex-shrink: 0;
}

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

.chat-name {
    font-size: 16px;
    color: rgb(229, 228, 238);
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.last-massege {
    font-size: 13px;
    color: rgb(204, 204, 204);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== MAIN CHAT AREA ===== */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: rgb(35, 29, 70);
}

.chat-header {
    padding: 15px 20px;
    border-bottom: 2px solid rgb(57, 70, 112);
    background-color: rgb(26, 21, 50);
}

.chat-title {
    font-size: 18px;
    color: rgb(229, 228, 238);
}

/* ===== MESSAGES CONTAINER ===== */
.massages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: calc(100vh - 140px);
}

/* ===== MESSAGE STYLES ===== */
.massage {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 70%;
}

.massage-from-me {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.avatar-massage {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    margin-top: 5px;
}

.message-content {
    background-color: rgb(53, 20, 161);
    padding: 12px 15px;
    border-radius: 18px;
    max-width: 100%;
    word-wrap: break-word;
}

.massage-from-me .message-content {
    background-color: rgb(82, 55, 240);
}

.massage-text {
    color: rgb(229, 228, 238);
    margin: 0;
    line-height: 1.4;
    font-size: 14px;
}

/* ===== MESSAGE INPUT ===== */
.message-input-container {
    padding: 20px;
    background-color: rgb(26, 21, 50);
    border-top: 2px solid rgb(57, 70, 112);
}

.type-massage {
    display: flex;
    gap: 10px;
    align-items: center;
}

.type-massage-input {
    flex: 1;
    height: 45px;
    padding: 0 15px;
    border: 2px solid rgb(45, 55, 89);
    border-radius: 25px;
    background-color: rgb(68, 83, 130);
    color: rgb(229, 228, 238);
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s ease;
}

.type-massage-input:focus {
    border-color: rgb(82, 55, 240);
}

.type-massage-input::placeholder {
    color: rgb(204, 204, 204);
}

.send-massage {
    height: 45px;
    padding: 0 20px;
    background-color: rgb(82, 55, 240);
    color: rgb(229, 228, 238);
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.send-massage:hover {
    background-color: rgb(102, 75, 255);
}

/* ===== SCROLLBAR ===== */
.massages::-webkit-scrollbar {
    width: 8px;
}

.massages::-webkit-scrollbar-track {
    background: rgba(45, 55, 89, 0.3);
    border-radius: 4px;
    margin: 5px 0;
}

.massages::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, 
        rgba(82, 55, 240, 0.8) 0%, 
        rgba(53, 20, 161, 0.8) 100%);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.massages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, 
        rgba(102, 75, 255, 0.9) 0%, 
        rgba(73, 40, 181, 0.9) 100%);
}

.chats-list::-webkit-scrollbar {
    width: 6px;
}

.chats-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 40vh;
    }
    
    .chat-area {
        height: 60vh;
    }
    
    .massage {
        max-width: 85%;
    }
    
    .type-massage-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* ===== UTILITY CLASSES ===== */
.no-messages {
    text-align: center;
    color: rgb(204, 204, 204);
    padding: 40px 20px;
    font-style: italic;
}

.loading {
    display: flex;
    justify-content: center;
    padding: 20px;
    color: rgb(204, 204, 204);
}