/* 水印：全屏固定定位，不阻挡交互 */
.watermark {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
    opacity: 0.03;
    background-repeat: repeat;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
                 "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
}

/* ============================================================
 * 管理后台样式（移植自 main 分支 public/css/style.css）
 * 全部 scope 到 #page-admin 容器，避免污染主站 tailwind 样式
 * ============================================================ */
#page-admin {
    --primary-color: #1890ff;
    --danger-color: #ff4d4f;
    --success-color: #52c41a;
    --text-color: #333;
    --text-secondary: #666;
    --border-color: #e8e8e8;
    --bg-color: #f5f5f5;
    --card-bg: #fff;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    color: var(--text-color);
}

/* === main:style.css L1049-1067 === */
#page-admin .btn-primary {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
}

#page-admin .btn-primary:hover {
    opacity: 0.9;
}

#page-admin .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}


/* === main:style.css L1069-1106 === */
#page-admin .admin-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

#page-admin .admin-section h3 {
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

#page-admin .admin-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#page-admin .form-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

#page-admin .form-row label {
    width: 120px;
    color: var(--text-secondary);
}

#page-admin .form-row input {
    width: 120px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}


/* === main:style.css L1107-1134 === */
#page-admin .admin-post-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 8px;
}

#page-admin .admin-post-content {
    flex: 1;
    overflow: hidden;
}

#page-admin .btn-danger {
    background: var(--danger-color);
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

#page-admin .btn-danger:hover {
    opacity: 0.9;
}

/* === main:style.css L1323-1444 === */
#page-admin .admin-layout {
    display: flex;
    min-height: calc(100vh - 60px);
    margin-top: 60px;
}

#page-admin .admin-sidebar {
    width: 220px;
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

#page-admin .admin-sidebar h2 {
    font-size: 18px;
    margin-bottom: 20px;
    color: var(--primary-color);
}

#page-admin .admin-nav {
    flex: 1;
}

#page-admin .admin-nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 4px;
}

#page-admin .admin-nav-item:hover {
    background: var(--bg-color);
}

#page-admin .admin-nav-item.active {
    background: var(--primary-color);
    color: #fff;
}

#page-admin .admin-nav-item .bbs-icon svg {
    width: 16px;
    height: 16px;
}

#page-admin .admin-back {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    margin-top: 20px;
}

#page-admin .admin-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    overflow-x: auto;
}

#page-admin .admin-tab {
    display: none;
}

#page-admin .admin-tab.active {
    display: block;
}

#page-admin .admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

#page-admin .admin-header h3 {
    margin: 0;
}

#page-admin .admin-header input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 200px;
}

#page-admin .admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.admin-table th,
#page-admin .admin-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

#page-admin .admin-table th {
    background: var(--bg-color);
    font-weight: 600;
    color: var(--text-secondary);
}

#page-admin .admin-table tr:hover td {
    background: #fafafa;
}

#page-admin .post-content-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* === main:style.css L1445-1477 === */
#page-admin .btn-sm {
    padding: 4px 10px;
    font-size: 13px;
    margin-right: 4px;
}

#page-admin .btn-secondary {
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
}

#page-admin .btn-secondary:hover {
    background: #e8e8e8;
}

#page-admin .admin-form-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    box-shadow: var(--shadow);
}

#page-admin .form-hint {
    color: var(--text-secondary);
    font-size: 12px;
    margin-left: 12px;
}


/* === main:style.css L1479-1527 === */
#page-admin .modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#page-admin .modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

#page-admin .modal-content h3 {
    margin-bottom: 20px;
}

#page-admin .modal-content .form-row {
    margin-bottom: 16px;
}

#page-admin .modal-content textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    resize: vertical;
}

#page-admin .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

/* === main:style.css L1672-1720 === */
#page-admin .bbs-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
}

#page-admin .bbs-icon svg {
    width: 16px;
    height: 16px;
}

/* 导航栏图标 */
#page-admin .nav-item .icon {
    font-size: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

#page-admin .nav-item .icon[data-icon]::before {
    content: none;
}

#page-admin .nav-item .icon svg {
    width: 18px;
    height: 18px;
}

/* 帖子操作按钮图标 */
#page-admin .action-btn .icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#page-admin .action-btn .icon svg {
    width: 16px;
    height: 16px;
}

/* === main:style.css L1726-1830 === */
#page-admin .icon-select-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

#page-admin .icon-preview {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-color);
}

#page-admin .icon-preview svg {
    width: 24px;
    height: 24px;
}

#page-admin .icon-picker-grid-modal {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 12px;
    max-height: 300px;
    overflow-y: auto;
}

#page-admin .icon-picker-item {
    position: relative;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

#page-admin .icon-picker-item:hover {
    border-color: var(--primary-color);
    background: var(--bg-color);
    transform: scale(1.1);
    z-index: 10;
}

#page-admin .icon-picker-item[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 100;
}

#page-admin .icon-picker-item:nth-child(-n+4)[title]:hover::after {
    bottom: auto;
    top: 100%;
    margin-bottom: 0;
    margin-top: 8px;
}

#page-admin .icon-picker-item.selected {
    border-color: var(--primary-color);
    background: rgba(24, 144, 255, 0.15);
}

#page-admin .icon-picker-item svg {
    width: 28px;
    height: 28px;
}

#page-admin .modal-sm {
    max-width: 400px;
}

/* ============================================================
 * 管理后台样式微调（叠加在移植的旧样式之上，对齐 rebuild 主站观感）
 * ============================================================ */
#page-admin {
    /* 主色对齐 rebuild 的 blue-600 */
    --primary-color: #2563eb;
    --border-color: #f3f4f6;
    --bg-color: #f8f9fb;
    --text-color: #1f2937;
    --text-secondary: #6b7280;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

/* 整个 admin 包成一张卡片，去掉与 chrome 重复的留白 */
#page-admin .admin-layout {
    margin-top: 0;
    min-height: calc(100vh - 160px);
    background: #fff;
    border: 1px solid #f3f4f6;
    border-radius: 16px;
    overflow: hidden;
}

/* 左侧 sidebar：去掉硬边框，换成柔和右分隔 */
#page-admin .admin-sidebar {
    width: 200px;
    background: #fafbfc;
    border-right: 1px solid #f3f4f6;
    padding: 20px 14px;
}
#page-admin .admin-sidebar h2 {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* nav item：选中态用淡蓝 + 蓝字，hover 浅灰 */
#page-admin .admin-nav-item {
    padding: 9px 12px;
    font-size: 14px;
    color: #4b5563;
    border-radius: 8px;
    margin-bottom: 2px;
}
#page-admin .admin-nav-item:hover {
    background: #f3f4f6;
}
#page-admin .admin-nav-item.active {
    background: #eff6ff;
    color: #2563eb;
    font-weight: 500;
}

/* 返回首页 link */
#page-admin .admin-back {
    color: #9ca3af;
    font-size: 13px;
    padding: 8px 12px;
}
#page-admin .admin-back:hover {
    color: #2563eb;
}

/* 右侧内容区 */
#page-admin .admin-content {
    padding: 24px 28px;
}
#page-admin .admin-header {
    margin-bottom: 16px;
}
#page-admin .admin-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}
#page-admin .admin-header input {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f8f9fb;
    font-size: 13px;
    width: 220px;
}
#page-admin .admin-header input:focus {
    outline: none;
    border-color: #93c5fd;
    background: #fff;
}

/* 表格：去除粗 border，行间软分隔 */
#page-admin .admin-table {
    border: none;
    font-size: 13px;
}
#page-admin .admin-table th {
    background: #fafbfc;
    color: #6b7280;
    font-weight: 500;
    font-size: 12px;
    text-transform: none;
    border-bottom: 1px solid #f3f4f6;
}
#page-admin .admin-table td {
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
    padding: 10px 12px;
}
#page-admin .admin-table tr:hover td {
    background: #fafbfc;
}
#page-admin .post-content-cell {
    max-width: 380px;
    color: #1f2937;
}

/* 按钮：删除 / 编辑 / 主按钮 风格统一 */
#page-admin .btn-primary {
    background: #2563eb;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}
#page-admin .btn-primary:hover { background: #1d4ed8; opacity: 1; }

#page-admin .btn-secondary {
    background: #fff;
    color: #4b5563;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
}
#page-admin .btn-secondary:hover { background: #f3f4f6; }

#page-admin .btn-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
}
#page-admin .btn-danger:hover { background: #fee2e2; opacity: 1; }

#page-admin .btn-sm { padding: 5px 12px; font-size: 12px; }

/* 热门配置 form 卡片 */
#page-admin .admin-form-card {
    background: #fafbfc;
    border: 1px solid #f3f4f6;
    border-radius: 12px;
    padding: 24px;
    max-width: 560px;
}
#page-admin .form-row input {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
}
#page-admin .form-row input:focus {
    outline: none;
    border-color: #93c5fd;
}
#page-admin .form-hint {
    color: #9ca3af;
    font-size: 12px;
}

/* 模态框：圆角 + 阴影柔和 */
#page-admin .modal-content {
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    padding: 24px;
}
#page-admin .modal-content h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
}
#page-admin .modal-content textarea {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    resize: vertical;
}

/* 图标选择器 grid */
#page-admin .icon-picker-item {
    border: 1px solid transparent;
    border-radius: 8px;
}
#page-admin .icon-picker-item:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
}
#page-admin .icon-picker-item.selected {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #2563eb;
}

/* ---------- 排序表头 + 分页栏 ---------- */
#page-admin .admin-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 18px;
}
#page-admin .admin-table th.sortable:hover {
    color: #2563eb;
}
#page-admin .admin-table th.sortable::after {
    content: '';
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 4px solid #d1d5db;
    margin-bottom: 6px;
    box-shadow: 0 6px 0 -2px #d1d5db;
    opacity: 0.6;
}
#page-admin .admin-table th.sort-asc::after {
    border-bottom-color: #2563eb;
    box-shadow: none;
    opacity: 1;
}
#page-admin .admin-table th.sort-desc::after {
    border-bottom: none;
    border-top: 4px solid #2563eb;
    margin-bottom: 0;
    box-shadow: none;
    opacity: 1;
}

#page-admin .admin-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 4px 4px;
    font-size: 13px;
    color: #6b7280;
}
#page-admin .admin-pagination .page-info {
    color: #9ca3af;
}
#page-admin .admin-pagination .page-ctrl {
    display: flex;
    align-items: center;
    gap: 8px;
}
#page-admin .admin-pagination .page-btn {
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #4b5563;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
}
#page-admin .admin-pagination .page-btn:hover:not(:disabled) {
    background: #f3f4f6;
    border-color: #d1d5db;
}
#page-admin .admin-pagination .page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
#page-admin .admin-pagination .page-num {
    font-variant-numeric: tabular-nums;
    color: #374151;
    min-width: 60px;
    text-align: center;
}
#page-admin .admin-pagination .page-size {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    color: #4b5563;
    cursor: pointer;
}

/* ---------- 模态框微调（更紧凑 + label 对齐 + 输入框统一）---------- */
#page-admin .modal-content {
    max-width: 440px;
    padding: 22px 24px;
}
#page-admin .modal-content h3 {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f3f4f6;
}
#page-admin .modal-content .form-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 14px;
}
#page-admin .modal-content .form-row label {
    width: 56px;
    flex-shrink: 0;
    font-size: 13px;
    color: #6b7280;
    line-height: 32px;
}
#page-admin .modal-content .form-row input[type="text"],
#page-admin .modal-content .form-row input[type="number"] {
    flex: 1;
    width: auto;
    height: 32px;
    padding: 0 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    font-size: 13px;
    color: #1f2937;
    transition: border-color .15s;
}
#page-admin .modal-content .form-row input:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.2);
}
#page-admin .modal-content .form-row textarea {
    flex: 1;
    width: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    color: #1f2937;
    line-height: 1.5;
    min-height: 64px;
    resize: vertical;
}
#page-admin .modal-content .form-row textarea:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.2);
}

/* 图标选择行：预览框更精致 */
#page-admin .icon-select-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}
#page-admin .icon-preview {
    width: 36px;
    height: 36px;
    border: 1px dashed #d1d5db;
    border-radius: 8px;
    background: #fafbfc;
    color: #6b7280;
}
#page-admin .icon-preview svg {
    width: 20px;
    height: 20px;
}
#page-admin .icon-select-wrapper .btn-secondary {
    height: 32px;
    padding: 0 14px;
    line-height: 1;
}

/* 底部按钮区：分隔线 + 紧凑 */
#page-admin .modal-actions {
    margin-top: 22px;
    padding-top: 14px;
    border-top: 1px solid #f3f4f6;
    gap: 8px;
}
#page-admin .modal-actions .btn-primary {
    padding: 7px 18px;
    font-size: 13px;
}
#page-admin .modal-actions .btn-secondary {
    padding: 7px 16px;
    font-size: 13px;
}

/* 动态编辑弹窗：更宽 + select 样式 + 字数计数 */
#page-admin #post-edit-modal .modal-content {
    max-width: 560px;
}
#page-admin #post-edit-modal .form-row label {
    width: 64px;
}
#page-admin #post-edit-modal textarea {
    min-height: 140px;
    line-height: 1.6;
}
#page-admin .form-row select {
    flex: 1;
    width: auto;
    height: 32px;
    padding: 0 28px 0 10px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M1 1l4 4 4-4'/></svg>")
        no-repeat right 10px center;
    font-size: 13px;
    color: #1f2937;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
#page-admin .form-row select:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.2);
}
#page-admin .post-edit-counter {
    margin-top: -6px;
    margin-left: 78px;
    font-size: 12px;
    color: #9ca3af;
    text-align: right;
}
#page-admin .post-edit-counter.over {
    color: #dc2626;
}

/* 表格操作列：紧凑文字按钮 inline + 间距 */
#page-admin .admin-table td:last-child {
    white-space: nowrap;
}
#page-admin .admin-table td .btn-sm {
    padding: 4px 10px;
    margin-right: 0;
}
#page-admin .admin-table td .btn-sm + .btn-sm {
    margin-left: 6px;
}

/* 图标选择器面板（在图标弹窗里）更宽更舒适 */
#page-admin #icon-picker-modal .modal-content {
    max-width: 480px;
}
#page-admin .icon-picker-grid-modal {
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    padding: 8px 0;
    max-height: 360px;
}
#page-admin .icon-picker-item {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4b5563;
}
