* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

:root {
    --primary: #075e54;
    --secondary: #128c7e;
    --accent: #25d366;
    --dark: #1a1a2e;
    --light: #f8f9fa;
    --gray: #6c757d;
    --border: #e0e0e0;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --message-out: #dcf8c6;
    --message-in: #ffffff;
}

body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Auth Screen */
.auth-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.auth-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header i {
    font-size: 3rem;
    color: var(--secondary);
    margin-bottom: 10px;
}

.auth-header h1 {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 5px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.auth-tab {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--gray);
    transition: all 0.3s;
}

.auth-tab.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--secondary);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--secondary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary:hover {
    background: var(--primary);
    transform: translateY(-2px);
}

.demo-accounts {
    margin-top: 30px;
    padding: 20px;
    background: var(--light);
    border-radius: 8px;
    font-size: 0.9rem;
}

/* Chat Screen */
.chat-screen {
    display: flex;
    height: calc(100vh - 100px);
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* Sidebar */
.sidebar {
    width: 300px;
    background: #f0f2f5;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
}

.user-profile {
    padding: 20px;
    background: white;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid var(--border);
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--secondary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    position: relative;
    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info {
    flex: 1;
}

.user-info h3 {
    font-size: 1rem;
    margin-bottom: 3px;
}

.status {
    font-size: 0.8rem;
}

.status.online {
    color: var(--accent);
}

.status i {
    font-size: 0.6rem;
    margin-right: 3px;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--gray);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s;
}

.icon-btn:hover {
    background: var(--light);
    color: var(--primary);
}

.rooms-section, .online-users {
    padding: 20px;
}

.rooms-section h4, .online-users h4 {
    margin-bottom: 15px;
    color: var(--gray);
    font-size: 0.9rem;
    text-transform: uppercase;
}

.rooms-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.room-item {
    padding: 12px 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.room-item i {
    width: 20px;
    color: var(--gray);
}

.room-item:hover {
    background: var(--light);
}

.room-item.active {
    background: var(--secondary);
    color: white;
}

.room-item.active i {
    color: white;
}

.online-users {
    flex: 1;
    overflow-y: auto;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

.user-name {
    flex: 1;
    font-size: 0.9rem;
}

.user-status {
    font-size: 0.7rem;
    color: var(--accent);
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #efeae2;
}

.chat-header {
    padding: 20px;
    background: white;
    border-bottom: 1px solid var(--border);
}

.room-info h2 {
    font-size: 1.2rem;
    margin-bottom: 3px;
}

#typingIndicator {
    font-size: 0.8rem;
    color: var(--gray);
    font-style: italic;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    display: flex;
    margin-bottom: 10px;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.outgoing {
    justify-content: flex-end;
}

.message.incoming {
    justify-content: flex-start;
}

.message-content {
    max-width: 60%;
    padding: 10px 15px;
    border-radius: 10px;
    position: relative;
}

.message.outgoing .message-content {
    background: var(--message-out);
    border-top-right-radius: 0;
}

.message.incoming .message-content {
    background: var(--message-in);
    border-top-left-radius: 0;
}

.message-sender {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 3px;
}

.message-text {
    word-wrap: break-word;
    margin-bottom: 3px;
}

.message-time {
    font-size: 0.7rem;
    color: var(--gray);
    text-align: right;
}

.message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--secondary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: bold;
    margin: 0 10px;
}

.message.incoming .message-avatar {
    margin-left: 0;
    margin-right: 10px;
}

/* Message Input */
.message-input-container {
    padding: 20px;
    background: white;
    display: flex;
    gap: 10px;
    align-items: center;
}

#messageInput {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

#messageInput:focus {
    border-color: var(--secondary);
}

#sendBtn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 0;
}

/* Emoji Picker */
.emoji-mart {
    position: absolute;
    bottom: 80px;
    right: 20px;
    z-index: 1000;
    display: none;
}

.emoji-mart.show {
    display: block;
}

/* Footer */
footer {
    text-align: center;
    color: white;
    margin-top: 20px;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Responsive */
@media (max-width: 768px) {
    .chat-screen {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
    }
    
    .message-content {
        max-width: 80%;
    }
}