/* 附件管理样式 - v3.2 更新：修复夜间模式样式优先级问题 */
.attachments-container {
    /* margin-top: 1.5rem; */
}

.attachments-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    background: var(--bg-primary) !important;
    overflow: hidden;
}

/* 附件项 */
.attachment-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
    cursor: default;
}

.attachment-item:last-child {
    border-bottom: none;
}

.attachment-item:hover {
    background: var(--bg-hover);
}

/* 拖动手柄 */
.drag-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
    cursor: grab;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
}

.drag-handle:hover {
    opacity: 1;
    color: var(--text-primary);
}

.drag-handle:active {
    cursor: grabbing;
}

/* 拖动状态 */
.attachment-item[draggable="true"] {
    cursor: grab;
}

.attachment-item.dragging {
    opacity: 0.5;
    transform: rotate(2deg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.attachment-item.drag-over {
    border-top: 2px solid var(--primary-color);
}

/* 拖动排序列表 */
.sortable-list {
    position: relative;
}

.sortable-list .attachment-item {
    position: relative;
}

.attachment-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.attachment-type-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.attachment-title-info {
    flex: 1;
    min-width: 0;
}

.attachment-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.25rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attachment-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.attachment-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.attachment-action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.attachment-action-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.attachment-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.attachment-action-btn i {
    font-size: 16px;
}

/* 预览按钮 */
.attachment-preview-btn:hover:not(:disabled) {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

/* 复制链接按钮 */
.attachment-copy-link-btn:hover:not(:disabled) {
    background: rgba(168, 85, 247, 0.1);
    color: #a855f7;
}

/* 下载按钮 */
.attachment-download-btn:hover:not(:disabled) {
    background: rgba(34, 197, 94, 0.1);
    color: #059669;
}

/* 删除按钮 */
.attachment-delete-btn:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* 上传区域 */
.attachment-upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2rem 1rem;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.attachment-upload-area:hover:not(.disabled) {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.02);
}

.attachment-upload-area.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--bg-tertiary);
}

.attachment-upload-area.drag-over {
    border-color: var(--primary-color);
    background: rgba(59, 130, 246, 0.05);
}

.upload-icon {
    font-size: 2rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.upload-text {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.upload-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 1rem;
}

.upload-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.upload-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.upload-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 夜间模式适配 */
[data-theme="dark"] .attachments-list {
    background: var(--color-surface) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
}

[data-theme="dark"] .attachment-item {
    background: var(--color-surface) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .attachment-item:hover {
    background: var(--color-surface-hover);
}

[data-theme="dark"] .attachment-upload-area {
    border-color: rgba(255, 255, 255, 0.2);
    background: var(--color-surface);
}

[data-theme="dark"] .attachment-upload-area:hover:not(.disabled) {
    background: var(--color-surface-hover);
    border-color: var(--primary-color);
}

[data-theme="dark"] .attachment-upload-area.disabled {
    background: var(--color-background);
    opacity: 0.5;
}

[data-theme="dark"] .attachment-upload-area.drag-over {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary-color);
}

/* 响应式设计 */
@media (max-width: 1023px) {
    .attachment-item {
        padding: 0.75rem 0.5rem;
        gap: 0.5rem;
        flex-wrap: nowrap;
    }
    
    .attachment-header {
        gap: 0.5rem;
        flex: 1;
        min-width: 0;
    }
    
    .attachment-type-icon {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }
    
    .attachment-title-info {
        flex: 1;
        min-width: 0;
    }
    
    .attachment-name {
        font-size: 0.8rem;
        line-height: 1.2rem;
    }
    
    .attachment-meta {
        gap: 0.5rem;
        margin-top: 0.125rem;
        font-size: 0.7rem;
        justify-content: flex-start;
    }
    
    .attachment-size {
        text-align: left;
        flex-shrink: 0;
    }
    
    .attachment-actions {
        gap: 0.125rem;
        flex-shrink: 0;
    }
    
    .attachment-action-btn {
        width: 28px;
        height: 28px;
        flex-shrink: 0;
    }
    
    .attachment-action-btn i {
        font-size: 14px;
    }
    
    .attachment-upload-area {
        padding: 1.5rem 0.75rem;
    }
    
    .upload-icon {
        font-size: 1.5rem;
    }
}

/* 附件数量徽章 */
.attachment-count-badge {
    display: inline-block;
    background: #4A89DC;
    color: white;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

/* 附件标题中的数量显示样式 */
#detailAttachmentsTitle,
#detailPanelAttachmentsTitle,
#editorAttachmentsLabel {
    font-weight: 600;
    color: var(--text-primary, #1a1a1a);
    margin-bottom: 0.75rem;
}

/* 暗色主题适配 */
[data-theme="dark"] #detailAttachmentsTitle,
[data-theme="dark"] #detailPanelAttachmentsTitle,
[data-theme="dark"] #editorAttachmentsLabel {
    color: var(--text-primary, #ffffff);
}

/* 附件标题悬停效果 */
#detailAttachmentsTitle:hover,
#detailPanelAttachmentsTitle:hover,
#editorAttachmentsLabel:hover {
    color: var(--primary-color, #4A89DC);
    transition: color 0.2s ease;
}

/* 附件区域整体样式 */
.detail-attachments,
.detail-panel-attachments {
    border-top: 1px solid var(--border-color, #e5e5e5);
    padding-top: 1rem;
    margin-top: 1.5rem;
}

/* 编辑器中的附件区域 */
.form-group #editorAttachmentsLabel {
    border-top: 1px solid var(--border-color, #e5e5e5);
    padding-top: 1rem;
    margin-top: 1rem;
}

/* 文件类型图标颜色 */
.attachment-icon i[data-lucide="file-text"] {
    color: #e74c3c;
}

.attachment-icon i[data-lucide="image"] {
    color: #2ecc71;
}

.attachment-icon i[data-lucide="archive"] {
    color: #f39c12;
}

.attachment-icon i[data-lucide="file-spreadsheet"] {
    color: #27ae60;
}

.attachment-icon i[data-lucide="file"] {
    color: #95a5a6;
}

/* 空状态 */
.attachments-empty {
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    opacity: 0.8;
}

.attachments-empty p {
    margin: 0;
}

/* 附件计数器 */
.attachment-counter {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
}

.attachment-counter .current {
    font-weight: 600;
    color: #4A89DC;
}

.attachment-counter .max {
    color: #999;
}

 