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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0;
}

/* 对话容器 */
.chat-container {
    width: 100%;
    max-width: 800px;
    height: 90vh;
    max-height: 600px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 头部 */
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #667eea;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.chat-info h2 {
    font-size: 20px;
    font-weight: 600;
}

.chat-info p {
    font-size: 14px;
    opacity: 0.9;
}

/* 对话内容 */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden; /* 禁用横向滚动 */
    display: flex;
    flex-direction: column;
    gap: 15px;
    -ms-overflow-style: none;  /* IE和Edge禁用滚动条 */
    scrollbar-width: none;  /* Firefox禁用滚动条 */
}

/* 隐藏滚动条但保持滚动功能 */
.chat-messages::-webkit-scrollbar {
    display: none; /* Chrome、Safari和Opera隐藏滚动条 */
}

/* 防止横向滑动 */
.chat-messages {
    -webkit-overflow-scrolling: touch; /* 使iOS设备上的滚动更平滑 */
    overscroll-behavior-x: none; /* 防止在x轴方向上的过度滚动 */
    touch-action: pan-y; /* 只允许垂直方向的触摸动作 */
}

/* 消息容器样式 */
.message-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-width: 70%;
}

.user-message-container {
    align-self: flex-end;
}

.bot-message-container {
    align-self: flex-start;
}

/* 消息样式 */
.message {
    padding: 12px 16px;
    border-radius: 20px;
    line-height: 1.5;
    position: relative;
    animation: slideIn 0.3s ease forwards;
    cursor: pointer;
}

.message:hover .message-actions {
    opacity: 1;
}

.message-actions {
    position: absolute;
    right: 5px;
    top: 5px;
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    gap: 5px;
}

.action-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(0, 0, 0, 0.3);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.action-btn:hover {
    background: rgba(0, 0, 0, 0.5);
}

.quoted-message {
    background: rgba(102, 126, 234, 0.1);
    border-left: 3px solid #667eea;
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 14px;
    color: #333;
    border-radius: 8px;
}

.message-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.message-time {
    font-size: 10px;
    opacity: 0.7;
    text-align: right;
    margin-right: 10px;
    margin-top: 3px;
    color: #888;
    font-style: italic;
}

@keyframes slideIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    50% {
        opacity: 0.8;
        transform: translateY(5px) scale(1.02);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.user-message {
    align-self: flex-end;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 5px;
}

.bot-message {
    align-self: flex-start;
    background: #f1f1f1;
    color: #333;
    border-bottom-left-radius: 5px;
}

/* 输入区域 */
.chat-input {
    display: flex;
    padding: 20px;
    gap: 10px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

.input-wrapper {
    flex: 1;
    position: relative;
}

#message-input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.9);
}

#message-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 按钮 */
.btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

/* 表情面板 */
.emoji-panel {
    position: absolute;
    bottom: 70px;
    left: 0;
    right: 0;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 10px;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 1000;
}

.emoji-panel.show {
    display: grid;
}

.emoji {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.emoji:hover {
    background: #f0f0f0;
}

/* 快捷按钮区域 */
.quick-actions {
    display: flex;
    gap: 10px;
    padding: 10px 20px;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
}

.quick-btn {
    padding: 8px 16px;
    border: 2px solid #e0e0e0;
    background: white;
    color: #667eea;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.quick-btn:hover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.quick-btn:active {
    transform: translateY(0);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}

/* 响应式设计 */
@media (max-width: 600px) {
    body {
        padding: 0;
        margin: 0;
        overflow: hidden;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) fixed;
    }
    
    .chat-container {
        width: 100vw;
        height: 100vh;
        max-height: none;
        border-radius: 0;
        box-shadow: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        overflow: hidden;
    }

    .message-container {
        max-width: calc(100% - 20px);
        margin-left: 8px;
        margin-right: 8px;
    }

    .chat-header {
        padding: 12px 15px;
        min-height: 50px;
    }

    .chat-messages {
        padding: 10px 12px 120px 12px;
        margin: 0;
        height: calc(100vh - 170px);
        overflow-x: hidden;
        overflow-y: auto;
    }

    .chat-input {
        padding: 10px 12px 10px 12px;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        z-index: 100;
        margin: 0;
        height: 60px;
    }

    .quick-actions {
        position: fixed;
        bottom: 60px;
        left: 0;
        right: 0;
        z-index: 99;
        padding: 8px 12px 8px 12px;
        margin: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(5px);
        border-top: 1px solid #eee;
    }

    .emoji-panel {
        bottom: 120px;
        left: 12px;
        right: 12px;
        margin: 0;
        background: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
    }
    
    .avatar {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .chat-info h2 {
        font-size: 18px;
    }
    
    .chat-info p {
        font-size: 12px;
    }
    
    .message {
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .message-time {
        font-size: 9px;
        margin-right: 8px;
        margin-top: 2px;
    }
    
    .input-wrapper {
        flex: 1;
        margin-right: 8px;
    }
    
    #message-input {
        padding: 12px 16px;
        font-size: 15px;
        height: 40px;
    }
    
    .btn {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .quick-btn {
        padding: 6px 12px;
        font-size: 13px;
        margin: 2px;
    }
}

/* 隐藏原始元素 */
.content { 
    display: none; 
}

/* 确保现代化界面在最前面 */
.chat-container {
    z-index: 9999;
    position: relative;
}