
:root {
    --bg-color: #0f141c;
    --sidebar-bg: #17212b;
    --chat-bg: #0e1621;
    --panel-bg: #1f2c34;
    --accent-color: #2b5278;
    --accent-hover: #3b6b9e;
    --text-primary: #f5f5f5;
    --text-secondary: #8ab4f8;
    --text-muted: #707579;
    --message-in: #182533;
    --message-out: #2b5278;
    --border-color: #232e3c;
    --input-bg: #242f3d;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body, html {
    width: 100%;
    height: 100vh;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
}

#app {
    width: 100%;
    height: 100vh;
    display: flex;
}

/* Auth Styles */
.auth-container {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #1b2735 0%, #090a0f 100%);
}

.auth-card {
    background: var(--sidebar-bg);
    padding: 40px;
    border-radius: 16px;
    width: 380px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    text-align: center;
    border: 1px solid var(--border-color);
}

.auth-logo {
    font-size: 64px;
    color: #51bdf3;
    margin-bottom: 15px;
}

.auth-card h2 {
    margin-bottom: 8px;
    font-weight: 600;
}

.auth-card p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.auth-card input {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 14px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: #fff;
    font-size: 15px;
    outline: none;
    transition: border 0.2s;
}

.auth-card input:focus {
    border-color: #51bdf3;
}

.auth-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-primary, .btn-secondary {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-primary {
    background-color: #51bdf3;
    color: #0e1621;
}

.btn-primary:hover {
    background-color: #6ec9f5;
}

.btn-secondary {
    background-color: var(--input-bg);
    color: #fff;
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #2b3a4a;
}

.error-msg {
    background: rgba(255, 80, 80, 0.15);
    color: #ff6b6b;
    padding: 10px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 80, 80, 0.3);
}

/* Messenger Layout */
.messenger-container {
    display: flex;
    width: 100%;
    height: 100vh;
}

.sidebar {
    width: 340px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

.menu-btn {
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
}

.menu-btn:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.search-bar {
    flex: 1;
    background: var(--input-bg);
    border-radius: 20px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    height: 38px;
    border: 1px solid transparent;
}

.search-bar:focus-within {
    border-color: #51bdf3;
}

.search-bar i {
    color: var(--text-muted);
    font-size: 14px;
    margin-right: 10px;
}

.search-bar input {
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 14px;
    width: 100%;
}

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

.chat-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    gap: 12px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.02);
}

.chat-item:hover {
    background: rgba(255,255,255,0.04);
}

.chat-item.active {
    background: var(--accent-color);
}

.chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

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

.chat-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.chat-item-name {
    font-weight: 600;
    font-size: 15px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-time {
    font-size: 12px;
    color: var(--text-muted);
}

.chat-item-preview {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-profile-bar {
    padding: 12px 15px;
    background: rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid var(--border-color);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

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

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: #fff;
}

.user-status {
    font-size: 12px;
    color: #51bdf3;
}

.logout-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
}

.logout-btn:hover {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

/* Chat Area */
.chat-area {
    flex: 1;
    background-color: var(--chat-bg);
    background-image: radial-gradient(rgba(255,255,255,0.03) 1px, transparent 0);
    background-size: 24px 24px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.placeholder-content {
    text-align: center;
}

.placeholder-content i {
    font-size: 64px;
    margin-bottom: 15px;
    opacity: 0.5;
}

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

.active-chat-header {
    padding: 10px 20px;
    background: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 15px;
}

.active-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.active-chat-title {
    font-weight: 600;
    font-size: 15px;
    color: #fff;
}

.active-chat-status {
    font-size: 12px;
    color: #51bdf3;
}

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

.message {
    max-width: 65%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    word-break: break-word;
}

.message.incoming {
    background: var(--message-in);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message.outgoing {
    background: var(--message-out);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message-text {
    margin-bottom: 4px;
    padding-right: 45px;
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
    float: right;
    margin-top: -4px;
    margin-left: 8px;
}

.chat-input-bar {
    padding: 15px 20px;
    background: var(--sidebar-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-input-bar input {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 10px 16px;
    color: #fff;
    font-size: 14px;
    outline: none;
}

.chat-input-bar input:focus {
    border-color: #51bdf3;
}

.send-btn {
    background: #51bdf3;
    color: #0e1621;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s;
}

.send-btn:hover {
    background: #6ec9f5;
}
