/* 后台管理样式 */

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

.login-box {
    background: #fff;
    padding: 30px 25px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.btn-primary {
    background: #1a73e8;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    width: 100%;
}

.btn-primary:hover {
    background: #1557b0;
}

.back-link {
    text-align: center;
    margin-top: 20px;
}

.back-link a {
    color: #666;
    text-decoration: none;
}

/* 后台头部 */
.admin-header {
    background: #2c3e50;
    color: #fff;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    font-size: 18px;
    margin: 0;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
}

.header-content nav {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.header-content nav a {
    color: #fff;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background 0.2s;
    font-size: 14px;
}

.header-content nav a:hover {
    background: rgba(255,255,255,0.1);
}

/* 后台主体 */
.admin-main {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
}

/* 仪表板 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: #fff;
    padding: 20px 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h3 {
    color: #666;
    font-size: 13px;
    margin-bottom: 8px;
}

.stat-number {
    font-size: 28px;
    font-weight: bold;
    color: #1a73e8;
}

/* 表格 */
.data-table {
    width: 100%;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
}

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

.data-table a {
    color: #1a73e8;
    text-decoration: none;
}

/* 状态标签 */
.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
}

.status-published {
    background: #d4edda;
    color: #155724;
}

.status-draft {
    background: #fff3cd;
    color: #856404;
}

/* 按钮 */
.btn-secondary {
    background: #6c757d;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn-danger {
    background: #dc3545;
    color: #fff;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

/* 表单 */
.article-form {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.form-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

/* 页面头部 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.inline-form {
    display: flex;
    gap: 10px;
}

.inline-form input {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* 筛选器 */
.filters {
    margin-bottom: 20px;
}

.filters form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filters select,
.filters input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.filters button,
.filters .btn-secondary,
.filters .btn-primary {
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    border: none;
    font-size: 14px;
}

/* 标签小 */
.tag-small {
    display: inline-block;
    padding: 2px 6px;
    background: #e8f4fd;
    color: #1a73e8;
    font-size: 12px;
    border-radius: 3px;
    margin-right: 5px;
}

/* 提示消息 */
.flash-messages {
    margin-bottom: 20px;
}

.alert {
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
}

/* ========== 响应式设计 ========== */

/* 平板及以下 */
@media (max-width: 768px) {
    .header-content {
        padding: 10px 12px;
    }

    .header-content h1 {
        font-size: 16px;
    }

    .menu-toggle {
        display: block;
    }

    .header-content nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #2c3e50;
        flex-direction: column;
        padding: 10px;
        gap: 0;
    }

    .header-content nav.active {
        display: flex;
    }

    .header-content nav a {
        padding: 12px 15px;
        border-radius: 0;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }

    .header-content nav a:last-child {
        border-bottom: none;
    }

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

    .inline-form {
        width: 100%;
        flex-direction: column;
    }

    .inline-form input,
    .inline-form select,
    .inline-form button {
        width: 100%;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions button,
    .form-actions a {
        width: 100%;
        text-align: center;
    }
}

/* 手机 */
@media (max-width: 480px) {
    .admin-main {
        padding: 0 10px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 15px 10px;
    }

    .stat-number {
        font-size: 24px;
    }

    .page-header h2 {
        font-size: 18px;
    }
}

/* 表格响应式 */
@media (max-width: 700px) {
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .data-table {
        min-width: 600px;
    }
}

/* 移动端表格卡片化 */
@media (max-width: 600px) {
    .table-container {
        overflow: visible;
    }

    .data-table,
    .data-table thead,
    .data-table tbody,
    .data-table th,
    .data-table td,
    .data-table tr {
        display: block;
    }

    .data-table thead {
        display: none;
    }

    .data-table tr {
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        margin-bottom: 15px;
        padding: 15px;
    }

    .data-table td {
        padding: 8px 0;
        border-bottom: 1px solid #eee;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #555;
        margin-right: 10px;
        min-width: 60px;
    }

    .data-table td:last-child {
        border-bottom: none;
        justify-content: flex-start;
        gap: 10px;
    }

    .data-table .actions {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }

    /* 复选框列 */
    .data-table td[data-label="选择"],
    .data-table td[data-label="ID"] {
        justify-content: flex-start;
    }

    .data-table td[data-label="选择"]::before {
        display: none;
    }

    /* 搜索框 */
    .search-box {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }

    .search-box input {
        width: 100%;
    }

    /* 批量操作 */
    .bulk-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .bulk-actions.active {
        display: flex;
    }

    /* 统计卡片移动端 */
    .task-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    /* 页面操作按钮 */
    .page-actions {
        display: flex;
        gap: 10px;
        width: 100%;
    }

    .page-actions button {
        flex: 1;
    }

    /* 分页 */
    .pagination {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
        margin-top: 20px;
    }

    .pagination a,
    .pagination span {
        padding: 8px 12px;
        font-size: 14px;
    }
}
