/* =========================================
   PORTFOLIO EDITOR - Dark Theme
   ========================================= */

:root {
    --bg: #0a0612;
    --bg-2: #14101e;
    --bg-3: #1f1830;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-2: rgba(255, 255, 255, 0.06);
    --surface-3: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.08);
    --border-2: rgba(255, 255, 255, 0.14);
    --text: #f5f5f7;
    --text-2: #a0a0b0;
    --text-3: #6b6878;
    --accent: #a78bfa;
    --accent-2: #8b5cf6;
    --amber: #fbbf24;
    --rose: #f472b6;
    --green: #4ade80;
    --red: #f87171;
    --grad-1: linear-gradient(135deg, #a78bfa 0%, #8b5cf6 50%, #6d28d9 100%);
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, sans-serif;
    font-weight: 400;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse 60% 50% at 20% 0%, rgba(139, 92, 246, 0.12), transparent 60%),
        radial-gradient(ellipse 50% 40% at 80% 100%, rgba(251, 191, 36, 0.06), transparent 60%);
    background-attachment: fixed;
}

.ed-noise {
    position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ===== 顶部栏 ===== */
.ed-topbar {
    position: sticky; top: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 24px;
    background: rgba(10, 6, 18, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.ed-topbar-left, .ed-topbar-right { display: flex; align-items: center; gap: 16px; }

.ed-back {
    color: var(--text-2); text-decoration: none; font-size: 13px; font-weight: 500;
    padding: 6px 14px; border: 1px solid var(--border-2); border-radius: 999px;
    transition: all 0.3s var(--ease);
}
.ed-back:hover { color: var(--text); border-color: var(--accent); }

.ed-logo {
    font-weight: 800; font-size: 14px; letter-spacing: 1.5px;
    background: var(--grad-1); -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* ===== 按钮 ===== */
.ed-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 18px; border-radius: 999px;
    font-size: 13px; font-weight: 600; cursor: pointer;
    border: 1px solid transparent; transition: all 0.3s var(--ease);
    white-space: nowrap; font-family: inherit;
}

.ed-btn-accent {
    background: var(--grad-1); color: #fff;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
}
.ed-btn-accent:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(139, 92, 246, 0.5); }

.ed-btn-ghost {
    background: var(--surface); color: var(--text); border-color: var(--border-2);
}
.ed-btn-ghost:hover { background: var(--surface-2); border-color: var(--accent); }

.ed-btn-sm {
    padding: 6px 14px; font-size: 12px; border-radius: 999px;
    border: 1px solid transparent; cursor: pointer; font-family: inherit; font-weight: 600;
    transition: all 0.3s var(--ease);
}

.ed-btn-danger {
    background: rgba(248, 113, 113, 0.1); color: var(--red);
    border: 1px solid rgba(248, 113, 113, 0.3);
}
.ed-btn-danger:hover { background: rgba(248, 113, 113, 0.2); }

/* ===== 布局 ===== */
.ed-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    min-height: calc(100vh - 64px);
    position: relative; z-index: 2;
}

/* ===== 侧边栏 ===== */
.ed-sidebar {
    background: rgba(20, 16, 30, 0.5);
    border-right: 1px solid var(--border);
    padding: 20px 16px;
    overflow-y: auto;
    max-height: calc(100vh - 64px);
    position: sticky; top: 64px;
}

.ed-sidebar-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px;
}
.ed-sidebar-header h2 { font-size: 15px; font-weight: 700; letter-spacing: 1px; }

.ed-product-list { display: flex; flex-direction: column; gap: 8px; }

/* 主页文案入口按钮 */
.ed-site-btn {
    width: 100%; margin-bottom: 14px; padding: 9px 12px;
    letter-spacing: 0.5px;
}

/* 整页长图槽位（独立站） */
.ed-long-slot {
    border: 1px dashed var(--border-2);
    border-radius: 12px; padding: 14px;
    background: var(--surface);
}
.ed-long-preview {
    border-radius: 8px; overflow: hidden;
    border: 1px solid var(--border);
    max-height: 320px; overflow-y: auto;
    background: var(--bg-2);
}
.ed-long-preview img { width: 100%; display: block; }
.ed-long-empty {
    padding: 28px 12px; text-align: center;
    color: var(--text-3); font-size: 13px;
    background: var(--bg-2); border-radius: 8px;
    border: 1px dashed var(--border);
}
.ed-long-actions {
    display: flex; gap: 8px; margin-top: 12px;
}

.ed-product-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 12px;
    background: var(--surface); border: 1px solid var(--border);
    cursor: pointer; transition: all 0.25s var(--ease);
}
.ed-product-item:hover { background: var(--surface-2); border-color: var(--border-2); }
.ed-product-item.active { background: rgba(167, 139, 250, 0.1); border-color: var(--accent); }

.ed-product-item .pi-thumb {
    width: 40px; height: 40px; border-radius: 8px; overflow: hidden;
    background: var(--bg-3); flex-shrink: 0;
}
.ed-product-item .pi-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ed-product-item .pi-thumb-empty {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    color: var(--text-3); font-size: 16px;
}

.ed-product-item .pi-info { flex: 1; min-width: 0; }
.ed-product-item .pi-title {
    font-size: 13px; font-weight: 500; color: var(--text);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ed-product-item .pi-type {
    font-size: 10px; color: var(--accent); font-weight: 600; letter-spacing: 1px;
    text-transform: uppercase;
}
.ed-product-item .pi-type.web { color: var(--amber); }

/* ===== 编辑面板 ===== */
.ed-main { padding: 32px 40px; overflow-y: auto; max-width: 900px; }

/* 表单顶部快捷导航 */
.ed-section-toc {
    display: flex; align-items: center; gap: 6px;
    padding: 12px 14px; margin: 0 0 24px;
    background: linear-gradient(135deg, rgba(139,92,246,.12), rgba(251,191,36,.08));
    border: 1px solid rgba(139,92,246,.3);
    border-radius: 12px;
    position: sticky; top: 0; z-index: 5;
    backdrop-filter: blur(8px);
    font-size: 12px;
}
.ed-toc-item {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 999px;
    background: rgba(255,255,255,.04); color: var(--text-2);
    border: 1px solid transparent; cursor: pointer;
    text-decoration: none; transition: all 0.25s var(--ease);
}
.ed-toc-item:hover { background: rgba(139,92,246,.18); color: var(--text); }
.ed-toc-item.active {
    background: var(--accent); color: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 16px rgba(139,92,246,.4);
}
.ed-toc-num {
    font-family: var(--font-mono); font-size: 10px;
    background: rgba(0,0,0,.3); padding: 2px 5px; border-radius: 4px;
}
.ed-toc-item.active .ed-toc-num { background: rgba(255,255,255,.25); }
.ed-toc-spacer { flex: 1; }
.ed-toc-hint { color: var(--accent); font-size: 11px; opacity: 0.9; }

.ed-empty {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 60vh; text-align: center;
}
.ed-empty-icon { font-size: 48px; margin-bottom: 16px; color: var(--accent); opacity: 0.4; }
.ed-empty p { color: var(--text-3); font-size: 14px; }

/* 表单 */
.ed-form { display: flex; flex-direction: column; gap: 28px; }

.ed-form-section {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: 16px; padding: 24px;
}

.ed-form-section h3 {
    font-size: 13px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
    color: var(--accent); margin-bottom: 20px;
    display: flex; align-items: center; gap: 8px;
}
.ed-form-section h3 .ed-section-num {
    font-family: 'JetBrains Mono', monospace; color: var(--text-3); font-size: 12px;
}

.ed-field { margin-bottom: 18px; }
.ed-field:last-child { margin-bottom: 0; }

.ed-field label {
    display: block; font-size: 12px; font-weight: 600; color: var(--text-2);
    margin-bottom: 6px; letter-spacing: 0.5px;
}
.ed-field .ed-hint { font-size: 11px; color: var(--text-3); margin-top: 4px; }

.ed-input, .ed-textarea, .ed-select {
    width: 100%; padding: 10px 14px;
    background: rgba(10, 6, 18, 0.6); border: 1px solid var(--border-2);
    border-radius: 10px; color: var(--text); font-size: 14px;
    font-family: inherit; transition: border-color 0.25s var(--ease);
    outline: none;
}
.ed-input:focus, .ed-textarea:focus, .ed-select:focus { border-color: var(--accent); }

.ed-textarea { resize: vertical; min-height: 80px; line-height: 1.6; }

.ed-select { appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a78bfa' stroke-width='2' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px;
}

.ed-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* 标签输入 */
.ed-tags-input {
    display: flex; flex-wrap: wrap; gap: 6px;
    padding: 8px 10px; min-height: 42px;
    background: rgba(10, 6, 18, 0.6); border: 1px solid var(--border-2);
    border-radius: 10px; transition: border-color 0.25s var(--ease);
}
.ed-tags-input:focus-within { border-color: var(--accent); }
.ed-tag-chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 999px;
    background: rgba(167, 139, 250, 0.15); color: var(--accent);
    font-size: 12px; font-weight: 500;
}
.ed-tag-chip .ed-tag-rm { cursor: pointer; opacity: 0.6; }
.ed-tag-chip .ed-tag-rm:hover { opacity: 1; }
.ed-tags-input input {
    flex: 1; min-width: 80px; border: none; background: none; outline: none;
    color: var(--text); font-size: 13px; font-family: inherit;
}

/* 图片上传区 */
.ed-images { display: flex; flex-direction: column; gap: 12px; }

.ed-image-item {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 12px; border-radius: 12px;
    background: rgba(10, 6, 18, 0.4); border: 1px solid var(--border);
    transition: border-color 0.25s var(--ease);
}
.ed-image-item:hover { border-color: var(--border-2); }
.ed-image-item.dragging { border-color: var(--accent); background: rgba(167, 139, 250, 0.05); }

.ed-image-thumb {
    width: 80px; height: 80px; border-radius: 10px; overflow: hidden;
    background: var(--bg-3); flex-shrink: 0; position: relative;
}
.ed-image-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ed-image-num {
    position: absolute; top: 4px; left: 4px;
    background: rgba(10, 6, 18, 0.8); color: var(--accent);
    font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
}

.ed-image-fields { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.ed-image-cap-input {
    padding: 6px 10px; background: rgba(10, 6, 18, 0.6);
    border: 1px solid var(--border); border-radius: 8px;
    color: var(--text); font-size: 12px; font-family: inherit; outline: none;
    transition: border-color 0.25s var(--ease);
}
.ed-image-cap-input:focus { border-color: var(--accent); }

.ed-image-actions { display: flex; gap: 6px; }
.ed-img-btn {
    padding: 4px 10px; font-size: 11px; border-radius: 6px;
    border: 1px solid var(--border-2); background: var(--surface);
    color: var(--text-2); cursor: pointer; transition: all 0.2s var(--ease);
    font-family: inherit;
}
.ed-img-btn:hover { border-color: var(--accent); color: var(--accent); }
.ed-img-btn.del:hover { border-color: var(--red); color: var(--red); }

/* 上传区 */
.ed-upload-zone {
    border: 2px dashed var(--border-2); border-radius: 16px;
    padding: 32px; text-align: center; transition: all 0.3s var(--ease);
    cursor: pointer; position: relative;
}
.ed-upload-zone:hover, .ed-upload-zone.dragover {
    border-color: var(--accent); background: rgba(167, 139, 250, 0.05);
}
.ed-upload-zone .ed-upload-icon { font-size: 32px; margin-bottom: 8px; color: var(--accent); }
.ed-upload-zone p { color: var(--text-2); font-size: 13px; }
.ed-upload-zone .ed-upload-hint { color: var(--text-3); font-size: 11px; margin-top: 4px; }

/* 五点描述 */
.ed-bullets { display: flex; flex-direction: column; gap: 8px; }
.ed-bullet-row {
    display: flex; gap: 8px; align-items: flex-start;
}
.ed-bullet-row input {
    flex: 1; padding: 8px 12px; background: rgba(10, 6, 18, 0.6);
    border: 1px solid var(--border); border-radius: 8px;
    color: var(--text); font-size: 13px; font-family: inherit; outline: none;
    transition: border-color 0.25s var(--ease);
}
.ed-bullet-row input:focus { border-color: var(--accent); }
.ed-bullet-num {
    padding: 8px 0; font-size: 12px; font-weight: 700; color: var(--accent);
    font-family: 'JetBrains Mono', monospace; width: 24px; text-align: center; flex-shrink: 0;
}

/* 操作按钮 */
.ed-form-actions {
    display: flex; gap: 12px; justify-content: flex-end;
    padding-top: 8px;
}

/* ===== 弹窗 ===== */
.ed-modal {
    position: fixed; inset: 0; z-index: 200;
    display: none; align-items: center; justify-content: center;
}
.ed-modal.show { display: flex; }
.ed-modal-bg {
    position: absolute; inset: 0;
    background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(8px);
}
.ed-modal-card {
    position: relative; z-index: 1;
    background: var(--bg-2); border: 1px solid var(--border-2);
    border-radius: 24px; padding: 40px; max-width: 480px; width: 90%;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}
.ed-modal-card h3 { font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.ed-modal-desc { color: var(--text-2); font-size: 14px; line-height: 1.7; margin-bottom: 20px; }
.ed-modal-stats {
    display: flex; gap: 16px; margin-bottom: 24px;
    padding: 16px; background: var(--surface); border-radius: 12px;
}
.ed-modal-stats div { text-align: center; flex: 1; }
.ed-modal-stats b { display: block; font-size: 24px; font-weight: 800; color: var(--accent); }
.ed-modal-stats span { font-size: 11px; color: var(--text-3); }
.ed-modal-actions { display: flex; gap: 12px; justify-content: flex-end; }

/* ===== Toast ===== */
.ed-toast {
    position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: var(--bg-3); border: 1px solid var(--border-2);
    padding: 12px 24px; border-radius: 999px; font-size: 13px; font-weight: 500;
    color: var(--text); z-index: 300; opacity: 0; pointer-events: none;
    transition: all 0.4s var(--ease);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.ed-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.ed-toast.success { border-color: var(--green); }
.ed-toast.error { border-color: var(--red); }

/* ===== 工作经历编辑器 ===== */
.ed-exp-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: border-color 0.3s var(--ease);
}
.ed-exp-item:hover { border-color: var(--border-2); }
.ed-exp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.ed-exp-num {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 1px;
    text-transform: uppercase;
    font-family: 'JetBrains Mono', monospace;
}
.ed-exp-del {
    width: 24px; height: 24px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; line-height: 1;
    padding: 0; border: 1px solid var(--border-2);
    background: transparent; color: var(--text-2);
    cursor: pointer; transition: all 0.2s;
}
.ed-exp-del:hover {
    background: rgba(239,68,68,0.15);
    border-color: #ef4444;
    color: #ef4444;
}

/* ===== 海报预览 ===== */
.ed-poster-preview {
    flex-shrink: 0;
    overflow: hidden;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .ed-layout { grid-template-columns: 1fr; }
    .ed-sidebar { position: static; max-height: 240px; }
    .ed-main { padding: 20px 16px; }
    .ed-field-row { grid-template-columns: 1fr; }
    .ed-topbar-right { gap: 8px; }
    .ed-btn { padding: 6px 12px; font-size: 12px; }
}
