/* ==================== 全局重置与基础样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* ==================== 主要容器 ==================== */
.policy-database-wrapper {
    min-height: auto;  /* 改为这个 */
    height: auto;      /* 添加这行 */
    overflow: visible; /* 确保内容可见 */
}

/* 确保body可以滚动 */
body {
    overflow-y: auto;  /* 允许垂直滚动 */
    overflow-x: hidden; /* 防止水平滚动 */
}

.policy-database-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: auto;  /* 确保自动高度 */
    min-height: 0; /* 重置最小高度 */
}

/* ==================== 返回导航 ==================== */
.back-nav {
    padding: 20px 0;
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    z-index: 100;
    border-bottom: 1px solid rgba(234, 234, 234, 0.8);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    color: #495057;
    font-weight: 500;
    transition: all 0.3s ease;
    font-size: 14px;
}

.back-link:hover {
    background: #e9ecef;
    transform: translateX(-4px);
}

.back-link svg {
    width: 18px;
    height: 18px;
}

/* ==================== 页面头部 ==================== */
.policy-database-header {
    text-align: center;
    padding: 60px 0 40px;
    margin-bottom: 40px;
}

.policy-database-header h1 {
    font-size: 2.8rem;
    font-weight: 800;
    color: #2c3e50;
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.policy-database-header p {
    font-size: 1.2rem;
    color: #6c757d;
    margin-bottom: 30px;
    font-weight: 400;
}

/* 头部装饰线 */
.header-decoration {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 30px;
}

.decoration-line {
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #3498db, transparent);
}

.decoration-dot {
    width: 8px;
    height: 8px;
    background: #3498db;
    border-radius: 50%;
}

/* ==================== 搜索区域 ==================== */
.search-section {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    margin-bottom: 40px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* 主搜索框 */
.search-box {
    display: flex;
    gap: 16px;
    margin-bottom: 30px;
}

.search-input {
    flex: 1;
    padding: 18px 24px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f8f9fa;
    font-family: inherit;
}

.search-input:focus {
    outline: none;
    border-color: #3498db;
    background: white;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.1);
}

.search-button {
    padding: 18px 36px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    letter-spacing: 0.3px;
}

.search-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.25);
}

.search-button svg {
    width: 18px;
    height: 18px;
}

/* 高级筛选器 */
.advanced-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    padding-top: 30px;
    border-top: 1px solid rgba(234, 234, 234, 0.8);
}

.filter-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
    letter-spacing: 0.5px;
}

.filter-select {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    background: white;
    font-size: 15px;
    color: #495057;
    transition: all 0.3s ease;
    font-family: inherit;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* ==================== 结果区域 ==================== */
.results-section {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    margin-bottom: 40px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f8f9fa;
}

.results-header h2 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.8rem;
    font-weight: 700;
}

.results-stats {
    display: flex;
    align-items: center;
    gap: 24px;
}

.results-stats span {
    color: #6c757d;
    font-size: 14px;
    font-weight: 500;
}

/* 视图切换 */
.view-toggle {
    display: flex;
    gap: 8px;
    background: #f8f9fa;
    padding: 6px;
    border-radius: 10px;
}

.view-btn {
    padding: 8px 20px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.3s ease;
}

.view-btn.active {
    background: white;
    color: #3498db;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.view-btn:hover:not(.active) {
    color: #495057;
}

/* ==================== 政策列表 ==================== */
.policy-list {
    min-height: 400px;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #6c757d;
}

.empty-icon {
    font-size: 4.5rem;
    margin-bottom: 24px;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 12px;
    color: #495057;
    font-size: 1.5rem;
    font-weight: 600;
}

.empty-state p {
    font-size: 1rem;
    opacity: 0.8;
}

/* ==================== 政策项样式 ==================== */
.policy-item {
    background: white;
    border: 1px solid #eaeaea;
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    border-left: 5px solid #3498db;
}

.policy-item:hover {
    border-color: #3498db;
    box-shadow: 0 12px 40px rgba(52, 152, 219, 0.12);
    transform: translateY(-4px);
}

.policy-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.policy-title {
    margin: 0;
    color: #2c3e50;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.4;
    flex: 1;
    min-width: 300px;
}

.policy-badges {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge.country {
    background: #e3f2fd;
    color: #1976d2;
}

.badge.year {
    background: #f3e5f5;
    color: #7b1fa2;
}

.badge.topic {
    background: #e8f5e9;
    color: #388e3c;
}

.policy-abstract {
    color: #546e7a;
    line-height: 1.7;
    margin-bottom: 20px;
    font-size: 1rem;
}

.policy-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    color: #78909c;
    padding-top: 20px;
    border-top: 1px solid #f5f5f5;
    flex-wrap: wrap;
    gap: 16px;
}

.department {
    font-weight: 500;
}

.policy-keywords {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.keyword {
    padding: 4px 10px;
    background: #f5f5f5;
    border-radius: 6px;
    font-size: 12px;
    color: #616161;
}

/* ==================== 网格视图 ==================== */
.policy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.policy-item.grid-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 24px;
}

.grid-header {
    margin-bottom: 16px;
}

.grid-badges {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.topic-tag {
    display: inline-block;
    padding: 6px 14px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 12px;
}

.grid-body {
    flex: 1;
    margin-bottom: 16px;
}

.grid-body .policy-abstract {
    margin-bottom: 16px;
}

.grid-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid #f5f5f5;
    font-size: 13px;
    color: #78909c;
}

/* ==================== 分页控件 ==================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 50px;
    padding-top: 40px;
    border-top: 1px solid rgba(234, 234, 234, 0.8);
}

.pagination-btn {
    padding: 12px 28px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    color: #495057;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    font-size: 14px;
}

.pagination-btn:hover:not(:disabled) {
    border-color: #3498db;
    color: #3498db;
    transform: translateY(-2px);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn svg {
    width: 16px;
    height: 16px;
}

.page-numbers {
    display: flex;
    gap: 8px;
}

.page-number {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #f8f9fa;
    color: #495057;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    font-size: 14px;
}

.page-number.active {
    background: #3498db;
    color: white;
}

.page-number:hover:not(.active) {
    background: #e9ecef;
}

/* ==================== 特色功能区域 ==================== */
.features-section {
    background: white;
    padding: 50px 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    margin-bottom: 40px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.features-section h3 {
    text-align: center;
    margin-bottom: 40px;
    color: #2c3e50;
    font-size: 1.8rem;
    font-weight: 700;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.feature-card {
    text-align: center;
    padding: 40px 30px;
    background: #f8f9fa;
    border-radius: 16px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    border-color: #3498db;
    background: white;
}

.feature-icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
    display: inline-block;
}

.feature-card h4 {
    margin-bottom: 12px;
    color: #2c3e50;
    font-size: 1.3rem;
    font-weight: 700;
}

.feature-card p {
    color: #6c757d;
    font-size: 15px;
    line-height: 1.6;
}

/* ==================== 页脚 ==================== */
.policy-footer {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
    font-size: 14px;
    border-top: 1px solid rgba(234, 234, 234, 0.8);
    margin-top: 60px;
}

.policy-footer p {
    margin-bottom: 8px;
}

.footer-note {
    font-style: italic;
    opacity: 0.7;
    font-size: 13px;
}

/* ==================== 加载和错误状态 ==================== */
.loading-state,
.error-state {
    text-align: center;
    padding: 80px 20px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    margin: 0 auto 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-state p {
    color: #6c757d;
    font-size: 16px;
}

.error-state .error-icon {
    font-size: 3.5rem;
    margin-bottom: 24px;
    color: #e74c3c;
}

.error-state h3 {
    margin-bottom: 12px;
    color: #e74c3c;
    font-size: 1.5rem;
    font-weight: 600;
}

.error-state p {
    color: #6c757d;
    margin-bottom: 24px;
}

.retry-btn {
    padding: 12px 28px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.retry-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1024px) {
    .policy-database-header h1 {
        font-size: 2.4rem;
    }

    .policy-database-header p {
        font-size: 1.1rem;
    }

    .search-section,
    .results-section,
    .features-section {
        padding: 30px;
    }
}

@media (max-width: 768px) {
    .policy-database-container {
        padding: 0 16px;
    }

    .policy-database-header {
        padding: 40px 0 30px;
    }

    .policy-database-header h1 {
        font-size: 2rem;
    }

    .policy-database-header p {
        font-size: 1rem;
    }

    .search-box {
        flex-direction: column;
    }

    .search-button {
        width: 100%;
        justify-content: center;
    }

    .advanced-filters {
        grid-template-columns: 1fr;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .results-stats {
        width: 100%;
        justify-content: space-between;
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .policy-grid {
        grid-template-columns: 1fr;
    }

    .pagination {
        flex-direction: column;
        gap: 16px;
    }

    .policy-header {
        flex-direction: column;
    }

    .policy-title {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .search-section,
    .results-section,
    .features-section {
        padding: 24px 20px;
    }

    .policy-item {
        padding: 20px;
    }

    .policy-title {
        font-size: 1.2rem;
    }

    .badge {
        padding: 5px 12px;
        font-size: 11px;
    }

    .feature-card {
        padding: 30px 20px;
    }
}