/* ============================================
   全局样式重置
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a90e2;
    --primary-dark: #357abd;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-bg: #f8f9fa;
    --dark-text: #2c3e50;
    --border-color: #e0e0e0;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.15);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    background-attachment: fixed;
    color: var(--dark-text);
    line-height: 1.6;
    font-size: 14px;
    min-height: 100vh;
}

/* ============================================
   布局容器
   ============================================ */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

/* ============================================
   头部导航
   ============================================ */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid rgba(255,255,255,0.1);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 30px;
    max-width: 100%;
}

.header h1 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.user-info {
    display: flex;
    gap: 16px;
    align-items: center;
}

.user-info span {
    font-size: 14px;
    opacity: 0.95;
}

.user-info a {
    color: white;
    text-decoration: none;
    padding: 8px 18px;
    background-color: rgba(255,255,255,0.2);
    border-radius: 20px;
    transition: var(--transition);
    font-size: 13px;
    border: 1px solid rgba(255,255,255,0.3);
}

.user-info a:hover {
    background-color: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

/* ============================================
   侧边栏导航
   ============================================ */
.sidebar {
    width: 220px;
    background: white;
    border-radius: var(--border-radius);
    padding: 0;
    box-shadow: var(--shadow-md);
    height: fit-content;
    position: sticky;
    top: 90px;
    overflow: hidden;
}

.sidebar::before {
    content: '';
    display: block;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

.sidebar ul {
    list-style: none;
    padding: 12px 0;
}

.sidebar li {
    margin: 4px 0;
}

.sidebar a {
    display: flex;
    align-items: center;
    padding: 14px 24px;
    color: #555;
    text-decoration: none;
    transition: var(--transition);
    font-size: 14px;
    position: relative;
    border-left: 3px solid transparent;
}

.sidebar a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-color);
    transform: scaleY(0);
    transition: var(--transition);
}

.sidebar a:hover {
    background-color: var(--light-bg);
    color: var(--primary-color);
    padding-left: 28px;
}

.sidebar a:hover::before {
    transform: scaleY(1);
}

.sidebar a.active {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    color: var(--primary-color);
    font-weight: 600;
    border-left-color: var(--primary-color);
}

.sidebar a.active::before {
    transform: scaleY(1);
}

/* ============================================
   主内容区
   ============================================ */
.content {
    flex: 1;
    background: white;
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: var(--shadow-md);
    min-height: 600px;
}

.content h2 {
    margin: 0 0 28px 0;
    color: var(--dark-text);
    font-size: 26px;
    font-weight: 600;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--light-bg);
    position: relative;
}

.content h2::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

/* ============================================
   卡片样式
   ============================================ */
.card {
    background: white;
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card h3 {
    margin: 0 0 20px 0;
    color: var(--dark-text);
    font-size: 18px;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--light-bg);
}

.info-box {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-left: 4px solid var(--primary-color);
    padding: 24px;
    border-radius: var(--border-radius);
    margin-top: 24px;
    box-shadow: var(--shadow-sm);
}

.info-box h3 {
    margin: 0 0 16px 0;
    color: var(--dark-text);
    font-size: 18px;
    font-weight: 600;
}

.info-box p {
    margin: 8px 0;
    line-height: 1.8;
}

.info-box strong {
    color: var(--dark-text);
    font-weight: 600;
    margin-right: 8px;
}

/* ============================================
   统计卡片
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 28px;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card:nth-child(2) {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-card:nth-child(3) {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-card:nth-child(4) {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.stat-card:nth-child(5) {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.stat-card h3 {
    font-size: 14px;
    margin: 0 0 12px 0;
    opacity: 0.95;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    font-size: 42px;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    position: relative;
    z-index: 1;
}

/* ============================================
   表单样式
   ============================================ */
.form {
    max-width: 700px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--dark-text);
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
    background: white;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

.form-inline {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-inline .form-group {
    flex: 1;
    min-width: 180px;
    margin-bottom: 0;
}

.range-input {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.range-input input {
    width: 140px;
    flex-shrink: 0;
}

.range-input span {
    color: #666;
    font-size: 14px;
}

/* ============================================
   按钮样式
   ============================================ */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
    text-align: center;
    line-height: 1.5;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3d91 100%);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

/* ============================================
   表格样式
   ============================================ */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.table thead {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.table th {
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: var(--dark-text);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
}

.table td {
    padding: 16px;
    border-bottom: 1px solid var(--light-bg);
    color: #555;
    font-size: 14px;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.table a {
    color: var(--primary-color);
    text-decoration: none;
    margin-right: 12px;
    font-weight: 500;
    transition: var(--transition);
    padding: 4px 8px;
    border-radius: 4px;
}

.table a:hover {
    background-color: rgba(74, 144, 226, 0.1);
    text-decoration: none;
}

.text-center {
    text-align: center;
    color: #999;
    padding: 40px !important;
}

/* ============================================
   提示框样式
   ============================================ */
.alert {
    padding: 16px 20px;
    border-radius: var(--border-radius);
    margin-bottom: 24px;
    border-left: 4px solid;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-color: var(--success-color);
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border-color: var(--danger-color);
}

/* ============================================
   徽章样式
   ============================================ */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background-color: var(--success-color);
    color: white;
}

.badge-danger {
    background-color: var(--danger-color);
    color: white;
}

/* ============================================
   分页样式
   ============================================ */
.pagination {
    margin-top: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination a {
    padding: 10px 18px;
    background: white;
    color: var(--primary-color);
    text-decoration: none;
    border-radius: var(--border-radius);
    transition: var(--transition);
    border: 2px solid var(--border-color);
    font-weight: 500;
}

.pagination a:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.pagination span {
    padding: 0 16px;
    color: #666;
    font-size: 14px;
}

/* ============================================
   登录页面样式
   ============================================ */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-box {
    background: white;
    padding: 48px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-box h2 {
    text-align: center;
    margin: 0 0 32px 0;
    color: var(--dark-text);
    font-size: 24px;
    font-weight: 600;
}

.login-box .form-group {
    margin-bottom: 20px;
}

.login-box .btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    margin-top: 8px;
}

.login-box .text-center {
    text-align: center;
    margin-top: 24px;
    padding: 0;
}

.login-box .text-center a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.login-box .text-center a:hover {
    text-decoration: underline;
}

/* ============================================
   关键词标签
   ============================================ */
.keyword-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
    padding: 16px;
    background: var(--light-bg);
    border-radius: var(--border-radius);
}

.keyword-tag {
    display: inline-block;
    padding: 8px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.keyword-tag:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: var(--shadow-md);
}

/* ============================================
   文章查看样式
   ============================================ */
.article-view {
    max-width: 900px;
    background: white;
    padding: 32px;
    border-radius: var(--border-radius);
}

.article-view h2 {
    color: var(--dark-text);
    margin: 0 0 20px 0;
    font-size: 32px;
    font-weight: 700;
    line-height: 1.3;
}

.article-meta {
    display: flex;
    gap: 24px;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--light-bg);
    color: #666;
    font-size: 14px;
    flex-wrap: wrap;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.article-content {
    line-height: 2;
    font-size: 16px;
    color: #444;
    white-space: pre-wrap;
    word-wrap: break-word;
    padding: 24px;
    background: var(--light-bg);
    border-radius: var(--border-radius);
    margin-bottom: 24px;
}

/* PDF导出时的样式优化 */
@media print {
    .article-view {
        max-width: 100%;
        padding: 20px;
    }
    
    .article-content {
        background: white;
        padding: 20px;
    }
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 1024px) {
    .container {
        flex-direction: column;
        gap: 16px;
    }
    
    .sidebar {
        width: 100%;
        position: static;
        top: auto;
    }
    
    .sidebar ul {
        display: flex;
        overflow-x: auto;
        padding: 8px;
    }
    
    .sidebar li {
        flex-shrink: 0;
        margin: 0 4px;
    }
    
    .sidebar a {
        padding: 10px 16px;
        white-space: nowrap;
    }
    
    .content {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 12px;
        padding: 16px 20px;
    }
    
    .header h1 {
        font-size: 18px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .stat-card {
        padding: 24px;
    }
    
    .stat-number {
        font-size: 36px;
    }
    
    .form-inline {
        flex-direction: column;
    }
    
    .form-inline .form-group {
        width: 100%;
        min-width: 100%;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
    }
    
    .content {
        padding: 20px;
    }
    
    .login-box {
        padding: 32px 24px;
    }
}

@media (max-width: 480px) {
    .content h2 {
        font-size: 20px;
    }
    
    .article-view h2 {
        font-size: 24px;
    }
    
    .article-content {
        font-size: 14px;
        padding: 16px;
    }
}
