/* ===========================================================
   CMS 文章管理系统 - 后台管理样式
   =========================================================== */

/* ---- Reset & Base ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background: #f0f2f5;
}

a {
    color: #1890ff;
    text-decoration: none;
}
a:hover {
    color: #40a9ff;
}

.text-muted { color: #999; }
.text-danger { color: #e74c3c; }
.text-center { text-align: center; }
.small { font-size: 12px; }
.ml-2 { margin-left: 8px; }

/* ---- Login Page ---- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: #fff;
    border-radius: 8px;
    padding: 40px 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.login-title {
    text-align: center;
    font-size: 24px;
    color: #333;
    margin-bottom: 4px;
}

.login-subtitle {
    text-align: center;
    color: #999;
    font-size: 14px;
    margin-bottom: 30px;
}

/* ---- Admin Layout ---- */
.admin-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 24px;
    background: #001529;
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-logo {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
}
.header-logo:hover { color: #1890ff; }

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-user {
    color: rgba(255,255,255,0.85);
    font-size: 13px;
}

.header-link {
    color: rgba(255,255,255,0.65);
    font-size: 13px;
    transition: color 0.2s;
}
.header-link:hover { color: #fff; }
.header-logout:hover { color: #ff4d4f; }

.admin-body {
    display: flex;
    margin-top: 56px;
    min-height: calc(100vh - 56px);
}

.admin-sidebar {
    width: 240px;
    background: #0f172a;
    position: fixed;
    top: 56px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 50;
    display: flex;
    flex-direction: column;
}
.admin-sidebar::-webkit-scrollbar { width: 4px; }
.admin-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.sidebar-nav {
    padding: 16px 0;
    flex: 1;
}

/* 侧边栏分组标题 */
.sidebar-section-title {
    padding: 8px 20px 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.28);
    margin-top: 12px;
}
.sidebar-section-title:first-child { margin-top: 0; }

/* 侧边栏分隔线 */
.sidebar-divider {
    margin: 8px 16px;
    height: 1px;
    background: rgba(255,255,255,0.06);
    border: none;
}

/* 侧边栏链接 */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    margin: 2px 8px;
    border-radius: 8px;
    color: rgba(255,255,255,0.55);
    font-size: 13.5px;
    font-weight: 450;
    text-decoration: none;
    transition: all 0.18s ease;
    position: relative;
    white-space: nowrap;
}
.sidebar-link:hover {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.9);
}
.sidebar-link.active {
    background: rgba(59,130,246,0.15);
    color: #60a5fa;
    font-weight: 600;
}
.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: #3b82f6;
    border-radius: 0 3px 3px 0;
}

/* 侧边栏图标 */
.sidebar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.65;
    transition: opacity 0.18s;
}
.sidebar-link:hover .sidebar-icon,
.sidebar-link.active .sidebar-icon {
    opacity: 1;
}
.sidebar-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* 侧边栏底部 */
.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.sidebar-footer-info {
    font-size: 11px;
    color: rgba(255,255,255,0.22);
    display: flex;
    align-items: center;
    gap: 6px;
}
.sidebar-footer-info .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
}

.admin-content {
    flex: 1;
    margin-left: 240px;
    padding: 24px;
    min-height: calc(100vh - 56px);
}

.admin-footer {
    display: none;
}

/* ---- Page Title ---- */
.page-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin-bottom: 20px;
}

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

/* ---- Cards ---- */
.welcome-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    font-size: 15px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: #999;
}

.stat-blue .stat-number { color: #1890ff; }
.stat-green .stat-number { color: #52c41a; }
.stat-orange .stat-number { color: #fa8c16; }
.stat-red .stat-number { color: #f5222d; }
.stat-purple .stat-number { color: #722ed1; }
.stat-teal .stat-number { color: #13c2c2; }
.stat-pink .stat-number { color: #eb2f96; }

/* ---- Dashboard Grid ---- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.dashboard-panel {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.panel-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f2f5;
}

/* ---- Top List ---- */
.top-list {
    list-style: none;
    padding: 0;
}

.top-list li {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f5f5f5;
    gap: 8px;
}

.top-list li:last-child {
    border-bottom: none;
}

.top-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #f0f2f5;
    font-size: 12px;
    font-weight: 700;
    color: #666;
    flex-shrink: 0;
}

.top-rank-1 { background: #ff4d4f; color: #fff; }
.top-rank-2 { background: #fa8c16; color: #fff; }
.top-rank-3 { background: #1890ff; color: #fff; }

.top-list li a {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Table ---- */
.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #f0f2f5;
}

.table th {
    background: #fafafa;
    font-weight: 600;
    font-size: 13px;
    color: #666;
}

.table tbody tr:hover {
    background: #fafafa;
}

.table-compact th,
.table-compact td {
    padding: 10px 12px;
}

/* ---- Status Badge ---- */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.status-published { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.status-draft { background: #fff7e6; color: #fa8c16; border: 1px solid #ffd591; }
.status-trash { background: #fff1f0; color: #f5222d; border: 1px solid #ffa39e; }

/* ---- Buttons ---- */
.btn {
    display: inline-block;
    padding: 8px 20px;
    border-radius: 4px;
    border: 1px solid #d9d9d9;
    background: #fff;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    line-height: 1.5;
}
.btn:hover {
    border-color: #1890ff;
    color: #1890ff;
}

.btn-primary {
    background: #1890ff;
    border-color: #1890ff;
    color: #fff;
}
.btn-primary:hover {
    background: #40a9ff;
    border-color: #40a9ff;
    color: #fff;
}

.btn-secondary {
    background: #fff;
    border-color: #d9d9d9;
    color: #333;
}
.btn-secondary:hover {
    border-color: #1890ff;
    color: #1890ff;
}

.btn-success {
    background: #52c41a;
    border-color: #52c41a;
    color: #fff;
}
.btn-success:hover {
    background: #73d13d;
    border-color: #73d13d;
    color: #fff;
}

.btn-warning {
    background: #fa8c16;
    border-color: #fa8c16;
    color: #fff;
}
.btn-warning:hover {
    background: #ffa940;
    border-color: #ffa940;
    color: #fff;
}

.btn-danger {
    background: #f5222d;
    border-color: #f5222d;
    color: #fff;
}
.btn-danger:hover {
    background: #ff4d4f;
    border-color: #ff4d4f;
    color: #fff;
}

.btn-info {
    background: #13c2c2;
    border-color: #13c2c2;
    color: #fff;
}
.btn-info:hover {
    background: #36cfc9;
    border-color: #36cfc9;
    color: #fff;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 12px;
}

.btn-block {
    display: block;
    width: 100%;
}

/* ---- Form Controls ---- */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
    color: #555;
}

.form-control {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24,144,255,0.15);
}

.form-control-lg {
    font-size: 18px;
    padding: 12px 16px;
    font-weight: 600;
}

select.form-control {
    cursor: pointer;
}

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

.required {
    color: #f5222d;
}

/* ---- Alert ---- */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-success {
    background: #f6ffed;
    border: 1px solid #b7eb8f;
    color: #52c41a;
}

.alert-danger {
    background: #fff1f0;
    border: 1px solid #ffa39e;
    color: #f5222d;
}

/* ---- Filter Bar ---- */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    flex-shrink: 0;
}

.filter-search {
    flex: 1;
    min-width: 200px;
}

.filter-input {
    height: 36px;
}

/* ---- Batch Bar ---- */
.batch-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px 16px;
    background: #fafafa;
    border-radius: 4px;
    border: 1px solid #f0f2f5;
}

.checkbox-inline {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 13px;
}

/* ---- Action Links ---- */
.action-links {
    white-space: nowrap;
}
.action-links a {
    margin-right: 8px;
    font-size: 13px;
}

/* ---- Pagination ---- */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
}

.pagination-list {
    display: flex;
    gap: 4px;
    list-style: none;
}

.pagination-list li a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-size: 13px;
    transition: all 0.2s;
}

.pagination-list li a:hover {
    border-color: #1890ff;
    color: #1890ff;
}

.pagination-list li.active a {
    background: #1890ff;
    border-color: #1890ff;
    color: #fff;
}

/* ---- Form Panel ---- */
.form-panel {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.form-panel h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f2f5;
}

/* ---- Inline Form ---- */
.inline-form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.inline-form-row .form-group {
    margin-bottom: 0;
}

/* ---- Article Edit ---- */
.article-form .form-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 24px;
    align-items: start;
}

.form-main {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.form-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-panel {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.sidebar-panel h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f2f5;
}

/* ---- SEO Collapse ---- */
.seo-collapse {
    margin-top: 16px;
}

.seo-toggle {
    color: #999;
    font-size: 13px;
}
.seo-toggle:hover {
    color: #1890ff;
}

.seo-fields {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #e8e8e8;
}

/* ---- Modal ---- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.45);
}

.modal-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 520px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #f0f2f5;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    font-size: 24px;
    color: #999;
    line-height: 1;
}
.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid #f0f2f5;
}

/* ---- Settings ---- */
.settings-form .form-panel {
    max-width: 700px;
}

/* ---- Article Title Link ---- */
.article-title-link {
    font-weight: 500;
}

/* ---- wangEditor Override ---- */
#editor {
    border: 1px solid #d9d9d9;
    border-radius: 4px;
}
#editor:focus-within {
    border-color: #1890ff;
    box-shadow: 0 0 0 2px rgba(24,144,255,0.15);
}

/* ---- Responsive ---- */
@media (max-width: 992px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

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

    .admin-sidebar {
        width: 56px;
        overflow: hidden;
    }
    .admin-sidebar:hover {
        width: 240px;
        overflow-y: auto;
    }
    .admin-content {
        margin-left: 56px;
    }
    .sidebar-link {
        padding: 10px 16px;
        font-size: 0;
        justify-content: center;
    }
    .admin-sidebar:hover .sidebar-link {
        font-size: 13.5px;
        justify-content: flex-start;
    }
    .sidebar-link .sidebar-label { display: none; }
    .admin-sidebar:hover .sidebar-link .sidebar-label { display: inline; }
    .sidebar-section-title { font-size: 0; padding: 4px; }
    .admin-sidebar:hover .sidebar-section-title { font-size: 10px; padding: 8px 20px 6px; }
    .sidebar-footer { display: none; }
    .admin-sidebar:hover .sidebar-footer { display: block; }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .filter-bar {
        flex-direction: column;
    }

    .filter-search {
        width: 100%;
    }

    .inline-form-row {
        flex-direction: column;
    }

    .admin-content {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .admin-header {
        padding: 0 12px;
    }

    .header-user {
        display: none;
    }
}

/* ---- 插件管理 ---- */
.icon-plugin::before { content: "\25A3"; }
.status-enabled { color: #52c41a; font-weight: bold; }
.status-disabled { color: #d9d9d9; }
.code-editor {
    width: 100%;
    min-height: 300px;
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.8;
    padding: 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    resize: vertical;
    background: #fafafa;
    tab-size: 4;
}
.plugin-actions { white-space: nowrap; }
.plugin-actions form { display: inline; }
