/* 管理后台样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a90e2;
    --primary-hover: #357abd;
    --success-color: #52c41a;
    --warning-color: #faad14;
    --danger-color: #ff4d4f;
    --text-primary: #333;
    --text-secondary: #666;
    --text-light: #999;
    --border-color: #e8e8e8;
    --bg-gray: #f5f5f5;
    --bg-white: #fff;
    --sidebar-bg: #1a1a1a;
    --sidebar-text: #ccc;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
        'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-gray);
}

a {
    text-decoration: none;
    color: inherit;
}

/* 登录页 */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--primary-color);
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-form {
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.input-with-btn {
    display: flex;
    gap: 8px;
}

.input-with-btn input {
    flex: 1;
}

.input-with-btn .btn {
    white-space: nowrap;
    padding: 12px 16px;
}

.login-footer {
    text-align: center;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* 管理后台布局 */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: 240px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid #333;
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: var(--sidebar-text);
    transition: all 0.3s;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-nav a.active {
    background: var(--primary-color);
    color: #fff;
}

.sidebar-nav a .icon {
    margin-right: 12px;
    font-size: 18px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid #333;
}

.user-info {
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.user-info span {
    color: #fff;
    font-weight: 500;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: 240px;
    display: flex;
    flex-direction: column;
}

/* 顶部栏 */
.topbar {
    background: var(--bg-white);
    padding: 16px 24px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar h1 {
    font-size: 20px;
    font-weight: 600;
}

.org-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.org-name {
    padding: 6px 16px;
    background: var(--primary-color);
    color: #fff;
    border-radius: 20px;
    font-size: 13px;
}

/* 内容区 */
.content-wrapper {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* 统计卡片 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    font-size: 40px;
    opacity: 0.8;
}

.stat-content h3 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-content p {
    color: var(--text-secondary);
    font-size: 13px;
}

/* 仪表盘区块 */
.dashboard-sections {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 24px;
}

.dashboard-section {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 16px;
    font-weight: 600;
}

/* 表格 */
.table-container {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 12px;
    background: var(--bg-gray);
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 13px;
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.data-table tr:hover {
    background: var(--bg-gray);
}

.text-center {
    text-align: center;
}

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    background: none;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-outline {
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    background: none;
}

.btn-outline:hover {
    background: var(--primary-color);
    color: #fff;
}

.btn-danger {
    background: var(--danger-color);
    color: #fff;
}

.btn-danger:hover {
    background: #ff7875;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 13px;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-logout {
    width: 100%;
    background: rgba(255, 77, 79, 0.2);
    color: #ff7875;
}

.btn-logout:hover {
    background: rgba(255, 77, 79, 0.3);
    color: #ff4d4f;
}

/* 状态标签 */
.status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-success {
    background: #f6ffed;
    color: var(--success-color);
}

.status-warning {
    background: #fffbe6;
    color: var(--warning-color);
}

.status-danger {
    background: #fff2f0;
    color: var(--danger-color);
}

.post-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    background: var(--primary-color);
    color: #fff;
}

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 100%;
    max-width: 500px;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

.modal-lg {
    max-width: 700px;
}

@keyframes modalSlideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 28px;
    color: var(--text-light);
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 24px;
}

/* 表单网格 */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.form-grid .full-width {
    grid-column: 1 / -1;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .dashboard-sections {
        grid-template-columns: 1fr;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .main-content {
        margin-left: 0;
    }

    .sidebar.open {
        transform: translateX(0);
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }

    .stat-card {
        padding: 16px;
    }

    .stat-icon {
        font-size: 32px;
    }

    .stat-content h3 {
        font-size: 24px;
    }

    .table-container {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px;
    }
}
