:root {
    --primary-gradient: linear-gradient(135deg, #ff9900, #ff6600);
    --primary-color: #ff9900;
    --secondary-color: #ff6600;
    --ai-bg: #f8f9fa;
    --text-on-primary: white;
}

/* Red Skin */
[data-skin="red"] {
    --primary-gradient: linear-gradient(135deg, #ff4d4f, #cf1322);
    --primary-color: #ff4d4f;
    --secondary-color: #cf1322;
}

/* Green Skin */
[data-skin="green"] {
    --primary-gradient: linear-gradient(135deg, #2ecc71, #27ae60);
    --primary-color: #2ecc71;
    --secondary-color: #27ae60;
}

/* Blue Skin */
[data-skin="blue"] {
    --primary-gradient: linear-gradient(135deg, #3498db, #2980b9);
    --primary-color: #3498db;
    --secondary-color: #2980b9;
}

/* Orange Skin */
[data-skin="orange"] {
    --primary-gradient: linear-gradient(135deg, #ff9900, #ff6600);
    --primary-color: #ff9900;
    --secondary-color: #ff6600;
}

/* Dark Skin */
[data-skin="dark"] {
    --primary-gradient: linear-gradient(135deg, #34495e, #2c3e50);
    --primary-color: #34495e;
    --secondary-color: #2c3e50;
    background-color: #1a1a1a;
}

[data-skin="dark"] .chat-container {
    background: #222;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

[data-skin="dark"] .chat-messages, 
[data-skin="dark"] .chat-header, 
[data-skin="dark"] .chat-footer {
    background: #222;
    color: #eee;
    border-color: #333;
}

[data-skin="dark"] .chat-header h1 { color: #eee; }
[data-skin="dark"] .message-content { background: #333; color: #eee; }
[data-skin="dark"] .input-wrapper { background: #333; }
[data-skin="dark"] .input-wrapper input { color: #eee; }

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    background-color: #f5f5f5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.chat-container {
    width: 100%;
    max-width: 450px;
    height: 100vh;
    max-height: 850px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    margin: 0 auto;
}

.chat-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.back-icon {
    position: absolute;
    left: 20px;
    color: #666;
    cursor: pointer;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #2ecc71;
    border-radius: 50%;
    margin-right: 8px;
}

.chat-header h1 {
    font-size: 18px;
    color: #333;
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    gap: 20px;
    -webkit-overflow-scrolling: touch;
}

.message {
    display: flex;
    max-width: 85%;
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-message {
    align-self: flex-start;
}

/* 首条欢迎消息样式 */
.ai-message.welcome-message {
    align-self: flex-start;
    flex-direction: row;
    align-items: flex-start;
    max-width: 90%;
}

.ai-message.welcome-message .avatar {
    margin-right: 10px;
    margin-bottom: 0;
    width: 40px;
    height: 40px;
}

.ai-message.welcome-message .message-content {
    margin-left: 0;
    text-align: left;
    border-radius: 0 15px 15px 15px;
}

.user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-content {
    margin-left: 10px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 0 15px 15px 15px;
    font-size: 15px;
    line-height: 1.8;
    color: #333;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    text-align: left;
}

/* 打字机内容区域 */
.typing-content {
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.8;
    text-indent: 2em;
}

/* 取消br标签的段落间距 */
.typing-content br {
    display: block;
    content: '';
    margin: 0;
    padding: 0;
    line-height: 1.8;
}

.message-content p {
    margin-bottom: 12px;
    text-indent: 2em;
}

.message-content p:first-child {
    text-indent: 2em;
}

.message-content p:last-child {
    margin-bottom: 0;
}

/* 列表项取消缩进 */
.message-content ul li,
.message-content ol li {
    text-indent: 0;
    margin-bottom: 8px;
}

/* 列表样式 */
.message-content ul,
.message-content ol {
    padding-left: 20px;
    margin: 12px 0;
    text-indent: 0;
}

/* 按钮等不缩进 */
.message-content .action-buttons,
.message-content .quick-prompts {
    text-indent: 0;
}

.user-message .message-content {
    margin-left: 0;
    margin-right: 10px;
    background: var(--primary-gradient);
    color: var(--text-on-primary);
    border-radius: 15px 0 15px 15px;
}

.quick-prompts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.prompt-btn {
    text-align: left;
    background: white;
    border: 1px solid #eee;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    color: var(--primary-color);
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.prompt-btn:hover {
    background: #f0f7ff;
    border-color: #1890ff;
}

.prompt-btn:active {
    transform: scale(0.98);
    background: #e6f4ff;
}

.action-buttons {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.btn {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border-radius: 20px;
    border: none;
    font-size: 13px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
    transition: all 0.3s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    will-change: transform;
    transform: translateZ(0);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn i {
    font-size: 11px;
}

/* 响应式布局 */
@media (max-width: 768px) {
    body {
        padding: 0;
        align-items: stretch;
    }
    
    .chat-container {
        width: 100%;
        height: 100vh;
        max-height: none;
        border-radius: 0;
        box-shadow: none;
    }
    
    /* 隐藏移动端标题栏 */
    .chat-header {
        display: none;
    }
    
    .chat-messages {
        padding: 15px;
        gap: 15px;
    }
    
    .message {
        max-width: 90%;
    }
    
    .avatar {
        width: 35px;
        height: 35px;
    }
    
    .message-content {
        font-size: 16px;
        padding: 12px;
    }
    
    .prompt-btn {
        font-size: 14px;
        padding: 10px 12px;
    }
    
    .chat-footer {
        padding: 15px;
    }
    
    .input-wrapper {
        padding: 4px 4px 4px 15px;
    }
    
    .input-wrapper input {
        font-size: 16px;
    }
    
    .send-btn {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 500px) {
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        flex: none;
        width: 100%;
        justify-content: center;
        padding: 10px 12px;
    }
    
    .chat-header h1 {
        font-size: 15px;
    }
    
    .message-content {
        font-size: 14px;
    }
    
    .footer-note {
        font-size: 10px;
    }
    
    .copyright {
        font-size: 9px;
    }
}

@media (max-width: 360px) {
    .chat-messages {
        padding: 10px;
    }
    
    .message-content {
        padding: 10px;
    }
    
    .btn {
        font-size: 11px;
        padding: 8px 10px;
    }
    
    .prompt-btn {
        font-size: 11px;
        padding: 8px 10px;
    }
}

.btn-red { background-color: #e74c3c; }
.btn-orange { background-color: #f39c12; }
.btn-blue { background-color: #3498db; }
.btn-green { background-color: #2ecc71; }

.chat-footer {
    padding: 20px;
    background: white;
    border-top: 1px solid #f0f0f0;
}

.input-wrapper {
    display: flex;
    background: #f0f2f5;
    border-radius: 30px;
    padding: 5px 5px 5px 20px;
    align-items: center;
}

.input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    outline: none;
    font-size: 15px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.input-wrapper input:focus {
    outline: none;
}

.send-btn {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border: none;
    border-radius: 50%;
    color: var(--text-on-primary);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.3s, transform 0.2s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.send-btn:hover {
    filter: brightness(0.9);
}

.send-btn:active {
    transform: scale(0.95);
}

.footer-note {
    text-align: center;
    font-size: 11px;
    color: #999;
    margin-top: 10px;
}

.copyright {
    text-align: center;
    font-size: 10px;
    color: #bbb;
    margin-top: 15px;
    line-height: 1.4;
}

/* Scrollbar styles */
.chat-messages::-webkit-scrollbar {
    width: 5px;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 10px;
}
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

/* 移动端隐藏滚动条 */
@media (max-width: 768px) {
    .chat-messages::-webkit-scrollbar {
        width: 0;
        display: none;
    }
}

/* Typing Animation */
.typing-text {
    display: flex;
    align-items: center;
    color: #666;
}

.dot-ani {
    display: inline-block;
    width: 1.5em;
    vertical-align: bottom;
    overflow: hidden;
    animation: dots 1.5s infinite steps(4);
}

@keyframes dots {
    0% { width: 0; }
    100% { width: 1.5em; }
}
