/* =====================
   全局变量与字体设置
====================== */
:root {
    --primary-color: #007bff;
    --primary-hover-color: #0056b3;
    --text-color: #343a40;
    --label-color: #495057;
    --border-color: #ced4da;
    --background-color: #f8f9fa;
    --card-background-color: #ffffff;
    --input-background-color: #f1f3f5;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --rate-up-color: #28a745;
    --rate-down-color: #dc3545;
}

/* =====================
   页面容器与翻页系统
====================== */
.page-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.pages-wrapper {
    display: flex;
    width: 200vw;
    height: 100vh;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.page {
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

/* 页面指示器 */
.page-indicators {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    z-index: 1000;
}

.page-indicators .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-indicators .dot:hover {
    background-color: rgba(0, 0, 0, 0.4);
    transform: scale(1.2);
}

.page-indicators .dot.active {
    background-color: var(--primary-color);
    width: 32px;
    border-radius: 6px;
}

/* =====================
   外汇牌价详情页面
====================== */
.exchange-page-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px 40px;
    box-sizing: border-box;
}

.exchange-page-title {
    font-size: 42px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 48px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.exchange-page-title i {
    color: var(--primary-color);
}

.exchange-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 380px));
    gap: 32px;
    max-width: 1400px;
    width: 100%;
    justify-content: center;
}

/* 外汇卡片样式 */
.exchange-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.exchange-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.exchange-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.exchange-card:hover::before {
    opacity: 1;
}

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

.currency-header h2 {
    color: #ffffff;
    font-size: 28px;
    font-weight: 700;
    margin: 0;
}

.rate-change {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 16px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    background-color: rgba(255, 255, 255, 0.2);
}

.rate-change.positive {
    color: var(--rate-up-color);
}

.rate-change.negative {
    color: var(--rate-down-color);
}

.rate-change.neutral {
    color: #ffc107;
}

.rate-info {
    background-color: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

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

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

.rate-item span:first-child {
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
}

.rate-item .rate-value {
    color: #ffffff;
    font-size: 24px;
    font-weight: 700;
    font-family: 'Segoe UI', 'Arial', sans-serif;
}

.update-time {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    text-align: center;
}

.exchange-page-footer {
    margin-top: 40px;
    text-align: center;
    color: var(--label-color);
    font-size: 14px;
}

.exchange-page-footer p {
    margin: 8px 0;
}

.update-info {
    font-weight: 500;
    color: var(--primary-color);
}

.loading-indicator {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
    color: var(--label-color);
    font-size: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-indicator::before {
    content: '';
    width: 48px;
    height: 48px;
    border: 4px solid rgba(0, 123, 255, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-indicator.pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* =====================
   页面基础布局与字体
====================== */
body {
    font-family: 'Noto Sans SC', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}

#page1 {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
}

/* =====================
   标题样式
====================== */
h1,
h2 {
    text-align: center;
    color: var(--text-color);
    margin-top: 0;
    margin-bottom: 32px;
    /* 标题下方间距 */
    font-weight: 700;
}

h1 {
    font-size: 28px;
}

h2 {
    font-size: 24px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--label-color);
    font-size: 15px;
    font-weight: 500;
}

/* =====================
   主容器与工具区布局
====================== */
.main-container {
    display: flex;
    max-width: 1600px;
    /* 增加最大宽度以适应三列内容 */
    width: 100%;
    justify-content: center;
    /* 确保内容在容器内居中 */
    padding: 0 20px;
    /* 增加内边距防止贴边 */
}

.tool-container {
    display: flex;
    gap: 32px;
    align-items: stretch;
    flex-wrap: wrap;
    height: auto;
    width: 100%;
    justify-content: center;
}

/* =====================
   左侧财务工具卡片
====================== */
.financial-tool-card {
    flex: 0 1 600px;
    min-width: 500px;
    max-width: 600px;
    display: flex;
    flex-direction: column;
}

/* =====================
   中间堆叠工具卡片（日期工具）
====================== */
.stacked-tools-column {
    display: flex;
    flex-direction: column;
    gap: 32px;
    flex: 0 1 380px;
    min-width: 280px;
    max-width: 380px;
    min-height: 0;
}

/* =====================
   右侧外汇工具卡片（新增）
====================== */
.exchange-tools-column {
    display: flex;
    flex-direction: column;
    flex: 0 1 300px;
    min-width: 240px;
    max-width: 300px;
    align-self: stretch;
}

.exchange-rate-card {
    flex: 1;
    /* 让卡片在列中占满高度 */
    display: flex;
    flex-direction: column;
}

/* =====================
   外汇牌价样式
====================== */
.exchange-rates-container {
    display: flex;
    flex-direction: column;
    /* 竖向排列 */
    gap: 16px;
    margin-top: 8px;
    flex: 1;
    /* 让容器占满卡片剩余空间 */
    justify-content: space-evenly;
    /* 均匀分布 */
}

.currency-item {
    background-color: var(--input-background-color);
    padding: 20px 16px;
    /* 增加内边距 */
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    flex: 1;
    /* 每个货币项均分空间 */
    max-height: 180px;
    /* 限制最大高度，避免过高 */
}

.currency-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.currency-name {
    font-size: 18px;
    /* 增大字体 */
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    width: 100%;
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 8px;
}

.rate-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    padding: 0 10px;
}

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

.rate-label {
    font-size: 13px;
    color: #868e96;
}

.rate-value {
    font-size: 18px;
    font-weight: 700;
    font-family: 'Segoe UI', sans-serif;
}

.rate-value.buy {
    color: #28a745;
    /* 买入价用绿色 */
}

.rate-value.sell {
    color: #dc3545;
    /* 卖出价用红色 */
}

.exchange-note {
    font-size: 12px;
    color: #adb5bd;
    text-align: center;
    /* 居中 */
    margin-top: 24px;
    font-style: italic;
}

.loading {
    color: var(--label-color);
    text-align: center;
    width: 100%;
    padding: 20px;
}

.card {
    background-color: var(--card-background-color);
    padding: 32px;
    border-radius: 12px;
    box-shadow: 0 4px 12px var(--shadow-color);
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

/* =====================
   表单与输入框样式
====================== */
input[type="number"],
input[type="text"],
select {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 16px;
    background-color: #fff;
    transition: all 0.2s ease-in-out;
}

input[type="text"]#baseDate,
input[type="text"]#produceDate {
    background-image: none;
    cursor: text;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

/* =====================
   按钮样式
====================== */
.copy-button {
    padding: 10px 16px;
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    margin-left: 10px;
    flex-shrink: 0;
}

.copy-button:hover {
    background-color: var(--primary-hover-color);
    transform: translateY(-1px);
}

/* =====================
   结果区与分割线
====================== */
.result {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e9ecef;
    margin-bottom: 0;
    /* Override default margin for result container */
}

.result-item,
.date-row,
.expiry-row {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.card>div:last-child {
    margin-bottom: 0;
}

.result-item label,
.date-row label,
.expiry-row label {
    width: 110px;
    margin-bottom: 0;
    flex-shrink: 0;
}

.input-group {
    display: flex;
    flex-grow: 1;
    align-items: center;
}

.result input[type="text"] {
    margin-bottom: 0;
    background-color: var(--input-background-color);
}

.date-row input,
.expiry-row input {
    margin-bottom: 0;
    flex-grow: 1;
}

.result-display {
    background-color: var(--input-background-color);
    padding: 12px 16px;
    border-radius: 8px;
    min-height: 48px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    width: 100%;
}

.result-display label {
    font-weight: 700;
}

.result-display span {
    font-size: 16px;
    color: var(--primary-color);
    font-weight: 700;
}

/* =====================
   每日诗词分割线
====================== */
.poem-divider {
    width: 100%;
    height: 1px;
    border-top: 1px solid #e9ecef;
    margin: 16px 0 0 0;
}

/* =====================
   每日诗词区域
====================== */
.poem-card {
    margin-top: 40px;
    background: var(--input-background-color);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(24, 144, 255, 0.06);
    padding: 22px 16px;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.poem-title {
    font-size: 16px;
    color: #1890ff;
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.poem-content {
    font-size: 17px;
    color: #333;
    line-height: 1.7;
    min-height: 32px;
    word-break: break-all;
    font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    letter-spacing: 1.5px;
    text-align: center;
}

/* =====================
   响应式布局
====================== */
@media (max-width: 1500px) {
    body {
        padding: 24px 16px;
    }

    .main-container {
        max-width: 1400px;
        padding: 0 16px;
    }

    .tool-container {
        gap: 24px;
    }

    .financial-tool-card {
        flex: 0 1 560px;
        min-width: 500px;
        max-width: 560px;
    }

    .stacked-tools-column {
        flex: 0 1 360px;
        min-width: 320px;
        max-width: 360px;
        gap: 20px;
    }

    .exchange-tools-column {
        flex: 0 1 260px;
        min-width: 240px;
        max-width: 260px;
    }
}

@media (max-width: 1280px) {
    body {
        padding: 20px 14px;
    }

    .main-container {
        max-width: 1200px;
        padding: 0 12px;
    }

    .tool-container {
        gap: 20px;
    }

    .financial-tool-card {
        flex: 0 1 980px;
        min-width: 0;
        max-width: 980px;
    }

    .stacked-tools-column {
        flex: 0 1 620px;
        min-width: 300px;
        max-width: 620px;
        gap: 20px;
    }

    .exchange-tools-column {
        flex: 0 1 320px;
        min-width: 240px;
        max-width: 320px;
    }
}

@media (max-width: 992px) {
    .tool-container {
        flex-direction: column;
        height: auto;
        align-items: stretch;
    }

    .financial-tool-card,
    .stacked-tools-column,
    .exchange-tools-column {
        height: auto;
        min-height: 0;
        flex: unset;
        max-width: none;
        width: 100%;
    }

    .stacked-tools-column {
        gap: 20px;
    }
}