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

:root {
    --primary-color: #2563eb;
    --primary-gradient: linear-gradient(135deg, #2563eb, #1d4ed8);
    --secondary-color: #1d4ed8;
    --accent-teal: #0ea5e9;
    --accent-purple: #6366f1;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --bg-page: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.92);
    --bg-card-light: rgba(255, 255, 255, 0.8);
    --border-color: rgba(15, 23, 42, 0.08);
    --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.08);
    --shadow-light: 0 4px 12px rgba(15, 23, 42, 0.04);
    --shadow-medium: 0 8px 24px rgba(15, 23, 42, 0.06);
    --shadow-heavy: 0 12px 32px rgba(37, 99, 235, 0.18);
    --radius-small: 10px;
    --radius-medium: 12px;
    --radius-large: 18px;
    --radius-pill: 50px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #ffffff;
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Google多彩风格背景 */
.gradient-background {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 15% 20%, rgba(37, 99, 235, 0.18) 0, transparent 42%),
                radial-gradient(circle at 85% 25%, rgba(14, 165, 233, 0.15) 0, transparent 48%),
                radial-gradient(circle at 50% 75%, rgba(99, 102, 241, 0.18) 0, transparent 55%),
                radial-gradient(circle at 70% 10%, rgba(37, 99, 235, 0.12) 0, transparent 35%),
                linear-gradient(160deg, #ffffff 0%, #f3f4f6 100%);
    z-index: 0;
    pointer-events: none;
}

/* 顶部导航栏 */
.header {
    background: var(--primary-gradient);
    color: white;
    padding: 15px 20px;
    box-shadow: var(--shadow-light);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.nav-tabs {
    display: flex;
    gap: 10px;
}

.nav-tab {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 20px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-tab:hover {
    background: rgba(255, 255, 255, 0.3);
}

.nav-tab.active {
    background: white;
    color: var(--primary-color);
    font-weight: 600;
}

/* 主内容区 */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* 页面容器 */
.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

.container {
    max-width: 800px;
    margin: 0 auto;
}

/* 卡片样式 */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-large);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    box-shadow: var(--shadow-medium);
    border-color: rgba(37, 99, 235, 0.15);
    transform: translateY(-3px);
}

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

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

/* 计算类型切换 */
.calc-type-tabs {
    display: flex;
    background: #F8F9FA;
    border-radius: var(--radius-medium);
    padding: 6px;
    gap: 6px;
}

.calc-type-tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px;
    border-radius: var(--radius-small);
    font-size: 16px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.calc-type-tab:hover {
    background: rgba(37, 99, 235, 0.05);
}

.calc-type-tab.active {
    background: white;
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: var(--shadow-light);
}

/* 贷款类型按钮 */
.loan-type-grid {
    display: flex;
    gap: 10px;
}

.loan-type-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: var(--radius-medium);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.loan-type-btn:hover {
    border-color: rgba(37, 99, 235, 0.4);
    background: rgba(37, 99, 235, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.loan-type-btn.active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
    font-weight: 600;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.2);
}

/* 章节头部 */
.section-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.section-icon {
    font-size: 20px;
    margin-right: 10px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* 表单组 */
.form-group {
    margin-bottom: 24px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.form-title {
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* 输入框 */
.input-field {
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-medium);
    padding: 12px 16px;
    font-size: 16px;
    color: var(--text-primary);
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.input-field:focus {
    outline: none;
    border-color: rgba(37, 99, 235, 0.6);
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.input-field::placeholder {
    color: #CCCCCC;
}

/* 金额输入 */
.amount-input {
    display: flex;
    align-items: center;
    background: #F8F9FA;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-medium);
    padding: 0 16px;
    transition: all 0.3s ease;
}

.amount-input:focus-within {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.amount-input .input-field {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 8px;
    text-align: right;
    font-weight: 600;
}

.amount-input .input-field:focus {
    box-shadow: none;
}

.input-unit {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

/* 组合贷款金额输入 */
.combined-amount-input {
    display: flex;
    gap: 12px;
}

.amount-row {
    flex: 1;
    display: flex;
    align-items: center;
    background: #F8F9FA;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-medium);
    padding: 0 12px;
    transition: all 0.3s ease;
}

.amount-row:focus-within {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.amount-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-right: 8px;
    white-space: nowrap;
}

.amount-row .input-field {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 4px;
    font-size: 14px;
    text-align: right;
}

.amount-row .input-field:focus {
    box-shadow: none;
}

.amount-row .input-unit {
    font-size: 12px;
}

/* 年限选择器 */
.year-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.year-chip {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.year-chip:hover {
    border-color: rgba(37, 99, 235, 0.4);
    background: rgba(37, 99, 235, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.year-chip.active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}

/* 期限输入行 */
.period-input-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.period-input-group {
    flex: 1;
    display: flex;
    align-items: center;
    background: #F8F9FA;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-medium);
    padding: 0 12px;
    transition: all 0.3s ease;
}

.period-input-group:focus-within {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.period-input-group .input-field {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
}

.period-input-group .input-field:focus {
    box-shadow: none;
}

.period-separator {
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
}

.period-tips {
    margin-top: 8px;
}

.tip-text {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 4px;
}

.tip-text:last-child {
    margin-bottom: 0;
}

/* 利率输入区域 */
.rate-section {
    margin-bottom: 20px;
}

.rate-section:last-child {
    margin-bottom: 0;
}

.rate-input-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.rate-label {
    min-width: 100px;
    font-size: 14px;
    color: var(--text-secondary);
    margin-right: 16px;
}

.rate-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: #F8F9FA;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-medium);
    padding: 0 16px;
    transition: all 0.3s ease;
}

.rate-input-wrapper:focus-within {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.rate-input-wrapper .input-field {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 8px;
    text-align: right;
    font-weight: 600;
}

.rate-input-wrapper .input-field:focus {
    box-shadow: none;
}

.rate-tips {
    margin-top: 8px;
}

.rate-preset {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.preset-btn {
    flex: 1;
    background: #F8F9FA;
    border: 2px solid var(--border-color);
    padding: 10px 16px;
    border-radius: var(--radius-small);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.preset-btn:hover {
    border-color: var(--primary-color);
}

.preset-btn.active {
    background: rgba(37, 99, 235, 0.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

/* 还款方式选择器 */
.payment-type-selector {
    display: flex;
    gap: 12px;
}

.payment-option {
    flex: 1;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: var(--radius-medium);
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.payment-option:hover {
    border-color: rgba(37, 99, 235, 0.4);
    background: rgba(37, 99, 235, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.08);
}

.payment-option.active {
    background: var(--primary-gradient);
    border-color: transparent;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.2);
}

.option-icon {
    font-size: 20px;
    margin-right: 12px;
}

.option-content {
    flex: 1;
}

.option-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.option-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 期限类型切换 */
.period-type-tabs {
    display: flex;
    background: #F8F9FA;
    border-radius: var(--radius-medium);
    padding: 4px;
    margin-bottom: 16px;
}

.period-tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px;
    border-radius: var(--radius-small);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.period-tab:hover {
    background: rgba(37, 99, 235, 0.05);
}

.period-tab.active {
    background: white;
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: var(--shadow-light);
}

/* 任意贷款信息卡片 */
.loan-type-info {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-teal));
    color: white;
}

.info-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.info-icon {
    font-size: 20px;
    margin-right: 12px;
}

.info-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.info-desc {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.4;
    margin: 0;
}

/* 计算按钮 */
.calc-button-wrapper {
    margin-top: 30px;
    padding: 0 20px;
}

.calc-button {
    width: 100%;
    background: var(--primary-gradient);
    border: none;
    border-radius: var(--radius-pill);
    padding: 16px;
    font-size: 18px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    box-shadow: var(--shadow-heavy);
    transition: all 0.3s ease;
    letter-spacing: 0.02em;
}

.calc-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 40px rgba(37, 99, 235, 0.25);
}

.calc-button:active {
    transform: translateY(0);
    box-shadow: var(--shadow-medium);
}

/* 隐私说明 */
.privacy-notice {
    padding: 30px 20px 40px;
    text-align: center;
}

.privacy-text {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* 历史记录页面 */
.filter-card {
    margin-bottom: 20px;
}

.filter-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.filter-item {
    flex: 1;
    display: flex;
    align-items: center;
}

.filter-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-right: 10px;
    white-space: nowrap;
}

.filter-select {
    flex: 1;
    background: #F8F9FA;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-small);
    padding: 8px 12px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.search-box {
    position: relative;
}

.search-input {
    width: 100%;
    background: #F8F9FA;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-medium);
    padding: 12px 40px 12px 16px;
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
}

/* 历史记录列表 */
.history-list {
    margin-bottom: 20px;
}

.history-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-medium);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-light);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
}

.history-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
    border-color: rgba(37, 99, 235, 0.15);
}

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

.history-type {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.history-date {
    font-size: 12px;
    color: var(--text-muted);
}

.history-details {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 12px;
}

.history-detail-item {
    font-size: 13px;
    color: var(--text-secondary);
}

.history-result {
    display: flex;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.history-result-item {
    font-size: 13px;
}

.result-label-small {
    color: var(--text-secondary);
    margin-right: 4px;
}

.result-value-small {
    color: var(--primary-color);
    font-weight: 600;
}

.history-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.history-action-btn {
    background: #F8F9FA;
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: var(--radius-small);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

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

.history-action-btn.delete {
    color: #FF4D4F;
}

.history-action-btn.delete:hover {
    border-color: #FF4D4F;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.empty-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.empty-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

/* 统计卡片 */
.stats-card {
    margin-top: 20px;
}

.stats-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    text-align: center;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
}

/* 详情页面 */
.back-button {
    background: white;
    border: 2px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.back-button:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.result-card {
    background: var(--primary-gradient);
    color: white;
}

.result-title {
    font-size: 20px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 20px;
}

.result-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.summary-item {
    text-align: center;
}

.summary-label {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 6px;
}

.summary-value {
    font-size: 16px;
    font-weight: 600;
}

/* 还款方式切换 */
.payment-toggle {
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.toggle-label {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 12px;
}

.toggle-selector {
    display: flex;
    gap: 12px;
}

.toggle-option {
    flex: 1;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    padding: 12px;
    border-radius: var(--radius-medium);
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-option:hover {
    background: rgba(255, 255, 255, 0.25);
}

.toggle-option.active {
    background: white;
    border-color: white;
}

.toggle-option.active .option-icon,
.toggle-option.active .option-name,
.toggle-option.active .option-desc {
    color: var(--primary-color);
}

/* 核心结果 */
.core-results {
    margin-bottom: 20px;
}

.results-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.result-item.highlight {
    background: rgba(37, 99, 235, 0.08);
    margin: 0 -24px;
    padding: 12px 24px;
    border-radius: var(--radius-small);
    border: none;
}

.result-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.result-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.result-item.highlight .result-value {
    color: var(--primary-color);
}

.text-warning {
    color: #FAAD14;
}

.text-success {
    color: var(--primary-color);
}

/* 图表 */
.chart-card {
    margin-bottom: 20px;
}

.chart-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    text-align: center;
}

.chart-container {
    position: relative;
    height: 250px;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.action-btn {
    flex: 1;
    padding: 12px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
    color: white;
    box-shadow: var(--shadow-heavy);
    letter-spacing: 0.02em;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 40px rgba(37, 99, 235, 0.25);
}

.btn-secondary {
    background: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-secondary:hover {
    background: rgba(37, 99, 235, 0.08);
}

/* 弹窗 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease-out;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-large);
    padding: 0;
    margin: 20px;
    max-width: 800px;
    max-height: 90vh;
    width: 100%;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #F8F9FA;
    color: var(--text-primary);
}

.modal-body {
    padding: 20px 24px;
    max-height: calc(90vh - 140px);
    overflow-y: auto;
}

/* 还款明细表格 */
.schedule-table-wrapper {
    overflow-x: auto;
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.schedule-table th {
    background: #F8F9FA;
    color: var(--text-secondary);
    font-weight: 600;
    padding: 12px 8px;
    text-align: center;
    position: sticky;
    top: 0;
}

.schedule-table td {
    padding: 10px 8px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.schedule-table tr:hover {
    background: #F8F9FA;
}

.schedule-table tr:nth-child(even) {
    background: #FAFAFA;
}

/* Toast 提示 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius-medium);
    font-size: 14px;
    z-index: 2000;
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.toast.show {
    display: block;
}

/* 响应式设计 - 优化移动端体验 */

/* 平板设备 (768px - 1024px) */
@media (max-width: 1024px) {
    .container {
        max-width: 100%;
    }
}

/* 小平板和大手机 (480px - 768px) */
@media (max-width: 768px) {
    /* 头部导航 */
    .header {
        padding: 12px 15px;
    }
    
    .header-content {
        flex-direction: column;
        gap: 12px;
    }
    
    .logo {
        font-size: 18px;
    }
    
    .nav-tabs {
        width: 100%;
        justify-content: center;
    }
    
    .nav-tab {
        flex: 1;
        max-width: 150px;
    }

    /* 主内容区 */
    .main-content {
        padding: 15px;
    }
    
    .card {
        padding: 20px;
        margin-bottom: 15px;
    }

    /* 计算类型切换 - 保持横向 */
    .calc-type-tabs {
        flex-wrap: wrap;
    }
    
    .calc-type-tab {
        font-size: 14px;
        padding: 10px 8px;
    }

    /* 贷款类型按钮 */
    .loan-type-grid {
        flex-direction: column;
        gap: 8px;
    }
    
    .loan-type-btn {
        font-size: 15px;
    }

    /* 组合金额输入 */
    .combined-amount-input {
        flex-direction: column;
        gap: 10px;
    }

    /* 期限输入 */
    .period-input-row {
        flex-direction: column;
        gap: 10px;
    }

    .period-separator {
        display: none;
    }
    
    .period-input-group {
        width: 100%;
    }

    /* 年限选择器 */
    .year-selector {
        gap: 8px;
    }
    
    .year-chip {
        padding: 10px 14px;
        font-size: 14px;
        min-width: auto;
        flex: 1;
    }

    /* 还款方式选择 */
    .payment-type-selector {
        flex-direction: column;
        gap: 10px;
    }
    
    .payment-option {
        padding: 14px;
    }

    /* 利率输入 */
    .rate-input-row {
        flex-direction: column;
        align-items: stretch;
    }

    .rate-label {
        margin-bottom: 8px;
        margin-right: 0;
        min-width: auto;
    }

    /* 结果展示 */
    .result-summary {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .summary-item {
        padding: 8px 0;
    }

    /* 统计信息 */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* 操作按钮 */
    .action-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .action-btn {
        width: 100%;
    }

    /* 筛选行 */
    .filter-row {
        flex-direction: column;
        gap: 12px;
    }
    
    .filter-item {
        width: 100%;
    }

    /* 弹窗 */
    .modal-content {
        margin: 10px;
        max-height: 90vh;
        max-width: calc(100% - 20px);
    }
    
    .schedule-table {
        font-size: 12px;
    }
    
    .schedule-table th,
    .schedule-table td {
        padding: 8px 4px;
    }
    
    /* 图表 */
    .chart-container {
        height: 220px;
    }
    
    /* 历史记录 */
    .history-item {
        padding: 14px;
    }
    
    .history-details {
        flex-direction: column;
        gap: 6px;
    }
}

/* 手机设备 (max-width: 480px) */
@media (max-width: 480px) {
    /* 全局 */
    body {
        font-size: 14px;
    }
    
    /* 头部 */
    .header {
        padding: 10px 12px;
    }
    
    .logo {
        font-size: 16px;
    }
    
    .nav-tab {
        font-size: 13px;
        padding: 6px 14px;
    }
    
    /* 主内容 */
    .main-content {
        padding: 12px;
    }

    .card {
        padding: 16px;
        border-radius: 16px;
        margin-bottom: 12px;
    }
    
    /* 章节标题 */
    .section-title {
        font-size: 16px;
    }
    
    .section-icon {
        font-size: 18px;
    }

    /* 表单 */
    .form-label {
        font-size: 13px;
    }
    
    .input-field {
        font-size: 15px;
        padding: 10px 12px;
    }

    /* 计算类型切换 */
    .calc-type-tab {
        font-size: 13px;
        padding: 10px 6px;
    }
    
    /* 年限选择 */
    .year-selector {
        gap: 6px;
    }

    .year-chip {
        padding: 8px 10px;
        font-size: 13px;
        min-width: 60px;
    }
    
    /* 金额输入 */
    .amount-input .input-field,
    .amount-row .input-field {
        font-size: 16px; /* 防止iOS自动缩放 */
    }
    
    /* 还款方式 */
    .option-name {
        font-size: 13px;
    }
    
    .option-desc {
        font-size: 11px;
    }
    
    .option-icon {
        font-size: 18px;
    }
    
    /* 计算按钮 */
    .calc-button {
        padding: 14px;
        font-size: 16px;
        height: auto;
    }
    
    /* 提示文本 */
    .tip-text {
        font-size: 11px;
    }
    
    /* 预设按钮 */
    .preset-btn {
        font-size: 11px;
        padding: 8px 10px;
    }
    
    /* 详情页 */
    .back-button {
        font-size: 13px;
        padding: 6px 12px;
    }
    
    .result-title {
        font-size: 18px;
    }
    
    .summary-label {
        font-size: 12px;
    }
    
    .summary-value {
        font-size: 14px;
    }
    
    .results-title {
        font-size: 16px;
    }
    
    .result-label {
        font-size: 13px;
    }
    
    .result-value {
        font-size: 16px;
    }
    
    /* 图表 */
    .chart-container {
        height: 200px;
    }
    
    .chart-title {
        font-size: 15px;
    }
    
    /* 历史记录 */
    .history-item {
        padding: 12px;
        margin-bottom: 10px;
    }
    
    .history-type {
        font-size: 14px;
    }
    
    .history-date {
        font-size: 11px;
    }
    
    .history-detail-item {
        font-size: 12px;
    }
    
    .history-action-btn {
        font-size: 11px;
        padding: 5px 10px;
    }
    
    /* 统计卡片 */
    .stats-title {
        font-size: 15px;
    }
    
    .stat-label {
        font-size: 11px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    /* 空状态 */
    .empty-icon {
        font-size: 50px;
    }
    
    .empty-title {
        font-size: 18px;
    }
    
    .empty-desc {
        font-size: 13px;
    }
    
    /* 弹窗 */
    .modal-content {
        margin: 8px;
        max-height: 92vh;
        border-radius: 16px;
    }
    
    .modal-header {
        padding: 15px 16px;
    }
    
    .modal-title {
        font-size: 16px;
    }
    
    .modal-body {
        padding: 15px 16px;
        max-height: calc(92vh - 120px);
    }
    
    .schedule-table {
        font-size: 11px;
    }
    
    .schedule-table th,
    .schedule-table td {
        padding: 6px 2px;
    }
    
    /* Toast */
    .toast {
        padding: 12px 20px;
        font-size: 13px;
        max-width: calc(100% - 40px);
    }
}

/* 超小屏幕 (max-width: 360px) */
@media (max-width: 360px) {
    .main-content {
        padding: 10px;
    }
    
    .card {
        padding: 14px;
    }
    
    .calc-type-tab {
        font-size: 12px;
        padding: 8px 4px;
    }
    
    .year-chip {
        padding: 7px 8px;
        font-size: 12px;
        min-width: 50px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .loan-type-btn {
        font-size: 14px;
        padding: 12px;
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    /* 增加触摸目标大小 */
    button,
    .year-chip,
    .loan-type-btn,
    .payment-option,
    .history-item,
    .nav-tab {
        min-height: 44px; /* iOS建议的最小触摸尺寸 */
    }
    
    /* 移除hover效果 */
    button:hover,
    .year-chip:hover,
    .loan-type-btn:hover {
        transform: none;
    }
    
    /* 增加active反馈 */
    button:active,
    .year-chip:active,
    .loan-type-btn:active {
        opacity: 0.8;
        transform: scale(0.98);
    }
}

/* 横屏适配 */
@media (max-width: 768px) and (orientation: landscape) {
    .header {
        padding: 8px 15px;
    }
    
    .card {
        padding: 16px;
    }
    
    .chart-container {
        height: 180px;
    }
    
    .modal-content {
        max-height: 85vh;
    }
}

/* ==========================================
   友情链接 (Links Section)
   ========================================== */
.links-section {
    margin-top: 24px;
    padding: 0;
}

.links-container {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.03) 0%, rgba(14, 165, 233, 0.02) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-medium);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    transition: all 0.3s ease;
}

.links-container:hover {
    border-color: rgba(37, 99, 235, 0.2);
    box-shadow: 0 2px 12px rgba(37, 99, 235, 0.08);
}

.links-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.links-label::before {
    content: '🔗';
    font-size: 14px;
}

.links-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

.link-item {
    position: relative;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: var(--radius-small);
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid transparent;
    transition: all 0.3s ease;
    font-weight: 500;
}

.link-item:hover {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}

.link-item:active {
    transform: translateY(0);
}

/* 移除竖线分隔符 */
.link-item::after {
    display: none;
}

/* 移动端友情链接适配 */
@media (max-width: 768px) {
    .links-section {
        margin-top: 20px;
    }
    
    .links-container {
        padding: 14px 16px;
        gap: 10px;
    }
    
    .links-label {
        font-size: 12px;
        width: 100%;
        justify-content: center;
    }
    
    .links-list {
        width: 100%;
        justify-content: center;
        gap: 6px;
    }
    
    .link-item {
        font-size: 12px;
        padding: 5px 10px;
    }
}

/* 超小屏幕适配 */
@media (max-width: 480px) {
    .links-container {
        padding: 12px;
    }
    
    .links-list {
        gap: 4px;
    }
    
    .link-item {
        font-size: 11px;
        padding: 4px 8px;
    }
}

