:root {
    --bg-color: #0b0c10;
    --surface-color: #1f2833;
    --primary-color: #66fcf1;
    --secondary-color: #45a29e;
    --text-color: #c5c6c7;
    --border-color: #333;
    --own-msg-bg: #45a29e;
    --other-msg-bg: #2b3a47;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
}

.hidden { display: none !important; }

/* Modal & Overlay */
.auth-overlay, .modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.auth-box, .modal-content {
    background: var(--surface-color);
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.btn {
    background: var(--primary-color);
    color: var(--bg-color);
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}
.btn:hover { background: #55d6cc; }
.btn-secondary { background: transparent; color: var(--text-color); border: 1px solid var(--border-color); }

.form-group { margin-bottom: 15px; text-align: left; }
.form-group label { display: block; margin-bottom: 5px; font-size: 14px; }
.form-group input { width: 100%; padding: 10px; background: var(--bg-color); border: 1px solid var(--border-color); color: white; border-radius: 4px; }

/* Main App Layout */
.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background: var(--surface-color);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info { display: flex; align-items: center; gap: 10px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.sidebar-actions button { background: none; border: none; color: var(--text-color); font-size: 1.2rem; cursor: pointer; }

.groups-list {
    flex: 1;
    overflow-y: auto;
}

.group-item {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.group-item:hover { background: rgba(255,255,255,0.05); }
.group-item.active { background: rgba(102, 252, 241, 0.1); border-left: 4px solid var(--primary-color); }

/* Main Chat */
.main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
}

.no-chat-selected {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.chat-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-header {
    padding: 15px 20px;
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-locked { color: #f39c12; font-size: 12px; }
.status-unlocked { color: #2ecc71; font-size: 12px; }

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

.msg-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 70%;
}
.msg-wrapper.own { align-self: flex-end; }
.msg-wrapper.other { align-self: flex-start; }

.msg-info { font-size: 11px; color: #888; margin-bottom: 4px; }
.msg-wrapper.own .msg-info { text-align: right; }

.msg-bubble {
    padding: 10px 15px;
    border-radius: 8px;
    line-height: 1.4;
    word-break: break-word;
}
.msg-wrapper.own .msg-bubble { background: var(--own-msg-bg); color: #fff; border-bottom-right-radius: 0; }
.msg-wrapper.other .msg-bubble { background: var(--other-msg-bg); color: #fff; border-bottom-left-radius: 0; }
.msg-encrypted { font-style: italic; opacity: 0.7; }

.chat-input-area {
    padding: 15px;
    background: var(--surface-color);
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    padding: 12px;
    border-radius: 20px;
    border: none;
    background: var(--bg-color);
    color: white;
}

.chat-input-area button {
    width: 45px;
    border-radius: 50%;
    border: none;
    background: var(--primary-color);
    color: var(--bg-color);
    cursor: pointer;
}

.password-prompt-area {
    padding: 30px;
    background: var(--surface-color);
    text-align: center;
    border-top: 1px solid var(--border-color);
}
.password-prompt-area input {
    padding: 10px;
    margin: 10px 0;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: white;
}
