/*
 * article.css
 * 来源: article.php
 */

:root {
            --bg-deep: #050508;
            --bg-panel: rgba(12, 12, 18, 0.95);
            --text-main: #e4e4e7;
            --text-muted: #71717a;
            --accent-primary: #00ff9d;
            --accent-secondary: #00d4ff;
            --border-color: rgba(0, 255, 157, 0.15);
        }
        [data-theme="light"] {
            --bg-deep: #ffffff;
            --bg-panel: rgba(255, 255, 255, 0.98);
            --text-main: #0f172a;
            --text-muted: #64748b;
            --accent-primary: #059669;
            --accent-secondary: #0284c7;
            --border-color: rgba(5, 150, 105, 0.15);
        }
        * { margin: 0; padding: 0; box-sizing: border-box; }
        html { scroll-behavior: smooth; }
        body { font-family: 'Noto Sans SC', sans-serif; background: var(--bg-deep); color: var(--text-main); min-height: 100vh; transition: background 0.4s, color 0.4s; }
        .font-mono { font-family: 'JetBrains Mono', monospace; }
        
        #shader-canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
        .main-wrapper { position: relative; z-index: 10; }
        
        .nav-bar { position: fixed; top: 0; width: 100%; z-index: 100; padding: 0.75rem 1rem; display: flex; justify-content: space-between; align-items: center; background: var(--bg-panel); border-bottom: 1px solid var(--border-color); backdrop-filter: blur(12px); height: 60px; }
        
        .menu-btn { display: none; padding: 0.5rem; background: transparent; border: 1px solid var(--border-color); border-radius: 6px; color: var(--text-main); cursor: pointer; }
        .menu-btn:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
        
        .sidebar-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 199; opacity: 0; visibility: hidden; transition: all 0.3s; }
        .sidebar-overlay.active { opacity: 1; visibility: visible; }
        
        .mobile-sidebar { position: fixed; top: 0; right: -280px; width: 280px; height: 100%; background: var(--bg-panel); border-left: 1px solid var(--border-color); z-index: 200; padding: 1.5rem; transition: right 0.3s; display: flex; flex-direction: column; }
        .mobile-sidebar.open { right: 0; }
        
        @media (max-width: 768px) {
            .menu-btn { display: flex; align-items: center; gap: 0.5rem; }
        }
        
        .btn-geek { background: transparent; border: 1px solid var(--accent-primary); color: var(--accent-primary); padding: 0.5rem 1rem; font-weight: 600; font-size: 0.8rem; cursor: pointer; transition: all 0.3s; clip-path: polygon(6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%, 0 6px); text-decoration: none; display: inline-block; }
        .btn-geek:hover { color: var(--bg-deep); background: var(--accent-primary); }
        
        .theme-toggle { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border-color); background: transparent; color: var(--text-main); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.3s; flex-shrink: 0; }
        .theme-toggle:hover { background: rgba(255,255,255,0.1); color: var(--accent-primary); border-color: var(--accent-primary); }
        
        .content-wrapper { max-width: 800px; margin: 0 auto; padding: 5rem 1rem 2rem; }
        
        .article-header { margin-bottom: 2rem; }
        .article-title { font-size: 1.75rem; font-weight: 700; margin-bottom: 1rem; line-height: 1.4; }
        .article-meta { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.8rem; color: var(--text-muted); }
        .article-cover { width: 100%; max-height: 400px; object-fit: cover; border-radius: 8px; margin-bottom: 1.5rem; }
        
        .article-content { line-height: 1.9; color: var(--text-muted); font-size: 0.95rem; }
        .article-content h1, .article-content h2, .article-content h3 { color: var(--text-main); margin: 1.5rem 0 0.75rem; }
        .article-content h2 { font-size: 1.3rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; }
        .article-content h3 { font-size: 1.1rem; }
        .article-content p { margin-bottom: 1rem; }
        .article-content ul, .article-content ol { margin: 1rem 0; padding-left: 1.5rem; }
        .article-content li { margin-bottom: 0.5rem; }
        .article-content a { color: var(--accent-primary); }
        .article-content code { background: rgba(0, 255, 157, 0.1); padding: 0.1rem 0.3rem; border-radius: 3px; font-family: 'JetBrains Mono', monospace; font-size: 0.85em; }
        .article-content pre { 
            background: var(--bg-panel); 
            border: 1px solid var(--border-color);
            padding: 1rem; 
            border-radius: 6px; 
            overflow-x: auto; 
            margin: 1rem 0; 
            font-size: 0.85rem; 
            position: relative;
        }
        .article-content pre code { background: none; padding: 0; color: var(--text-main); }
        .article-content blockquote { border-left: 3px solid var(--accent-primary); padding-left: 1rem; margin: 1rem 0; color: var(--text-muted); }
        .article-content img { max-width: 100%; border-radius: 6px; margin: 1rem 0; }
        
        /* 代码复制按钮 */
        .code-copy-btn {
            position: absolute;
            top: 0.5rem;
            right: 0.5rem;
            padding: 0.25rem 0.75rem;
            background: rgba(0, 255, 157, 0.1);
            border: 1px solid var(--border-color);
            border-radius: 4px;
            color: var(--text-muted);
            font-size: 0.75rem;
            cursor: pointer;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 0.25rem;
        }
        .code-copy-btn:hover {
            background: rgba(0, 255, 157, 0.2);
            color: var(--accent-primary);
            border-color: var(--accent-primary);
        }
        .code-copy-btn.copied {
            background: rgba(16, 185, 129, 0.2);
            color: #10b981;
            border-color: #10b981;
        }
        
        /* 评论区样式 - QQ/微信聊天风格 */
        .comments-section { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border-color); }
        .comments-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 1.5rem; }
        
        .comments-list { margin-bottom: 2rem; display: flex; flex-direction: column; gap: 1rem; }
        
        /* 评论项 - 左右布局 */
        .comment-item { display: flex; gap: 0.75rem; max-width: 85%; }
        .comment-item.self { align-self: flex-end; flex-direction: row-reverse; }
        .comment-item.other { align-self: flex-start; }
        
        /* 头像 */
        .comment-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
        
        /* 评论内容区 */
        .comment-content { display: flex; flex-direction: column; gap: 0.25rem; }
        .comment-item.self .comment-content { align-items: flex-end; }
        .comment-item.other .comment-content { align-items: flex-start; }
        
        /* 用户名和时间 */
        .comment-meta { font-size: 0.7rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.5rem; }
        .comment-name { font-weight: 600; color: var(--text-main); }
        
        /* 聊天气泡 */
        .comment-bubble { 
            padding: 0.75rem 1rem; 
            border-radius: 12px; 
            font-size: 0.85rem; 
            line-height: 1.6; 
            position: relative;
            word-break: break-word;
        }
        .comment-item.other .comment-bubble { 
            background: var(--bg-card); 
            border: 1px solid var(--border-color);
            border-top-left-radius: 4px;
        }
        .comment-item.self .comment-bubble { 
            background: rgba(0, 255, 157, 0.15); 
            border: 1px solid rgba(0, 255, 157, 0.3);
            border-top-right-radius: 4px;
            color: var(--text-main);
        }
        
        /* 引用回复 */
        .comment-quote {
            background: rgba(0, 0, 0, 0.2);
            border-left: 3px solid var(--accent-primary);
            padding: 0.5rem 0.75rem;
            margin-bottom: 0.5rem;
            border-radius: 4px;
            font-size: 0.75rem;
            color: var(--text-muted);
        }
        .comment-quote-author { font-weight: 600; color: var(--accent-primary); margin-bottom: 0.25rem; }
        .comment-quote-text { 
            display: -webkit-box; 
            -webkit-line-clamp: 2; 
            -webkit-box-orient: vertical; 
            overflow: hidden;
        }
        
        /* 回复按钮 */
        .comment-actions { display: flex; gap: 0.5rem; margin-top: 0.25rem; }
        .comment-reply-btn { 
            font-size: 0.7rem; 
            padding: 0.15rem 0.5rem; 
            background: transparent; 
            border: 1px solid var(--border-color); 
            border-radius: 4px; 
            color: var(--text-muted); 
            cursor: pointer;
            transition: all 0.2s;
        }
        .comment-reply-btn:hover { border-color: var(--accent-primary); color: var(--accent-primary); }
        
        /* 评论表单 */
        .comment-form { margin-top: 2rem; background: var(--bg-panel); padding: 1.5rem; border-radius: 12px; border: 1px solid var(--border-color); }
        .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; }
        @media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }
        .form-input { width: 100%; padding: 0.6rem 0.8rem; background: transparent; border: 1px solid var(--border-color); border-radius: 6px; color: var(--text-main); font-size: 0.85rem; }
        .form-input:focus { outline: none; border-color: var(--accent-primary); }
        .form-textarea { min-height: 100px; resize: vertical; }

        /* 评论正文：可编辑区 + 右下角插图按钮 */
        .comment-editor-wrap {
            border: 1px solid var(--border-color);
            border-radius: 8px;
            overflow: visible;
            margin-bottom: 0.75rem;
        }
        .comment-editor-wrap.comment-editor-rich {
            position: relative;
            padding-bottom: 0;
        }
        .comment-editor-wrap:focus-within {
            border-color: var(--accent-primary);
            box-shadow: 0 0 0 1px rgba(0, 255, 157, 0.12);
        }
        [data-theme="light"] .comment-editor-wrap:focus-within {
            box-shadow: 0 0 0 1px rgba(5, 150, 105, 0.15);
        }
        /* 提交用：完整 Markdown（含图片 URL），对用户不可见 */
        .comment-content-real {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            white-space: nowrap;
            border: 0;
            opacity: 0;
            pointer-events: none;
        }
        .comment-editor-textarea {
            min-height: 120px;
            max-height: 320px;
            overflow-y: auto;
            resize: vertical;
            width: 100%;
            padding: 0.65rem 3rem 0.65rem 0.75rem;
            margin: 0;
            border: none !important;
            border-radius: 8px !important;
            background: transparent;
            color: var(--text-main);
            font-size: 0.85rem;
            line-height: 1.55;
            word-break: break-word;
        }
        .comment-editor-textarea:focus {
            outline: none;
            box-shadow: none !important;
        }
        .comment-insert-img-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border: 1px solid var(--border-color);
            background: rgba(0, 0, 0, 0.15);
            color: var(--text-muted);
            cursor: pointer;
            transition: border-color 0.2s, color 0.2s, background 0.2s;
        }
        [data-theme="light"] .comment-insert-img-btn {
            background: rgba(15, 23, 42, 0.05);
        }
        .comment-insert-img-btn:hover {
            border-color: var(--accent-primary);
            color: var(--accent-primary);
            background: rgba(0, 255, 157, 0.08);
        }
        .comment-insert-img-btn:disabled {
            opacity: 0.55;
            cursor: not-allowed;
        }
        .comment-insert-img-fab {
            position: absolute;
            right: 8px;
            bottom: 8px;
            z-index: 2;
            width: 40px;
            height: 40px;
            padding: 0;
            border-radius: 8px;
        }
        .comment-upload-status-fab {
            position: absolute;
            right: 52px;
            bottom: 14px;
            z-index: 2;
            font-size: 0.72rem;
            color: var(--text-muted);
            max-width: calc(100% - 120px);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            pointer-events: none;
        }
        .comment-editor-wrap.is-dragover {
            border-color: var(--accent-primary);
            box-shadow: 0 0 0 2px rgba(0, 255, 157, 0.18);
        }
        [data-theme="light"] .comment-editor-wrap.is-dragover {
            box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.2);
        }
        .comment-image-preview {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            padding: 0 0.75rem 0.65rem;
            border-top: 1px dashed var(--border-color);
            margin-top: 0;
        }
        .comment-image-preview:not([hidden]) {
            padding-top: 0.65rem;
        }
        .comment-image-preview__item {
            position: relative;
            width: 72px;
            height: 72px;
            flex-shrink: 0;
            border-radius: 8px;
            overflow: hidden;
            border: 2px solid var(--border-color);
            background: rgba(0, 0, 0, 0.12);
            cursor: pointer;
            transition: border-color 0.2s, transform 0.15s;
        }
        [data-theme="light"] .comment-image-preview__item {
            background: rgba(15, 23, 42, 0.04);
        }
        .comment-image-preview__item:hover {
            border-color: var(--accent-primary);
            transform: translateY(-1px);
        }
        .comment-image-preview__item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
            pointer-events: none;
        }
        .comment-image-preview__remove {
            position: absolute;
            top: 2px;
            right: 2px;
            width: 20px;
            height: 20px;
            padding: 0;
            border: none;
            border-radius: 50%;
            background: rgba(0, 0, 0, 0.65);
            color: #fff;
            font-size: 14px;
            line-height: 1;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            transition: opacity 0.15s;
        }
        .comment-image-preview__item:hover .comment-image-preview__remove,
        .comment-image-preview__remove:focus-visible {
            opacity: 1;
        }
        .comment-image-preview__add {
            width: 72px;
            height: 72px;
            flex-shrink: 0;
            border-radius: 8px;
            border: 1px dashed var(--border-color);
            background: transparent;
            color: var(--text-muted);
            cursor: pointer;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 2px;
            font-size: 0.65rem;
            transition: border-color 0.2s, color 0.2s;
        }
        .comment-image-preview__add:hover:not(:disabled) {
            border-color: var(--accent-primary);
            color: var(--accent-primary);
        }
        .comment-image-preview__add:disabled {
            opacity: 0.45;
            cursor: not-allowed;
        }
        .comment-image-preview__add svg {
            opacity: 0.85;
        }
        .comment-image-preview__item img.comment-inline-img {
            max-width: none;
            border: none;
            border-radius: 0;
            margin: 0;
        }
        .comment-inline-img-wrap { display: block; margin: 0.25rem 0; }
        .comment-inline-img {
            max-width: min(100%, 360px); height: auto; border-radius: 8px;
            border: 1px solid var(--border-color);
        }
        
        /* 回复提示 */
        #replyHint { 
            padding: 0.75rem 1rem; 
            background: rgba(0, 255, 157, 0.1); 
            border: 1px solid rgba(0, 255, 157, 0.2);
            border-radius: 8px; 
            margin-bottom: 1rem; 
            font-size: 0.85rem;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        #replyHint button { background: transparent; border: none; color: var(--text-muted); cursor: pointer; font-size: 0.8rem; }
        #replyHint button:hover { color: var(--accent-primary); }
        
        footer { border-top: 1px solid var(--border-color); background: var(--bg-panel); padding-top: 3rem; padding-bottom: 1.5rem; }
        .footer-links a { color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
        .footer-links a:hover { color: var(--accent-primary); }
        .beian-link { color: var(--text-muted); text-decoration: none; transition: color 0.2s; display: inline-flex; align-items: center; gap: 0.25rem; }
        .beian-link:hover { color: var(--text-main); }
        
        /* 小尺寸二维码样式 */
        .qrcode-box-small { width: 70px; height: 70px; padding: 4px; background: #fff; border-radius: 6px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); }
        .qrcode-img-small { width: 100%; height: 100%; object-fit: contain; border-radius: 3px; }
        
        /* 自定义底部栏样式 */
        .footer-custom-wrapper { width: 100%; }
        .footer-custom-grid { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
        .footer-custom-left { flex: 1; text-align: left; min-width: 100px; }
        .footer-custom-center { flex: 1; text-align: center; min-width: 100px; }
        .footer-custom-right { flex: 1; text-align: right; min-width: 100px; }
        @media (max-width: 768px) {
            .footer-custom-grid { flex-direction: column; align-items: center; }
            .footer-custom-left, .footer-custom-center, .footer-custom-right { text-align: center; }
        }
        .footer-custom-wrapper img, .footer-custom-wrapper svg { max-height: 24px; vertical-align: middle; }
        .footer-custom-wrapper a { color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
        .footer-custom-wrapper a:hover { color: var(--accent-primary); }
