* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
    background: #f0f2f5;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}
.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}
.login-box {
    background: #fff;
    padding: 40px 30px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}
.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 24px;
    color: #1a1a2e;
}
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
}
.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border 0.3s;
}
.form-group input:focus {
    border-color: #6c63ff;
    outline: none;
}
.login-box button {
    width: 100%;
    padding: 14px;
    background: #6c63ff;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}
.login-box button:hover {
    background: #5a52d5;
}
.register-link {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: #666;
}
.register-link a {
    color: #6c63ff;
    text-decoration: none;
}
#app {
    width: 100%;
    height: 100vh;
    max-width: 900px;
    margin: 0 auto;
    background: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
}
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #6c63ff;
    color: #fff;
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;
}
.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 600;
}
.user-badge {
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 14px;
}
.logout-btn {
    background: rgba(255,255,255,0.15);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.3s;
}
.logout-btn:hover {
    background: rgba(255,255,255,0.3);
}
#chat-main {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    background: #f8f9fc;
}
#messages-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.message {
    max-width: 80%;
    margin-bottom: 16px;
    padding: 12px 18px;
    border-radius: 18px;
    line-height: 1.6;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}
.message.user {
    align-self: flex-end;
    background: #6c63ff;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.message.assistant {
    align-self: flex-start;
    background: #e9ecef;
    color: #1a1a2e;
    border-bottom-left-radius: 4px;
}
.message .message-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
    text-align: left;
}
.message.user .message-time {
    text-align: right;
}
#typing-indicator {
    align-self: flex-start;
    color: #888;
    font-size: 14px;
    padding: 8px 16px;
    background: #e9ecef;
    border-radius: 18px;
    margin-top: 8px;
}
footer {
    flex-shrink: 0;
    background: #fff;
    border-top: 1px solid #eee;
    padding: 12px 24px;
    border-radius: 12px 12px 0 0;
}
.input-area {
    display: flex;
    align-items: center;
    gap: 10px;
}
.file-upload-wrapper {
    position: relative;
}
.file-label {
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    background: #f0f0f0;
    border-radius: 50%;
    transition: background 0.3s;
}
.file-label:hover {
    background: #ddd;
}
#file-input {
    display: none;
}
#message-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 30px;
    font-size: 16px;
    outline: none;
    transition: border 0.3s;
}
#message-input:focus {
    border-color: #6c63ff;
}
#send-btn {
    background: #6c63ff;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}
#send-btn:hover {
    background: #5a52d5;
}
#file-preview {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0;
}
.preview-item {
    background: #f0f0f0;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.preview-item .remove-file {
    cursor: pointer;
    color: #d32f2f;
    font-weight: bold;
}
@media (max-width: 600px) {
    header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .header-title {
        font-size: 16px;
    }
    #chat-main {
        padding: 12px 16px;
    }
    .message {
        max-width: 90%;
        padding: 10px 14px;
    }
    footer {
        padding: 10px 16px;
    }
    #message-input {
        font-size: 14px;
        padding: 10px 14px;
    }
    #send-btn {
        width: 42px;
        height: 42px;
        font-size: 18px;
    }
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}