/* AI 产业洞察 Chat 页面专属样式 */

/* ==================== 对话气泡 ==================== */

.chat-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    animation: fadeIn 0.3s ease-in-out;
    word-wrap: break-word;
}

/* 用户气泡（右侧，蓝色） */
.chat-bubble-user {
    background: linear-gradient(135deg, #0066FF 0%, #0052CC 100%);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

/* Agent 气泡（左侧，灰色） — 全宽，含企业列表/表格等内容需要充足空间 */
.chat-bubble-agent {
    max-width: 100%;
    background: white;
    color: #374151;
    margin-right: auto;
    border-bottom-left-radius: 4px;
    border: 1px solid #e5e7eb;
}

/* ==================== 工具状态卡片 ==================== */

.tool-status-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f0f7ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    margin-bottom: 8px;
    font-size: 13px;
    color: #1e40af;
}

.tool-status-card .tool-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #dbeafe;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tool-status-card .tool-icon i {
    font-size: 12px;
    color: #2563eb;
}

.tool-status-card .tool-label {
    font-weight: 500;
}

/* 工具状态 loading 动画 */
.tool-status-card .tool-loading {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 4px;
}

.tool-status-card .tool-loading span {
    width: 4px;
    height: 4px;
    background-color: #60a5fa;
    border-radius: 50%;
    animation: toolPulse 1.2s infinite;
}

.tool-status-card .tool-loading span:nth-child(2) { animation-delay: 0.2s; }
.tool-status-card .tool-loading span:nth-child(3) { animation-delay: 0.4s; }

@keyframes toolPulse {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* ==================== 企业信息卡片 ==================== */

.enterprise-info-card {
    padding: 14px 16px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    margin-bottom: 8px;
}

.enterprise-info-card .enterprise-name {
    font-size: 14px;
    font-weight: 600;
    color: #166534;
    margin-bottom: 4px;
}

.enterprise-info-card .enterprise-detail {
    font-size: 12px;
    color: #6b7280;
}

/* ==================== 企业列表表格 ==================== */

.enterprise-list-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 8px;
}

.enterprise-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}

.enterprise-list-header .list-title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.enterprise-list-header .list-count {
    font-size: 12px;
    color: #6b7280;
}

.enterprise-list-table {
    width: 100%;
    border-collapse: collapse;
}

.enterprise-list-table th {
    padding: 8px 12px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.enterprise-list-table td {
    padding: 8px 12px;
    font-size: 13px;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
}

.enterprise-list-table tr:hover td {
    background: #f8fafc;
}

.enterprise-list-table .enterprise-name-cell {
    color: #0066FF;
    font-weight: 500;
    cursor: pointer;
}

.enterprise-list-table .enterprise-name-cell:hover {
    text-decoration: underline;
}

/* 翻页控件 */
.enterprise-list-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
}

.enterprise-list-pagination button {
    padding: 4px 12px;
    font-size: 12px;
    color: #374151;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.enterprise-list-pagination button:hover:not(:disabled) {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.enterprise-list-pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.enterprise-list-pagination .page-info {
    font-size: 12px;
    color: #6b7280;
}

/* ==================== 候选消歧卡片 ==================== */

.candidate-card {
    transition: all 0.2s ease;
}

.candidate-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 102, 255, 0.1);
    border-color: #93c5fd;
}

/* ==================== 引用标注 ==================== */

.cite {
    display: inline-block;
    color: #0066FF;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: 600;
    vertical-align: super;
    margin: 0 1px;
    padding: 0 2px;
    border-radius: 2px;
    transition: background-color 0.15s;
}

.cite:hover {
    background-color: #dbeafe;
}

/* ==================== 引用来源浮窗 ==================== */

.reference-popup {
    position: fixed;
    z-index: 9999;
    width: 340px;
    max-height: 360px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.reference-popup.hidden {
    display: none;
}

.reference-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}

.reference-popup-title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.reference-popup-close {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.reference-popup-close:hover {
    background: #e5e7eb;
    color: #374151;
}

.reference-popup-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.reference-item {
    padding: 10px 16px;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s;
}

.reference-item:last-child {
    border-bottom: none;
}

.reference-item:hover {
    background: #f8fafc;
}

.reference-item .ref-id {
    display: inline-block;
    width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: #0066FF;
    background: #dbeafe;
    border-radius: 4px;
    margin-right: 8px;
    flex-shrink: 0;
}

.reference-item .ref-title {
    font-size: 13px;
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 4px;
}

.reference-item .ref-meta {
    font-size: 11px;
    color: #94a3b8;
}

/* ==================== 思考过程折叠面板 ==================== */

.think-panel {
    margin-bottom: 8px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.think-panel-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f8fafc;
    cursor: pointer;
    font-size: 12px;
    color: #6b7280;
    user-select: none;
    transition: background 0.15s;
}

.think-panel-header:hover {
    background: #f1f5f9;
}

.think-panel-header .think-toggle {
    transition: transform 0.2s;
    font-size: 10px;
}

.think-panel-header .think-toggle.expanded {
    transform: rotate(0deg);
}

.think-panel-header .think-toggle:not(.expanded) {
    transform: rotate(-90deg);
}

.think-panel-body {
    padding: 10px 12px;
    font-size: 12px;
    color: #9ca3af;
    line-height: 1.6;
    background: #fafafa;
    border-top: 1px solid #e5e7eb;
    max-height: 200px;
    overflow-y: auto;
}

.think-panel-body.collapsed {
    display: none;
}

/* ==================== 历史记录项 ==================== */

.history-item {
    transition: all 0.2s ease;
    cursor: pointer;
}

.history-item:hover {
    background-color: #f9fafb;
    transform: translateX(2px);
}

.history-item.active {
    background-color: #eff6ff;
    border-left: 3px solid #0066FF;
}

/* ==================== Agent 气泡内操作按钮 ==================== */

.bubble-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f3f4f6;
}

.bubble-action-btn {
    padding: 5px 12px;
    font-size: 12px;
    color: #0066FF;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.bubble-action-btn:hover {
    background: #dbeafe;
    border-color: #93c5fd;
}

.bubble-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== 示例提示按钮动画 ==================== */

.example-prompt {
    transition: all 0.2s ease;
}

.example-prompt:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ==================== 模式引导建议卡片 ==================== */

.mode-suggestion-card {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 85%;
    margin: 8px 0 12px 40px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f0f7ff 0%, #e0edff 100%);
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    border-top-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 102, 255, 0.08);
    animation: fadeIn 0.3s ease-in-out;
}

.mode-suggestion-card .suggestion-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #dbeafe;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.mode-suggestion-card .suggestion-icon i {
    font-size: 13px;
    color: #2563eb;
}

.mode-suggestion-card .suggestion-body {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.mode-suggestion-card .suggestion-text {
    flex: 1;
    font-size: 13px;
    color: #1e40af;
    line-height: 1.5;
}

.bubble-action-suggestion {
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #0066FF 0%, #0052CC 100%);
    border: 1px solid #0052CC;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.bubble-action-suggestion:hover {
    background: linear-gradient(135deg, #0052CC 0%, #004499 100%);
    border-color: #004499;
    box-shadow: 0 2px 6px rgba(0, 102, 255, 0.2);
}

/* ==================== 延续性追问引导 ==================== */

.follow-up-container {
    max-width: 85%;
    margin: 8px 0 12px 40px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fcd34d;
    border-radius: 12px;
    border-top-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(245, 158, 11, 0.1);
    animation: fadeIn 0.3s ease-in-out;
}

.follow-up-header {
    font-size: 13px;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 10px;
}

.follow-up-header i {
    color: #f59e0b;
    margin-right: 5px;
}

.follow-up-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.follow-up-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    font-size: 13px;
    color: #1e40af;
    background: #fff;
    border: 1px solid #93c5fd;
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.4;
    font-weight: 500;
}

.follow-up-chip::before {
    content: '\f0a4';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 11px;
    color: #3b82f6;
}

.follow-up-chip:hover {
    background: #3b82f6;
    border-color: #2563eb;
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
}

.follow-up-chip:hover::before {
    color: #fff;
}

/* ==================== 实体标记链接 ==================== */

.entity-link {
    display: inline;
    color: #1d4ed8;
    text-decoration: none;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
    padding: 0 4px;
    font-weight: 500;
    line-height: 1.6;
}

.entity-link:hover {
    color: #1e40af;
    background: #dbeafe;
    border-color: #93c5fd;
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.15);
}

.entity-link i {
    font-size: 10px;
    margin-right: 2px;
    opacity: 0.8;
}

/* ==================== 错误消息 ==================== */

.chat-error-msg {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: 13px;
    color: #dc2626;
    margin: 4px 0;
}
