/* 文章编辑器专用样式 */

/* ==================== 消息区域 ==================== */
/* 默认消息区域（文章列表等） */
.message-area {
    margin: 16px 0;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    display: none;
}

.message-area.show {
    display: block;
}

/* 编辑器专用消息提示 - 悬浮居中显示，3秒后自动消失 */
#editorMessageArea {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 99999;
    padding: 20px 40px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
    min-width: 280px;
    max-width: 480px;
    text-align: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

#editorMessageArea.show {
    visibility: visible;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.03);
}

.message-area.success,
#editorMessageArea.success {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border-left: 4px solid #10b981;
    color: #065f46;
}

.message-area.error,
#editorMessageArea.error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-left: 4px solid #ef4444;
    color: #991b1b;
}

.message-area.info,
#editorMessageArea.info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-left: 4px solid #3b82f6;
    color: #1e40af;
}

/* ==================== 图片插入对话框 ==================== */
.image-insert-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-light);
    position: relative;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.image-tab-content {
    display: none;
}

.image-tab-content.active {
    display: block;
}

/* ==================== 链接配置样式 ==================== */
.links-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.link-item-row {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px;
    background: #f9f9f9;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.link-item-row input {
    flex: 1;
}

.link-item-row .remove-link-btn {
    padding: 6px 12px;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.link-item-row .remove-link-btn:hover {
    background: #fecaca;
}

/* ==================== 背景设置样式 ==================== */
.background-settings {
    padding: 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

/* 背景颜色行 - 颜色选择器和删除按钮并排 */
.bg-color-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* 删除底色按钮 */
.clear-bg-color-btn {
    padding: 0 16px;
    height: 48px;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.3s ease;
}

.clear-bg-color-btn:hover {
    background: #fecaca;
    border-color: #f87171;
}

/* 已清除状态 */
.clear-bg-color-btn.cleared {
    background: #d1fae5;
    color: #065f46;
    border-color: #6ee7b7;
}

.clear-bg-color-btn.cleared:hover {
    background: #a7f3d0;
    border-color: #34d399;
}

/* 背景设置中的输入框加大 */
.background-settings input[type="url"],
.background-settings input[type="color"],
.background-settings select {
    height: 48px !important;
    font-size: 16px !important;
    padding: 8px 12px !important;
}

.background-settings .form-row {
    margin-bottom: 12px;
}

.background-settings .form-row:last-child {
    margin-bottom: 0;
}

/* ==================== 编辑器样式 ==================== */

/* WangEditor 编辑器容器 - 背景图设置 */
#editor-container {
    /* 背景图设置 - 取消注释并修改图片路径即可 */
    /* background-image: url('../images/your-background.jpg'); */
    /* background-size: cover; */
    /* background-position: center; */
    /* background-repeat: no-repeat; */
    /* background-attachment: fixed; */
    
    /* 如果要设置背景色 */
    /* background-color: #f5f5f5; */
}

/* WangEditor 编辑区域背景（文字输入区域） */
.w-e-text-container {
    /* 如果需要编辑区域也有背景，可以设置 */
    /* background-color: rgba(255, 255, 255, 0.9); */
}

.message-area.info,
#editorMessageArea.info {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-left: 4px solid #3b82f6;
    color: #1e40af;
}

/* ==================== 筛选器栏 ==================== */
.filter-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.filter-bar select {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background-color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-bar select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

/* ==================== 文章列表容器 ==================== */
.article-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

/* ==================== 文章卡片 ==================== */
.article-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.article-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-gradient);
    transform: scaleX(0);
    transition: transform 0.3s ease;
    transform-origin: left;
}

.article-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
    border-color: rgba(102, 126, 234, 0.2);
}

/* 隐藏文章样式 */
.article-card-hidden {
    opacity: 0.7;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.article-card-hidden::before {
    background: linear-gradient(90deg, #94a3b8 0%, #cbd5e1 100%);
}

.article-status-badge {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
    margin-left: 8px;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

.article-card:hover::before {
    transform: scaleX(1);
}

.article-card-header {
    margin-bottom: 12px;
}

.article-card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 8px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.article-card-id-info {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
    font-size: 11px;
}

.id-info-tag {
    display: inline-block;
    padding: 2px 8px;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 6px;
    font-family: monospace;
    font-size: 11px;
    user-select: all;
}

.article-card-category {
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: #1e40af;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.article-card-author {
    color: var(--primary-color);
    font-weight: 500;
}

.article-card-time {
    color: var(--text-light);
    margin-left: auto;
}

.article-card-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    grid-column: 1 / -1;
}

.article-card-empty .icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* ==================== 编辑器卡片 ==================== */
.editor-card {
    max-width: 1200px;
    margin: 0 auto;
}

.editor-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.editor-header h2 {
    flex: 1;
    margin: 0;
}

/* ==================== Quill 编辑器自定义样式 ==================== */
#quillEditor {
    background: white;
    border-radius: var(--radius-sm);
}

.ql-toolbar.ql-snow {
    border: 2px solid var(--border-color);
    border-bottom: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
}

.ql-container.ql-snow {
    border: 2px solid var(--border-color);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
}

.ql-editor {
    min-height: 400px;
    padding: 20px;
    line-height: 1.8;
}

.ql-editor p {
    margin-bottom: 12px;
}

.ql-editor h1,
.ql-editor h2,
.ql-editor h3 {
    margin-top: 24px;
    margin-bottom: 12px;
}

.ql-editor img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    margin: 16px 0;
}

/* ==================== 表单操作按钮 ==================== */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid var(--border-color);
}

/* ==================== 模态框 ==================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-overlay.hidden {
    display: none;
}

/* 通用模态框内容样式 */
.modal-content:not(.login-modal) {
    background: white;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 2px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: var(--bg-color-solid);
    color: var(--text-color);
}

.modal-body {
    padding: 24px;
}

/* 大模态框 */
.modal-large {
    max-width: 900px;
    width: 90%;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 2px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ==================== 分类列表 ==================== */
.category-list {
    margin-top: 24px;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    transition: all 0.3s ease;
    background: white;
}

.category-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.category-item-info {
    flex: 1;
}

.category-item-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 4px;
}

.category-item-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

.category-item-actions {
    display: flex;
    gap: 8px;
}

.category-item-actions button {
    padding: 6px 12px;
    font-size: 13px;
}

/* ==================== 登录区域 ==================== */
.login-section {
    text-align: center;
    max-width: 500px;
    margin: 100px auto;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .article-list-container {
        grid-template-columns: 1fr;
    }
    
    .filter-bar {
        flex-direction: column;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .form-actions {
        flex-wrap: wrap;
    }
    
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .category-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .category-item-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* ==================== 加载动画 ==================== */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60% { content: '...'; }
    80%, 100% { content: ''; }
}

/* ==================== 精选文章管理 ==================== */
.modal-lg {
    max-width: 900px;
}

.featured-section {
    margin-bottom: 32px;
}

.featured-section h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: var(--text-color);
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

/* 可选文章列表 */
.article-select-list {
    display: grid;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.available-article-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: white;
    transition: all 0.3s ease;
}

.available-article-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.available-article-info {
    flex: 1;
}

.available-article-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 6px;
}

.available-article-meta {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* 精选文章列表 */
.featured-article-list {
    display: grid;
    gap: 12px;
    min-height: 100px;
}

.featured-article-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    cursor: move;
    transition: all 0.3s ease;
}

.featured-article-item:hover {
    border-color: #f59e0b;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.featured-article-item.dragging {
    opacity: 0.5;
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fde68a 0%, #fcd34d 100%);
}

.drag-handle {
    font-size: 20px;
    color: #92400e;
    cursor: grab;
    user-select: none;
    padding: 4px 8px;
}

.drag-handle:active {
    cursor: grabbing;
}

.featured-article-info {
    flex: 1;
}

.featured-article-title {
    font-size: 15px;
    font-weight: 600;
    color: #78350f;
    margin-bottom: 6px;
}

.featured-article-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}

.category-badge {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(255, 255, 255, 0.8);
    color: #92400e;
    font-size: 12px;
    font-weight: 500;
    border-radius: 12px;
}

.order-badge {
    display: inline-block;
    padding: 3px 10px;
    background: #f59e0b;
    color: white;
    font-size: 12px;
    font-weight: 600;
    border-radius: 12px;
}

.featured-article-summary {
    font-size: 13px;
    color: #92400e;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==================== 文章列表拖拽排序 ==================== */

/* 排序工具栏 */
.article-order-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-sm);
}

.article-order-toolbar .toolbar-hint {
    font-size: 13px;
    color: #1e40af;
    flex: 1;
}

.article-order-toolbar .order-status {
    font-size: 13px;
    font-weight: 500;
    min-width: 80px;
}

/* 可拖拽的文章卡片 */
.draggable-card {
    display: flex;
    align-items: stretch;
    cursor: default;
}

.draggable-card .article-card-body {
    flex: 1;
    cursor: pointer;
}

.draggable-card.card-dragging {
    opacity: 0.5;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
}

/* 卡片拖拽手柄 */
.drag-handle-card {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    min-width: 40px;
    font-size: 20px;
    color: #9ca3af;
    cursor: grab;
    user-select: none;
    background: #f9fafb;
    border-right: 1px solid #e5e7eb;
    border-radius: var(--radius) 0 0 var(--radius);
    transition: all 0.2s ease;
}

.drag-handle-card:hover {
    color: var(--primary-color);
    background: #eff6ff;
}

.drag-handle-card:active {
    cursor: grabbing;
}

/* 序号标签 */
.order-badge-sm {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
    background: #f3f4f6;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 8px;
}
