/* ========================================
   基金赎回日期计算器 - 样式
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background: #f5f8fb;
    color: #2d3748;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 16px;
}

/* ========== 头部 ========== */
.page-header {
    text-align: center;
    padding: 24px 0 8px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: #1a365d;
    letter-spacing: 0.5px;
}

/* ========== 区块标题 ========== */
.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 20px 0 12px;
    gap: 12px;
}

.section-title {
    font-size: 17px;
    font-weight: 700;
    color: #1a365d;
    padding-left: 12px;
    border-left: 3px solid #3182ce;
    margin: 0;
}

/* 微信信息 */
.wechat-info {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid #cbd5e0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    flex-shrink: 0;
}

.wechat-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    border-radius: 4px;
}

.wechat-name {
    font-size: 13px;
    color: #2d3748;
    font-weight: 500;
    white-space: nowrap;
}

/* ========== 卡片容器 ========== */
.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 16px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

/* ========== 规则表格 ========== */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
}

.rule-table {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
    text-align: center;
    font-size: 13px;
    white-space: nowrap;
}

.rule-table th,
.rule-table td {
    padding: 10px 6px;
    border: 1px solid #cbd5e0;
}

/* 一级分类表头 - A股蓝色 */
.cat-header-ag {
    background: #3182ce;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 1px;
}

/* 一级分类表头 - QDII紫色 */
.cat-header-qdii {
    background: #805ad5;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 1px;
}

/* 二级分类表头 - A股 */
.sub-header-ag {
    background: #ebf8ff;
    color: #2b6cb0;
    font-weight: 600;
    font-size: 13px;
}

/* 二级分类表头 - QDII */
.sub-header-qdii {
    background: #faf5ff;
    color: #6b46c1;
    font-weight: 600;
    font-size: 13px;
}

/* 三级列表头 - A股 */
.col-header-ag {
    background: #f7faff;
    font-weight: 500;
    font-size: 12px;
    color: #2d3748;
}

/* 三级列表头 - QDII */
.col-header-qdii {
    background: #fafaff;
    font-weight: 500;
    font-size: 12px;
    color: #2d3748;
}

/* 数据行 - A股 */
.data-cell-ag {
    background: #ffffff;
    color: #1a202c;
}

/* 数据行 - QDII */
.data-cell-qdii {
    background: #ffffff;
    color: #1a202c;
}

/* 偶数行加深 */
.rule-table tbody tr:nth-child(even) .data-cell-ag {
    background: #f7fafc;
}

.rule-table tbody tr:nth-child(even) .data-cell-qdii {
    background: #f7fafc;
}

/* 到账规则行 - A股 */
.rule-row-ag {
    background: #ebf8ff;
    font-size: 12px;
    color: #2b6cb0;
    padding: 10px 6px;
    font-weight: 500;
}

/* 到账规则行 - QDII */
.rule-row-qdii {
    background: #faf5ff;
    font-size: 12px;
    color: #6b46c1;
    padding: 10px 6px;
    font-weight: 500;
}

/* 节假日规则行 */
.rule-row-common {
    background: #f7fafc;
    text-align: left;
    padding: 14px 16px !important;
    font-size: 13px;
    line-height: 1.8;
    color: #2d3748;
    white-space: normal;
}

/* 高亮规则行 */
.rule-row-highlight {
    background: #ffffff;
    font-size: 13px;
    line-height: 1.8;
    color: #2d3748;
    white-space: normal;
    padding: 12px 16px !important;
}

/* ========== 计算器表单 ========== */
.calculator-form {
    padding: 20px;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 12px;
    align-items: end;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: #4a5568;
    white-space: nowrap;
}

.form-group select,
.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    color: #1a202c;
    background: #ffffff;
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%234a5568' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.15);
}

.btn-calculate {
    padding: 10px 24px;
    background: #3182ce;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.btn-calculate:hover {
    background: #2c5282;
}

.btn-calculate:active {
    transform: scale(0.98);
}

/* ========== 计算结果 ========== */
.result-section {
    padding: 0 20px 20px;
    display: none;
}

.result-section.show {
    display: block;
}

.result-divider {
    border: none;
    border-top: 1px solid #e2e8f0;
    margin: 0 20px;
}

.result-title {
    font-size: 15px;
    font-weight: 700;
    color: #1a365d;
    margin-bottom: 14px;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.result-item {
    background: #f7fafc;
    padding: 14px 12px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e2e8f0;
}

.result-item .label {
    font-size: 12px;
    color: #718096;
    margin-bottom: 6px;
    font-weight: 500;
}

.result-item .value {
    font-size: 16px;
    font-weight: 700;
    color: #2b6cb0;
    word-break: break-all;
}

.result-item .value.qdii {
    color: #805ad5;
}

.result-note {
    padding: 14px 16px;
    background: #f7fafc;
    border-radius: 8px;
    font-size: 13px;
    color: #2d3748;
    line-height: 1.7;
    border: 1px solid #e2e8f0;
}

.result-note.error {
    background: #fff5f5;
    color: #c53030;
    border-color: #fed7d7;
}

/* ========== 响应式 ========== */
@media (max-width: 640px) {
    .container {
        padding: 10px;
    }

    .page-header {
        padding: 16px 0 4px;
    }

    .page-header h1 {
        font-size: 19px;
    }

    .section-title-row {
        align-items: flex-start;
    }

    .section-title {
        font-size: 15px;
        margin: 0;
    }

    .wechat-info {
        padding: 4px 8px;
    }

    .wechat-icon {
        width: 18px;
        height: 18px;
    }

    .wechat-name {
        font-size: 11px;
    }

    .card {
        border-radius: 8px;
    }

    .calculator-form {
        padding: 14px;
        grid-template-columns: 1fr 1fr;
    }

    .btn-calculate {
        padding: 12px;
        font-size: 15px;
    }

    .result-section {
        padding: 0 14px 14px;
    }

    .result-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .result-item {
        padding: 12px 10px;
    }

    .result-item .value {
        font-size: 14px;
    }

    .rule-table {
        min-width: 0;
        table-layout: fixed;
        font-size: 10px;
    }

    .rule-table th,
    .rule-table td {
        padding: 6px 2px;
    }

    .cat-header-ag,
    .cat-header-qdii {
        font-size: 11px;
        letter-spacing: 0;
    }

    .sub-header-ag,
    .sub-header-qdii {
        font-size: 10px;
    }

    .col-header-ag,
    .col-header-qdii {
        font-size: 10px;
    }

    .rule-row-ag,
    .rule-row-qdii {
        font-size: 10px;
        padding: 6px 2px;
    }

    .rule-row-common {
        padding: 10px 12px !important;
        font-size: 12px;
        line-height: 1.7;
    }

    .rule-row-highlight {
        padding: 8px 12px !important;
        font-size: 12px;
        line-height: 1.7;
    }
}

/* 极小屏 */
@media (max-width: 380px) {
    .result-grid {
        grid-template-columns: 1fr;
    }

    .page-header h1 {
        font-size: 17px;
    }

    .rule-table {
        font-size: 9px;
    }

    .rule-table th,
    .rule-table td {
        padding: 4px 1px;
    }

    .cat-header-ag,
    .cat-header-qdii {
        font-size: 10px;
    }

    .rule-row-common {
        padding: 8px 10px !important;
        font-size: 11px;
        line-height: 1.6;
    }

    .rule-row-highlight {
        padding: 8px 10px !important;
        font-size: 11px;
        line-height: 1.6;
    }
}
