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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
}

/* 访客聊天界面 */
.chat-container {
    width: 100%;
    max-width: 400px;
    height: 100vh;
    margin: 0 auto;
    background: #fff;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-info h3 {
    font-size: 18px;
    margin-bottom: 5px;
}

.status {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
}

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

.status-dot.waiting {
    background: #ffc107;
    animation: pulse 1.5s ease-in-out infinite;
}

.status-dot.active {
    background: #4caf50;
}

.status-dot.closed {
    background: #f44336;
}

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

.close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.3s;
}

.close-btn:hover {
    background: rgba(255,255,255,0.3);
}

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

.message {
    margin-bottom: 15px;
    display: flex;
}

.message.visitor {
    justify-content: flex-start;
}

.message.staff {
    justify-content: flex-end;
}

.message-content {
    max-width: 70%;
    padding: 10px 12px;
    border-radius: 12px;
    position: relative;
}

.message.visitor .message-content {
    background: white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message.staff .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 5px;
    display: block;
}

.system-message {
    text-align: center;
    color: #999;
    font-size: 12px;
    padding: 10px;
    margin: 10px 0;
}

.chat-input-area {
    border-top: 1px solid #e0e0e0;
    padding: 15px;
    background: white;
}

.input-tools {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.tool-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.input-wrapper textarea {
    flex: 1;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    font-family: inherit;
    resize: none;
    font-size: 14px;
}

.send-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}

/* 客服管理后台 */
.admin-container {
    display: flex;
    height: 100vh;
}

.admin-sidebar {
    width: 280px;
    background: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
}

.staff-info {
    padding: 20px;
    border-bottom: 1px solid #34495e;
}

.staff-info h4 {
    margin-bottom: 5px;
}

.online-status {
    display: inline-block;
    background: #4caf50;
    color: white;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 5px;
}

.logout-btn {
    display: inline-block;
    margin-top: 10px;
    color: #ecf0f1;
    text-decoration: none;
    font-size: 12px;
}

.sidebar-menu {
    flex: 1;
    padding: 20px 0;
}

.menu-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-item:hover {
    background: #34495e;
}

.menu-item.active {
    background: #34495e;
    border-left: 3px solid #667eea;
}

.badge {
    background: #e74c3c;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 12px;
}

.admin-content {
    flex: 1;
    background: #ecf0f1;
    overflow-y: auto;
}

.tab-content {
    display: none;
    padding: 20px;
}

.tab-content.active {
    display: block;
}

.conversation-item {
    background: white;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.conversation-item.waiting {
    border-left: 4px solid #ffc107;
}

.conversation-item.active {
    border-left: 4px solid #4caf50;
}

.conv-info strong {
    display: block;
    margin-bottom: 5px;
}

.conv-info small {
    color: #7f8c8d;
    font-size: 12px;
}

.conv-time {
    color: #95a5a6;
    font-size: 12px;
}

.empty-state {
    text-align: center;
    color: #95a5a6;
    padding: 40px;
}

/* 聊天窗口 */
.chat-window {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-window-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-chat {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
}

.chat-window-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
}

.chat-window-input {
    padding: 15px;
    border-top: 1px solid #e0e0e0;
}

.chat-window-input textarea {
    width: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    font-family: inherit;
    resize: none;
    margin-bottom: 10px;
}

.chat-window-input button {
    background: #667eea;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    margin-right: 10px;
}

.end-btn {
    background: #e74c3c !important;
}

/* 登录页面 */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

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

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    font-weight: bold;
}

.demo-info {
    margin-top: 20px;
    text-align: center;
    font-size: 12px;
    color: #999;
}

.error-message {
    background: #f44336;
    color: white;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}