/*
 * [INPUT]: public/admin/editor.html - 编辑器页面结构
 * [OUTPUT]: 编辑器组件与交互样式
 * [POS]: 编辑器组件细节样式
 *
 * [自指声明]
 * 1. 一旦我被更新，必须更新本文件 Header
 * 2. 影响外部接口则更新所属 folder/CLAUDE.md
 * 3. 架构级变动则更新根目录 CLAUDE.md
 * 4. 若依赖的文件 POS 变化，需检查本文件 INPUT 是否仍然准确
 *
 * [PROTOCOL]: 变更时更新此头部，然后检查 CLAUDE.md
 */
        
        .media-drop-hint svg {
            stroke: #666;
            margin-bottom: 0.5rem;
        }

        .resource-drop-zone:not(.empty) .media-drop-hint {
            display: none;
        }

        .media-item {
            position: relative;
            aspect-ratio: 1;
            border-radius: 8px;
            overflow: hidden;
            background: rgba(0, 0, 0, 0.2);
        }

        .media-item img,
        .media-item video {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }
        
        .media-item video {
            background: rgba(0, 0, 0, 0.1);
        }
        
        .video-overlay {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: rgba(0, 0, 0, 0.6);
            border-radius: 50%;
            width: 48px;
            height: 48px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            pointer-events: none;
            opacity: 0.8;
            transition: opacity 0.3s ease;
        }
        
        .media-item:hover .video-overlay {
            opacity: 1;
        }

        .media-remove {
            position: absolute;
            top: 0.5rem;
            right: 0.5rem;
            width: 24px;
            height: 24px;
            background: rgba(0, 0, 0, 0.5);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .media-item:hover .media-remove {
            opacity: 1;
        }

        /* 封面上传样式优化 */
        .cover-section {
            background: rgba(0, 0, 0, 0.2);
            border-radius: 12px;
            border: 1px solid rgba(255, 255, 255, 0.1);
            padding: 1.5rem;
            margin-bottom: 2rem;
        }

        .cover-preview {
            width: 100%;
            height: 200px;
            border-radius: 8px;
            overflow: hidden;
            margin-bottom: 1rem;
            background: rgba(0, 0, 0, 0.2);
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .cover-preview:hover {
            background: rgba(0, 0, 0, 0.3);
        }

        .cover-preview img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: all 0.3s ease;
        }

        .cover-actions {
            display: flex;
            gap: 1rem;
        }

        .cover-upload-btn {
            flex: 1;
            padding: 8px 16px;
            border-radius: 6px;
            background: #8B5CF6;
            color: white;
            border: none;
            cursor: pointer;
            font-size: 14px;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        .cover-upload-btn:hover {
            background: #7C3AED;
        }

        .cover-remove-btn {
            padding: 8px 16px;
            border-radius: 6px;
            background: rgba(255, 255, 255, 0.1);
            color: white;
            border: none;
            cursor: pointer;
            font-size: 14px;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
        }

        .cover-remove-btn:hover {
            background: rgba(255, 255, 255, 0.2);
        }

        .cover-placeholder {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: rgba(255, 255, 255, 0.5);
            text-align: center;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 1rem;
        }

        .cover-placeholder svg {
            width: 32px;
            height: 32px;
            opacity: 0.5;
        }

        .cover-placeholder span {
            font-size: 14px;
        }

        /* 文件上传和预览样式 */
        .file-upload-zone {
            border: 2px dashed rgba(255, 255, 255, 0.1);
            border-radius: 8px;
            padding: 2rem;
            text-align: center;
            background: rgba(0, 0, 0, 0.2);
            transition: all 0.3s ease;
            margin-bottom: 1rem;
        }

        .file-upload-zone.drag-over {
            border-color: var(--primary-color);
            background: rgba(139, 92, 246, 0.1);
        }

        .file-preview-container {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 1rem;
            margin-top: 1rem;
        }

        .file-preview-item {
            position: relative;
            background: rgba(0, 0, 0, 0.2);
            border-radius: 8px;
            overflow: hidden;
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        .file-preview-item img {
            width: 100%;
            height: 150px;
            object-fit: cover;
        }

        .file-preview-item .file-info {
            padding: 0.75rem;
        }

        .file-preview-item .file-name {
            font-size: 0.875rem;
            color: rgba(255, 255, 255, 0.9);
            margin-bottom: 0.25rem;
            word-break: break-all;
        }

        .file-preview-item .file-size {
            font-size: 0.75rem;
            color: rgba(255, 255, 255, 0.5);
        }

        .file-preview-item .file-remove {
            position: absolute;
            top: 0.5rem;
            right: 0.5rem;
            width: 24px;
            height: 24px;
            background: rgba(0, 0, 0, 0.5);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .file-preview-item:hover .file-remove {
            opacity: 1;
        }

        .file-upload-progress {
            height: 4px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 2px;
            overflow: hidden;
            margin-top: 0.5rem;
        }

        .file-upload-progress .progress-bar {
            height: 100%;
            background: var(--primary-color);
            width: 0;
            transition: width 0.3s ease;
        }

        /* 添加文件卡片样式 */
        .file-card {
            display: flex;
            align-items: center;
            padding: 12px;
            margin: 8px 0;
            background: rgba(255,255,255,0.05);
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.3s;
        }

        .file-card:hover {
            background: rgba(255,255,255,0.1);
        }

        .file-icon {
            font-size: 24px;
            margin-right: 12px;
            color: var(--primary-color);
        }

        .file-info {
            flex: 1;
        }

        .file-name {
            font-size: 14px;
            color: rgba(255,255,255,0.9);
            margin-bottom: 4px;
        }

        .file-hint {
            font-size: 12px;
            color: rgba(255,255,255,0.5);
        }

        .download-btn {
            padding: 6px 12px;
            background: var(--primary-color);
            border-radius: 4px;
            color: #fff;
            font-size: 13px;
        }

        /* 编辑器工具栏样式 */
        .editor-toolbar {
            position: sticky;
            top: 60px; /* 头部导航栏高度 */
            background: rgba(10, 10, 10, 0.95);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            z-index: 100;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
            padding: 0.5rem 0;
        }

        /* 确保工具栏按钮在固定位置时也能正常显示 */
        .editor-toolbar button {
            z-index: 101;
        }

        /* 全局滚动条样式 */
        * {
            scrollbar-width: thin;
            scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
        }

        *::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }

        *::-webkit-scrollbar-track {
            background: transparent;
        }

        *::-webkit-scrollbar-thumb {
            background-color: rgba(255, 255, 255, 0.2);
            border-radius: 3px;
            border: none;
        }

        *::-webkit-scrollbar-thumb:hover {
            background-color: rgba(255, 255, 255, 0.3);
        }

        /* 编辑器特定的滚动条样式 */
        .toastui-editor-defaultUI {
            scrollbar-width: thin;
            scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
        }

        .toastui-editor-defaultUI::-webkit-scrollbar {
            width: 6px;
            height: 6px;
        }

        .toastui-editor-defaultUI::-webkit-scrollbar-track {
            background: transparent;
        }

        .toastui-editor-defaultUI::-webkit-scrollbar-thumb {
            background-color: rgba(255, 255, 255, 0.2);
            border-radius: 3px;
            border: none;
        }

        .toastui-editor-defaultUI::-webkit-scrollbar-thumb:hover {
            background-color: rgba(255, 255, 255, 0.3);
        }

        /* 草稿创建失败遮罩 */
        .draft-error-mask {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.6);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 11000;
        }

        .draft-error-card {
            background: #fff;
            border-radius: 10px;
            padding: 20px 24px;
            max-width: 360px;
            text-align: center;
            box-shadow: 0 8px 24px rgba(0,0,0,0.2);
        }

        .draft-error-card h3 {
            margin: 0 0 8px;
            color: #dc2626;
        }

        .draft-error-card p {
            margin: 0 0 16px;
            color: #444;
            font-size: 14px;
        }

        .draft-error-card button {
            border: none;
            background: #111827;
            color: #fff;
            padding: 8px 14px;
            border-radius: 6px;
            cursor: pointer;
        }

        /* 上传进度面板样式 */
        #upload-progress-panel {
            position: fixed;
            bottom: 20px;
            right: 20px;
            width: 360px;
            max-height: 420px;
            background: white;
            border-radius: 10px;
            box-shadow: 0 8px 24px rgba(0,0,0,0.12);
            z-index: 10000;
            overflow: hidden;
            display: none;
        }

        /* 编辑区上传态卡片（飞书式占位反馈） */
        .editor-main {
            position: relative;
        }

        #editor-inline-upload-overlay {
            position: absolute;
            top: 16px;
            right: 16px;
            width: min(420px, calc(100% - 32px));
            display: flex;
            flex-direction: column;
            gap: 10px;
            z-index: 200;
            pointer-events: none;
        }

        .editor-inline-upload-item {
            display: flex;
            align-items: stretch;
            gap: 10px;
            padding: 10px;
            border-radius: 10px;
            border: 1px solid #dbeafe;
            background: rgba(255, 255, 255, 0.96);
            box-shadow: 0 10px 24px rgba(15, 23, 42, 0.14);
            pointer-events: auto;
        }

        .editor-inline-upload-item.is-error {
            border-color: #fecaca;
            background: rgba(254, 242, 242, 0.98);
        }

        .editor-inline-upload-item.is-complete {
            border-color: #bbf7d0;
            background: rgba(240, 253, 244, 0.98);
        }

        .editor-inline-upload-preview {
            width: 78px;
            height: 78px;
            flex-shrink: 0;
            border-radius: 8px;
            overflow: hidden;
            background: #f1f5f9;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .editor-inline-upload-preview img,
        .editor-inline-upload-preview video {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

        .editor-inline-upload-file-badge {
            min-width: 52px;
            padding: 4px 8px;
            border-radius: 999px;
            background: #e2e8f0;
            color: #334155;
            font-size: 12px;
            font-weight: 700;
            text-align: center;
        }

        .editor-inline-upload-meta {
            flex: 1;
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .editor-inline-upload-file-name {
            font-size: 14px;
            font-weight: 600;
            color: #0f172a;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .editor-inline-upload-file-size {
            font-size: 12px;
            color: #64748b;
        }

        .editor-inline-upload-progress {
            width: 100%;
            height: 6px;
            border-radius: 999px;
            background: #e2e8f0;
            overflow: hidden;
        }

        .editor-inline-upload-progress-fill {
            width: 0%;
            height: 100%;
            background: linear-gradient(90deg, #6366f1, #8b5cf6);
            border-radius: 999px;
            transition: width 0.2s ease;
        }

        .editor-inline-upload-footer {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
        }

        .editor-inline-upload-status {
            font-size: 12px;
            color: #334155;
            white-space: nowrap;
        }

        .editor-inline-upload-item.is-error .editor-inline-upload-status {
            color: #dc2626;
        }

        .editor-inline-upload-item.is-complete .editor-inline-upload-status {
            color: #15803d;
        }

        .editor-inline-upload-retry {
            border: 1px solid #ef4444;
            background: transparent;
            color: #dc2626;
            border-radius: 4px;
            font-size: 12px;
            line-height: 1;
            padding: 4px 8px;
            cursor: pointer;
            align-items: center;
            justify-content: center;
        }

        .toastui-editor-contents .editor-upload-inline-error {
            margin-top: 6px;
        }

        .toastui-editor-contents .editor-upload-inline-retry {
            border: 1px solid #ef4444;
            background: #fff;
            color: #dc2626;
            font-size: 12px;
            line-height: 1.2;
            border-radius: 4px;
            padding: 4px 10px;
            cursor: pointer;
        }

        .toastui-editor-contents .editor-upload-inline-retry:hover {
            background: #fee2e2;
        }

        .toastui-editor-contents .editor-upload-processing-dots {
            display: inline-block;
            min-width: 1.2em;
            text-align: left;
            vertical-align: baseline;
        }

        .toastui-editor-contents .editor-upload-processing-dots::after {
            content: '...';
            display: inline-block;
            width: 0;
            overflow: hidden;
            animation: editor-upload-dots 1.2s steps(4, end) infinite;
        }

        @keyframes editor-upload-dots {
            from { width: 0; }
            to { width: 1.2em; }
        }

        #upload-progress-panel.is-highlight {
            box-shadow: 0 0 0 2px #f59e0b, 0 8px 24px rgba(0,0,0,0.12);
        }

        #upload-progress-panel.is-collapsed .upload-panel-body {
            display: none;
        }

        .upload-panel-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px 12px;
            background: #fafafa;
            border-bottom: 1px solid #f0f0f0;
        }

        .upload-panel-title {
            font-size: 13px;
            font-weight: 600;
            color: #333;
        }

        .upload-panel-toggle {
            border: none;
            background: transparent;
            color: #666;
            font-size: 12px;
            cursor: pointer;
        }

        .upload-panel-body {
            max-height: 340px;
            overflow-y: auto;
            padding: 8px 12px 12px;
        }

        .upload-progress-item {
            padding: 10px 0;
            border-bottom: 1px solid #f0f0f0;
            animation: fadeIn 0.3s ease;
        }

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

        .upload-progress-item.is-error .progress-percent {
            color: #ef4444;
        }

        .upload-progress-item.is-error .upload-progress-fill {
            background: linear-gradient(90deg, #ef4444, #f97316);
        }

        .upload-progress-item.is-complete .progress-percent {
            color: #16a34a;
        }

        .upload-progress-bar {
            height: 6px;
            background: #e5e7eb;
            border-radius: 3px;
            margin: 8px 0;
            overflow: hidden;
        }

        .upload-progress-fill {
            height: 100%;
            background: linear-gradient(90deg, #4CAF50, #66BB6A);
            border-radius: 3px;
            transition: width 0.3s;
        }

        .upload-info {
            display: flex;
            justify-content: space-between;
            font-size: 12px;
            color: #666;
        }

        .upload-error {
            display: none;
            align-items: center;
            justify-content: space-between;
            margin-top: 6px;
            font-size: 12px;
            color: #ef4444;
        }

        .upload-progress-item.is-error .upload-error {
            display: flex;
        }

        .upload-retry-btn {
            border: 1px solid #ef4444;
            background: transparent;
            color: #ef4444;
            padding: 2px 8px;
            border-radius: 4px;
            font-size: 12px;
            cursor: pointer;
        }

        .file-name {
            font-weight: 500;
            color: #333;
            max-width: 200px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .progress-percent {
            font-weight: bold;
            color: #4CAF50;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
