/**
 * [INPUT]: public/admin/editor.html - 编辑器页面
 * [OUTPUT]: 编辑器页面通用样式
 * [POS]: 编辑器旧版样式基座，覆盖布局与组件外观
 *
 * [自指声明]
 * 1. 一旦我被更新，必须更新本文件 Header
 * 2. 影响外部接口则更新所属 folder/CLAUDE.md
 * 3. 架构级变动则更新根目录 CLAUDE.md
 * 4. 若依赖的文件 POS 变化，需检查本文件 INPUT 是否仍然准确
 *
 * [PROTOCOL]: 变更时更新此头部，然后检查 CLAUDE.md
 */
:root {
    --primary-color: #000;
    --background-color: #fff;
    --text-color: #000;
    --text-secondary: #666;
    --border-color: #ddd;
    --hover-bg: #f5f5f5;
    --sidebar-width: 360px;
    --header-height: 60px;
}
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    line-height: 1.6;
}
/* 头部样式 - 黑白简约 */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: white;
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
}
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    padding: 0 2rem;
    max-width: 100%;
}
.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-color);
}
.nav-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}
/* 编辑器容器 */
.editor-container {
    display: flex;
    height: calc(100vh - var(--header-height));
    margin-top: var(--header-height);
    background: #f8f9fa;
}
/* 侧边栏样式 - 卡片化设计 */
.editor-sidebar {
    width: var(--sidebar-width);
    background: #f8f9fa;
    border-right: 1px solid var(--border-color);
    padding: 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
}
/* 卡片容器样式 */
.sidebar-section {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}
/* 表单样式 - 黑白风格 */
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-weight: 500;
}
.form-input,
input[type="text"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 0.625rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-color);
    font-size: 0.875rem;
    transition: all 0.2s;
}
.form-input:focus,
input[type="text"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
}
textarea {
    resize: vertical;
    min-height: 80px;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

/* 按钮样式 - 描边风格 */
.btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--primary-color);
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background: transparent;
    color: var(--primary-color);
}

.btn:hover {
    background: var(--primary-color);
    color: white;
}

.btn-primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-primary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-secondary {
    border-color: var(--text-secondary);
    color: var(--text-secondary);
    background: transparent;
}

.btn-secondary:hover {
    background: var(--text-secondary);
    color: white;
}

.btn-text {
    border: none;
    background: transparent;
    color: var(--text-secondary);
}

.btn-text:hover {
    background: var(--hover-bg);
    color: var(--text-color);
}

.btn-danger {
    border-color: #dc3545;
    color: #dc3545;
    background: transparent;
}

.btn-danger:hover {
    background: #dc3545;
    color: white;
}

.btn-success {
    border-color: #28a745;
    color: #28a745;
    background: transparent;
}

.btn-success:hover {
    background: #28a745;
    color: white;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-block {
    width: 100%;
}

/* 标签和功能列表样式 */
.tags-container,
.tags-list,
.features-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.tag,
.feature,
.tag-item {
    background: white;
    border: 1px solid var(--border-color);
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8125rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.tag:hover,
.feature:hover,
.tag-item:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
}

.remove-tag,
.remove-feature,
.tag-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    margin-left: 0.25rem;
}

.remove-tag:hover,
.remove-feature:hover,
.tag-remove:hover {
    color: var(--primary-color);
}

/* 媒体上传样式 */
.media-upload {
    margin-top: 1rem;
    padding: 1.5rem;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    transition: all 0.2s;
    background: white;
    text-align: center;
}

.media-upload:hover {
    border-color: var(--primary-color);
    background: var(--hover-bg);
}

.media-upload-btn {
    width: 100%;
    padding: 0.75rem;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    background: white;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.media-upload-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--hover-bg);
}

.file-input {
    width: 100%;
    margin-bottom: 1rem;
    color: var(--text-color);
}

/* 媒体容器样式 */
.media-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
    min-height: 120px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    background: white;
    position: relative;
}

.media-container.empty {
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-container.drag-over {
    border-color: var(--primary-color);
    background: var(--hover-bg);
}

.media-drop-hint {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-align: center;
}

.media-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.media-item {
    position: relative;
    padding-top: 100%;
    border-radius: 6px;
    overflow: hidden;
    background: var(--hover-bg);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
}

.media-item:hover {
    transform: scale(1.05);
    border-color: var(--primary-color);
}

.media-item img,
.media-item video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-remove,
.remove-media {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s;
}

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

.media-remove:hover,
.remove-media:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

/* 封面上传样式 */
.cover-section {
    background: white;
    border-radius: 8px;
    padding: 0;
}

.cover-preview {
    width: 100%;
    height: 160px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1rem;
    background: var(--hover-bg);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.cover-preview:hover {
    border-color: var(--primary-color);
    background: white;
}

.cover-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cover-placeholder {
    text-align: center;
    color: var(--text-secondary);
}

.cover-placeholder svg {
    width: 40px;
    height: 40px;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

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

.cover-upload-btn,
.cover-remove-btn {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.cover-upload-btn {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.cover-upload-btn:hover {
    background: var(--primary-color);
    color: white;
}

.cover-remove-btn:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

/* 分类管理样式 */
.category-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
}

.category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s;
}

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

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

.category-item-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    cursor: pointer;
}

.category-name {
    font-size: 0.875rem;
    color: var(--text-color);
}

.category-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--hover-bg);
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
}

.category-actions {
    display: flex;
    gap: 0.25rem;
}

.btn-icon {
    padding: 0.25rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.875rem;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--hover-bg);
    color: var(--text-color);
}

.btn-icon.delete:hover {
    background: #ffebee;
    color: #dc3545;
}

.btn-icon.edit:hover {
    background: #e3f2fd;
    color: #2196f3;
}

/* 文件上传区域 */
.file-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background: white;
    transition: all 0.2s;
    cursor: pointer;
}

.file-upload-zone.drag-over {
    border-color: var(--primary-color);
    background: var(--hover-bg);
}

.upload-hint {
    color: var(--text-secondary);
}

.upload-hint svg {
    width: 40px;
    height: 40px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.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: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.2s;
}

.file-preview-item:hover {
    border-color: var(--primary-color);
}

/* 编辑器主体 */
.editor-main {
    flex: 1;
    padding: 1.5rem;
    background: white;
    overflow: auto;
}

/* Toast UI Editor 自定义样式 - 黑白主题 */
.toastui-editor-defaultUI {
    border-radius: 8px;
    border: 1px solid var(--border-color) !important;
    background: white !important;
}

.toastui-editor-toolbar {
    background: white !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.toastui-editor-contents {
    background: white !important;
    color: var(--text-color) !important;
}

/* 模态框样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    min-width: 400px;
    border: 1px solid var(--border-color);
}

.modal-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color);
}

.modal-body {
    margin-bottom: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: var(--hover-bg);
    color: var(--text-color);
}

/* 快速添加分类 */
.quick-add-category {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.new-category-input {
    flex: 1;
}

/* 切换按钮 */
.btn-toggle {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-toggle:hover {
    background: var(--hover-bg);
    color: var(--text-color);
}

/* 日期输入框样式 */
.date-input {
    color-scheme: light;
    cursor: pointer;
}

.date-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.calendar-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
    pointer-events: none;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--hover-bg);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .editor-container {
        flex-direction: column;
    }
    
    .editor-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}
