/* General Styles */
.chat-container {
  max-width: 800px;
  margin: 0 auto;

  background-color: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-top: 10px;
  margin-bottom: 10px;
  width: 100%;
  height: 95%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.chat-header {
    background-color: #1890ff;
    color: white;
    padding: 10px;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.ai-disclaimer {
    font-size: 9px;
    color: #fff;
    margin-left: 10px;
}
.chat-messages {
  padding: 15px;
  overflow-y: auto;
  background-color: #fafafa;
  flex: 1;
  min-height: 100px;
}

.message {
    margin-bottom: 15px;
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 18px;
    line-height: 1.4;
    position: relative;
}

.user-message {
    background-color: #1890ff;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 5px;
}

.bot-message {
    background-color: #e6e6e6;
    color: #333;
    margin-right: auto;
    border-bottom-left-radius: 5px;
}

.bot-message a {
    color: #1890ff;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s;
}

.bot-message a:hover {
    color: #004499;
    text-decoration: underline;
}

.chat-input {
    display: flex;
    padding: 15px;
    border-top: 1px solid #eee;
    background-color: #fff;
}

#message-input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    font-size: 16px;
}

#analysisImage,
#send-button {
    margin-left: 10px;
    padding: 10px 20px;
    background-color: #48cfad;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 16px;
}

#analysisImage:hover,
#send-button:hover {
    background-color: #39b797;
}

#analysisImage:disabled,
#send-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.typing-indicator {
    display: none;
    color: #666;
    font-style: italic;
    margin-bottom: 15px;
}

.cancel-button {
    position: absolute;
    right: 10px;
    top: 5px;
    background: transparent;
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: #999;
}

.message-loading {
    opacity: 0.7;
}

/* Deep Analysis Button Style */
.btn-deep-analysis {
    transition: all 0.3s ease;
    padding: 8px 20px;
    font-size: 16px;
    border-radius: 30px;
    background-color: #48cfad;
    color: white;
    border: none;
    box-shadow: 0 2px 10px rgba(72, 207, 173, 0.3);
    cursor: pointer;
}

.btn-deep-analysis:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(72, 207, 173, 0.4);
    background-color: #39b797;
}

.btn-deep-analysis i {
    margin-right: 5px;
}

/* Preset Button Container Style */
.preset-buttons {
    display: flex;
    gap: 10px;
    padding: 5px;
    background-color: #f8f9fa;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
}

/* Preset Button Style */
.preset-buttons button {
    flex: 1;
    min-width: 200px;
    padding: 12px 15px;
    border: none;
    border-radius: 25px;
    background-color: #48cfad;
    color: white;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
}

/* Hover Effect for Buttons */
.preset-buttons button:hover {
    background-color: #39b797;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Active Effect for Buttons */
.preset-buttons button:active {
    transform: translateY(0);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .preset-buttons {
        flex-direction: column;
    }
    
    .preset-buttons button {
        width: 100%;
        min-width: auto;
    }

    .chat-container {
        max-width: 100%;
        margin-top: 5px;
        margin-bottom: 5px;
    }
    
    .chat-header {
        font-size: 16px;
        padding: 10px;
    }
    
    .chat-input {
        padding: 10px;
    }

    #message-input {
        font-size: 14px;
    }

    .message {
        max-width: 100%;
    }
}

/* For Small Screens (Mobile) */
@media (max-width: 600px) {
    .chat-header {
        font-size: 14px;
        padding: 10px;
    }

    .chat-input {
        padding: 8px;
    }

    #message-input {
        font-size: 14px;
        padding: 8px;
    }

    .preset-buttons button {
        width: 100%;
        min-width: auto;
        font-size: 14px;
    }

    .message {
        padding: 8px 12px;
    }
    
    /* Make Buttons Full Width on Small Screens */
    #analysisImage,
    #send-button {
        width: 100%;
        padding: 12px;
    }

    /* Adjust chat container for mobile */
    .chat-container {
        max-width: 100%;
        padding: 5px;
        margin-top: 5px;
    }

    .typing-indicator {
        font-size: 14px;
        margin-bottom: 10px;
    }

    .cancel-button {
        font-size: 14px;
    }
}

/* New Header Button Style */
#interpret-btn {
    font-size: 14px;
    padding: 6px 15px;
    border-radius: 15px;
    background: #48cfad;
    color: white;
    border: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#interpret-btn:hover {
    background: #39b797;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Keyframe for Loading Animation */
@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

/* Disabled Button Style */
button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}
.onto-link {
    color: #1890ff;
    text-decoration: underline;
    cursor: pointer;
}
.onto-link:hover {
    opacity: 0.8;
}
/* 角色选择下拉菜单样式 */
#role-selector {
  background: #fff;
  border: 1px solid #d1e5ff;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  margin-left: auto;
  margin-right: 10px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M10.29 5.29L7.78 2.78l-2.51 2.51 2.51 2.51 2.51-2.51z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  transition: all 0.2s ease;
}

.slim-select {
  /* 尺寸更小 */
  padding: 4px 8px;
  font-size: 13px;
  line-height: 1.2;

  /* 边框更细、颜色更淡 */
  border: 1px solid #ccc;
  border-radius: 4px;

  /* 背景干净，无多余装饰 */
  background-color: #fff;

  /* 去除默认聚焦轮廓（可选，或自定义） */
  outline: none;

  /* 鼠标悬停效果（可选） */
  transition: border-color 0.2s;
}

.slim-select:hover {
  border-color: #999;
}

.slim-select:focus {
  border-color: #66b3ff;
  box-shadow: 0 0 0 2px rgba(102, 179, 255, 0.2);
}
/* 引用标记样式 */  
.ref-badge {  
    cursor: pointer;  
    color: #1890ff;  
    font-size: 0.8em;  
    vertical-align: super;  
}  
  
.ref-badge.ref-popup {  
    background: #e6f7ff;  
    padding: 0 4px;  
    border-radius: 3px;  
}  
  
.ref-badge.ref-popup:hover {  
    background: #bae7ff;  
}  
  
/* 详情弹窗样式 */  
.source-detail-modal {  
    position: fixed;  
    top: 0;  
    left: 0;  
    width: 100%;  
    height: 100%;  
    z-index: 1000;  
    display: flex;  
    align-items: center;  
    justify-content: center;  
}  
  
.source-detail-overlay {  
    position: absolute;  
    top: 0;  
    left: 0;  
    width: 100%;  
    height: 100%;  
    background: rgba(0, 0, 0, 0.5);  
}  
  
.source-detail-content {  
    position: relative;  
    background: white;  
    border-radius: 8px;  
    max-width: 700px;  
    max-height: 80vh;  
    overflow-y: auto;  
    padding: 20px;  
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);  
}  
  
.source-detail-header {  
    display: flex;  
    align-items: center;  
    gap: 10px;  
    border-bottom: 1px solid #eee;  
    padding-bottom: 10px;  
    margin-bottom: 15px;  
}  
  
.source-detail-header h3 {  
    flex: 1;  
    margin: 0;  
}  
  
.source-type-badge {  
    background: #f0f0f0;  
    padding: 2px 8px;  
    border-radius: 4px;  
    font-size: 0.85em;  
}  
  
.close-btn {  
    background: none;  
    border: none;  
    font-size: 24px;  
    cursor: pointer;  
    color: #999;  
}  
  
.close-btn:hover {  
    color: #333;  
}  
  
/* 图片展示 */  
.source-images {  
    margin-top: 15px;  
}  
  
.source-images h4 {  
    margin-bottom: 10px;  
}  
  
.source-image {  
    max-width: 200px;  
    max-height: 150px;  
    margin: 5px;  
    cursor: pointer;  
    border-radius: 4px;  
    border: 1px solid #ddd;  
    transition: transform 0.2s;  
}  
  
.source-image:hover {  
    transform: scale(1.05);  
}  
  
/* 来源面板中的图片指示器 */  
.image-indicator {  
    margin-left: 5px;  
}  
/* 参考资料面板 */  
.sources-panel {  
    margin-top: 15px;  
    padding: 10px;  
    background: #f9f9f9;  
    border-radius: 8px;  
    border: 1px solid #e8e8e8;  
}  
  
.sources-section {  
    margin-bottom: 10px;  
}  
  
.sources-section:last-child {  
    margin-bottom: 0;  
}  
  
.sources-title {  
    font-weight: bold;  
    color: #333;  
    margin-bottom: 8px;  
    padding-bottom: 5px;  
    border-bottom: 1px solid #ddd;  
}  
  
.source-item {  
    padding: 8px 0;  
    border-bottom: 1px dashed #eee;  
    display: flex;  
    align-items: flex-start;  
    gap: 8px;  
    flex-wrap: wrap;  
}  
  
.source-item:last-child {  
    border-bottom: none;  
}  
  
.source-index {  
    color: #1890ff;  
    font-weight: bold;  
    white-space: nowrap;  
}  
  
.source-item a {  
    color: #1890ff;  
    text-decoration: none;  
    font-weight: 500;  
}  
  
.source-item a:hover {  
    text-decoration: underline;  
}  
  
.source-snippet {  
    color: #666;  
    font-size: 0.9em;  
    width: 100%;  
    margin-top: 4px;  
    display: -webkit-box;  
    -webkit-line-clamp: 2;  
    -webkit-box-orient: vertical;  
    overflow: hidden;  
}  
  
.image-indicator {  
    cursor: pointer;  
}  
  
/* book 类型特殊样式 */  
.source-book {  
    background: #fffbe6;  
    padding: 8px;  
    border-radius: 4px;  
    margin-bottom: 5px;  
}  
  
/* database 类型样式（如果需要显示） */  
.source-database {  
    background: #e6f7ff;  
    padding: 8px;  
    border-radius: 4px;  
    margin-bottom: 5px;  
}  
