﻿/* 后台管理样式 - 知默 */

/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #f8fafc;
    color: #334155;
    line-height: 1.6;
}

/* 登录检查 */
.admin-login-check {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-check-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-check-content i {
    font-size: 3rem;
    color: #2563eb;
    margin-bottom: 20px;
}

.login-check-content h2 {
    color: #1e293b;
    margin-bottom: 30px;
    font-size: 1.5rem;
}

/* 按钮组件 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: #f1f5f9;
    color: #475569;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-block {
    width: 100%;
    padding: 12px;
}

/* 搜索框 */
.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 40px 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-box button {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
}

/* 表单组件 */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 后台容器 */
.admin-container {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.admin-sidebar {
    width: 250px;
    background: #1e293b;
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-header i {
    font-size: 1.5rem;
    color: #2563eb;
}

.sidebar-header span {
    font-size: 1.2rem;
    font-weight: 600;
}

.sidebar-nav {
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #94a3b8;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

.nav-item.active {
    background: #2563eb;
    color: white;
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #94a3b8;
    text-decoration: none;
    padding: 8px 0;
    transition: color 0.3s ease;
    font-size: 0.9rem;
}

.sidebar-footer a:hover {
    color: white;
}

/* 主内容区 */
.admin-main {
    margin-left: 250px;
    background: #f8fafc;
    min-height: 100vh;
    flex: 1;
}

/* 顶部栏 */
.admin-header {
    background: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: 70px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #475569;
    padding: 5px;
}

.page-title {
    font-size: 1.5rem;
    color: #1e293b;
    margin: 0;
    font-weight: 600;
    white-space: nowrap;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.header-notifications {
    position: relative;
    flex-shrink: 0;
}

.notification-btn {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: #64748b;
    position: relative;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.notification-btn:hover {
    background: #f1f5f9;
    color: #2563eb;
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #475569;
    font-weight: 500;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.header-user:hover {
    background: #f1f5f9;
}

.header-user img {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
}

/* 内容区 */
.admin-content {
    padding: 30px;
}

.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
}

/* 统计卡片 - 关键修复 */
.stats-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 20px;
    margin-bottom: 30px;
    width: 100%;
}

.stat-card {
    flex: 1 1 0;
    min-width: 0;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
}

.stat-icon.users {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.stat-icon.articles {
    background: linear-gradient(135deg, #f093fb, #f5576c);
}

.stat-icon.views {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
}

.stat-icon.messages {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
}

.stat-info {
    flex: 1;
    min-width: 0;
}

.stat-info h3 {
    font-size: 1.8rem;
    color: #1e293b;
    margin: 0 0 5px 0;
}

.stat-info p {
    color: #64748b;
    font-size: 0.9rem;
    margin: 0;
}

.stat-trend {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    font-weight: 600;
    flex-shrink: 0;
}

.stat-trend.up {
    color: #10b981;
}

.stat-trend.down {
    color: #ef4444;
}

/* 图表区域 */
.charts-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    flex: 1 1 calc(50% - 10px);
    min-width: 400px;
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chart-card h3 {
    font-size: 1.1rem;
    color: #1e293b;
    margin-bottom: 20px;
}

.chart-placeholder {
    height: 300px;
    background: #f8fafc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 0.9rem;
}

/* 活动网格 */
.activity-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.activity-card {
    flex: 1 1 calc(50% - 10px);
    min-width: 350px;
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.activity-card h3 {
    font-size: 1.1rem;
    color: #1e293b;
    margin-bottom: 20px;
}

.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.activity-list li {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

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

.activity-list img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.activity-list li > div {
    flex: 1;
}

.activity-list p {
    color: #475569;
    font-size: 0.9rem;
    margin: 0 0 5px 0;
    line-height: 1.4;
}

.activity-list span {
    color: #94a3b8;
    font-size: 0.8rem;
}

/* 区块头部 */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.section-header h2 {
    font-size: 1.5rem;
    color: #1e293b;
    margin: 0;
}

/* 筛选栏 */
.filters-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filters-bar .search-box {
    flex: 1;
    min-width: 250px;
}

.filters-bar select {
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #475569;
    font-size: 0.9rem;
    cursor: pointer;
}

/* 表格容器 */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: #f8fafc;
}

.data-table th,
.data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.data-table th {
    font-weight: 600;
    color: #475569;
    font-size: 0.9rem;
}

.data-table td {
    color: #334155;
    font-size: 0.9rem;
}

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

.data-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 状态标签 */
.status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status.published {
    background: #dcfce7;
    color: #10b981;
}

.status.draft {
    background: #fef3c7;
    color: #f59e0b;
}

.status.pending {
    background: #dbeafe;
    color: #2563eb;
}

.status.replied {
    background: #dcfce7;
    color: #10b981;
}

/* 角色标签 */
.role {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.role.admin {
    background: #fef3c7;
    color: #f59e0b;
}

.role.expert {
    background: #dbeafe;
    color: #2563eb;
}

.role.user {
    background: #f1f5f9;
    color: #64748b;
}

/* 按钮图标 */
.btn-icon {
    width: 35px;
    height: 35px;
    border: none;
    background: #f8fafc;
    border-radius: 8px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.3s ease;
    margin: 0 3px;
}

.btn-icon:hover {
    background: #2563eb;
    color: white;
}

.btn-icon.danger:hover {
    background: #ef4444;
}

/* 消息管理卡片 */
.messages-admin-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message-admin-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

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

.message-type {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.message-type.question {
    background: #dbeafe;
    color: #2563eb;
}

.message-type.suggestion {
    background: #fef3c7;
    color: #f59e0b;
}

.message-type.praise {
    background: #dcfce7;
    color: #10b981;
}

.message-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.message-status.pending {
    background: #fef3c7;
    color: #f59e0b;
}

.message-status.replied {
    background: #dcfce7;
    color: #10b981;
}

.message-admin-content {
    margin-bottom: 15px;
}

.message-admin-content p {
    color: #475569;
    line-height: 1.6;
    margin: 0;
}

.message-admin-content .message-time {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 5px;
    display: inline-block;
}

.message-admin-actions {
    display: flex;
    gap: 10px;
}

/* 分类管理网格 */
.categories-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.category-admin-card {
    flex: 1 1 calc(25% - 15px);
    min-width: 250px;
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    text-align: center;
    transition: all 0.3s ease;
}

.category-admin-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.category-admin-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2563eb, #0ea5e9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 1.5rem;
    color: white;
}

.category-admin-card h3 {
    font-size: 1.2rem;
    color: #1e293b;
    margin-bottom: 5px;
}

.category-admin-card p {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.category-admin-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* 工具管理网格 */
.tools-admin-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.tool-admin-card {
    flex: 1 1 calc(25% - 15px);
    min-width: 250px;
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    text-align: center;
    transition: all 0.3s ease;
}

.tool-admin-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.tool-admin-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #10b981, #0ea5e9);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 2rem;
    color: white;
}

.tool-admin-card h3 {
    font-size: 1.2rem;
    color: #1e293b;
    margin-bottom: 5px;
}

.tool-admin-card p {
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

.tool-admin-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
}

.tool-admin-stats span {
    color: #94a3b8;
    font-size: 0.85rem;
}

.tool-admin-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* 设置网格 */
.settings-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.settings-card {
    flex: 1 1 calc(50% - 10px);
    min-width: 350px;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.settings-card h3 {
    font-size: 1.2rem;
    color: #1e293b;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.settings-card .form-group {
    margin-bottom: 20px;
}

.settings-card label {
    display: block;
    margin-bottom: 8px;
    color: #475569;
    font-weight: 500;
    font-size: 0.9rem;
}

.settings-card input[type="text"],
.settings-card input[type="email"],
.settings-card input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.settings-card input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 开关按钮 */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: 0.3s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.switch input:checked + .slider {
    background-color: #2563eb;
}

.switch input:checked + .slider:before {
    transform: translateX(24px);
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
}

.pagination .btn {
    padding: 8px 20px;
}

.pagination span {
    color: #64748b;
    font-size: 0.9rem;
}

/* 移动端遮罩层 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* 响应式 */
@media (max-width: 1200px) {
    .stat-card {
        flex: 1 1 calc(50% - 10px);
    }
    .stats-grid {
        flex-wrap: wrap;
    }
}

@media (max-width: 1024px) {
    .chart-card,
    .activity-card,
    .settings-card {
        flex: 1 1 100%;
        min-width: 100%;
    }
    
    .category-admin-card,
    .tool-admin-card {
        flex: 1 1 calc(50% - 10px);
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .admin-sidebar.active {
        transform: translateX(0);
    }

    .admin-main {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .stat-card {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .section-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

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

    .filters-bar .search-box {
        min-width: 100%;
    }
    
    .category-admin-card,
    .tool-admin-card {
        flex: 1 1 100%;
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .admin-header {
        padding: 15px 20px;
    }

    .admin-content {
        padding: 20px 15px;
    }

    .header-user span {
        display: none;
    }

    .page-title {
        font-size: 1.2rem;
    }
}
