/* 后台管理系统样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }

body.admin-body {
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    font-size: 14px;
    color: #333;
    background-color: #f0f2f5;
    display: flex;
    min-height: 100vh;
}

/* ======= 侧边栏 ======= */
.admin-sidebar {
    width: 240px;
    background: linear-gradient(180deg, #1e3a5f 0%, #2c5282 100%);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: width 0.3s ease;
    overflow: hidden;
}

.admin-sidebar.collapsed {
    width: 64px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px;
    background: rgba(0,0,0,0.2);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #c41e3a, #e63950);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    flex-shrink: 0;
}

.logo-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}

.logo-sub {
    font-size: 11px;
    color: rgba(255,255,255,0.6);
    white-space: nowrap;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.sidebar-nav a.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
    font-size: 14px;
}

.sidebar-nav a.nav-item:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.sidebar-nav a.nav-item.active {
    background: rgba(196, 30, 58, 0.8);
    color: #fff;
}

.nav-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.logout-btn {
    display: block;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 13px;
    padding: 8px 0;
    transition: color 0.2s;
}

.logout-btn:hover {
    color: #ff6b6b;
}

/* ======= 主内容区 ======= */
.admin-main {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* ======= 顶部导航 ======= */
.admin-topbar {
    height: 60px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #555;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s;
}

.sidebar-toggle:hover {
    background: #f5f5f5;
}

.topbar-breadcrumb {
    font-size: 13px;
    color: #666;
}

.topbar-breadcrumb a {
    color: #c41e3a;
    text-decoration: none;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-welcome {
    font-size: 13px;
    color: #666;
}

.topbar-btn {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    color: #555;
    text-decoration: none;
    transition: all 0.2s;
}

.topbar-btn:hover {
    border-color: #c41e3a;
    color: #c41e3a;
}

.topbar-logout {
    border-color: #ffa0a0;
    color: #c41e3a;
}

/* ======= 内容区域 ======= */
.admin-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 22px;
    color: #333;
    font-weight: 600;
    margin-bottom: 4px;
}

.page-header p {
    font-size: 13px;
    color: #999;
}

/* ======= 统计卡片 ======= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: relative;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-info p {
    font-size: 13px;
    color: #999;
}

.stat-link {
    position: absolute;
    bottom: 15px;
    right: 15px;
    font-size: 12px;
    color: #c41e3a;
    text-decoration: none;
}

/* ======= 仪表盘网格 ======= */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.dashboard-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.card-header h3 {
    font-size: 16px;
    color: #333;
    font-weight: 600;
}

.card-header a {
    font-size: 13px;
    color: #c41e3a;
    text-decoration: none;
}

/* ======= 表格 ======= */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th {
    background: #f8f9fa;
    padding: 10px 12px;
    text-align: left;
    font-weight: 500;
    color: #555;
    border-bottom: 1px solid #e9ecef;
}

.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
    vertical-align: middle;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: #fafafa;
}

/* ======= 快捷操作 ======= */
.quick-actions {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.quick-actions h3 {
    font-size: 16px;
    color: #333;
    margin-bottom: 15px;
    font-weight: 600;
}

.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.action-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #c41e3a;
    color: #fff;
    border-radius: 6px;
    font-size: 14px;
    text-decoration: none;
    transition: opacity 0.2s;
}

.action-btn:hover {
    opacity: 0.85;
}

/* ======= 按钮 ======= */
.btn {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary { background: #c41e3a; color: #fff; }
.btn-primary:hover { background: #a01830; }
.btn-success { background: #28a745; color: #fff; }
.btn-success:hover { background: #218838; }
.btn-warning { background: #ffc107; color: #333; }
.btn-danger { background: #dc3545; color: #fff; }
.btn-danger:hover { background: #c82333; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ======= 徽标 ======= */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info { background: #d1ecf1; color: #0c5460; }
.badge-secondary { background: #e2e3e5; color: #383d41; }

/* ======= 表单 ======= */
.admin-form {
    background: #fff;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 14px; color: #333; margin-bottom: 6px; font-weight: 500; }
.form-group label .required { color: #c41e3a; margin-left: 3px; }

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    color: #333;
    outline: none;
    transition: border-color 0.2s;
    background: #fff;
    font-family: inherit;
}

.form-control:focus { border-color: #c41e3a; box-shadow: 0 0 0 2px rgba(196,30,58,0.1); }
.form-control[disabled], .form-control[readonly] { background: #f8f9fa; color: #888; }
textarea.form-control { min-height: 120px; resize: vertical; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-actions { display: flex; gap: 12px; padding-top: 10px; border-top: 1px solid #f0f0f0; margin-top: 20px; align-items: center; flex-wrap: wrap; }

/* ======= 搜索/筛选栏 ======= */
.table-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; flex-wrap: wrap; gap: 10px; }
.search-form { display: flex; gap: 8px; align-items: center; }
.search-form input, .search-form select { padding: 7px 12px; border: 1px solid #ddd; border-radius: 5px; font-size: 13px; outline: none; }
.search-form input:focus, .search-form select:focus { border-color: #c41e3a; }

/* ======= 分页 ======= */
.pagination { display: flex; justify-content: flex-end; gap: 5px; margin-top: 15px; flex-wrap: wrap; }
.pagination a, .pagination span { display: inline-block; padding: 6px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 13px; color: #555; text-decoration: none; transition: all 0.2s; }
.pagination a:hover { border-color: #c41e3a; color: #c41e3a; }
.pagination .current { background: #c41e3a; color: #fff; border-color: #c41e3a; }

/* ======= 消息提示 ======= */
.alert { padding: 12px 16px; border-radius: 6px; margin-bottom: 20px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error, .alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ======= 图片上传 ======= */
.upload-preview { margin-top: 8px; display: flex; align-items: center; gap: 10px; }
.upload-preview img { max-width: 150px; max-height: 100px; object-fit: cover; border-radius: 4px; border: 1px solid #ddd; }
.upload-area { border: 2px dashed #ddd; border-radius: 8px; padding: 30px; text-align: center; cursor: pointer; transition: border-color 0.2s; background: #fafafa; }
.upload-area:hover { border-color: #c41e3a; }
.upload-area p { font-size: 13px; color: #999; margin-top: 10px; }

/* ======= 列表页面 ======= */
.admin-list-page { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }

.status-toggle { display: inline-block; width: 40px; height: 22px; background: #ddd; border-radius: 11px; position: relative; cursor: pointer; transition: background 0.2s; }
.status-toggle.on { background: #28a745; }
.status-toggle::after { content: ''; position: absolute; width: 18px; height: 18px; background: #fff; border-radius: 50%; top: 2px; left: 2px; transition: left 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.status-toggle.on::after { left: 20px; }

/* ======= 富文本编辑器 ======= */
.editor-toolbar { border: 1px solid #ddd; border-bottom: none; padding: 8px; background: #f8f9fa; border-radius: 5px 5px 0 0; display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.editor-toolbar button { padding: 4px 8px; background: #fff; border: 1px solid #ddd; border-radius: 3px; font-size: 12px; cursor: pointer; transition: all 0.2s; }
.editor-toolbar button:hover { background: #c41e3a; color: #fff; border-color: #c41e3a; }
.editor-toolbar button:disabled { cursor: not-allowed; }
.editor-toolbar-sep { display: inline-block; width: 1px; height: 18px; background: #ddd; margin: 0 4px; }
/* 编辑器内视频删除按钮 */
p.video-wrapper { position: relative; display: inline-block; width: 100%; margin: 8px 0; }
p.video-wrapper .video-delete-btn {
    display: none;
    position: absolute; top: 8px; right: 8px;
    background: rgba(196,30,58,0.9); color: #fff;
    border: none; border-radius: 4px; padding: 4px 10px;
    font-size: 12px; cursor: pointer; z-index: 10;
}
p.video-wrapper:hover .video-delete-btn { display: block; }
#editor-content { border: 1px solid #ddd; border-radius: 0 0 5px 5px; min-height: 300px; padding: 15px; outline: none; font-size: 14px; line-height: 1.8; color: #333; }
#editor-content:focus { border-color: #c41e3a; }


.img-thumb { width: 60px; height: 45px; object-fit: cover; border-radius: 3px; border: 1px solid #e0e0e0; }

/* ======= 响应式 ======= */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .admin-sidebar { width: 0; overflow: hidden; }
    .admin-sidebar.mobile-open { width: 240px; }
    .admin-main { margin-left: 0; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
}
