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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* Container */
.container {
    width: 100%;
    max-width: 450px;
}

/* Chat page container override */
.chat-container {
    max-width: 1100px;
}

/* Login Card */
.login-card, .register-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    padding: 40px;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.card-header {
    text-align: center;
    margin-bottom: 30px;
}

.logo {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: white;
    font-size: 28px;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.card-header h2 {
    color: #333;
    font-size: 28px;
    margin-bottom: 8px;
}

.subtitle {
    color: #666;
    font-size: 15px;
}

/* Form */
.login-form, .register-form {
    width: 100%;
}

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

/* Input Container */
.input-container {
    position: relative;
    width: 100%;
}

.input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #667eea;
    font-size: 18px;
    z-index: 2;
}

.input-container input {
    width: 100%;
    padding: 18px 18px 18px 50px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    background: white;
    transition: all 0.3s ease;
    outline: none;
    color: #333;
}

.input-container input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-container label {
    position: absolute;
    left: 50px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    font-size: 16px;
    transition: all 0.3s ease;
    pointer-events: none;
    background: white;
    padding: 0 5px;
}

.input-container input:focus + label,
.input-container input:not(:placeholder-shown) + label {
    top: 0;
    transform: translateY(-50%);
    font-size: 14px;
    color: #667eea;
    font-weight: 500;
}

/* Password Toggle */
.toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    transition: color 0.3s ease;
}

.toggle-password:hover {
    color: #667eea;
}

/* Form Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    font-size: 14px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 8px;
}

.remember-me input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

.forgot-password {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.forgot-password:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Submit Button */
.submit-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.submit-btn:active {
    transform: translateY(0);
}

.btn-icon {
    transition: transform 0.3s ease;
}

.submit-btn:hover .btn-icon {
    transform: translateX(5px);
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    margin: 25px 0;
    color: #888;
    font-size: 14px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e0e0e0;
}

.divider span {
    padding: 0 15px;
}

/* Social Login */
.social-login {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.social-btn {
    flex: 1;
    padding: 14px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #333;
}

.social-btn:hover {
    transform: translateY(-2px);
    border-color: #667eea;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.social-btn.google:hover {
    color: #DB4437;
    border-color: #DB4437;
}

.social-btn.github:hover {
    color: #333;
    border-color: #333;
}

/* Sign Up Link */
.signup-link {
    text-align: center;
    color: #666;
    font-size: 15px;
}

.signup-link a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.signup-link a:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 480px) {
    .login-card, .register-card {
        padding: 30px 20px;
    }
    
    .social-login {
        flex-direction: column;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .forgot-password {
        align-self: flex-end;
    }
}

/* Chat layout */
.chat-app {
    background: white;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    padding: 24px;
    max-width: 980px;
    width: 100%;
    animation: slideUp 0.5s ease;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.chat-header h2 {
    color: #333;
}

.chat-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #666;
}

.chat-actions .link {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.chat-actions .link:hover {
    color: #764ba2;
    text-decoration: underline;
}

.chat-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 16px;
}

.chat-sidebar {
    background: #f7f7ff;
    border: 1px solid #e6e6ff;
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.08);
}

.online-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.online-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.online-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

#onlineCount {
    font-size: 13px;
    color: #667eea;
    font-weight: 600;
}

.online-users-list {
    max-height: 360px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.online-user {
    display: flex;
    cursor: pointer;
    width: 80%;
    align-self: center;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 10px;
    background: white;
    border: 1px solid #ececff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

.online-user:hover {
    transform: translateX(4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.online-user.user-selected {
    background: #eef9f3;
    border-color: #c7f5d9;
    box-shadow: 0 6px 16px rgba(46, 213, 115, 0.18);
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: 6px;
}

.status-indicator.online {
    background-color: #2ed573;
    box-shadow: 0 0 6px #2ed573;
}

.status-indicator.offline {
    background-color: #ff4757;
    box-shadow: 0 0 6px #ff4757;
}

.chat-main {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-messages {
    border: 1px solid #e0e0e0;
    border-radius: 14px;
    padding: 14px;
    height: 400px;
    overflow-y: auto;
    background: #f8f9ff;
}

.message {
    background: white;
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.04);
}

.message--system {
    background: #eef2ff;
    color: #4b5563;
}

.chat-input {
    display: flex;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 15px;
    outline: none;
}

.chat-input button {
    padding: 14px 18px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-input button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(102, 126, 234, 0.25);
}

@media (max-width: 900px) {
    .chat-layout {
        grid-template-columns: 1fr;
    }
    
    .online-users-list {
        max-height: 200px;
    }
}