/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

/* 顶部导航栏样式 */
.top-nav {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.95) 0%, rgba(5, 150, 105, 0.95) 100%);
    position: relative;
    overflow: hidden;
}

.top-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('https://images.unsplash.com/photo-1497366216548-37526070297c?w=1920');
    background-size: cover;
    background-position: center;
    opacity: 0.3;
    z-index: 0;
}

.nav-container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.nav-logo h1 {
    color: #fff;
    font-size: 28px;
    margin-bottom: 5px;
}

.nav-logo p {
    color: #d1fae5;
    font-size: 12px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 30px;
}

.nav-menu li a {
    color: #fff;
    font-size: 16px;
    padding: 8px 16px;
    border-radius: 4px;
}

.nav-menu li a:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.nav-contact button {
    background-color: #fff;
    color: #10b981;
    border: none;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-contact button:hover {
    background-color: #f0fdf4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* 主容器 */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 资讯区域 */
.news-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

/* 左侧资讯列表 */
.news-list {
    background: #fff;
    border-radius: 8px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.news-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #10b981;
}

.news-header h2 {
    color: #10b981;
    font-size: 24px;
}

.news-tabs {
    display: flex;
    gap: 15px;
}

.news-tab {
    padding: 8px 20px;
    background: #f0fdf4;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    color: #10b981;
    transition: all 0.3s ease;
}

.news-tab.active {
    background: #10b981;
    color: #fff;
}

.news-item {
    display: flex;
    padding: 20px 0;
    border-bottom: 1px solid #e5e7eb;
}

.news-item:hover {
    background-color: #f9fafb;
    border-radius: 4px;
}

.news-item:last-child {
    border-bottom: none;
}

.news-tag {
    padding: 4px 12px;
    background: #dcfce7;
    color: #10b981;
    font-size: 12px;
    border-radius: 4px;
    margin-right: 15px;
    white-space: nowrap;
    height: fit-content;
}

.news-tag.loan {
    background: #dbeafe;
    color: #3b82f6;
}

.news-tag.law {
    background: #fef3c7;
    color: #d97706;
}

.news-content {
    flex: 1;
}

.news-content h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: #1f2937;
}

.news-content h3 a:hover {
    color: #10b981;
}

.news-meta {
    display: flex;
    gap: 20px;
    color: #6b7280;
    font-size: 13px;
}

.news-summary {
    margin-top: 10px;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.5;
}

/* 右侧贷款计算器 */
.calculator-section {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 8px;
    padding: 25px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.calculator-section h2 {
    font-size: 22px;
    margin-bottom: 20px;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #d1fae5;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.95);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.calc-btn {
    width: 100%;
    padding: 14px;
    background: #fff;
    color: #10b981;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.calc-btn:hover {
    background: #f0fdf4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.result-box {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    display: none;
}

.result-box.show {
    display: block;
}

.result-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.result-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.result-item:last-child {
    font-size: 18px;
    font-weight: bold;
    padding-top: 10px;
}

.detail-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.detail-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 底部导航栏样式 */
.bottom-nav {
    background: #1f2937;
    color: #fff;
    padding: 40px 20px 20px;
    margin-top: 60px;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

.footer-section h3 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #10b981;
}

.footer-section h4 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #d1fae5;
}

.footer-section p {
    margin-bottom: 10px;
    color: #9ca3af;
    font-size: 14px;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section ul li a {
    color: #9ca3af;
    font-size: 14px;
}

.footer-section ul li a:hover {
    color: #10b981;
    padding-left: 5px;
}

.footer-bottom {
    max-width: 1200px;
    margin: 30px auto 0;
    padding-top: 20px;
    border-top: 1px solid #374151;
    text-align: center;
    color: #6b7280;
    font-size: 13px;
}

/* 贷款计算器页面样式 */
#page-calculator .calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

/* 资讯中心页面样式 */
#page-news .news-content-grid {
    display: grid;
    grid-template-columns: 1fr 3fr;
    gap: 30px;
}

#page-calculator .calculator-card {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-width: 300px;
}

#page-calculator .form-group label {
    color: #10b981;
    font-weight: 500;
}

#page-calculator .schedule-section {
    background: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-top: 30px;
}

/* 响应式设计 - 根据页面宽度自动调整布局 */

@media (max-width: 900px) {
    /* 窄屏幕：资讯和计算器改为上下分置 */
    .news-section {
        grid-template-columns: 1fr;
    }

    /* 窄屏幕：隐藏首页的分类标签 */
    #page-home .news-tabs {
        display: none;
    }
}

@media (min-width: 901px) {
    /* 宽屏幕：资讯和计算器左右分置 */
    .news-section {
        grid-template-columns: 2fr 1fr;
    }
}

@media (max-width: 900px) {
    /* 窄屏幕：资讯列表分类标签放在上方（仅资讯中心页面） */
    #page-news .news-tabs {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
        margin-top: 10px;
    }

    /* 窄屏幕：服务页面格子单列 */
    #page-services .services-grid {
        grid-template-columns: 1fr;
    }

    /* 窄屏幕：关于我们页面核心优势单列 */
    #page-about .core-advantages {
        grid-template-columns: 1fr;
    }

    /* 窄屏幕：资讯中心隐藏左侧分类,右侧内容占满整个宽度 */
    #page-news .news-sidebar {
        display: none;
    }

    #page-news .news-content-grid {
        grid-template-columns: 1fr;
    }
}

/* 贷款计算器页面响应式 - 第一步: 改为上下分置并居中 */
@media (max-width: 700px) {
    /* 当屏幕宽度小于700px时,calculator改为上下分置并居中,不缩小格子宽度 */
    #page-calculator .calculator-grid {
        grid-template-columns: 1fr;
        max-width: 550px;
        margin: 0 auto;
    }

    #page-calculator .schedule-section {
        max-width: 550px;
        margin: 30px auto 30px;
    }
}

/* 贷款计算器页面响应式 - 第二步: 只有在上下分置后还不行时才缩小格子 */
@media (max-width: 600px) {
    /* 当屏幕宽度小于600px时,进一步缩小格子宽度 */
    #page-calculator .calculator-grid {
        max-width: 100%;
        padding: 0 15px;
    }

    #page-calculator .schedule-section {
        max-width: 100%;
        padding: 0 15px;
    }

    #page-calculator .calculator-card {
        padding: 20px;
    }

    #page-calculator .schedule-section {
        padding: 20px;
    }
}

/* 当格子最小宽度无法满足时调整格子大小 */
@media (max-width: 700px) {
    #page-home .services-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    #page-home .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    /* 窄屏幕：银行产品页面格子调整 */
    #page-products .products-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    .news-tab {
        flex: 1;
        min-width: 70px;
        padding: 8px 12px;
        font-size: 13px;
        text-align: center;
    }

    /* 移动端：资讯项调整为垂直布局 */
    .news-item {
        flex-direction: column;
        gap: 10px;
    }

    .news-tag {
        align-self: flex-start;
    }

    .nav-container {
        flex-direction: column;
        gap: 15px;
    }

    .nav-menu {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
    }

    .nav-menu li a {
        font-size: 14px;
        padding: 6px 12px;
    }

    .nav-contact button {
        width: 100%;
    }

    /* 移动端：关于我们页面 */
    .page-about .core-advantages {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: repeat(2, 1fr);
    }

    /* 移动端：弹窗宽度调整 */
    .modal-content {
        max-width: 95%;
        margin: 20px;
        padding: 20px;
    }
}

/* 小屏幕手机优化 */
@media (max-width: 480px) {
    .nav-logo h1 {
        font-size: 22px;
    }

    .nav-logo p {
        font-size: 11px;
    }

    .nav-menu {
        gap: 5px;
    }

    .nav-menu li a {
        font-size: 13px;
        padding: 5px 10px;
    }

    .news-tab {
        font-size: 12px;
        padding: 6px 10px;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }
}

/* 隐藏的页面容器 */
.page-content {
    display: none;
}

.page-content.active {
    display: block;
}

/* 弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    border: none;
    background: #f3f4f6;
    border-radius: 50%;
    font-size: 20px;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #e5e7eb;
    color: #374151;
}

.modal-title {
    font-size: 24px;
    color: #10b981;
    margin-bottom: 20px;
    padding-right: 30px;
}

.modal-body {
    color: #374151;
    line-height: 1.6;
}

.modal-info-item {
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
}

.modal-info-item:last-child {
    border-bottom: none;
}

.modal-info-item strong {
    color: #10b981;
    display: inline-block;
    width: 100px;
}

.modal-footer {
    margin-top: 25px;
    text-align: center;
}

.modal-btn {
    padding: 12px 30px;
    background: #10b981;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn:hover {
    background: #059669;
}
