/* Extracted from legacy Custom-Fee-Table.php */

/* 表格容器样式 - 允许水平滚动 */
.custom-fee-table {
    overflow-x: auto;
    margin: 0px 0;
    width: 100%;
    max-width: 100%;
}

/* 表格基本样式 */
.custom-fee-table .dce-acf-repeater-table {
    width: 100% !important;
    border-collapse: collapse !important;
    background: white !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    min-width: 600px !important;
    table-layout: auto !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 表格单元格通用样式 - 高特异性，增加padding */
.custom-fee-table .dce-acf-repeater-table th,
.custom-fee-table .dce-acf-repeater-table td {
    padding: 9px 7px !important;
    text-align: center !important;
    border: 1px solid #dee2e6 !important;
    white-space: nowrap !important;
    font-size: 0.9rem !important;
    vertical-align: middle !important;
    line-height: 1.5 !important;
    margin: 0 !important;
}

/* 表头样式 - 高特异性 */
.custom-fee-table .dce-acf-repeater-table thead th {
    background-color: steelblue !important;
    color: white !important;
    font-weight: 600 !important;
    border: 1px solid #4682b4 !important;
}

/* 奇偶行背景色 - 高特异性覆盖外部样式 */
.custom-fee-table .dce-acf-repeater-table tbody tr:nth-child(odd) td {
    background-color: #fff !important;
}

.custom-fee-table .dce-acf-repeater-table tbody tr:nth-child(even) td {
    background-color: #fafafa !important;
}

/* 悬停效果 - 高特异性 */
.custom-fee-table .dce-acf-repeater-table tbody tr:hover td {
    background-color: #f2f3f4 !important;
}

/* 列宽设置 - 自适应 (由 Antigravity 优化) */

/* 首列保留加粗 */
.custom-fee-table .dce-acf-repeater-table th:nth-child(1),
.custom-fee-table .dce-acf-repeater-table td:nth-child(1) {
    font-weight: 600 !important;
}

/* 重置所有列宽为自适应 */
.custom-fee-table .dce-acf-repeater-table th,
.custom-fee-table .dce-acf-repeater-table td {
    width: auto !important;
}

/* 通过类名控制宽度 (紧凑模式) */
.custom-fee-table .col-nowrap {
    white-space: nowrap !important;
    width: 1% !important;
}

/* 通过类名控制宽度 (填充模式) */
.custom-fee-table .col-normal {
    white-space: normal !important;
    word-break: break-word !important;
    min-width: 100px !important;
    width: auto !important;
}

/* 金额列特殊样式 - 确保完整显示 */
.custom-fee-table .col-currency,
.custom-fee-table .col-currency .repeater-item {
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important; /* 防止显示省略号 */
    max-width: none !important;
    width: auto !important;
}

/* 学费列额外样式 - 高特异性，更新颜色为steelblue */
/* 注意：这里使用col-currency可能更通用，但保留nth-child以防特定列需要颜色 */
.custom-fee-table .dce-acf-repeater-table td:nth-child(4) {
    font-weight: 600 !important;
    color: steelblue !important;
}

/* 数字列样式 - 高特异性 */
.custom-fee-table .dce-acf-repeater-table td:nth-child(1) .repeater-item,
.custom-fee-table .dce-acf-repeater-table td:nth-child(3) .repeater-item,
.custom-fee-table .dce-acf-repeater-table td:nth-child(4) .repeater-item {
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
    max-width: none !important;
    display: inline-block !important;
}

/* 文字列样式 - 高特异性 */
.custom-fee-table .dce-acf-repeater-table td:nth-child(2) .repeater-item,
.custom-fee-table .dce-acf-repeater-table td:nth-child(5) .repeater-item {
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    display: inline-block !important;
}

/* 专门处理外部样式的覆盖 - 针对 .dce-acf-repeater-table tr td:first-child */
.custom-fee-table .dce-acf-repeater-table tr td:first-child {
    background-color: white !important;
    font-weight: 600 !important; /* 首列字体加粗，覆盖外部样式 */
}

/* 专门处理外部样式的覆盖 - 针对 table tbody>tr:nth-child(odd)>td */
.custom-fee-table table tbody tr:nth-child(odd) td,
.custom-fee-table table tbody tr:nth-child(odd) th {
    background-color: white !important;
}

.custom-fee-table table tbody tr:nth-child(even) td,
.custom-fee-table table tbody tr:nth-child(even) th {
    background-color: #fafafa !important;
}

/* 专门处理外部样式的覆盖 - 针对 table td, table th */
.custom-fee-table table td,
.custom-fee-table table th {
    border: 1px solid #dee2e6 !important;
    line-height: 1.5 !important;
    padding: 10px 8px !important;
    vertical-align: middle !important;
}

/* 确保repeater-item元素正确显示 */
.custom-fee-table .repeater-item {
    display: inline-block !important;
    box-sizing: border-box !important;
}

/* 响应式设计 - 移动设备 */
@media (max-width: 768px) {
    .custom-fee-table .dce-acf-repeater-table {
        /* 允许表格宽度由内容决定，但至少占满屏幕 */
        min-width: 100% !important;
        width: auto !important;
    }

    .custom-fee-table .dce-acf-repeater-table th,
    .custom-fee-table .dce-acf-repeater-table td {
        padding: 10px 8px !important;
        font-size: 0.8rem !important;
    }

    /* 手机端：当有建校费和年支出列时，隐藏年龄列 */
    .custom-fee-table.has-levy .col-age {
        display: none !important;
    }
    
    /* 手机端：当有建校费和年支出列时，也隐藏阶段列 */
    .custom-fee-table.has-levy .col-stage {
        display: none !important;
    }
}

/* 确保自适应布局生效 (ID选择器增强优先级) */
#stp-fee-table-wrapper .col-nowrap {
    white-space: nowrap !important;
    width: 1% !important;
}

#stp-fee-table-wrapper .col-normal {
    white-space: normal !important;
    word-break: break-word !important;
    width: auto !important;
}

/* 备注说明样式 */
.fee-table-note {
    margin-top: 10px; 
    font-size: 0.9em; 
    color: #666; 
    line-height: 1.4;
    font-style: italic;
}
