* {
    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;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ========== 客服选择弹窗 ========== */
.cs-choice-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

.cs-choice-box {
    background: #fff;
    border-radius: 20px;
    padding: 36px 28px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.25);
    animation: modalFadeIn 0.4s ease;
    text-align: center;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.cs-choice-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 8px;
}

.cs-choice-desc {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 28px;
}

.cs-choice-btns {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cs-choice-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    border-radius: 14px;
    border: 2px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    text-align: left;
}

.cs-choice-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}

.cs-wechat-choice {
    background: linear-gradient(135deg, #07c160 0%, #06a552 100%);
    color: #fff;
}

.cs-qq-choice {
    background: linear-gradient(135deg, #12b7f5 0%, #0e9ad6 100%);
    color: #fff;
}

.cs-online-choice {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
}

.cs-choice-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
}

.cs-choice-label {
    font-size: 1rem;
    font-weight: 700;
    flex: 1;
}

.cs-choice-hint {
    font-size: 0.75rem;
    opacity: 0.85;
    flex-shrink: 0;
}

/* ========== 聊天容器 ========== */
.chat-container {
    width: 100%;
    max-width: 480px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 650px;
}

.chat-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
    padding: 20px;
    text-align: center;
    flex-shrink: 0;
}

.chat-title {
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #9ca3af;
}

.status-dot.online {
    background: #22c55e;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
}

.chat-subtitle {
    font-size: 0.875rem;
    opacity: 0.8;
    margin-top: 4px;
}

/* ========== 引导按钮栏 ========== */
.guide-buttons-bar {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 14px;
    background: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.guide-btn {
    padding: 6px 14px;
    border-radius: 20px;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.guide-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    opacity: 0.9;
}

/* ========== 消息区域 ========== */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
}

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

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

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

.message {
    display: flex;
    margin-bottom: 12px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

.message-content {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-break: break-all;
}

.message.client .message-content {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message.admin .message-content {
    background: #e2e8f0;
    color: #334155;
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 4px;
    text-align: right;
}

.message.admin .message-time {
    text-align: left;
}

/* 已撤回消息样式 */
.message-content.msg-recalled {
    background: #f1f5f9 !important;
    color: #94a3b8 !important;
    border: 1px dashed #cbd5e1 !important;
    font-style: italic;
}
.message.client .message-content.msg-recalled {
    background: #f1f5f9 !important;
    color: #94a3b8 !important;
}

.system-message {
    text-align: center;
    font-size: 0.8rem;
    color: #94a3b8;
    padding: 8px;
    margin-bottom: 12px;
}

/* ========== 按钮卡片消息 ========== */
.msg-button-card {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.15s ease;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.msg-button-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
}

.msg-button-icon {
    font-size: 1.1rem;
}

/* ========== 输入区域 ========== */
.chat-input-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 16px 12px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
    flex-shrink: 0;
}

.input-toolbar {
    display: flex;
    gap: 4px;
}

.tool-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.tool-btn:hover {
    background: #f1f5f9;
}

.emoji-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    background: #f8fafc;
    border-radius: 8px;
    max-height: 120px;
    overflow-y: auto;
}

.emoji-item {
    font-size: 1.3rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.15s;
}

.emoji-item:hover {
    background: #e2e8f0;
}

.input-row {
    display: flex;
    gap: 8px;
}

.chat-input-area input[type="text"] {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 24px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input-area input[type="text"]:focus {
    border-color: #667eea;
}

.chat-input-area button {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 24px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-input-area button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.chat-input-area button:active {
    transform: translateY(0);
}

/* ========== 图片和文件消息 ========== */
.msg-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    cursor: pointer;
    display: block;
    margin-top: 4px;
}

.msg-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    font-size: 0.8rem;
}

.msg-file:hover {
    background: rgba(0,0,0,0.1);
}

.msg-file-icon {
    font-size: 1.5rem;
}

.msg-file-info {
    display: flex;
    flex-direction: column;
}

.msg-file-name {
    font-weight: 600;
    word-break: break-all;
}

.msg-file-size {
    color: #94a3b8;
    font-size: 0.7rem;
}

/* ========== 图片预览 ========== */
.image-preview-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: pointer;
}

.image-preview-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
}

/* ========== 昵称弹窗 ========== */
.name-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.name-modal {
    background: #fff;
    border-radius: 16px;
    padding: 28px 24px;
    width: 100%;
    max-width: 360px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalFadeIn 0.3s ease;
}

.name-modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
    margin-bottom: 8px;
}

.name-modal-desc {
    font-size: 0.85rem;
    color: #64748b;
    text-align: center;
    margin-bottom: 20px;
}

.name-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 12px;
}

.name-input:focus {
    border-color: #667eea;
}

.name-random-hint {
    font-size: 0.8rem;
    color: #94a3b8;
    text-align: center;
    margin-bottom: 20px;
}

.name-random-hint span {
    color: #667eea;
    cursor: pointer;
    font-weight: 600;
    margin-left: 4px;
}

.name-random-hint span:hover {
    text-decoration: underline;
}

.name-modal-actions {
    display: flex;
    justify-content: center;
}

.name-btn {
    padding: 10px 32px;
    border: none;
    border-radius: 24px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.name-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.name-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* ========== 上传进度条 ========== */
.upload-progress-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 4px 0;
}

.upload-progress-item {
    background: #f1f5f9;
    border-radius: 10px;
    padding: 8px 12px;
    max-width: 280px;
}

.upload-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    font-size: 0.75rem;
    color: #64748b;
}

.upload-progress-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.upload-progress-percent {
    font-weight: 600;
    color: #6366f1;
    flex-shrink: 0;
}

.upload-progress-bar {
    height: 4px;
    background: #e2e8f0;
    border-radius: 2px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 2px;
    transition: width 0.2s ease;
}
