/* ========== 基础重置 ========== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0
}

html {
    font-size: 14px
}

body {
    font-family: "PingFang SC","Microsoft YaHei",sans-serif;
    color: #1a1a2e;
    background: #f0f2f5;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh
}

a {
    color: inherit;
    text-decoration: none
}

ul {
    list-style: none
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none
}

input, select, textarea {
    font-family: inherit;
    outline: none;
    border: 1px solid #d9dce0;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    transition: border .2s,box-shadow .2s;
    width: 100%
}

    input:focus, select:focus, textarea:focus {
        border-color: #4a90d9;
        box-shadow: 0 0 0 3px rgba(74,144,217,.12)
    }

textarea {
    resize: vertical;
    min-height: 200px;
    line-height: 1.8
}

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px
}

.required {
    color: #e74c3c
}

/* ========== 登录页 ========== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg,#0a1628 0%,#0f2440 40%,#1a3a6c 100%);
    padding: 20px
}

.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3)
}

    .login-card .login-logo {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-bottom: 32px
    }

        .login-card .login-logo .logo-cn {
            font-size: 28px;
            font-weight: 800;
            color: #2d6cb0;
            letter-spacing: 3px
        }

        .login-card .login-logo .logo-en {
            font-size: 11px;
            color: #999;
            letter-spacing: 1px;
            margin-top: 4px
        }

    .login-card h2 {
        text-align: center;
        font-size: 20px;
        color: #0a1628;
        margin-bottom: 28px
    }

.login-form .form-group {
    margin-bottom: 20px
}

.login-form input {
    padding: 12px 16px;
    font-size: 15px
}

.login-form .btn-primary.full {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    margin-top: 8px
}

.login-error {
    color: #e74c3c;
    font-size: 13px;
    text-align: center;
    margin-top: 12px;
    min-height: 18px
}

.login-hint {
    text-align: center;
    font-size: 12px;
    color: #999;
    margin-top: 20px
}

/* ========== 后台布局 ========== */
.admin-app {
    display: flex;
    min-height: 100vh
}

/* 侧边栏 */
.sidebar {
    width: 240px;
    background: linear-gradient(180deg,#0a1628,#0f2440);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform .3s
}

.sidebar-logo {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    flex-direction: column
}

    .sidebar-logo .logo-cn {
        font-size: 20px;
        font-weight: 700;
        color: #4a90d9;
        letter-spacing: 2px
    }

    .sidebar-logo .logo-en {
        font-size: 10px;
        color: rgba(255,255,255,.4);
        margin-top: 2px
    }

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    color: rgba(255,255,255,.65);
    font-size: 14px;
    transition: all .2s
}

    .nav-item:hover {
        background: rgba(255,255,255,.08);
        color: #fff
    }

    .nav-item.active {
        background: linear-gradient(135deg,rgba(74,144,217,.25),rgba(45,108,176,.2));
        color: #fff;
        box-shadow: inset 3px 0 0 #4a90d9
    }

.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.08)
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg,#4a90d9,#2d6cb0);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700
}

.user-name {
    font-size: 14px;
    font-weight: 600
}

.user-role {
    font-size: 11px;
    color: rgba(255,255,255,.5)
}

.btn-logout {
    width: 100%;
    padding: 10px;
    background: rgba(255,255,255,.08);
    color: rgba(255,255,255,.7);
    border-radius: 8px;
    font-size: 13px;
    transition: all .2s
}

    .btn-logout:hover {
        background: rgba(231,76,60,.2);
        color: #e74c3c
    }

/* 主内容区 */
.main-content {
    margin-left: 240px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh
}

.top-bar {
    height: 64px;
    background: #fff;
    border-bottom: 1px solid #e8eaed;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 50
}

.page-title {
    font-size: 18px;
    font-weight: 700;
    color: #0a1628
}

.top-actions {
    display: flex;
    gap: 12px
}

/* ========== Tab 面板 ========== */
.tab-panel {
    display: none;
    padding: 28px;
    flex: 1
}

    .tab-panel.active {
        display: block
    }

/* ========== 统计卡片 ========== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 20px;
    margin-bottom: 28px
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,.04);
    transition: all .3s
}

    .stat-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 24px rgba(0,0,0,.08)
    }

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px
}

.stat-card.blue .stat-icon {
    background: rgba(74,144,217,.12)
}

.stat-card.green .stat-icon {
    background: rgba(46,204,113,.12)
}

.stat-card.orange .stat-icon {
    background: rgba(243,156,18,.12)
}

.stat-card.purple .stat-icon {
    background: rgba(155,89,182,.12)
}

.stat-info .stat-num {
    font-size: 28px;
    font-weight: 800;
    color: #0a1628;
    line-height: 1.1
}

.stat-info .stat-label {
    font-size: 12px;
    color: #888;
    margin-top: 4px
}

/* ========== 面板 ========== */
.panel {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0,0,0,.04);
    margin-bottom: 24px;
    overflow: hidden
}

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

    .panel-header h3 {
        font-size: 16px;
        font-weight: 700;
        color: #0a1628
    }

.panel-body {
    padding: 24px
}

    .panel-body.no-padding {
        padding: 0
    }

/* ========== 数据表格 ========== */
.data-table {
    width: 100%;
    border-collapse: collapse
}

    .data-table thead {
        background: #f7f9fc
    }

    .data-table th {
        text-align: left;
        padding: 14px 20px;
        font-size: 12px;
        font-weight: 600;
        color: #666;
        text-transform: uppercase;
        letter-spacing: .5px;
        border-bottom: 1px solid #eef0f3
    }

    .data-table td {
        padding: 16px 20px;
        font-size: 13px;
        color: #333;
        border-bottom: 1px solid #f5f6f8;
        vertical-align: middle
    }

    .data-table tbody tr:hover {
        background: #f8fafd
    }

    .data-table .news-title-cell {
        max-width: 360px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-weight: 500
    }

    .data-table .status-badge {
        display: inline-block;
        padding: 3px 10px;
        border-radius: 20px;
        font-size: 12px;
        font-weight: 500
    }

.status-badge.published {
    background: rgba(46,204,113,.12);
    color: #27ae60
}

.status-badge.draft {
    background: rgba(243,156,18,.12);
    color: #e67e22
}

/* ========== 操作按钮 ========== */
.btn-edit {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: rgba(74,144,217,.1);
    color: #4a90d9;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    transition: all .2s;
    margin-right: 6px
}

    .btn-edit:hover {
        background: rgba(74,144,217,.2)
    }

.btn-delete {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: rgba(231,76,60,.08);
    color: #e74c3c;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    transition: all .2s
}

    .btn-delete:hover {
        background: rgba(231,76,60,.18)
    }

/* ========== 搜索 & 分页 ========== */
.panel-actions {
    display: flex;
    align-items: center;
    gap: 12px
}

.search-input {
    max-width: 260px;
    padding: 9px 14px;
    font-size: 13px
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px
}

.page-btn {
    padding: 8px 14px;
    border: 1px solid #e0e3e8;
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
    color: #555;
    transition: all .2s;
    cursor: pointer
}

    .page-btn:hover:not(:disabled) {
        border-color: #4a90d9;
        color: #4a90d9
    }

    .page-btn.active {
        background: #4a90d9;
        color: #fff;
        border-color: #4a90d9
    }

    .page-btn:disabled {
        opacity: .4;
        cursor: not-allowed
    }

.page-info {
    font-size: 12px;
    color: #999
}

/* ========== 表单 ========== */
.news-form {
    max-width: 760px
}

.form-row {
    margin-bottom: 22px
}

    .form-row.two-cols {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
        margin-bottom: 22px
    }

.char-count {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
    text-align: right
}

.form-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid #f0f2f5
}

/* ========== 按钮 ========== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 11px 28px;
    background: linear-gradient(135deg,#4a90d9,#2d6cb0);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    transition: all .3s;
    border: none;
    cursor: pointer;
    letter-spacing: .5px
}

    .btn-primary:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 16px rgba(74,144,217,.4)
    }

.btn-primary-sm {
    padding: 8px 18px;
    font-size: 13px;
    background: linear-gradient(135deg,#4a90d9,#2d6cb0);
    color: #fff;
    border-radius: 8px;
    font-weight: 500;
    transition: all .2s;
    display: inline-flex;
    align-items: center;
    gap: 4px
}

    .btn-primary-sm:hover {
        transform: translateY(-1px);
        box-shadow: 0 3px 12px rgba(74,144,217,.35)
    }

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    background: transparent;
    color: #4a90d9;
    font-size: 14px;
    font-weight: 500;
    border: 1.5px solid #4a90d9;
    border-radius: 8px;
    transition: all .2s;
    cursor: pointer
}

    .btn-outline:hover {
        background: #4a90d9;
        color: #fff
    }

.btn-outline-sm {
    padding: 7px 14px;
    font-size: 12px;
    background: transparent;
    color: #4a90d9;
    border: 1px solid #4a90d9;
    border-radius: 6px;
    transition: all .2s
}

    .btn-outline-sm:hover {
        background: #4a90d9;
        color: #fff
    }

.btn-text {
    background: none;
    border: none;
    color: #999;
    font-size: 13px;
    cursor: pointer;
    padding: 8px 12px
}

    .btn-text:hover {
        color: #4a90d9
    }

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    background: rgba(231,76,60,.08);
    color: #e74c3c;
    font-size: 14px;
    font-weight: 500;
    border: 1.5px solid #e74c3c;
    border-radius: 8px;
    transition: all .2s;
    cursor: pointer
}

    .btn-danger:hover {
        background: #e74c3c;
        color: #fff
    }

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 20px
}

/* ========== 设置页 ========== */
.settings-group {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid #f0f2f5
}

    .settings-group:last-child {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0
    }

    .settings-group h4 {
        font-size: 15px;
        font-weight: 700;
        color: #0a1628;
        margin-bottom: 8px
    }

.settings-desc {
    font-size: 13px;
    color: #888;
    margin-bottom: 16px;
    line-height: 1.8
}

.settings-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap
}

.code-block {
    background: #1e2a3a;
    border-radius: 12px;
    padding: 20px 24px;
    overflow-x: auto;
    margin-top: 12px
}

    .code-block pre {
        color: #a8c8e8;
        font-size: 13px;
        line-height: 1.8;
        font-family: "Fira Code","Consolas",monospace;
        white-space: pre-wrap
    }

/* ========== 确认弹窗 ========== */
.confirm-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center
}

    .confirm-modal.open {
        display: flex
    }

.confirm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10,22,40,.5);
    backdrop-filter: blur(4px)
}

.confirm-panel {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 36px 32px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    animation: confirmIn .25s ease
}

@keyframes confirmIn {
    from {
        opacity: 0;
        transform: scale(.92)
    }

    to {
        opacity: 1;
        transform: scale(1)
    }
}

.confirm-icon {
    font-size: 42px;
    margin-bottom: 16px
}

.confirm-panel h3 {
    font-size: 18px;
    color: #0a1628;
    margin-bottom: 10px
}

.confirm-panel p {
    font-size: 14px;
    color: #666;
    margin-bottom: 24px;
    line-height: 1.7
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center
}

/* ========== Toast ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 8px
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,.12);
    font-size: 14px;
    font-weight: 500;
    animation: toastIn .3s ease;
    max-width: 360px
}

    .toast.success {
        border-left: 4px solid #2ecc71;
        color: #27ae60
    }

    .toast.error {
        border-left: 4px solid #e74c3c;
        color: #c0392b
    }

    .toast.info {
        border-left: 4px solid #4a90d9;
        color: #2d6cb0
    }

    .toast.fade-out {
        animation: toastOut .3s ease forwards
    }

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(60px)
    }

    to {
        opacity: 1;
        transform: translateX(0)
    }
}

@keyframes toastOut {
    from {
        opacity: 1
    }

    to {
        opacity: 0;
        transform: translateX(60px)
    }
}

/* ========== 链接按钮 ========== */
.link-btn {
    font-size: 13px;
    color: #4a90d9;
    font-weight: 500;
    transition: color .2s
}

    .link-btn:hover {
        color: #2d6cb0;
        text-decoration: underline
    }

/* ========== 响应式 ========== */
@media (max-width:960px) {
    .sidebar {
        transform: translateX(-100%)
    }

        .sidebar.open {
            transform: translateX(0)
        }

    .main-content {
        margin-left: 0
    }

    .stats-row {
        grid-template-columns: repeat(2,1fr)
    }

    .form-row.two-cols {
        grid-template-columns: 1fr
    }

    .top-bar {
        padding: 0 16px
    }

    .tab-panel {
        padding: 16px
    }

    .data-table th:nth-child(4), .data-table td:nth-child(4) {
        display: none
    }
}

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

    .panel-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start
    }

    .panel-actions {
        flex-direction: column;
        width: 100%
    }

    .search-input {
        max-width: none;
        width: 100%
    }
}

/* ========== 新闻配图上传（追加，原有规则未改动） ========== */
.opt {
    color: #999;
    font-weight: 400;
    font-size: 12px;
    margin-left: 4px
}

.pic-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px
}

    .pic-grid:empty {
        margin-bottom: 0
    }

.pic-item {
    position: relative;
    width: 132px;
    border: 1px solid #e8eaed;
    border-radius: 10px;
    overflow: hidden;
    background: #fafbfc
}

    .pic-item.is-cover {
        border-color: #4a90d9;
        box-shadow: 0 0 0 2px rgba(74,144,217,.18)
    }

.pic-thumb {
    width: 100%;
    height: 88px;
    object-fit: cover;
    display: block;
    background: #eef0f3
}

.pic-thumb-fallback {
    width: 100%;
    height: 88px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9aa3b0;
    font-size: 12px;
    background: #f0f2f5
}

.pic-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    font-size: 11px;
    color: #888;
    gap: 4px
}

.pic-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 78px
}

.pic-cover-tag {
    color: #4a90d9;
    font-weight: 600;
    flex-shrink: 0
}

.pic-ops {
    display: flex;
    border-top: 1px solid #eef0f3
}

    .pic-ops button {
        flex: 1;
        padding: 6px 0;
        font-size: 11px;
        background: #fff;
        color: #666;
        border: none;
        cursor: pointer;
        transition: all .15s
    }

        .pic-ops button:hover:not(:disabled) {
            background: #f0f5fc;
            color: #4a90d9
        }

        .pic-ops button:disabled {
            opacity: .35;
            cursor: not-allowed
        }

    .pic-ops .pic-del:hover {
        background: rgba(231,76,60,.1);
        color: #e74c3c
    }

.pic-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(10,22,40,.65);
    color: #fff;
    font-size: 13px;
    line-height: 1;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center
}

    .pic-remove:hover {
        background: #e74c3c
    }

.pic-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap
}

.pic-input {
    display: none
}

.pic-pick {
    cursor: pointer
}

.pic-tip {
    font-size: 12px;
    color: #999
}

.pic-hidden {
    display: none
}

/* 前台新闻配图（如已存在同名规则可不加） */
.news-figure {
    margin: 16px 0;
    text-align: center
}

    .news-figure img {
        max-width: 100%;
        height: auto;
        border-radius: 10px;
        box-shadow: 0 2px 14px rgba(0,0,0,.08)
    }

.news-detail-text .news-figure:first-child {
    margin-top: 0
}
