/* 云客服系统样式 */

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

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

.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

#main-page.active {
    display: flex;
}

/* 管理员页面样式 */
.admin-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    text-align: center;
    margin-bottom: 2rem;
}

.admin-header h2 {
    margin: 0 0 0.5rem 0;
    font-size: 2rem;
}

.admin-content {
    padding: 0 2rem;
}

.admin-section {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.admin-section h3 {
    margin: 0 0 1rem 0;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 0.5rem;
}

.admin-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #dee2e6;
}

.stat-card h4 {
    margin: 0 0 0.5rem 0;
    color: #666;
    font-size: 0.9rem;
}

.stat-card span {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
}

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

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-content h3 {
    margin: 0 0 1.5rem 0;
    color: #333;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

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

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

.login-container h1 {
    text-align: center;
    color: #333;
    margin-bottom: 2rem;
    font-size: 2rem;
}

.login-form h2 {
    margin-bottom: 1.5rem;
    color: #555;
    text-align: center;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: #667eea;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background-color: #5a6fd8;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
    width: 100%;
    margin-top: 1rem;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.qr-login {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #eee;
}

.qr-code-container {
    text-align: center;
    margin-top: 1rem;
}

.qr-code-container img {
    max-width: 200px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

/* 主界面样式 */
#main-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.header {
    background: white;
    padding: 1rem 2rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header h1 {
    color: #333;
    font-size: 1.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 侧边栏样式 */
.sidebar {
    width: 300px;
    background: white;
    border-right: 1px solid #eee;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    color: #333;
    font-size: 1.1rem;
}

.session-list {
    flex: 1;
    overflow-y: auto;
}

.session-item {
    padding: 1rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.session-item:hover {
    background-color: #f8f9fa;
}

.session-item.active {
    background-color: #e3f2fd;
    border-left: 3px solid #2196f3;
}

.session-item h4 {
    color: #333;
    margin-bottom: 0.25rem;
}

.session-item p {
    color: #666;
    font-size: 0.875rem;
}

.session-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.session-time {
    color: #999;
    font-size: 0.75rem;
}

.session-status {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.session-status.active {
    background-color: #d4edda;
    color: #155724;
}

.session-status.inactive {
    background-color: #f8d7da;
    color: #721c24;
}

/* 聊天区域样式 */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
}

.welcome-message {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.welcome-message h2 {
    color: #333;
    margin-bottom: 1rem;
}

.welcome-message p {
    color: #666;
    margin-bottom: 2rem;
}

.qr-chat-section {
    background: #f8f9fa;
    padding: 2rem;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.qr-chat-section h3 {
    color: #333;
    margin-bottom: 1rem;
}

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

.chat-header {
    padding: 1rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
}

.chat-header h3 {
    color: #333;
    font-size: 1.1rem;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #fafafa;
}

.message {
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
}

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

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

.message-content {
    max-width: 70%;
    padding: 0.75rem 1rem;
    border-radius: 18px;
    word-wrap: break-word;
}

.message.agent .message-content {
    background-color: #2196f3;
    color: white;
    border-bottom-right-radius: 5px;
}

.message.visitor .message-content {
    background-color: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 5px;
}

.message-meta {
    font-size: 0.75rem;
    color: #999;
    margin-top: 0.25rem;
}

.message-input {
    padding: 1rem;
    border-top: 1px solid #eee;
    display: flex;
    gap: 0.5rem;
    background: white;
}

.message-input input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 1rem;
}

.message-input input:focus {
    outline: none;
    border-color: #2196f3;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: 200px;
    }
    
    .chat-area {
        height: calc(100vh - 200px);
    }
    
    .login-container {
        margin: 1rem;
        padding: 1.5rem;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 通知样式 */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 5px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

.notification.success {
    background-color: #28a745;
}

.notification.error {
    background-color: #dc3545;
}

.notification.info {
    background-color: #17a2b8;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
