/**
 * 后台管理系统样式表
 */

/* CSS变量 */
:root {
    --primary: #1a365d;
    --primary-light: #2c5282;
    --primary-dark: #0d1b2a;
    --secondary: #c9a227;
    --secondary-light: #d4af37;
    --success: #48bb78;
    --warning: #ed8936;
    --danger: #f56565;
    --info: #4299e1;
    --gray-100: #f7fafc;
    --gray-200: #edf2f7;
    --gray-300: #e2e8f0;
    --gray-400: #cbd5e0;
    --gray-500: #a0aec0;
    --gray-600: #718096;
    --gray-700: #4a5568;
    --gray-800: #2d3748;
    --gray-900: #1a202c;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --topbar-height: 60px;
    --transition: all 0.3s ease;
}

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--gray-800);
    background: var(--gray-100);
}

a {
    text-decoration: none;
    color: inherit;
}

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

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-box {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.login-logo .logo-icon {
    width: 45px;
    height: 45px;
    background: var(--secondary);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    border-radius: 8px;
}

.login-logo .logo-text {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
}

.login-header h1 {
    font-size: 24px;
    color: var(--gray-800);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--gray-500);
    font-size: 14px;
}

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

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.1);
}

.form-error {
    color: var(--danger);
    font-size: 13px;
    margin-bottom: 15px;
    min-height: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-block {
    width: 100%;
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.login-footer {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

.login-footer p {
    color: var(--gray-500);
    font-size: 13px;
    margin-bottom: 5px;
}

/* 管理后台布局 */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: var(--primary);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo .logo-icon {
    width: 40px;
    height: 40px;
    background: var(--secondary);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    border-radius: 8px;
}

.sidebar-logo .logo-text {
    font-size: 18px;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 5px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    transition: var(--transition);
}

.sidebar-nav a:hover,
.sidebar-nav li.active a {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-nav svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 15px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    transition: var(--transition);
}

.sidebar-footer a:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-footer svg {
    width: 18px;
    height: 18px;
}

/* 主内容区 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部栏 */
.topbar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    position: sticky;
    top: 0;
    z-index: 99;
}

.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--gray-600);
    display: none;
}

.sidebar-toggle svg {
    width: 24px;
    height: 24px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.admin-name {
    font-weight: 500;
    color: var(--gray-700);
}

/* 内容区域 */
.content-wrapper {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 8px;
}

.page-header p {
    color: var(--gray-500);
}

/* 统计卡片 */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 24px;
    height: 24px;
}

.stat-icon.blue {
    background: rgba(66, 153, 225, 0.1);
    color: var(--info);
}

.stat-icon.green {
    background: rgba(72, 187, 120, 0.1);
    color: var(--success);
}

.stat-icon.orange {
    background: rgba(237, 137, 54, 0.1);
    color: var(--warning);
}

.stat-icon.red {
    background: rgba(245, 101, 101, 0.1);
    color: var(--danger);
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 5px;
}

/* 快捷操作 */
.quick-actions {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.quick-actions h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: var(--gray-800);
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 20px;
    background: var(--gray-100);
    border-radius: 8px;
    color: var(--gray-700);
    font-weight: 500;
    transition: var(--transition);
}

.action-btn:hover {
    background: var(--primary);
    color: white;
}

.action-btn svg {
    width: 20px;
    height: 20px;
}

/* 最近咨询 */
.recent-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
}

.view-all {
    color: var(--primary);
    font-size: 14px;
    font-weight: 500;
}

.view-all:hover {
    color: var(--primary-light);
}

/* 数据表格 */
.data-table-wrapper {
    overflow-x: auto;
}

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

.data-table th,
.data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.data-table th {
    font-weight: 600;
    color: var(--gray-600);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table td {
    color: var(--gray-700);
    font-size: 14px;
}

.data-table tbody tr:hover {
    background: var(--gray-100);
}

.loading-cell,
.empty-cell {
    text-align: center;
    color: var(--gray-500);
    padding: 40px !important;
}

.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.pending {
    background: rgba(237, 137, 54, 0.1);
    color: var(--warning);
}

.status-badge.completed {
    background: rgba(72, 187, 120, 0.1);
    color: var(--success);
}

.status-badge.published {
    background: rgba(72, 187, 120, 0.1);
    color: var(--success);
}

.status-badge.draft {
    background: rgba(160, 174, 192, 0.1);
    color: var(--gray-500);
}

.action-link {
    color: var(--primary);
    font-weight: 500;
}

.action-link:hover {
    color: var(--primary-light);
}

/* 列表页面 */
.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
}

.search-box {
    display: flex;
    gap: 10px;
}

.search-box input {
    width: 300px;
    padding: 10px 15px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 14px;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

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

.page-btn {
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.page-btn:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    color: var(--gray-600);
    font-size: 14px;
}

/* 表单页面 */
.form-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    max-width: 800px;
}

.form-card h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 25px;
    color: var(--gray-800);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 1px solid var(--gray-200);
}

/* 设置页面 */
.settings-grid {
    display: grid;
    gap: 20px;
}

.setting-item {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.setting-item label {
    display: block;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 8px;
}

.setting-item .help-text {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 12px;
}

/* 详情页面 */
.detail-card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.detail-header {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-200);
}

.detail-header h2 {
    font-size: 22px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 10px;
}

.detail-meta {
    display: flex;
    gap: 20px;
    color: var(--gray-500);
    font-size: 14px;
}

.detail-body {
    color: var(--gray-700);
    line-height: 1.8;
}

.detail-section {
    margin-bottom: 25px;
}

.detail-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 12px;
}

.detail-section p {
    color: var(--gray-600);
    line-height: 1.8;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .action-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .stats-cards {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .search-box input {
        width: 200px;
    }
    
    .content-wrapper {
        padding: 20px;
    }
}

/* 富文本编辑器 */
.editor-toolbar {
    display: flex;
    gap: 5px;
    padding: 10px;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
}

.editor-toolbar button {
    padding: 8px 12px;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.editor-toolbar button:hover {
    background: var(--gray-200);
}

.editor-content {
    min-height: 300px;
    padding: 15px;
    border: 1px solid var(--gray-300);
    border-radius: 0 0 8px 8px;
    outline: none;
}

/* Toast提示 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 9999;
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
}

.modal h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
}

.modal p {
    color: var(--gray-600);
    margin-bottom: 25px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
