/* AI智能问答页面样式 - 深绿色主题 */

/* 简化聊天界面样式 */
.chat-main-simple {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 150px);
    min-height: 600px;
}

.chat-panel-full {
    flex: 1;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(45, 80, 22, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 2px solid #e8f5e8;
    max-width: 100%;
}

/* 聊天容器 */
.chat-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    height: 100%;
}

/* 横向布局样式 - 强制横向 */
.chat-main-horizontal {
    display: flex !important;
    gap: 30px;
    height: calc(100vh - 200px);
    min-height: 600px;
    flex-wrap: nowrap !important;
}

.chat-panel-horizontal {
    flex: 1;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(45, 80, 22, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 2px solid #e8f5e8;
    min-width: 0; /* 防止flex项目收缩 */
}

.info-panel-horizontal {
    width: 450px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    flex-shrink: 0; /* 防止收缩 */
    min-width: 450px; /* 强制最小宽度 */
}

.info-panel-horizontal .info-card {
    flex: 1;
    min-height: 180px;
}

.info-panel-horizontal .card-body {
    padding: 15px;
}

.info-panel-horizontal .feature-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-panel-horizontal .feature-list li {
    font-size: 13px;
    padding: 5px 0;
}

.info-panel-horizontal .faq-item {
    margin-bottom: 8px;
}

.info-panel-horizontal .faq-question {
    font-size: 13px;
    padding: 8px 12px;
}

.info-panel-horizontal .stats-item {
    padding: 8px 0;
}

.info-panel-horizontal .stats-value {
    font-size: 16px;
}

/* 聊天容器 */
.chat-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    height: 100%;
}

/* 页面标题 */
.chat-header {
    text-align: center;
    padding: 30px 0;
    background: linear-gradient(135deg, #2d5016 0%, #4a7c28 100%);
    border-radius: 15px;
    color: white;
    margin-bottom: 30px;
    box-shadow: 0 8px 25px rgba(45, 80, 22, 0.3);
}

.chat-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.chat-header p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 0;
}

/* 聊天主体区域 */
.chat-main {
    gap: 30px;
}

/* 聊天面板 */
.chat-panel {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(45, 80, 22, 0.15);
    overflow: hidden;
    height: 600px;
    display: flex;
    flex-direction: column;
    border: 2px solid #e8f5e8;
}

/* 聊天消息区域 */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8faf8;
}

/* 消息样式 */
.message {
    display: flex;
    margin-bottom: 20px;
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-message {
    justify-content: flex-start;
}

.user-message {
    justify-content: flex-end;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.ai-message .message-avatar {
    background: linear-gradient(135deg, #2d5016 0%, #4a7c28 100%);
    margin-right: 12px;
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #4a7c28 0%, #6fa34d 100%);
    margin-left: 12px;
    order: 2;
}

.message-content {
    max-width: 70%;
}

.ai-message .message-content {
    text-align: left;
}

.user-message .message-content {
    text-align: right;
    order: 1;
}

.message-text {
    background: white;
    padding: 15px 20px;
    border-radius: 18px;
    box-shadow: 0 3px 12px rgba(45, 80, 22, 0.1);
    line-height: 1.6;
    font-size: 15px;
    color: #333;
    position: relative;
    border: 1px solid #e8f5e8;
}

.user-message .message-text {
    background: linear-gradient(135deg, #4a7c28 0%, #6fa34d 100%);
    color: white;
    border: 1px solid #4a7c28;
}

.message-text::before {
    content: '';
    position: absolute;
    top: 10px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
}

.ai-message .message-text::before {
    left: -16px;
    border-right-color: white;
}

.user-message .message-text::before {
    right: -16px;
    border-left-color: #4a7c28;
}

.message-time {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    display: flex;
    align-items: center;
}

.user-message .message-time {
    justify-content: flex-end;
    color: #e8f5e8;
}

/* 输入区域 */
.chat-input-area {
    padding: 20px;
    background: linear-gradient(135deg, #f8faf8 0%, #e8f5e8 100%);
    border-top: 2px solid #d4e8d4;
}

.chat-input {
    border: 2px solid #d4e8d4;
    border-radius: 25px;
    padding: 15px 20px;
    font-size: 15px;
    resize: none;
    transition: all 0.3s ease;
    background: white;
}

.chat-input:focus {
    border-color: #4a7c28;
    box-shadow: 0 0 0 0.2rem rgba(74, 124, 40, 0.25);
    outline: none;
}

.send-btn {
    border-radius: 25px;
    padding: 10px 25px;
    background: linear-gradient(135deg, #2d5016 0%, #4a7c28 100%);
    border: none;
    font-weight: 600;
    transition: all 0.3s ease;
    color: white;
    box-shadow: 0 4px 15px rgba(45, 80, 22, 0.3);
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(45, 80, 22, 0.4);
    background: linear-gradient(135deg, #4a7c28 0%, #6fa34d 100%);
}

.send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.input-hints {
    margin-top: 10px;
    text-align: center;
}

.input-hints i {
    color: #4a7c28;
}

/* 信息面板 */
.info-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.info-card {
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(45, 80, 22, 0.08);
    overflow: hidden;
    border: 1px solid #e8f5e8;
}

.info-card .card-header {
    background: linear-gradient(135deg, #f8faf8 0%, #e8f5e8 100%);
    padding: 15px 20px;
    border-bottom: 2px solid #d4e8d4;
}

.info-card .card-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d5016;
}

.info-card .card-header i {
    color: #4a7c28;
}

.info-card .card-body {
    padding: 20px;
}

/* 功能列表 */
.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.feature-list li {
    padding: 10px 0;
    border-bottom: 1px solid #f0f8f0;
    font-size: 14px;
    color: #555;
}

.feature-list li:last-child {
    border-bottom: none;
}

.feature-list .fa-check {
    color: #4a7c28;
}

/* FAQ项目 */
.faq-item {
    margin-bottom: 12px;
}

.faq-question {
    width: 100%;
    background: #f8faf8;
    border: 1px solid #d4e8d4;
    border-radius: 10px;
    padding: 12px 15px;
    text-align: left;
    font-size: 14px;
    color: #2d5016;
    transition: all 0.3s ease;
    cursor: pointer;
}

.faq-question:hover {
    background: linear-gradient(135deg, #2d5016 0%, #4a7c28 100%);
    color: white;
    border-color: #4a7c28;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(45, 80, 22, 0.25);
}

.faq-question i {
    color: #4a7c28;
    transition: color 0.3s ease;
}

.faq-question:hover i {
    color: white;
}

/* 统计项目 */
.stats-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f8f0;
}

.stats-item:last-child {
    border-bottom: none;
}

.stats-label {
    font-size: 14px;
    color: #666;
}

.stats-value {
    font-size: 18px;
    font-weight: 700;
    color: #4a7c28;
}

/* 加载覆盖层 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(45, 80, 22, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 2px solid #e8f5e8;
}

.loading-text {
    margin-top: 15px;
    font-size: 16px;
    color: #2d5016;
    font-weight: 500;
}

/* 响应式设计 - 保持横向布局 */
@media (max-width: 1400px) {
    .info-panel-horizontal {
        width: 400px;
        min-width: 400px;
    }
    
    .chat-main-horizontal {
        gap: 20px;
    }
}

@media (max-width: 1200px) {
    /* 强制保持横向布局，不切换为垂直 */
    .chat-main-horizontal {
        gap: 15px;
        height: calc(100vh - 150px);
    }
    
    .info-panel-horizontal {
        width: 350px;
        min-width: 350px;
    }
    
    .chat-panel-horizontal {
        height: 500px;
    }
    
    /* 允许水平滚动如果空间不足 */
    .chat-container {
        overflow-x: auto;
        min-width: 1200px;
    }
}

@media (max-width: 768px) {
    /* 即使在小屏幕上也保持横向布局 */
    .chat-container {
        padding: 5px;
        overflow-x: auto;
        min-width: 1000px;
    }
    
    .chat-main-horizontal {
        gap: 10px;
        height: calc(100vh - 120px);
    }
    
    .chat-panel-horizontal {
        height: 450px;
    }
    
    .info-panel-horizontal {
        width: 300px;
        min-width: 300px;
    }
    
    .message-content {
        max-width: 90%;
    }
    
    .message-text {
        font-size: 14px;
        padding: 12px 15px;
    }
    
    .chat-input-area {
        padding: 15px;
    }
}

@media (max-width: 576px) {
    /* 极小屏幕也保持横向，允许滚动 */
    .chat-container {
        padding: 5px;
        overflow-x: auto;
        min-width: 900px;
    }
    
    .chat-main-horizontal {
        gap: 8px;
        height: calc(100vh - 100px);
    }
    
    .chat-panel-horizontal {
        height: 400px;
    }
    
    .info-panel-horizontal {
        width: 280px;
        min-width: 280px;
    }
    
    .message-avatar {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .ai-message .message-avatar {
        margin-right: 10px;
    }
    
    .user-message .message-avatar {
        margin-left: 10px;
    }
    
    .message {
        margin-bottom: 15px;
    }
    
    .chat-messages {
        padding: 15px;
    }
    
    .info-panel-horizontal .info-card {
        min-height: 120px;
    }
    
    .info-panel-horizontal .card-body {
        padding: 12px;
    }
}

/* 滚动条样式 */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f0f8f0;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #4a7c28;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #2d5016;
}

/* 打字动画 */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 15px 20px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #4a7c28;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.7;
    }
    30% {
        transform: scale(1.3);
        opacity: 1;
    }
}

/* 首页AI问答图标样式 */
.ai-chat-fab {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2d5016 0%, #4a7c28 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(45, 80, 22, 0.4);
    transition: all 0.3s ease;
    z-index: 1000;
    text-decoration: none;
}

.ai-chat-fab:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(45, 80, 22, 0.5);
    color: white;
    text-decoration: none;
}

.ai-chat-fab:active {
    transform: translateY(-1px) scale(1.02);
}

.ai-chat-tooltip {
    position: absolute;
    bottom: 70px;
    right: 0;
    background: #2d5016;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.ai-chat-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 15px;
    border: 6px solid transparent;
    border-top-color: #2d5016;
}

.ai-chat-fab:hover .ai-chat-tooltip {
    opacity: 1;
    visibility: visible;
    bottom: 75px;
}

/* 消息来源样式 */
.message-sources {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f0f8f0;
}

.message-sources small {
    color: #666;
    font-size: 12px;
}

.message-sources i {
    color: #4a7c28;
}

/* Toast通知样式 */
.toast-container {
    z-index: 9999;
}

/* Bootstrap主题色覆盖 */
.bg-success {
    background-color: #4a7c28 !important;
}

.btn-success {
    background-color: #4a7c28;
    border-color: #4a7c28;
}

.btn-success:hover {
    background-color: #2d5016;
    border-color: #2d5016;
}

.text-success {
    color: #4a7c28 !important;
}
