/* ============================================
   后台管理面板样式
   ============================================ */

/* --- 后台布局 --- */
.admin-layout {
    display: flex;
    min-height: 100vh;
    padding-top: var(--navbar-height);
}

.admin-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 24px;
    min-height: calc(100vh - var(--navbar-height));
}

.admin-content-full {
    margin-left: 0;
}

/* --- 后台导航栏 --- */
.admin-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
    padding: 0 20px;
    height: 100%;
}

.admin-navbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    color: var(--text-on-glass-muted);
    font-size: 0.85rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.admin-user-menu:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-on-glass);
}

.admin-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--win-blue-light), var(--win-blue-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
}

/* --- 后台侧边栏 --- */
.admin-sidebar-nav {
    padding: 8px 0;
}

.sidebar-section-label {
    padding: 12px 20px 6px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.3);
    font-weight: 600;
}

.admin-sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--text-on-glass-muted);
    font-size: 0.88rem;
    text-decoration: none;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
    margin: 1px 0;
}

.admin-sidebar-link:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-on-glass);
    text-decoration: none;
}

.admin-sidebar-link.active {
    background: rgba(74, 143, 212, 0.15);
    color: var(--text-on-glass);
    border-left-color: var(--win-blue-light);
}

.admin-sidebar-link svg {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}

/* --- 后台页面标题 --- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--text-on-glass);
}

.page-title svg {
    width: 24px;
    height: 24px;
    color: var(--win-blue-light);
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- 仪表盘 --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: var(--blur-standard);
    -webkit-backdrop-filter: var(--blur-standard);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-window-light);
    transition: all var(--transition-normal);
}

.stat-card:hover {
    border-color: rgba(255,255,255,0.45);
    box-shadow: var(--shadow-window);
    transform: translateY(-2px);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.stat-card-label {
    font-size: 0.82rem;
    color: var(--text-on-glass-muted);
}

.stat-card-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card-icon svg {
    width: 20px;
    height: 20px;
    color: #fff;
}

.stat-card-icon.blue {
    background: linear-gradient(135deg, #4A8FD4, #2B5797);
}

.stat-card-icon.green {
    background: linear-gradient(135deg, #2CA855, #1E8C45);
}

.stat-card-icon.orange {
    background: linear-gradient(135deg, #E8A317, #CC8800);
}

.stat-card-icon.red {
    background: linear-gradient(135deg, #E85D59, #D4423E);
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 300;
    color: var(--text-on-glass);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card-change {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.4);
}

/* 仪表盘两列布局 */
.dashboard-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* --- 文章管理表格 --- */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.table-search {
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-search-input {
    padding: 6px 12px;
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--border-lighter);
    border-radius: var(--radius-sm);
    color: var(--text-on-glass);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    width: 220px;
    transition: all var(--transition-fast);
}

.table-search-input:focus {
    border-color: var(--win-blue-light);
    background: rgba(255,255,255,0.14);
    box-shadow: 0 0 0 2px rgba(74,143,212,0.2);
}

.table-search-input::placeholder {
    color: rgba(255,255,255,0.35);
}

.table-filter-select {
    padding: 6px 28px 6px 10px;
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--border-lighter);
    border-radius: var(--radius-sm);
    color: var(--text-on-glass);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='rgba(255,255,255,0.5)' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

.table-filter-select option {
    background: #1a2a40;
    color: #fff;
}

/* 表格内操作按钮 */
.table-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.table-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-lighter);
    border-radius: var(--radius-sm);
    color: var(--text-on-glass-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.table-action-btn:hover {
    background: rgba(255,255,255,0.15);
    color: var(--text-on-glass);
    text-decoration: none;
}

.table-action-btn.edit:hover {
    background: rgba(74, 143, 212, 0.25);
    color: #93C5FD;
}

.table-action-btn.delete:hover {
    background: rgba(212, 66, 62, 0.25);
    color: #FCA5A5;
}

.table-action-btn svg {
    width: 15px;
    height: 15px;
}

/* 文章状态标签 */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    font-size: 0.75rem;
    border-radius: 10px;
}

.status-badge.published {
    background: rgba(30, 140, 69, 0.2);
    color: #86EFAC;
    border: 1px solid rgba(30, 140, 69, 0.25);
}

.status-badge.draft {
    background: rgba(232, 163, 23, 0.2);
    color: #FDE68A;
    border: 1px solid rgba(232, 163, 23, 0.25);
}

/* --- 文章编辑器页面 --- */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

.editor-main .aero-window {
    overflow: visible;
}

.editor-sidebar-section {
    margin-bottom: 20px;
}

.editor-sidebar-section:last-child {
    margin-bottom: 0;
}

.editor-title-input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255,255,255,0.06);
    border: none;
    border-bottom: 1px solid var(--border-lighter);
    color: var(--text-on-glass);
    font-family: inherit;
    font-size: 1.3rem;
    font-weight: 400;
    outline: none;
    transition: all var(--transition-fast);
}

.editor-title-input:focus {
    background: rgba(255,255,255,0.1);
    border-bottom-color: var(--win-blue-light);
    box-shadow: 0 2px 0 var(--win-blue-light);
}

.editor-title-input::placeholder {
    color: rgba(255,255,255,0.3);
}

/* 富文本编辑器工具栏 */
.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 8px 12px;
    background: rgba(0,0,0,0.15);
    border-bottom: 1px solid var(--border-lighter);
}

.editor-toolbar-btn {
    width: 32px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-on-glass-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
    font-size: 0.85rem;
}

.editor-toolbar-btn:hover {
    background: rgba(255,255,255,0.12);
    border-color: var(--border-lighter);
    color: var(--text-on-glass);
}

.editor-toolbar-btn.active {
    background: rgba(74, 143, 212, 0.25);
    color: #93C5FD;
}

.editor-toolbar-btn svg {
    width: 16px;
    height: 16px;
}

.editor-toolbar-sep {
    width: 1px;
    height: 24px;
    background: var(--border-lighter);
    margin: 3px 6px;
}

/* 编辑器文本区域 */
.editor-content {
    min-height: 500px;
    padding: 20px;
    background: rgba(255,255,255,0.04);
    color: var(--text-on-glass);
    font-size: 0.95rem;
    line-height: 1.8;
    outline: none;
    border: none;
    width: 100%;
    font-family: inherit;
}

.editor-content:focus {
    background: rgba(255,255,255,0.06);
}

/* 摘要输入 */
.editor-excerpt {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-lighter);
    border-radius: var(--radius-md);
    color: var(--text-on-glass);
    font-family: inherit;
    font-size: 0.88rem;
    line-height: 1.6;
    outline: none;
    resize: vertical;
    transition: border-color var(--transition-fast);
}

.editor-excerpt:focus {
    border-color: var(--win-blue-light);
}

.editor-excerpt::placeholder {
    color: rgba(255,255,255,0.3);
}

/* 封面图上传 */
.cover-upload-area {
    border: 2px dashed var(--border-lighter);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    background: rgba(255,255,255,0.03);
}

.cover-upload-area:hover {
    border-color: var(--win-blue-light);
    background: rgba(74, 143, 212, 0.06);
}

.cover-upload-area svg {
    width: 32px;
    height: 32px;
    color: rgba(255,255,255,0.25);
    margin-bottom: 8px;
}

.cover-upload-area p {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.4);
}

.cover-upload-area input[type="file"] {
    display: none;
}

.cover-preview {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-lighter);
}

.cover-preview img {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.cover-preview-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    background: rgba(0,0,0,0.6);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.cover-preview:hover .cover-preview-remove {
    opacity: 1;
}

/* --- 登录页 --- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: rgba(20, 35, 55, 0.85);
    backdrop-filter: var(--blur-heavy);
    -webkit-backdrop-filter: var(--blur-heavy);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-window);
    overflow: hidden;
}

.login-header {
    text-align: center;
    padding: 32px 32px 24px;
    background: linear-gradient(180deg, rgba(74,143,212,0.2) 0%, transparent 100%);
    border-bottom: 1px solid var(--border-lighter);
}

.login-logo {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--win-blue-light), var(--win-blue-dark));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(43, 87, 151, 0.4);
}

.login-logo svg {
    width: 32px;
    height: 32px;
    color: #fff;
}

.login-title {
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--text-on-glass);
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 0.82rem;
    color: var(--text-on-glass-muted);
}

.login-body {
    padding: 28px 32px 32px;
}

.login-form .form-group {
    margin-bottom: 18px;
}

.login-form .form-control-glass {
    padding: 10px 14px;
    font-size: 0.95rem;
}

.login-form .form-label {
    margin-bottom: 6px;
    font-size: 0.85rem;
}

.login-btn {
    width: 100%;
    padding: 10px;
    font-size: 0.95rem;
    margin-top: 8px;
}

.login-error {
    background: rgba(212, 66, 62, 0.12);
    border: 1px solid rgba(212, 66, 62, 0.25);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    margin-bottom: 16px;
    color: #FCA5A5;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.login-error svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* --- 系统设置页 --- */
.settings-section {
    margin-bottom: 28px;
}

.settings-section-title {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-on-glass);
    padding-bottom: 10px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-lighter);
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-section-title svg {
    width: 18px;
    height: 18px;
    color: var(--win-blue-light);
}

.settings-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 12px;
    align-items: start;
    margin-bottom: 16px;
}

.settings-label {
    font-size: 0.88rem;
    color: var(--text-on-glass-muted);
    padding-top: 8px;
}

.settings-hint {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.3);
    margin-top: 4px;
}

/* Logo上传 */
.logo-upload-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-preview {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-lighter);
    background: rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.logo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.logo-preview svg {
    width: 28px;
    height: 28px;
    color: rgba(255,255,255,0.2);
}

/* 背景图设置 */
.wallpaper-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

.wallpaper-option {
    aspect-ratio: 16/9;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-lighter);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.wallpaper-option:hover {
    border-color: rgba(255,255,255,0.4);
}

.wallpaper-option.selected {
    border-color: var(--win-blue-light);
    box-shadow: 0 0 0 2px rgba(74,143,212,0.3);
}

.wallpaper-option.selected::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 20px;
    height: 20px;
    background: var(--win-blue-light);
    border-radius: 50%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='white' d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
}

.wallpaper-option img,
.wallpaper-option .wallpaper-color {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- 响应式 --- */
@media (max-width: 960px) {
    .editor-layout {
        grid-template-columns: 1fr;
    }

    .dashboard-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .admin-content {
        margin-left: 0;
        padding: 16px;
    }

    .admin-sidebar {
        transform: translateX(-100%);
        z-index: 1100;
        top: 0;
        padding-top: calc(var(--navbar-height) + 8px);
    }

    .admin-sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.5);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.4);
        z-index: 1050;
    }

    .sidebar-overlay.show {
        display: block;
    }

    .settings-row {
        grid-template-columns: 1fr;
    }

    .admin-sidebar-toggle {
        display: flex !important;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

.admin-sidebar-toggle {
    display: none !important;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: 1px solid var(--border-lighter);
    border-radius: var(--radius-sm);
    color: var(--text-on-glass);
    cursor: pointer;
}
