/* css/style.css - 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

/* 客户聊天窗口样式 */
.chat-container {
    width: 420px;
    max-width: 100%;
    height: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.chat-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.status-badge {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(255,255,255,0.2);
}

.status-badge.online {
    background: #10b981;
}

.status-badge.offline {
    background: #ef4444;
}

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

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

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

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

.message-bubble {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 18px;
    position: relative;
}

.message.customer .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.support .message-bubble {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message-text {
    word-wrap: break-word;
    line-height: 1.4;
}

.message-time {
    font-size: 10px;
    margin-top: 4px;
    opacity: 0.7;
    text-align: right;
}

.chat-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 12px;
    cursor: pointer;
}

.message.system {
    justify-content: center;
    margin: 10px 0;
}

.message.system .message-bubble {
    background: #e9ecef;
    color: #666;
    font-size: 12px;
    max-width: 80%;
    text-align: center;
}

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

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

.upload-btn {
    cursor: pointer;
    color: #667eea;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.upload-btn:hover {
    background: #f3f4f6;
}

.char-count {
    font-size: 12px;
    color: #9ca3af;
}

textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    margin-bottom: 10px;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
}

button {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s;
}

button:hover {
    transform: scale(0.98);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 客服工作台样式 */
.admin-container {
    width: 1000px;
    max-width: 95%;
    height: 700px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    display: flex;
    overflow: hidden;
}

.sidebar {
    width: 300px;
    background: #f8f9fa;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    background: white;
}

.sidebar-header h3 {
    font-size: 16px;
    margin-bottom: 8px;
}

.status-indicator {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 20px;
    display: inline-block;
}

.status-indicator.online {
    background: #d1fae5;
    color: #065f46;
}

.status-indicator.offline {
    background: #fee2e2;
    color: #991b1b;
}

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

.visitor-item {
    padding: 15px;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background 0.2s;
}

.visitor-item:hover {
    background: #f3f4f6;
}

.visitor-item.active {
    background: #e0e7ff;
    border-left: 3px solid #667eea;
}

.visitor-id {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.last-msg {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.last-time {
    font-size: 10px;
    color: #9ca3af;
}

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

.chat-area .chat-header {
    background: white;
    color: #333;
    border-bottom: 1px solid #e5e7eb;
    padding: 15px 20px;
}

.chat-area .chat-header h4 {
    font-size: 14px;
    font-weight: 500;
}

.logout-btn {
    width: auto;
    padding: 6px 16px;
    background: #ef4444;
    font-size: 12px;
}

.logout-btn:hover {
    background: #dc2626;
}

.chat-area .chat-messages {
    background: #f8f9fa;
}

.status-note {
    font-size: 11px;
    color: #9ca3af;
}

.loading, .no-visitors {
    padding: 20px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
}

/* 登录框样式 */
.login-box {
    background: white;
    padding: 30px;
    border-radius: 20px;
    width: 320px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.login-box h2 {
    margin-bottom: 20px;
    color: #333;
}

.login-box input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
}

.login-box button {
    width: 100%;
}

.error-msg {
    background: #fee2e2;
    color: #991b1b;
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 13px;
}

.tip {
    margin-top: 15px;
    font-size: 12px;
    color: #9ca3af;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}