/* 聊天页面样式 - chat.php */

/* 全局样式优化 */
body {
    background: linear-gradient(135deg, #f0faf5 0%, #e6f7ef 100%);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* 导航栏美化 */
.navbar {
    background: linear-gradient(135deg, #07C160 0%, #10D56A 100%) !important;
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px rgba(7, 193, 96, 0.3);
    border: none;
    height: 70px;
    padding: 0.75rem 1rem;
}

/* 变量定义 */
:root {
    --primary-color: #4285F4;
    --secondary-color: #34A853;
    --accent-color: #FBBC05;
    --danger-color: #EA4335;
    --light-bg: #f8f9fa;
    --dark-bg: #212529;
    --border-radius: 12px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 导航栏美化 */
.navbar {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.navbar-brand {
    font-weight: 600;
}

/* 聊天头部美化 */
.chat-header {
    background: linear-gradient(135deg, var(--primary-color), #6d5dfc);
    box-shadow: var(--box-shadow);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 15px 0;
}

.agent-avatar-wrapper img {
    border: 3px solid white;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.agent-avatar-wrapper img:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.7);
}

/* 消息区域美化 */
.chat-container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: transparent;
}

.chat-messages {
    padding: 20px;
    background-color: #f5f5f5;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin: 15px;
}

/* 消息气泡美化 - 参考微信配色 */
.message {
    margin-bottom: 20px;
    animation: fadeInUp 0.5s ease;
}

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

.message.user .message-content {
    background-color: #95ec69; /* 微信绿色气泡 */
    border-radius: 18px 0 18px 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    color: #000000; /* 黑色文字 */
    padding: 12px 15px;
}

.message.assistant .message-content {
    background-color: #ffffff; /* 白色气泡 */
    border-radius: 0 18px 18px 18px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    color: #000000; /* 黑色文字 */
    padding: 12px 15px;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease;
}

.message-avatar:hover {
    transform: scale(1.05);
}

.message-text {
    font-size: 16px;
    line-height: 1.6;
    color: #000000;
    word-break: break-word;
}

/* 消息时间样式优化 */
.message-time {
    font-size: 12px;
    color: #888888;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-top: 5px;
}

/* 消息操作按钮优化 */
.message-actions {
    opacity: 0;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
}

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

.message-action-btn {
    width: 26px;
    height: 26px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 2px;
    border-radius: 50%;
    background-color: transparent;
    border: none;
    color: #666;
    box-shadow: none;
}

.message-action-btn:hover {
    color: #000000;
}

.message.user .message-action-btn {
    color: #07C160;
}

.message.assistant .message-action-btn {
    color: #4285F4;
}

.message-action-btn i {
    font-size: 14px;
}

/* 输入区域美化 */
.chat-input-container {
    background-color: white;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 15px 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.form-control {
    border-radius: 20px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 12px 20px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.25);
}

.btn-primary {
    border-radius: 20px;
    padding: 8px 20px;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* 推荐问题美化 */
.recommended-question {
    border-radius: 18px;
    padding: 6px 15px;
    margin: 5px;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    background: white;
    border: 1px solid rgba(66, 133, 244, 0.3);
    color: var(--primary-color);
}

.recommended-question:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* 动画效果 */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.shine {
    position: relative;
    overflow: hidden;
}

.shine::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: shine-once 2s ease-in-out;
    animation-fill-mode: forwards;
}

@keyframes shine-once {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* 鼠标悬停时触发闪光效果 */
.shine:hover::after {
    left: -100%;
    animation: shine-once 1s ease-in-out;
}

/* 图片预览美化 */
#imagePreview {
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: all 0.3s ease;
}

#previewImg {
    border-radius: 8px;
    transition: all 0.3s ease;
}

#previewImg:hover {
    transform: scale(1.05);
}

/* 模态框美化 */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* 代码块美化 */
pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    overflow-x: auto;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
}

code {
    font-family: "Fira Code", Consolas, Monaco, "Andale Mono", monospace;
    font-size: 14px;
}

/* 表格美化 */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 15px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

th {
    background-color: #f5f5f5;
        font-weight: 600;
    }

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background-color: rgba(66, 133, 244, 0.05);
}

/* 附件预览样式 - 紧凑的图标式布局 */
.attachment-preview {
        display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    background: rgba(7, 193, 96, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(7, 193, 96, 0.1);
}

.attachment-item {
    position: relative;
    display: inline-block;
}

/* 图片缩略图样式 */
.attachment-thumbnail {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e0e0e0;
        transition: all 0.2s ease;
    }

.attachment-thumbnail:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.attachment-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 文件图标样式 */
.attachment-icon {
    position: relative;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.attachment-icon:hover {
    border-color: var(--primary-color);
    background: rgba(66, 133, 244, 0.1);
    transform: scale(1.05);
}

.attachment-icon i {
    font-size: 20px;
}

/* 删除按钮样式 */
.attachment-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--danger-color);
    color: white;
    border: none;
        display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    opacity: 0;
    transition: all 0.2s ease;
    cursor: pointer;
}

.attachment-item:hover .attachment-remove {
    opacity: 1;
}

.attachment-remove:hover {
    background: #c82333;
    transform: scale(1.1);
}

/* 消息图片样式 */
.message-image img {
    transition: all 0.3s ease;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message-image img:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 移动端优化 */
@media (max-width: 768px) {
    body {
        padding-bottom: 20px; /* 移除底部导航后减少底部padding */
    }
    
    .chat-messages {
        padding: 15px;
        margin: 10px;
    }
    
    .message-text {
        font-size: 15px;
        line-height: 1.5;
    }
    
    .chat-header {
        padding: 10px 0;
    }
    
    .agent-avatar-wrapper img {
        width: 40px;
        height: 40px;
    }
    
    /* 移动端消息操作按钮优化 */
    .message-actions {
        opacity: 1;
        display: flex;
        margin-left: 5px;
    }
    
    .message-action-btn {
        width: 22px;
        height: 22px;
        margin: 0 1px;
        background-color: transparent;
        border: none;
        color: #666;
        box-shadow: none;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .message-action-btn i {
        font-size: 12px;
    }
    
    .message-action-btn:active {
        transform: scale(0.95);
        opacity: 1;
    }
    
    .message.user .message-action-btn,
    .message.assistant .message-action-btn {
        background-color: transparent;
        color: #666;
    }
    
    /* 移动端消息气泡微信风格 */
    .message.user .message-content {
        background-color: #95ec69;
        border-radius: 15px 0 15px 15px;
        padding: 10px 12px;
        position: relative;
        box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
    }
    
    .message.assistant .message-content {
        background-color: white;
        border-radius: 0 15px 15px 15px;
        padding: 10px 12px;
        position: relative;
        box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
    }
    
    /* 移动端消息时间样式 */
    .message-time {
        font-size: 10px;
        margin-top: 3px;
    }
    
    /* 移动端输入区域优化 */
    .chat-input-container {
        padding: 10px 0;
        margin-bottom: 0;
        position: sticky;
        bottom: 0;
        background: white;
        z-index: 100;
    }
    
    /* 移除输入框下方空白 */
    .container-fluid .row.g-2 {
        margin-bottom: 0;
    }
    
    #recommendedQuestions {
        display: none !important;
    }
    
    /* 隐藏底部导航 */
    .bottom-nav {
        display: none !important;
    }
}
