/*以下都是覆盖原有的css*/
html, body, .pywebio, .container, #output-container {
    height: 100%;          /* 确保 body 和 html 高度为 100% */
    margin: 0;             /* 移除默认 margin */
    padding: 0;            /* 移除默认 padding */
}

#pywebio-scope-ROOT, #output-container, #pywebio-scope-root_scope {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}

#pywebio-scope-root_scope {
    display: flex;
    flex-direction: column;
    background-color: #f0f0f0;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

#pywebio-scope-header_contents {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #f0f0f0;
    box-shadow: 0 1px 10px #dee2e6;
    padding: 0 1.2rem;
    z-index: 100;
    transform: translateZ(0); /* 关键 */
}

#pywebio-scope-conversations-container, #pywebio-scope-collection-container {
    flex: 1;
    overflow: auto;
}

#pywebio-scope-conversations, #pywebio-scope-collection {
    margin: 4rem auto 1rem auto;
    padding: 1rem 1rem 0.5rem 1rem;
    max-width: 1000px;
}
#pywebio-scope-conversations {
    margin: 4rem auto 5rem auto
}

#pywebio-scope-inputs {
    position: fixed;
    bottom: 0;
    left: 0;                 /* 左侧对齐（可选） */
    right: 0;                /* 右侧对齐（可选） */
    width: 100%;
    margin: 0 auto;
    max-width: 1000px;
    border-radius: 1rem 1rem 0 0;
    background-color: #f0f0f0;
    box-shadow: 0 -1px 10px #dee2e6;
    z-index: 100;
    padding: 10px 15px 5px 15px;
    transform: translateZ(0); /* 关键 */
}

#input-container {
    display: none;
}

button {
    margin-bottom: 0 !important;
}

.btn-group-sm>.btn, .btn-sm {
    padding: 0.25em;
    /*border-radius: 1rem;*/
}

.btn-outline-dark {
    border: none;
}

.form-group {
    margin: 0.2rem 0;
    padding-top: 4px;
}

.markdown-body dl, .markdown-body ol, .markdown-body p, .markdown-body pre, .markdown-body table, .markdown-body ul, .markdown-body details {
    margin-bottom: 0.15rem;
    margin-top: 0.15rem;
}

.markdown-body p, .markdown-body pre, .markdown-body table, .markdown-body details {
    text-align: justify;
}

.markdown-body dl, .markdown-body ol, .markdown-body ul, .markdown-body li{
    text-align: left;
}

.markdown-body blockquote {
    margin: 0;
    padding: 0.2rem 0.75rem;
}

.markdown-body h1,.markdown-body h2,.markdown-body h3,.markdown-body h4,.markdown-body h5,.markdown-body h6 {
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
    line-height: 1.5
}

.markdown-body h1 {
    font-size: 1.5em
}

.markdown-body h2 {
    font-size: 1.35em
}

.markdown-body h3 {
    font-size: 1.1em
}

.markdown-body h4, .markdown-body h5, .markdown-body h6 {
    font-size: 1em
}

.markdown-body hr {
    height: 2px;
    padding: 0;
    margin: 0.75rem 0;
    background-color: #eaecef;
    border: 0;
}

.markdown-body {
    font-family: PingFang SC, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Ubuntu, Helvetica Neue, Helvetica, Arial, Hiragino Sans GB, Microsoft YaHei UI, Microsoft YaHei, Source Han Sans CN, sans-serif;;
    font-size: 14px;
    word-wrap: break-word;
    line-height: 1.5rem;
}

.markdown-body li>p {
    margin-top: 0.2rem;
}

/*中间的聊天最大宽度为960px*/
#pywebio-scope-conversations {
  max-width: 960px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* ``文本的颜色改为绿色 */
code {
    font-weight: 600;
    color: #32b171;
}
.markdown-body code {
    background-color: rgba(0, 0, 0, 0);
}

/*输入框自动调整高度*/
textarea {
    resize: none;        /* 禁用手动调整 */
    overflow: hidden;    /* 隐藏滚动条 */
    transition: height 0.2s ease-out; /* 平滑过渡效果（可选） */
}

#pywebio-scope-inputs textarea {
    line-height: 2;
}

.form-control {
    border: none
}

/*以下是新增的css设定*/
#pywebio-scope-header_contents > div {
    margin: 0;
    padding: 0 ;
    text-align: center;
}

.avatar {
    padding: 2px;
    margin: 0;
    background-color: transparent;
}

.avatar > img {
    background-color: transparent;
    box-shadow: 0 1px 4px #dee2e6;
    margin-top: 2px;
}

.avatar > img, .avatar-choice {
    width: 2rem;
    height: 2rem;
    display: flex;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    /*border: 1px solid rgba(125, 216, 170, 0.2);*/
    border: 1px solid transparent;
}

/*!*设置按钮*!*/
/*#pywebio-scope-setting button {*/
/*    border: none;*/
/*    margin-top: -3px;*/
/*    padding: 3px 10px;*/
/*}*/

/*#pywebio-scope-setting button:hover {*/
/*    background-color: rgba(0, 0, 0, 10%);*/
/*}*/

.button-hidden {
    display: flex;
    align-items: center; /* 垂直居中 */
    justify-content: center;
    border-radius: 0.2rem;
    background-color: transparent;
    border: none;
    margin: auto 0;
    padding: 0.3rem;
    height: 1.5rem;
    line-height: 1rem;
}

#pywebio-scope-hidden_button {
    display: none;
}

.button-hidden:hover {
    cursor: pointer;
    box-shadow: 0 0 5px #dee2e6;
}

.button-hidden > img {
    width: 0.9rem;
    max-width: none;
    margin: auto;
    background-color: transparent;
}

/*发送按钮点击后变成loading状态*/
#send-button > img {
    width: 1.6rem;
    margin: auto;
}

#send-button.loading {
    pointer-events: none; /* 禁用交互 */
}

.loading-spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 4px solid #32b171;
    border-left: 4px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/*欢迎文字部分*/
.chat-container {
    text-align: center;
    margin: 3rem auto 0 auto;
    padding: 0 1.5rem;
    background-color: transparent;
    color: #2b6451;
    max-width: 784px;
}

.welcome-message p {
    margin: 0;
    padding: 5px 0;
}

.large-green {
    font-size: 2.5rem; /* 大字体 */
    font-weight: 600;
    line-height: 1.2;
}

.small-gray {
    font-size: 1rem; /* 小字体 */
    line-height: 1.5;
}

.dashed-line::after {
    content: '';
    display: block;
    width: 100%;
    border-top: 1px dashed #2b6451; /* 虚线颜色 */
    margin: 10px 0; /* 虚线上下间距 */
}

/*思考内容折叠*/
details[open]>summary {
    border-bottom: none;
    margin-bottom: 0;
}

details[open] {
    padding: 0;
}

details {
    border: none;
    padding: 0;
}

summary {
    margin: -.5em -.5em 0;
    padding: .5em;
    background-color: transparent;
}

/* 按钮 */
.answer-actions > div {
    cursor: pointer;
    display: inline-block;
    height: 1.3rem;
    width: 1.3rem;
    margin: 0.25rem 0 0.25rem 0.5rem;
    border-radius: .25rem;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100% 100%;
    transition: background 0.3s ease;
    border: 1px solid transparent;
}
.answer-actions > div:hover {
    border: 0 solid transparent;
}
.answer-actions > .action-copy {
    background-image: url("/static/icons/copy.svg");
}
.answer-actions > .action-regenerate {
    background-image: url("/static/icons/regenerate.svg");
}
.answer-actions > .action-collect {
    background-image: url("/static/icons/collect.svg");
}
.answer-actions > .action-collect.action-on {
    background-image: url("/static/icons/collected.svg");
}
.answer-actions > .action-downvote {
    background-image: url("/static/icons/downvote.svg");
}
.answer-actions > .action-downvote.action-on {
    background-image: url("/static/icons/downvoted.svg");
}

/* 顶部菜单 */
#all-menus {
    display: flex;
    flex-direction: row;
    gap: 5px;
}
#all-menus img {
    animation-name: none;
}
#all-menus.on-chat > #chat-button {
    display: none;
}
#all-menus.on-chat > #new-chat-button,
#all-menus.on-chat > #collections-button {
    display: flex;
}

#all-menus > #new-chat-button,
#all-menus > #collections-button {
    display: none;
}
#all-menus > #chat-button {
    display: flex;
}

/* 用户菜单 */
/* 菜单容器 */
.menu-items {
    line-height: 2rem;
    display: none;
    position: absolute;
    top: 3rem;
    right: 1.5rem;
    background: white;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 5rem;
    z-index: 999;
    overflow: hidden;
}
/* 菜单项样式 */
.menu-item {
    padding: 0.2rem 0.6rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: 6px 6px 0 0;
    border-bottom: 1px solid #e9ecef;
}
.menu-items > .menu-item:last-child {
    border-bottom: none;
    border-radius: 0 0 6px 6px;
}
.menu-item:hover {
    background: #f8f9fa;
}
/* 图标样式 */
.menu-icon {
    width: 1rem;
    height:1rem;
    animation-name: none;
}
.menu-items > #login-button {
    display: none;
}
.menu-items.on-anonymous > #logout-button,
.menu-items.on-anonymous > #setting-button{
    display: none;
}
.menu-items.on-anonymous > #login-button {
    display: flex;
}


/* 收藏页面 */
#pywebio-scope-collection-container {
    display: none;
}
/* 基础卡片样式 */
.collection-item {
    cursor: pointer;
    background: #fff;
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 12px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s; /* 鼠标悬停效果 */
}
.collection-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
/* 内容区域：三行省略 */
.collection-item-content {
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
    display: -webkit-box;
    max-height: 4.5rem;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}
/* 底部区域：左右布局 */
.collection-item-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
/* 问题标题：左侧省略 */
.collection-item-question {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%; /* 根据需求调整比例 */
}
/* 时间戳：右侧对齐 */
.collection-item-timestamp {
    font-size: 0.9rem;
    color: #666;
    white-space: nowrap;
}
/* 整体间距优化 */
.collection-item + .collection-item {
    margin-top: 1rem; /* 相邻卡片间距 */
}
#pywebio-scope-collection-pagination button {
    background: none;
    border: none;
    color: #576B95;
}
#pywebio-scope-collection-pagination button:hover {
    background: transparent;
}