/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* 登录页面样式 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 400px;
    width: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.login-box h1 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-box p {
    color: #7f8c8d;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
    font-weight: 500;
}

.input-group {
    position: relative;
    margin-bottom: 30px;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #7f8c8d;
    font-size: 1.1rem;
}

.input-group input {
    width: 100%;
    padding: 15px 20px 15px 45px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

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

.login-box button {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

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

.login-box button:active {
    transform: translateY(0);
}

.login-box button i {
    margin-right: 10px;
}

/* 聊天界面样式 */
.chat-container {
    max-width: 1200px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.chat-header {
    background: linear-gradient(45deg, #2c3e50, #34495e);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid #667eea;
}

.header-left h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.header-left h2 i {
    margin-right: 15px;
    color: #667eea;
}

.online-indicator {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: #bdc3c7;
}

.online-indicator .dot {
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
    margin-right: 8px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 15px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.user-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.logout-btn {
    color: white;
    text-decoration: none;
    padding: 10px 20px;
    background: rgba(231, 76, 60, 0.8);
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(231, 76, 60, 1);
    transform: translateY(-2px);
}

.logout-btn i {
    margin-right: 8px;
}

/* 通知样式 */
.notification {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    padding: 15px 30px;
    text-align: center;
    font-weight: 500;
    position: relative;
    animation: slideDown 0.3s ease;
    z-index: 1000;
}

.notification.hidden {
    display: none;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

/* 聊天消息区域 */
.chat-messages {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: #f8f9fa;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #e9ecef;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #6c757d;
}

.system-message {
    background: #e3f2fd;
    color: #1565c0;
    padding: 15px 20px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 20px;
    font-weight: 500;
    border: 1px solid #bbdefb;
}

.message {
    background: white;
    border-radius: 18px;
    padding: 15px 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    max-width: 80%;
    margin-left: auto;
    margin-right: auto;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.message:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

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

.username {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95rem;
}

.message-time {
    color: #adb5bd;
    font-size: 0.85rem;
}

.message-content {
    color: #333;
    line-height: 1.5;
    word-wrap: break-word;
}

/* 聊天输入区域 */
.chat-input {
    background: white;
    padding: 50px 30px;
    border-top: 1px solid #dee2e6;
}

.chat-input form {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.chat-input textarea {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1rem;
    resize: none;
    font-family: inherit;
    transition: all 0.3s ease;
}

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

.send-btn {
    background: linear-gradient(45deg, #2ecc71, #27ae60);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    justify-content: center;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(46, 204, 113, 0.3);
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .login-box {
        padding: 30px 20px;
    }
    
    .login-box h1 {
        font-size: 1.8rem;
    }
    
    .chat-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-right {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .chat-messages {
        padding: 20px 15px;
    }
    
    .message {
        max-width: 95%;
    }
    
    .chat-input {
        padding: 15px;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    /* 优化输入框在手机上的居中显示 */
    .chat-input form {
        flex-direction: column;
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 10px;
    }
    
    .chat-input textarea {
        width: 100%;
        max-width: 95%;
        margin: 0 auto;
        padding: 12px 15px;
        border-radius: 15px;
    }
    
    .send-btn {
        width: 100%;
        max-width: 95%;
        margin: 0 auto;
        border-radius: 15px;
    }
    
    /* 针对更小屏幕的优化 */
    @media (max-width: 320px) {
        .chat-input textarea {
            max-width: 100%;
            padding: 10px 12px;
        }
        
        .send-btn {
            max-width: 100%;
            padding: 12px 20px;
        }
    }
}