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

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
    --border-color: #dee2e6;
    --bg-color: #ffffff;
    --sidebar-bg: #2c3e50;
    --sidebar-hover: #34495e;
    --message-bg: #e9ecef;
    --message-own-bg: #007bff;
    --message-own-text: #ffffff;
    --text-color: #212529;
    --text-light: #6c757d;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-color);
}

/* Auth Styles */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    width: 100%;
    max-width: 450px;
}

.auth-card h1 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 30px;
    font-size: 2rem;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: var(--light-color);
    cursor: pointer;
    border-radius: 5px;
    transition: all 0.3s;
    font-weight: 500;
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group label i {
    margin-right: 5px;
    color: var(--primary-color);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
    justify-content: center;
}

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.3);
}

.message {
    margin-top: 15px;
    padding: 12px;
    border-radius: 5px;
    text-align: center;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Chat Container */
.chat-container {
    display: flex;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.1);
}

/* Sidebar */
.sidebar {
    width: 320px;
    background: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.user-info {
    flex: 1;
}

.username {
    font-weight: 600;
    margin-bottom: 4px;
}

.user-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
}

.user-status.offline .status-dot {
    background: var(--secondary-color);
}

.user-status.away .status-dot {
    background: var(--warning-color);
}

.user-status.busy .status-dot {
    background: var(--danger-color);
}

.btn-icon {
    background: transparent;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 5px;
    transition: background 0.3s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.room-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.room-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.room-list-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.room-item {
    padding: 12px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.room-item:hover {
    background: var(--sidebar-hover);
}

.room-item.active {
    background: var(--primary-color);
}

.room-item-name {
    font-weight: 600;
    margin-bottom: 4px;
}

.room-item-preview {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.online-users-container {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.online-users-container h4 {
    font-size: 14px;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.8);
}

.online-user {
    padding: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.online-user:hover {
    background: rgba(255, 255, 255, 0.1);
}

.online-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

/* Chat Main Area */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

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

.chat-placeholder i {
    font-size: 80px;
    margin-bottom: 20px;
    color: var(--border-color);
}

.chat-active {
    flex: 1;
    display: flex;
    flex-direction: column;
}

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

.room-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.room-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.room-details h3 {
    margin-bottom: 4px;
    font-size: 18px;
}

.typing-indicator {
    font-size: 12px;
    color: var(--text-light);
    font-style: italic;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    background: #f8f9fa;
    padding: 20px;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message-item {
    display: flex;
    gap: 12px;
    max-width: 70%;
}

.message-item.own {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.message-content {
    background: var(--message-bg);
    padding: 12px 16px;
    border-radius: 12px;
    position: relative;
}

.message-item.own .message-content {
    background: var(--message-own-bg);
    color: var(--message-own-text);
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.message-sender {
    font-weight: 600;
    font-size: 14px;
}

.message-time {
    font-size: 11px;
    color: var(--text-light);
}

.message-item.own .message-time {
    color: rgba(255, 255, 255, 0.8);
}

.message-text {
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message-input-container {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    background: white;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--light-color);
    border-radius: 25px;
    padding: 8px 15px;
}

.input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
}

.btn-send {
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-send:hover {
    background: #0056b3;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-light);
}

.modal-body {
    padding: 20px;
}

.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
}

/* Responsive */
@media (max-width: 768px) {
    .chat-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        max-height: 300px;
    }

    .message-item {
        max-width: 85%;
    }
}

