/* 按钮样式 - 使用CSS变量简化 */
.btn {
    --bg-color: #f5f5f7;
    --border-color: #d2d2d7;
    --text-color: #333;
    --hover-bg: #e0e0e6;
    --hover-border: #c6c6cc;
    --active-bg: #d6d6dd;
    
    display: inline-block;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    text-align: center;
    transition: all 0.2s ease;
    text-decoration: none;
    font-weight: normal;
    line-height: 0.8;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.btn--primary {
    --bg-color: var(--color-primary);
    --border-color: var(--color-primary);
    --text-color: white;
    --hover-bg: #0062c4;
    --hover-border: #0062c4;
    --active-bg: #0054a8;
}

.btn--outline {
    --bg-color: transparent;
    --border-color: var(--color-primary);
    --text-color: var(--color-primary);
    --hover-bg: rgba(0, 113, 227, 0.08);
    --hover-border: #0062c4;
    --active-bg: rgba(0, 113, 227, 0.16);
}

.btn--danger {
    --bg-color: var(--color-danger);
    --border-color: var(--color-danger);
    --text-color: white;
    --hover-bg: #ff2d20;
    --hover-border: #ff2d20;
    --active-bg: #e63020;
}

.btn--success {
    --bg-color: var(--color-success);
    --border-color: var(--color-success);
    --text-color: white;
    --hover-bg: #219653;
    --hover-border: #219653;
    --active-bg: #1e8449;
}

.btn--warning {
    --bg-color: var(--color-warning);
    --border-color: var(--color-warning);
    --text-color: white;
    --hover-bg: #e67e22;
    --hover-border: #e67e22;
    --active-bg: #d35400;
}

.btn--lg {
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
    border-radius: 8px;
}

.btn--sm {
    margin-top: 0.5rem;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 4px;
    gap: 0.5rem;
}

.btn--xs {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    border-radius: 4px;
}

.btn:hover {
    background-color: var(--hover-bg);
    border-color: var(--hover-border);
}

.btn:active {
    background-color: var(--active-bg);
    transform: scale(0.98);
}

/* 工具栏按钮 - 使用标准按钮样式 */
.btn--toolbar {
    padding: 0.3rem 0.6rem;
    border: 1px solid #d2d2d7;
    border-radius: 5px;
    background-color: #f5f5f7;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
    font-weight: normal;
}

.btn--toolbar:hover {
    background-color: #e0e0e6;
    border-color: #c6c6cc;
}

.form-group {
    margin-bottom: 1rem;
}

.form-control {
    width: 100%;
    padding: 1rem 1.2rem;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-color: #fafbfc;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
    background-color: #ffffff;
}

/* 确保搜索框和下拉列表具有相同的高度和字体大小 */
#categoryFilter.form-control,
#searchInput.form-control {
    height: calc(2rem + 2px + 2px); 
    box-sizing: border-box;
    font-size: 1rem;
    line-height: 1.5;
    vertical-align: middle;
    width: 70%;
    max-width: 600px; /* 符合用户偏好设置 */
    min-width: auto; /* 确保在小屏幕上最小宽度 */
    padding: 0.5rem 1.2rem;  
}

/* 平板端优化 */
@media (max-width: 1023px) and (min-width: 768px) {
    #categoryFilter.form-control,
    #searchInput.form-control {
        max-width: none; /* 移除最大宽度限制 */
        min-width: auto;  /* 移除最小宽度限制 */
    }
}

/* 手机端优化 - 保持原有设置以确保兼容性 */
@media (max-width: 767px) {
    #categoryFilter.form-control,
    #searchInput.form-control {
        max-width: none; /* 移除最大宽度限制 */
        min-width: auto;  /* 移除最小宽度限制 */
    }
    
    .form-control {
        padding: 0.8rem 1rem;
        font-size: 0.95rem;
    }
    
    .btn {
        padding: 0.4rem 0.7rem;
        font-size: 0.9rem;
    }
    
    .btn--sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.9rem;
    }
}

/* 移动端适配 - 组件在极小屏幕上的优化 */
@media (max-width: 480px) {
    .form-control {
        padding: 0.7rem 0.9rem;
        font-size: 0.9rem;
    }
    
    .btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .btn--sm {
        padding: 0.2rem 0.4rem;
        font-size: 0.85rem;
    }
    
    .btn--xs {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }
    
    #categoryFilter.form-control,
    #searchInput.form-control {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
}

/* 统一搜索栏样式 */
.unified-search-bar {
    display: flex;
    align-items: center;
}

.form-actions {
    text-align: right;
    margin-top: 2rem; 
}

#editMessageContent {
    width: 100%;
    min-height: 180px; 
    padding: 1rem 1.2rem; 
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    font-size: 1.1rem; 
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-color: #fafbfc;
}

#editMessageContent:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
    background-color: #ffffff;
}

.ck-editor__editable {
    min-height: 350px;
    max-width: 100%;
    min-width: 600px;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    padding: 1rem 1.2rem;
    background-color: #fafbfc;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-size: 1rem;
}

.ck-editor__editable:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
    background-color: #ffffff;
}

.ck-editor__editable img {
    max-width: 70%;
    width: auto;
    height: auto;
    
    display: block;
    margin: 1rem auto;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ck-toolbar {
    border: 1px solid #e1e4e8;
    border-radius: 8px 8px 0 0;
    border-bottom: 0;
    
    max-width: 100%;
    min-width: 600px;
    background-color: #f5f5f7;
}

#replyEditor .ck-editor__editable {
    min-height: 250px;
    max-width: 100%;
    min-width: 600px;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    padding: 1rem 1.2rem;
    background-color: #fafbfc;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-size: 1rem;
}

#replyEditor .ck-editor__editable:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
    background-color: #ffffff;
}

#replyEditor .ck-editor__editable img {
    max-width: 70%;
    width: auto;
    height: auto;
    
    display: block;
    margin: 1rem auto;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#replyEditor .ck-toolbar {
    border: 1px solid #e1e4e8;
    border-radius: 8px 8px 0 0;
    border-bottom: 0;
    
    max-width: 100%;
    min-width: 600px;
    background-color: #f5f5f7;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    /* 添加以下样式确保模态框始终正确居中 */
    overflow: auto;
}

/* 添加特定的登录模态框样式以确保一致性 */
#loginModal {
    align-items: center;
    justify-content: center;
}

/* 确保关于模态框居中 */
#aboutModal {
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-container {
    background-color: #ffffff;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow-lg);
    width: 100%;
    max-width: 650px;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
    position: relative;
    z-index: 1001;
    margin: auto;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #f1f2f3;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: normal;
    color: var(--color-dark);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--color-secondary);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

/* 模态框关闭按钮悬停效果 */
.modal-close:hover {
    background-color: #e74c3c !important;
    color: white !important;
    transform: rotate(180deg) scale(1.1) !important;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3) !important;
    transition: all 0.3s ease-in-out !important;
}

.modal-close-btn {
    margin-left: 10px;
}

/* 关于模态框特定样式 - 更大的宽度 */
#aboutModal .modal-container {
    max-width: 800px;
    margin: 50px auto 0 auto;
}

.modal-body {
    padding: 1.5rem;
}

.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.image-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: -1;
}

.image-modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.image-modal-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.image-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    color: #fff;
    font-size: 2rem;
    font-weight: normal;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
    z-index: 1002;
}

.image-modal-close:hover {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
}

.pagination-container {
    margin: 1rem 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.8rem;
    justify-content: center;
    flex-wrap: wrap;
}

.pagination-info {
    color: var(--color-secondary);
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    gap: 0.3rem; 
    flex-wrap: wrap;
    justify-content: center;
}

.pagination-btn {
    min-width: 30px; 
    padding: 0.3rem 0.6rem; 
    font-size: 0.8rem; 
}

.pagination-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

/* 消息提示样式 */
.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    animation: slideIn 0.3s ease, fadeOut 0.5s ease 2.5s forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.message-info {
    background-color: var(--color-info);
}

.message-success {
    background-color: var(--color-success);
}

.message-error {
    background-color: var(--color-danger);
}

.message-warning {
    background-color: var(--color-warning);
}

/* 表单注释样式 */
.form-note {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--color-secondary);
    text-align: right;
}

/* 验证码图片样式 */
.captcha-img {
    height: 38px;
    cursor: pointer;
}

/* 结果消息框样式 */
.result-message {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
}

/* 图片文件名显示样式 */
.image-filename {
    font-size: 0.8em;
    color: #666;
    margin-top: 5px;
    margin-bottom: 15px;
    font-family: monospace;
    padding: 2px 4px;
    background-color: #f5f5f5;
    border-radius: 3px;
    display: inline-block;
}

/* 附件上传区域样式 */
.attachment-section {
    margin: 1rem 0;
}

/* 主题详情页面附件显示区域样式 */
#topicDetailAttachments {
    margin: 1.5rem 0;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

#topicDetailAttachments h4 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.1rem;
}

/* 附件卡片容器 */
.attachment-cards-container {
    margin-top: 1rem;
}

/* 附件卡片网格布局 */
.attachment-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

/* 单个附件卡片样式 */
.attachment-card {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.attachment-card:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* 附件卡片头部 */
.attachment-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

/* 附件文件名 */
.attachment-card-name {
    font-weight: 500;
    color: #0071e3;
    text-decoration: none;
    flex: 1;
    margin-right: 0.5rem;
    word-break: break-all;
}

.attachment-card-name:hover {
    text-decoration: underline;
}

/* 附件删除按钮 */
.attachment-card-delete {
    background: none;
    border: none;
    color: #ff3b30;
    font-size: 1.2rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

/* 附件删除按钮悬停效果 - 参考模态框关闭按钮样式 */
.attachment-card-delete:hover {
    background-color: #e74c3c !important;
    color: white !important;
    transform: rotate(180deg) scale(1.1) !important;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3) !important;
    transition: all 0.3s ease-in-out !important;
}

/* 附件信息 */
.attachment-card-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #6c757d;
}

.attachment-card-size {
    font-weight: 500;
}

.attachment-card-date {
    color: #495057;
}

/* 无附件时的提示 */
.no-attachments {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 2rem;
    grid-column: 1 / -1;
}

.topic-attachment-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.topic-attachment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.topic-attachment-info {
    flex: 1;
}

.topic-attachment-meta {
    font-size: 0.85rem;
    color: #6c757d;
}

.topic-attachment-size {
    margin-right: 0.5rem;
}

.attachment-upload-area {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.attachment-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}



.attachment-list {
    margin-top: 1rem;
}

.attachment-item {
    padding: 0.5rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.attachment-info {
    display: flex;
    flex-direction: column;
}

.attachment-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.attachment-name {
    font-size: 0.9rem;
    color: #333;
    flex: 1;
    word-break: break-all;
    padding-right: 1rem;
}

.attachment-meta {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.delete-attachment-btn {
    background: none;
    border: none;
    color: #ff3b30;
    font-size: 1.2rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.delete-attachment-btn:hover {
    background-color: rgba(255, 59, 48, 0.1);
}

/* 移动端适配 - 附件卡片在小屏幕上的优化 */
@media (max-width: 768px) {
    /* 附件卡片网格在移动端调整为单列布局 */
    .attachment-cards-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    /* 附件卡片在移动端的内边距调整 */
    .attachment-card {
        padding: 0.75rem;
    }
    
    /* 附件卡片头部在移动端调整 */
    .attachment-card-header {
        margin-bottom: 0.5rem;
    }
    
    /* 附件文件名在移动端的字体大小调整 */
    .attachment-card-name {
        font-size: 0.9rem;
    }
    
    /* 附件信息在移动端的字体大小调整 */
    .attachment-card-info {
        font-size: 0.8rem;
    }
    
    /* 删除按钮在移动端稍大一些以便点击 */
.attachment-card-delete {
    width: 36px;
    height: 36px;
    font-size: 1.3rem;
}

/* 移动端附件删除按钮悬停效果 - 参考模态框关闭按钮样式 */
.attachment-card-delete:hover {
    background-color: #e74c3c !important;
    color: white !important;
    transform: rotate(180deg) scale(1.1) !important;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3) !important;
    transition: all 0.3s ease-in-out !important;
}
}

/* CKEditor中图片文件名的特殊样式 */
.ck-editor__editable .image-filename {
    font-size: 0.75em;
    color: #888;
    margin-top: 4px;
    margin-bottom: 10px;
    background-color: #f8f8f8;
    border: 1px dashed #ddd;
    border-radius: 4px;
    padding: 3px 6px;
}

/* 移动端适配 - 模态框在小屏幕上的优化 */
@media (max-width: 768px) {
    .modal-container {
        max-width: 95%;
        margin: 20px auto;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-header h2 {
        font-size: 1.1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-close {
        font-size: 1.5rem;
        width: 25px;
        height: 25px;
    }
    
    /* 编辑器在平板上的优化 */
    .ck-editor__editable {
        min-height: 300px;
        min-width: auto;
        padding: 0.8rem 1rem;
        font-size: 0.95rem;
    }
    
    .ck-toolbar {
        min-width: auto;
    }
    
    #replyEditor .ck-editor__editable {
        min-height: 200px;
        min-width: auto;
        padding: 0.8rem 1rem;
        font-size: 0.95rem;
    }
    
    #replyEditor .ck-toolbar {
        min-width: auto;
    }
}

/* 移动端适配 - 模态框在极小屏幕上的优化 */
@media (max-width: 480px) {
    .modal-container {
        max-width: 98%;
        margin: 10px auto;
        border-radius: 8px;
    }
    
    .modal-header {
        padding: 0.8rem;
    }
    
    .modal-header h2 {
        font-size: 1rem;
    }
    
    .modal-body {
        padding: 0.8rem;
    }
    
    .modal-close {
        font-size: 1.3rem;
        width: 22px;
        height: 22px;
    }
    
    /* 分页控件在极小屏幕上的优化 */
    .pagination-container {
        margin: 0.8rem 0;
        gap: 0.5rem;
    }
    
    .pagination-btn {
        min-width: 25px;
        padding: 0.2rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .pagination-info {
        font-size: 0.8rem;
    }
    
    /* 编辑器在极小屏幕上的优化 */
    .ck-editor__editable {
        min-height: 250px;
        min-width: auto;
        padding: 0.7rem 0.9rem;
        font-size: 0.9rem;
    }
    
    .ck-toolbar {
        min-width: auto;
        overflow-x: auto;
    }
    
    #replyEditor .ck-editor__editable {
        min-height: 180px;
        min-width: auto;
        padding: 0.7rem 0.9rem;
        font-size: 0.9rem;
    }
    
    #replyEditor .ck-toolbar {
        min-width: auto;
        overflow-x: auto;
    }
    
    /* 表单在极小屏幕上的优化 */
    .form-actions {
        margin-top: 1.5rem;
    }
    
    .form-note {
        font-size: 0.8rem;
        margin-top: 0.3rem;
    }
    
    /* 附件卡片在极小屏幕上的进一步优化 */
    .attachment-cards-grid {
        gap: 0.5rem;
    }
    
    .attachment-card {
        padding: 0.6rem;
    }
    
    .attachment-card-name {
        font-size: 0.85rem;
    }
    
    .attachment-card-info {
        font-size: 0.75rem;
    }
    
    /* 删除按钮在极小屏幕上进一步优化 */
.attachment-card-delete {
    width: 32px;
    height: 32px;
    font-size: 1.2rem;
}

/* 极小屏幕附件删除按钮悬停效果 - 参考模态框关闭按钮样式 */
.attachment-card-delete:hover {
    background-color: #e74c3c !important;
    color: white !important;
    transform: rotate(180deg) scale(1.1) !important;
    box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3) !important;
    transition: all 0.3s ease-in-out !important;
}
}