/**
 * 生育智慧网 - 主样式文件
 */

:root {
    --primary-color: #28a745;
    --primary-dark: #218838;
    --primary-light: #d4edda;
    --secondary-color: #6c757d;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --success-color: #28a745;
    --info-color: #17a2b8;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    
    --font-family-base: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    --font-family-heading: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "WenQuanYi Micro Hei", sans-serif;
    
    --border-radius: 0.375rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    
    --transition-base: all 0.3s ease;
}

/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family-base);
    line-height: 1.6;
    color: var(--dark-color);
    background-color: #fff;
    padding-top: 56px; /* 导航栏高度 */
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-heading);
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--dark-color);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition-base);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.container {
    max-width: 1200px;
}

/* 导航栏 */
.navbar {
    box-shadow: var(--box-shadow);
    background-color: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
}

.navbar-brand i {
    margin-right: 0.5rem;
}

.nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem !important;
}

.nav-link.active {
    color: var(--primary-color) !important;
    font-weight: 600;
}

/* 英雄区域 */
.hero-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: var(--border-radius);
    margin-top: 2rem;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('/static/images/pattern.png') repeat;
    opacity: 0.1;
    z-index: 0;
}

.hero-section > * {
    position: relative;
    z-index: 1;
}

.hero-section h1 {
    font-size: 3rem;
    background: linear-gradient(45deg, var(--primary-color), var(--info-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2rem;
    }
}

/* 卡片样式 */
.card {
    border: none;
    box-shadow: var(--box-shadow);
    transition: var(--transition-base);
    height: 100%;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-lg);
}

.card-title {
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.card-title a {
    color: inherit;
}

.card-title a:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.card-text {
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

/* 分类卡片 */
.featured-categories .card {
    border-width: 2px;
}

.featured-categories .card-body {
    padding: 2rem 1rem;
}

.featured-categories i {
    transition: var(--transition-base);
}

.featured-categories .card:hover i {
    transform: scale(1.1);
}

/* 文章卡片 */
.latest-articles .card {
    border-left: 4px solid var(--primary-color);
}

.latest-articles .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* 关于经典区域 */
.about-classic {
    background: linear-gradient(135deg, var(--primary-light) 0%, #e9ecef 100%);
}

.about-classic img {
    transition: var(--transition-base);
}

.about-classic img:hover {
    transform: scale(1.02);
}

/* 订阅区域 */
.subscribe-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: var(--border-radius);
}

.subscribe-section h2 {
    color: white;
}

.subscribe-section .form-control {
    border: none;
    padding: 0.75rem 1rem;
}

.subscribe-section .form-control:focus {
    box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.25);
}

.subscribe-section .btn {
    background-color: white;
    color: var(--primary-color);
    border: none;
    font-weight: 600;
}

.subscribe-section .btn:hover {
    background-color: var(--light-color);
    color: var(--primary-dark);
}

/* 页脚 */
footer {
    background: linear-gradient(135deg, var(--dark-color) 0%, #212529 100%);
}

footer h5 {
    color: white;
    font-weight: 600;
}

footer a.text-white-50:hover {
    color: white !important;
    text-decoration: none;
}

.social-links a {
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    transition: var(--transition-base);
}

.social-links a:hover {
    background-color: var(--primary-color);
    transform: translateY(-3px);
}

/* 工具类 */
.text-success {
    color: var(--primary-color) !important;
}

.bg-success {
    background-color: var(--primary-color) !important;
}

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

.btn-success:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-success {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-success:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* 动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .navbar-collapse {
        background-color: white;
        padding: 1rem;
        border-radius: var(--border-radius);
        box-shadow: var(--box-shadow-lg);
        margin-top: 0.5rem;
    }
    
    .input-group {
        margin-top: 1rem;
    }
    
    .hero-section {
        padding: 2rem 1rem !important;
    }
    
    .featured-categories .col-md-3 {
        margin-bottom: 1rem;
    }
}

/* 打印样式 */
@media print {
    .navbar,
    footer,
    .subscribe-section,
    .btn {
        display: none !important;
    }
    
    body {
        padding-top: 0;
    }
    
    .container {
        max-width: 100%;
    }
    
    a {
        color: black !important;
        text-decoration: none !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}

/* 辅助功能 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:focus {
    outline: 3px solid rgba(40, 167, 69, 0.5);
    outline-offset: 2px;
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 0.25rem solid rgba(40, 167, 69, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* 文章内容样式 */
.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.article-content h2,
.article-content h3,
.article-content h4 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.article-content p {
    margin-bottom: 1.5rem;
}

.article-content ul,
.article-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.article-content blockquote {
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: var(--secondary-color);
}

.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    margin: 1.5rem 0;
}

.article-content table {
    width: 100%;
    margin: 1.5rem 0;
    border-collapse: collapse;
}

.article-content table th,
.article-content table td {
    padding: 0.75rem;
    border: 1px solid #dee2e6;
}

.article-content table th {
    background-color: var(--light-color);
    font-weight: 600;
}

.article-content pre {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: var(--border-radius);
    overflow-x: auto;
    margin: 1.5rem 0;
}

.article-content code {
    background-color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 0.2rem;
    font-family: 'Courier New', Courier, monospace;
}

/* 分享按钮 */
.share-buttons {
    display: flex;
    gap: 0.5rem;
    margin: 2rem 0;
}

.share-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    text-decoration: none;
    transition: var(--transition-base);
}

.share-button:hover {
    transform: translateY(-3px);
    text-decoration: none;
}

.share-wechat {
    background-color: #07c160;
}

.share-weibo {
    background-color: #e6162d;
}

.share-qq {
    background-color: #12b7f5;
}

.share-link {
    background-color: var(--secondary-color);
}

/* 评论区域 */
.comments-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #dee2e6;
}

.comment-form {
    background-color: var(--light-color);
    padding: 1.5rem;
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
}

.comment-list {
    margin-top: 2rem;
}

.comment-item {
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-author {
    font-weight: 600;
    color: var(--dark-color);
}

.comment-date {
    font-size: 0.875rem;
    color: var(--secondary-color);
}

.comment-content {
    margin-top: 0.5rem;
}

/* 分页 */
.pagination {
    justify-content: center;
    margin-top: 2rem;
}

.page-link {
    color: var(--primary-color);
    border: 1px solid #dee2e6;
}

.page-link:hover {
    color: var(--primary-dark);
    background-color: var(--light-color);
    border-color: #dee2e6;
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* 返回顶部按钮 */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-base);
    z-index: 1000;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: var(--primary-dark);
    transform: translateY(-3px);
}

/* 404页面 */
.error-page {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.error-code {
    font-size: 8rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

.error-message {
    font-size: 1.5rem;
    margin: 1rem 0 2rem;
}

/* 搜索页面 */
.search-results {
    margin-top: 2rem;
}

.search-result-item {
    padding: 1.5rem;
    border-bottom: 1px solid #dee2e6;
    transition: var(--transition-base);
}

.search-result-item:hover {
    background-color: var(--light-color);
}

.search-result-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.search-result-excerpt {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.search-result-meta {
    font-size: 0.875rem;
    color: var(--secondary-color);
}

/* 管理界面 */
.admin-sidebar {
    min-height: calc(100vh - 56px);
    background-color: var(--dark-color);
    color: white;
    padding: 1rem 0;
}

.admin-sidebar .nav-link {
    color: rgba(255, 255, 255, 0.8);
    padding: 0.5rem 1rem;
}

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

.admin-content {
    padding: 2rem;
}

/* 表单验证 */
.is-invalid {
    border-color: var(--danger-color) !important;
}

.invalid-feedback {
    display: block;
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* 工具提示 */
.tooltip-custom {
    position: relative;
    display: inline-block;
    border-bottom: 1px dotted var(--secondary-color);
    cursor: help;
}

.tooltip-custom .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: var(--dark-color);
    color: white;
    text-align: center;
    border-radius: var(--border-radius);
    padding: 0.5rem;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
}

.tooltip-custom .tooltip-text::after {
    content: "";
    position: