﻿/* 发布/编辑页面样式 */
@import '../design-system.css';

/* ── 容器宽度覆盖 ──────────────────────────────────────────────── */
.container {
    max-width: 960px;
}

/* ── 发布表单卡片 ──────────────────────────────────────────────── */
.release-form {
    background: var(--md-sys-color-surface-container);
    border-radius: 16px;
    padding: 36px;
    box-shadow: var(--card-shadow-soft);
    border: 1px solid var(--md-sys-color-surface-variant);
    margin-bottom: 32px;
}

/* ── 表单行 ────────────────────────────────────────────────────── */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ── 表单组 ────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 8px;
}

.form-group .required {
    color: #c0392b;
    margin-left: 2px;
}

.form-group .optional {
    font-weight: 400;
    font-size: 12px;
    color: var(--md-sys-color-outline);
    margin-left: 4px;
}

.form-group .hint {
    font-size: 12px;
    color: var(--md-sys-color-outline);
    margin-top: 6px;
}

.form-group input[type="text"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.form-group input[type="text"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--deep-orange);
    box-shadow: 0 0 0 3px rgba(155, 71, 0, 0.12);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* ── 字数统计 ──────────────────────────────────────────────────── */
.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.char-counter {
    font-size: 12px;
    color: var(--md-sys-color-outline);
    background: var(--md-sys-color-surface-variant);
    padding: 2px 8px;
    border-radius: 10px;
    font-variant-numeric: tabular-nums;
}

/* ── EasyMDE 编辑器主题 ────────────────────────────────────────── */
.CodeMirror {
    font-family: 'Google Sans', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px !important;
    border: 1px solid var(--md-sys-color-outline) !important;
    border-radius: 0 0 10px 10px !important;
    background: var(--md-sys-color-surface) !important;
    color: var(--md-sys-color-on-surface) !important;
    line-height: 1.7 !important;
}

.CodeMirror-focused {
    border-color: var(--deep-orange) !important;
    box-shadow: 0 0 0 3px rgba(155, 71, 0, 0.12) !important;
}

.editor-toolbar {
    background: var(--md-sys-color-surface-container) !important;
    border: 1px solid var(--md-sys-color-outline) !important;
    border-bottom: none !important;
    border-radius: 10px 10px 0 0 !important;
    padding: 8px !important;
}

.editor-toolbar button {
    color: var(--md-sys-color-on-surface) !important;
    background: transparent !important;
}

.editor-toolbar button:hover,
.editor-toolbar button.active {
    background: color-mix(in srgb, var(--deep-orange) 18%, transparent) !important;
    color: var(--deep-orange) !important;
    border-radius: 6px !important;
}

.editor-statusbar {
    background: var(--md-sys-color-surface-container) !important;
    border: 1px solid var(--md-sys-color-outline) !important;
    border-top: none !important;
    border-radius: 0 0 10px 10px !important;
    color: var(--md-sys-color-outline) !important;
    font-size: 12px !important;
    padding: 4px 12px !important;
}

/* ── 全屏编辑器覆盖层 ──────────────────────────────────────────── */
.editor-fullscreen-overlay {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2000 !important;
    display: flex;
    flex-direction: column;
    background: var(--md-sys-color-surface, #fff);
}

.editor-fullscreen-overlay .editor-toolbar {
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-top: none !important;
    flex-shrink: 0;
}

.editor-fullscreen-overlay .CodeMirror {
    flex: 1;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
}

.editor-fullscreen-overlay .editor-statusbar {
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    flex-shrink: 0;
}

/* ── 表单操作按钮 ──────────────────────────────────────────────── */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    flex-wrap: wrap;
    align-items: center;
}

/* ── 状态消息 ──────────────────────────────────────────────────── */
.status-message {
    display: none;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
    margin-top: 16px;
}

.status-message.loading {
    display: block;
    background: rgba(155, 71, 0, 0.08);
    color: var(--deep-orange);
    border-color: rgba(155, 71, 0, 0.2);
}

.status-message.success {
    display: block;
    background: rgba(27, 94, 32, 0.08);
    color: #1B5E20;
    border-color: rgba(27, 94, 32, 0.25);
}

.status-message.error {
    display: block;
    background: rgba(192, 57, 43, 0.08);
    color: #c0392b;
    border-color: rgba(192, 57, 43, 0.25);
}

/* ── 预览模态 ──────────────────────────────────────────────────── */
.preview-modal .modal-content {
    max-width: 860px;
    max-height: 90vh;
    overflow-y: auto;
    width: 95%;
}

#previewContent {
    background: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-surface-variant);
    border-radius: 10px;
    padding: 24px;
    min-height: 120px;
}

/* ── 响应式 ────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .release-form {
        padding: 20px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions button,
    .form-actions a {
        width: 100%;
        justify-content: center;
    }
}
