:root { --font-family: 'Roboto', sans-serif; --my-message-bg: #dcf8c6; --other-message-bg: #ffffff; --main-bg: #f0f2f5; --chat-bg: #e5ddd5; --sidebar-bg: #ffffff; --header-bg: #00a884; --border-color: #e9edef; --text-primary: #111b21; --text-secondary: #667781; --hover-bg: #f5f5f5; }
body { margin: 0; font-family: var(--font-family); background-color: var(--main-bg); color: var(--text-primary); overflow: hidden; }
.main-container { display: flex; height: 100dvh; }
.sidebar-header { display: flex; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border-color); }
.logo { height: 40px; width: 40px; margin-right: 15px; }
.sidebar-header h2 { margin: 0; font-size: 1.2rem; font-weight: 500; color: var(--text-primary); }
#sidebar { width: 350px; background-color: var(--sidebar-bg); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; transition: transform 0.3s ease-in-out; }
.sidebar-section { padding: 12px 16px; border-bottom: 1px solid var(--border-color); }
.sidebar-section h3 { display: flex; justify-content: space-between; align-items: center; margin: 0 0 10px 0; color: var(--header-bg); font-size: 1rem; }
.groups-section, .contacts-section { flex-grow: 1; display: flex; flex-direction: column; padding: 0; overflow: hidden; min-height: 100px; }
.groups-section h3, .contacts-section h3 { padding: 12px 16px; margin: 0; flex-shrink: 0; }
#create-group-btn { background: var(--header-bg); color: white; border: none; border-radius: 50%; width: 24px; height: 24px; font-size: 1.2rem; cursor: pointer; display: flex; align-items: center; justify-content: center; padding-bottom: 2px; }
#my-profile { display: flex; align-items: center; gap: 15px; flex-shrink: 0; }
#my-profile-pic, .contact-pic { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.profile-info { display: flex; flex-direction: column; flex-grow: 1; overflow: hidden; white-space: nowrap; }
#my-username { font-weight: 500; text-overflow: ellipsis; overflow: hidden; }
#logout-btn { font-size: 0.8rem; color: var(--text-secondary); text-decoration: none; }
#logout-btn:hover { text-decoration: underline; }
.edit-pic-btn { cursor: pointer; font-size: 1.2rem; }
#user-list, #requests-list, #group-list { list-style: none; padding: 0; margin: 0; overflow-y: auto; }
#user-list, #group-list { flex-grow: 1; }
#user-list li, #group-list li { display: flex; align-items: center; gap: 15px; padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--border-color); position: relative; }
#user-list li:hover, #group-list li:hover { background-color: var(--hover-bg); }
#user-list li span, #group-list li span { font-weight: 500; }
#requests-list li { display: flex; justify-content: space-between; align-items: center; padding: 10px 15px; border-bottom: 1px solid var(--border-color); }
#requests-list .actions button { font-size: 0.8rem; padding: 4px 8px; margin-left: 5px; border-radius: 5px; cursor: pointer; color: white; border: none; }
#requests-list .accept-btn { background-color: #25D366; }
#requests-list .decline-btn { background-color: #FF5A5F; }
#add-contact-form { display: flex; padding: 10px; border-top: 1px solid var(--border-color); background-color: #f0f2f5; flex-shrink: 0; }
#add-contact-form input { flex-grow: 1; border: 1px solid #ccc; border-radius: 15px; padding: 8px 12px; margin-right: 5px;}
#add-contact-form button { width: 34px; height: 34px; border-radius: 50%; background-color: var(--header-bg); color: white; border: none; font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 0 0 4px 0; }
#chat-area { flex-grow: 1; display: flex; flex-direction: column; background-color: var(--chat-bg); overflow: hidden; }
#chat-header { padding: 10px 16px; background-color: var(--main-bg); border-bottom: 1px solid var(--border-color); display: flex; align-items: center; gap: 15px; min-height: 40px; flex-shrink: 0; }
#partner-info-container { display: flex; align-items: center; gap: 15px; }
#partner-name { font-weight: 500; }
#messages { flex-grow: 1; list-style-type: none; margin: 0; padding: 20px; display: flex; flex-direction: column; overflow-y: auto; gap: 2px; }
#messages > li { padding: 8px 12px; border-radius: 8px; max-width: 70%; word-wrap: break-word; box-shadow: 0 1px 1px rgba(0,0,0,0.05); cursor: pointer; display: flex; flex-direction: column; margin-bottom: 8px; }
.message-author { font-weight: bold; font-size: 0.8rem; color: var(--header-bg); margin-bottom: 4px; }
.message-content { margin-bottom: 5px; }
.message-content img.chat-image { max-width: 100%; border-radius: 8px; margin-bottom: 5px; }
.message-timestamp { font-size: 0.75rem; color: var(--text-secondary); align-self: flex-end; }
#messages > li { background-color: var(--other-message-bg); align-self: flex-start; }
#messages > li.my-message { background-color: var(--my-message-bg); align-self: flex-end; }
#form { display: flex; padding: 10px; background-color: var(--main-bg); border-top: 1px solid var(--border-color); flex-shrink: 0; position: relative; align-items: center; }
#input { border: 1px solid #ccc; padding: 10px; flex-grow: 1; border-radius: 20px; margin: 0 5px; font-size: 16px; }
#send-btn, #emoji-btn, #attach-btn, #draw-btn { background: var(--header-bg); color: white; border: none; border-radius: 50%; cursor: pointer; width: 40px; height: 40px; flex-shrink: 0; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; padding: 0; }
#send-btn:disabled { background: #9e9e9e; cursor: not-allowed; }
#emoji-btn, #attach-btn, #draw-btn { background: none; color: var(--text-secondary); font-size: 1.6rem; }
emoji-picker { position: absolute; bottom: 65px; left: 10px; display: none; z-index: 100; }
emoji-picker.show { display: block; }
.auth-container { background: white; padding: 40px; border-radius: 8px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); width: 320px; margin: 100px auto; text-align: center; }
.auth-container h2 { margin-top: 0; color: var(--header-bg); }
.auth-container input { display: block; width: calc(100% - 22px); padding: 10px; margin-bottom: 10px; border-radius: 5px; border: 1px solid #ccc; font-size: 1rem; }
.auth-container button { width: 100%; font-size: 1rem; padding: 10px 20px; border-radius: 20px; }
.auth-container p { margin-top: 20px; }
.back-btn { display: none; }
.unread-indicator { width: 10px; height: 10px; background-color: var(--header-bg); border-radius: 50%; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); display: none; }
#user-list li.has-unread .unread-indicator, #group-list li.has-unread .unread-indicator { display: block; }
.reply-context { background-color: rgba(0, 0, 0, 0.05); border-left: 2px solid var(--header-bg); padding: 8px; margin-bottom: 5px; border-radius: 4px; }
.reply-context strong { color: var(--header-bg); font-weight: 500; }
.reply-context p { margin: 2px 0 0; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#reply-preview { display: flex; align-items: center; padding: 8px 10px; background-color: var(--hover-bg); border-top: 1px solid var(--border-color); border-left: 4px solid var(--header-bg); }
#reply-preview .reply-content { flex-grow: 1; overflow: hidden; }
#reply-preview strong, #reply-preview p { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#reply-preview strong { color: var(--header-bg); font-weight: 500; }
#reply-preview p { font-size: 0.9rem; }
#cancel-reply-btn { background: none; border: none; font-size: 1.5rem; color: var(--text-secondary); cursor: pointer; padding: 0 10px; }
.date-divider { text-align: center; margin: 15px 0; font-size: 0.8rem; color: var(--text-secondary); background-color: #e1f2fb; padding: 4px 12px; border-radius: 15px; max-width: 150px; align-self: center; }
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); display: flex; justify-content: center; align-items: center; z-index: 1000; }
.modal-content { background: white; padding: 20px; border-radius: 8px; box-shadow: 0 5px 15px rgba(0,0,0,0.3); width: 90%; max-width: 500px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; margin-bottom: 15px; }
.modal-header h2 { margin: 0; }
#close-group-modal-btn { background: none; border: none; font-size: 1.8rem; cursor: pointer; }
.modal-section { margin-top: 15px; }
.modal-section h3 { font-size: 1rem; margin-bottom: 10px; }
#modal-contacts-list { list-style: none; padding: 0; max-height: 150px; overflow-y: auto; border: 1px solid var(--border-color); border-radius: 5px; }
#modal-contacts-list li { padding: 10px; display: flex; align-items: center; gap: 10px; }
#modal-contacts-list input[type="checkbox"] { margin-right: 10px; }
#create-group-form input[type="text"] { width: calc(100% - 22px); padding: 10px; margin-bottom: 10px; border-radius: 5px; border: 1px solid #ccc; font-size: 1rem; }
#create-group-form button { width: 100%; margin-top: 20px; }
@media (min-width: 769px) { .message-content img.chat-image { max-width: 300px; } }
@media (max-width: 768px) { .main-container { overflow-x: hidden; position: relative; } #sidebar { width: 100%; position: absolute; top: 0; left: 0; z-index: 10; transform: translateX(0); height: 100dvh; } #chat-area { width: 100%; position: absolute; top: 0; left: 0; z-index: 5; transform: translateX(100%); transition: transform 0.3s ease-in-out; height: 100dvh; } body.chat-view-active #sidebar { transform: translateX(-100%); } body.chat-view-active #chat-area { transform: translateX(0); } .back-btn { display: block; background: none; border: none; font-size: 1.5rem; color: var(--text-secondary); cursor: pointer; padding-right: 15px; } }
