/**
 * 普法博客 v2 - 功能增强样式
 * 覆盖：修订提示、星标重点修改、AI评分框、批注系统、修改建议箱、Toast
 */

/* ===== Toast 通知 ===== */
.v2-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 10px 24px;
    border-radius: var(--radius-sm, 6px);
    font-size: 13px;
    font-weight: 500;
    z-index: 9000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(26,54,93,0.15);
}
.v2-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.v2-toast-info { background: var(--primary, #1a365d); color: white; }
.v2-toast-success { background: #38a169; color: white; }
.v2-toast-error { background: #c53030; color: white; }

/* ===== 修订中提示横幅 ===== */
.revision-notice {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 4px solid #d97706;
    color: #856404;
    padding: 12px 20px;
    border-radius: 8px;
    margin: 0 0 24px 0;
    font-size: 14px;
    line-height: 1.7;
}

/* ===== AI 评分徽章 ===== */
.ai-score-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: #4a5568;
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    margin: 0 0 0 4px;
    vertical-align: middle;
}
.ai-score-num {
    font-size: 13px;
    font-weight: 700;
    color: #2d3748;
}

/* ===== AI 审阅意见框 ===== */
.ai-review {
    background: #f8f9fa;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #718096;
    border-radius: 8px;
    padding: 16px 20px;
    margin: 0 0 28px 0;
    font-size: 13px;
    line-height: 1.7;
}
.ai-review h3 {
    font-size: 15px;
    color: #4a5568;
    margin: 0 0 10px 0;
    padding: 0;
    border: none;
    font-weight: 700;
}
.ai-review div {
    color: #4a5568;
    white-space: normal;
}
.ai-review-body table { width: 100%; border-collapse: collapse; margin: 10px 0 14px 0; font-size: 13px; }
.ai-review-body th, .ai-review-body td { border: 1px solid #cbd5e0; padding: 6px 10px; text-align: left; }
.ai-review-body th { background: #edf2f7; font-weight: 700; }
.ai-review-body h4 { font-size: 14px; color: #4a5568; margin: 0 0 8px 0; }
.ai-review-body p { margin: 8px 0; line-height: 1.7; }

/* ===== 星标重点修改（仅标题标识，卡片不变色） ===== */
.starred-section {
    border-left: none;
}
.starred-title {
    color: var(--primary, #1a365d) !important;
    border-bottom-color: var(--primary-bg, #ebf2fa) !important;
}
.status-starred {
    display: none;
}

/* ===== 隐藏状态 ===== */
.status-hidden {
    background: var(--primary-bg);
    color: #94a3b8;
    border: none;
}
.article-card.card-hidden {
    border-left-color: #94a3b8;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    opacity: 0.85;
}
.article-card.card-hidden:hover {
    box-shadow: 0 8px 24px rgba(148,163,184,0.12);
    transform: translateY(-4px);
    border-color: #94a3b8;
}

/* ===== Header 导航激活态 ===== */
.header-nav a.active {
    color: white;
    background: rgba(255,255,255,0.15);
}

/* ===== 批注系统 ===== */
.ann-toolbar {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 200;
}
.ann-btn-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    background: var(--primary, #1a365d);
    color: white;
    border: none;
    border-radius: 28px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(26,54,93,0.10);
    transition: all 0.25s;
    font-family: inherit;
    position: relative;
}
.ann-btn-toggle:hover {
    background: var(--primary-light, #2c5282);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(26,54,93,0.14);
}
.ann-count {
    background: #c53030;
    color: white;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    font-weight: 700;
}
.ann-pending-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: #e53e3e;
    border-radius: 50%;
    border: 2px solid white;
    animation: annDotPulse 2s ease infinite;
}
@keyframes annDotPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* 侧边面板 */
.ann-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    max-width: 90vw;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    z-index: 300;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}
.ann-panel.open { right: 0; }
.ann-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26,54,93,0.2);
    z-index: 250;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.ann-overlay.show { opacity: 1; pointer-events: auto; }
.ann-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: var(--primary, #1a365d);
    color: white;
}
.ann-panel-header h3 { font-size: 16px; font-weight: 700; }
.ann-panel-controls { display: flex; align-items: center; gap: 8px; }
.ann-group-toggle {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}
.ann-group-toggle:hover { background: rgba(255,255,255,0.25); }
.ann-panel-close {
    background: none;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.ann-panel-hint {
    padding: 10px 20px;
    font-size: 12px;
    color: #8492a6;
    background: #f8fafc;
    border-bottom: 1px solid #eef1f6;
}
.ann-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
}

/* 标签页 */
.ann-tabs {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
    background: #f7fafc;
}
.ann-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    border-bottom: 2px solid transparent;
}
.ann-tab:hover { background: #edf2f7; }
.ann-tab-active {
    color: var(--primary, #1a365d);
    border-bottom-color: var(--primary, #1a365d);
    font-weight: 700;
    background: white;
}
.ann-tab-count {
    display: inline-block;
    background: #e2e8f0;
    color: #4a5568;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 8px;
    margin-left: 4px;
    min-width: 16px;
    text-align: center;
}
.ann-tab-active .ann-tab-count {
    background: #ebf2fa;
    color: var(--primary, #1a365d);
    font-weight: 600;
}

/* 批注空状态 */
.ann-empty {
    text-align: center;
    color: #8492a6;
    font-size: 14px;
    padding: 40px 20px;
    line-height: 1.8;
}

/* 批注卡片 */
.ann-card {
    background: #f8fafc;
    border: 1px solid #eef1f6;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.ann-card:hover {
    background: #ebf2fa;
    border-color: #bdd4ea;
}
.ann-card-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.ann-author {
    font-weight: 700;
    font-size: 13px;
    color: #1e2a3a;
}
.ann-type {
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 600;
}
.ann-type-com { background: #dbeafe; color: #1e40af; }
.ann-type-sug { background: #fef3c7; color: #92400e; }
.ann-status {
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 4px;
    margin-left: auto;
    font-weight: 600;
}
.ann-st-pending { background: #fef3e8; color: #dd6b20; }
.ann-st-applied { background: #e6f7ed; color: #38a169; }
.ann-st-rejected { background: #fee2e2; color: #c53030; }
.ann-card-time {
    font-size: 11px;
    color: #8492a6;
    margin-bottom: 6px;
}
.ann-selected {
    border-left: 3px solid #bdd4ea;
    padding: 6px 10px;
    margin: 6px 0;
    background: white;
    font-size: 12px;
    color: #8492a6;
    font-style: italic;
    border-radius: 0 6px 6px 0;
    line-height: 1.6;
    max-height: 80px;
    overflow: hidden;
    cursor: pointer;
    transition: max-height 0.3s;
}
.ann-selected.ann-selected-expanded {
    max-height: none;
}
.ann-selected[data-collapsible]::after {
    content: '展开';
    display: block;
    text-align: right;
    font-size: 11px;
    font-style: normal;
    color: var(--primary-lighter, #3b6fa8);
    margin-top: 2px;
}
.ann-selected.ann-selected-expanded[data-collapsible]::after {
    content: '收起';
}
.ann-suggest {
    margin-top: 8px;
    padding: 8px 12px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 4px;
}
.ann-label {
    font-size: 12px;
    font-weight: 600;
    color: #4a5568;
    margin-right: 4px;
}
.ann-suggest-text {
    font-size: 13px;
    color: #92400e;
}
.ann-comment-text {
    font-size: 13px;
    color: #4a5568;
    line-height: 1.6;
    margin-top: 6px;
}
.ann-level {
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 600;
}
.ann-level-建议 { background: #e6f7ed; color: #38a169; }
.ann-level-重要 { background: #fef3c7; color: #b45309; }
.ann-level-严重 { background: #fee2e2; color: #c53030; }
.ann-review-note {
    margin-top: 8px;
    padding: 6px 10px;
    background: #edf2f7;
    border-left: 3px solid #a0aec0;
    border-radius: 0 4px 4px 0;
    font-size: 12px;
    color: #4a5568;
}

/* 分组 */
.ann-group {
    margin-bottom: 16px;
    border: 1px solid #eef1f6;
    border-radius: 6px;
    overflow: hidden;
}
.ann-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8fafc;
    border-bottom: 1px solid #eef1f6;
}
.ann-group-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary, #1a365d);
}
.ann-group-count {
    font-size: 11px;
    color: #8492a6;
}
.ann-group-body { padding: 6px; }
.ann-group-body .ann-card { margin-bottom: 6px; }

/* 回复 */
.ann-replies {
    margin: 6px 0;
    padding: 8px 10px;
    background: #f8fafc;
    border-radius: 6px;
    border-left: 3px solid #bdd4ea;
}
.ann-reply {
    padding: 4px 0;
    border-bottom: 1px solid #eef1f6;
}
.ann-reply:last-child { border-bottom: none; }
.ann-reply-author {
    font-weight: 600;
    font-size: 12px;
    color: var(--primary, #1a365d);
    margin-right: 6px;
}
.ann-reply-time {
    font-size: 10px;
    color: #8492a6;
}
.ann-reply-text {
    font-size: 13px;
    color: #1e2a3a;
    line-height: 1.6;
    margin-top: 2px;
}
.ann-reply-form {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}
.ann-reply-input {
    flex: 1;
    padding: 5px 10px;
    border: 1.5px solid #e3e8ef;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.2s;
}
.ann-reply-input:focus { outline: none; border-color: #bdd4ea; }
.ann-reply-btn {
    padding: 5px 12px;
    background: var(--primary-light, #2c5282);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}
.ann-reply-btn:hover { background: var(--primary, #1a365d); }
.ann-reply-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* 弹窗 */
.ann-popup {
    position: absolute;
    z-index: 400;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    overflow: hidden;
    width: 380px;
    max-width: 90vw;
}
.ann-popup-tabs {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
    background: #f7fafc;
}
.ann-popup-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    font-size: 13px;
    font-weight: 500;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.ann-popup-tab.active {
    background: white;
    color: var(--primary, #1a365d);
    font-weight: 700;
    border-bottom: 2px solid var(--primary, #1a365d);
}
.ann-popup-tab:hover:not(.active) { background: #edf2f7; }
.ann-popup-selected {
    padding: 10px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 12px;
    color: #8492a6;
    max-height: 100px;
    overflow-y: auto;
}
.ann-popup-selected blockquote {
    border-left: 3px solid #bdd4ea;
    padding-left: 8px;
    margin: 4px 0 0 0;
    font-style: italic;
}
.ann-popup-fields {
    padding: 14px 16px;
}
.ann-popup-fields input,
.ann-popup-fields select,
.ann-popup-fields textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    margin-bottom: 10px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.ann-popup-fields input:focus,
.ann-popup-fields select:focus,
.ann-popup-fields textarea:focus {
    outline: none;
    border-color: #bdd4ea;
}
.ann-popup-fields select {
    cursor: pointer;
    background: white;
}
.ann-popup-submit {
    width: 100%;
    padding: 10px;
    background: var(--primary, #1a365d);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
    margin-bottom: 0;
}
.ann-popup-submit:hover { background: var(--primary-light, #2c5282); }
.ann-popup-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.ann-suggest-section { margin-top: 4px; }

/* 高亮 */
.ann-highlight {
    background: #fff3cd;
    border-bottom: 2px solid #ffc107;
    padding: 1px 2px;
    border-radius: 2px;
    cursor: pointer;
    transition: background 0.3s;
}
.ann-highlight.ann-level-严重 {
    background: #fee2e2;
    border-bottom-color: #e53e3e;
}
.ann-highlight.ann-level-重要 {
    background: #fef3c7;
    border-bottom-color: #d97706;
}
.ann-highlight:hover { background: #ffeeba; }
@keyframes annFlash {
    0%, 100% { background: transparent; }
    25% { background: #fef3c7; }
    50% { background: transparent; }
    75% { background: #fef3c7; }
}
.ann-highlight.ann-flash { animation: annFlash 1s ease; }

/* ===== 修改建议箱 ===== */
.suggestion-section {
    background: linear-gradient(180deg, #ebf2fa 0%, #e8eef5 100%);
    padding: 40px 24px;
    border-top: 1px solid #eef1f6;
    margin-top: 40px;
}
.suggestion-inner {
    max-width: 680px;
    margin: 0 auto;
}
.suggestion-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary, #1a365d);
    text-align: center;
    margin-bottom: 6px;
}
.suggestion-desc {
    font-size: 13px;
    color: #8492a6;
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.7;
}
.suggestion-form {
    background: white;
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(26,54,93,0.08);
    border: 1px solid #eef1f6;
}
.sug-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}
.sug-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e3e8ef;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}
.sug-input:focus { outline: none; border-color: #bdd4ea; }
.sug-select {
    padding: 10px 14px;
    border: 2px solid #e3e8ef;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    color: #1e2a3a;
    cursor: pointer;
    min-width: 90px;
}
.sug-select:focus { outline: none; border-color: #bdd4ea; }
.sug-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e3e8ef;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    margin-bottom: 12px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.sug-textarea:focus { outline: none; border-color: #bdd4ea; }
.sug-actions { justify-content: flex-end; }
.sug-submit {
    padding: 10px 28px;
    background: var(--primary, #1a365d);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.sug-submit:hover { background: var(--primary-light, #2c5282); }
.sug-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.sug-success {
    text-align: center;
    padding: 20px;
    color: #38a169;
    font-size: 15px;
    font-weight: 600;
}

/* ===== 卡片 AI 评分 ===== */
.card-ai-score {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 3px 10px;
    border-radius: var(--radius-sm, 6px);
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-bg);
    white-space: nowrap;
}

/* ===== 筛选标签 ===== */
.filter-tabs {
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
}
.filter-tabs .filter-btn {
    flex: none;
    justify-content: center;
    padding: 6px 14px;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .revision-notice { font-size: 13px; padding: 10px 16px; }
    .suggestion-section { padding: 24px 16px; }
    .sug-row { flex-direction: column; }
    .ann-popup { width: calc(100vw - 32px); }
    .ann-panel { width: 100vw; max-width: none; }
    .filter-tabs { flex-wrap: wrap; }
}
/* ===== Mobile Fix (2026-08-09) ===== */
@media (max-width: 768px) {
    .article-layout { flex-direction: column !important; }
    /* 侧栏在移动端改为滑出面板（见 mobile.css），此处不再强制重排到正文下方 */
    .article-container { padding: 20px 16px !important; max-width: 100vw !important; border-radius: 0 !important; box-shadow: none !important; border: none !important; }
    .article-main { padding: 12px 0 60px !important; }
    .article-title { font-size: 20px !important; line-height: 1.4 !important; }
    .article-meta-bar { flex-wrap: wrap !important; gap: 6px !important; padding: 12px 16px !important; font-size: 12px !important; }
    .capsule-toggle-btn { margin-left: 8px !important; font-size: 11px !important; padding: 4px 10px !important; }
    .article-nav { font-size: 13px !important; padding: 16px !important; }
    .header-nav { display: flex !important; flex-wrap: wrap !important; gap: 4px !important; justify-content: center !important; }
    .header-nav a { padding: 6px 10px !important; font-size: 13px !important; }
    .article-content { overflow-wrap: break-word !important; word-break: break-word !important; }
    .article-content table { display: block !important; overflow-x: auto !important; -webkit-overflow-scrolling: touch !important; }
    .article-content img { max-width: 100% !important; height: auto !important; }
    .sidebar-collapse-btn, .sidebar-restore-btn { display: none !important; }
    .ai-review { padding: 12px !important; font-size: 13px !important; }
    .article-content.capsule-mode { padding: 16px 8px !important; border-radius: 0 !important; }
}
@media (max-width: 414px) {
    .article-container { padding: 14px 10px !important; }
    .article-title { font-size: 18px !important; }
}
/* ===== Header Mobile Fix (2026-08-09) ===== */
@media (max-width: 768px) {
    .site-header {
        position: static;
        border-bottom-width: 2px;
    }

    .header-bar {
        flex-wrap: wrap;
        padding: 8px 12px;
        height: auto;
        min-height: 44px;
        gap: 4px;
    }

    .header-bar .logo {
        font-size: 14px;
        letter-spacing: 0;
    }

    .header-subtitle {
        display: none;
    }

    .header-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 2px;
        margin-left: auto;
        order: 10;
        width: 100%;
        justify-content: center;
        padding-top: 4px;
    }

    .header-nav a {
        font-size: 12px;
        padding: 4px 8px;
        flex-shrink: 0;
    }

    .header-back-btn {
        font-size: 12px;
        padding: 4px 8px;
        margin-left: auto;
    }
}

@media (max-width: 414px) {
    .header-bar .logo {
        font-size: 13px;
        max-width: 180px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .header-nav a {
        font-size: 11px;
        padding: 3px 6px;
    }
}
