/* ==================== Application Dates Table ==================== */

/* Global: prevent page horizontal jiggle */
html, body { overflow-x: hidden; }

/* Responsive font sizes */
.application-dates {
    font-size: 14px; /* Desktop default */
    width: 100%;
    table-layout: fixed; /* Enable fixed table layout for column control */
    border-collapse: collapse; /* Ensure borders don't double up */
}

/* Mobile font size */
@media (max-width: 768px) {
    .application-dates {
        font-size: 12px;
    }
}

/* Column width distribution */
.application-dates th:nth-child(1),
.application-dates td:nth-child(1) {
    width: 16%; /* 通用年级 - minimum width */
}

.application-dates th:nth-child(2),
.application-dates td:nth-child(2) {
    width: 16%; /* 学校年级 - minimum width */
}

.application-dates th:nth-child(3),
.application-dates td:nth-child(3) {
    width: 17%; /* 申请开始 - more width for longer content */
}

.application-dates th:nth-child(4),
.application-dates td:nth-child(4) {
    width: 17%; /* 申请截止 - more width for longer content */
}

.application-dates th:nth-child(5),
.application-dates td:nth-child(5) {
    width: 17%; /* 评估日期 - more width for longer content */
}

.application-dates th:nth-child(6),
.application-dates td:nth-child(6) {
    width: 17%; /* 录取日期 - more width for longer content */
}

/* Table header styling - keep steelblue background */
.application-dates th {
    color: white;
    background-color: steelblue;
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
    word-wrap: break-word; /* 允许长单词换行 */
    word-break: break-word; /* 强制换行 */
    overflow-wrap: break-word; /* 现代浏览器的换行属性 */
    white-space: normal; /* 允许换行 */
}

.application-dates td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
    word-wrap: break-word; /* 允许长单词换行 */
    word-break: break-word; /* 强制换行 */
    overflow-wrap: break-word; /* 现代浏览器的换行属性 */
    white-space: normal; /* 允许换行 */
    overflow: hidden; /* 隐藏溢出内容 */
    text-overflow: ellipsis; /* 溢出时显示省略号 */
    max-width: 0; /* 配合table-layout: fixed使用 */
}

/* Table body row styling - only affects tbody */
.application-dates tbody tr:nth-child(odd) {
    background-color: #FFFFFF; /* 奇数行白色 */
}

.application-dates tbody tr:nth-child(even) {
    background-color: #F7F8FA; /* 偶数行#F7F8FA */
}

/* Hover effect for tbody rows */
.application-dates tbody tr:hover {
    background-color: #e6f3ff; /* 统一的hover效果 */
}

/* Ensure all cells in a row have the same background */
.application-dates tbody tr:nth-child(odd) td {
    background-color: #FFFFFF;
}

.application-dates tbody tr:nth-child(even) td {
    background-color: #F7F8FA;
}

.application-dates tbody tr:hover td {
    background-color: #e6f3ff;
}

/* 移动端特殊处理 */
@media (max-width: 768px) {
    .application-dates th,
    .application-dates td {
        padding: 6px 4px; /* 减少内边距 */
        font-size: 11px; /* 进一步减小字体 */
        line-height: 1.3; /* 调整行高 */
    }
    
    /* 移动端取消省略号，允许完全换行 */
    .application-dates td {
        text-overflow: clip;
        overflow: visible;
        white-space: normal;
    }
}

/* ==================== Safe Grade Tables (Steps, Materials, Assessment) ==================== */

/* 表格容器 - 强制移除所有空间 */
.safe-grade-table-wrap {
    width: 100%;
    max-width: 100%;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow-x: auto;
    clear: both;
    box-sizing: border-box;
    line-height: 0 !important;
}

/* 特别针对 step 表格 */
.safe-step-table-wrap {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 移除WordPress可能添加的外层容器间距 */
.entry-content .safe-grade-table-wrap,
.post-content .safe-grade-table-wrap,
.content .safe-grade-table-wrap,
div .safe-grade-table-wrap {
    margin: 0 !important;
    padding: 0 !important;
}

/* 移除shortcode可能产生的段落标签间距 */
p .safe-grade-table-wrap {
    margin: 0 !important;
    padding: 0 !important;
}

/* 表格 - 基础字体大小设置 */
.safe-grade-table {
    width: 100%;
    max-width: 100%;
    height: auto !important;
    border-collapse: collapse;
    background: #fff;
    font-size: 0.9rem !important; /* 表格基础字体大小 - 使用!important提高优先级 */
    font-family: Arial, sans-serif;
    table-layout: fixed;
    box-sizing: border-box;
    margin: 0 !important;
    line-height: normal;
    display: table;
}

/* 表头 - 居中，标题字体大小 */
.safe-grade-table thead th {
    background-color: steelblue;
    color: white;
    padding: 10px;
    text-align: center;
    font-weight: bold;
    font-size: 0.9rem !important; /* 表头字体大小 */
    border: 1px solid #ddd;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
}

/* 表体 - 内容字体大小 */
.safe-grade-table tbody td {
    padding: 10px;
    border: 1px solid #ddd;
    vertical-align: top;
    font-size: 0.9rem !important; /* 表格内容字体大小 */
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.6;
}

/* 编号列 - 居中，编号字体大小 */
.safe-grade-table .col-num {
    width: 15%;
    min-width: 40px;
    max-width: 80px;
    text-align: center;
    white-space: nowrap;
    font-size: 0.9rem !important; /* 编号列字体大小 */
}

/* 内容列 - 左对齐，内容字体大小（电脑端默认） */
.safe-grade-table .col-content {
    width: 85%;
    text-align: left;
    font-size: 0.9rem !important; /* 内容列字体大小 - 电脑端默认 0.9rem */
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
}

/* 年级行 - 年级标签字体大小 */
.safe-grade-table .grade-row,
.safe-grade-table .grade-row td {
    background-color: #e9f4f7 !important;
}

.safe-grade-table .grade-label {
    font-weight: bold;
    padding: 10px;
    text-align: left;
    font-size: 0.9rem !important; /* 年级标签字体大小 */
}

/* 悬停 */
.safe-grade-table tbody tr:not(.grade-row):hover {
    background-color: #f5f5f5;
}

/* ==================== 列表样式 ==================== */

/* 列表容器 */
.safe-grade-list-wrap {
    width: 100%;
    max-width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    clear: both;
    box-sizing: border-box;
    font-size: 0.9rem !important; /* 列表容器基础字体大小 */
}

/* 列表主体 - 设置列表的整体字体大小 */
.safe-grade-list {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    list-style: none;
    margin: 0;
    width: 100%;
    box-sizing: border-box;
    font-size: 0.9rem !important; /* 列表整体字体大小 - 可修改此值调整列表文字大小 */
}

/* 列表项 - 设置每个列表项的字体大小 */
.safe-grade-list li,
.safe-grade-list .list-item {
    padding: 12px 0 12px 20px;
    border-bottom: 1px dotted #e0e0e0;
    line-height: 1.6;
    position: relative;
    text-align: left;
    font-size: 0.9rem !important; /* 列表项字体大小 - 直接控制每个列表项的文字大小 */
}

/* 列表项前的圆点符号 */
.safe-grade-list li::before,
.safe-grade-list .list-item::before {
    content: "•";
    color: goldenrod;
    font-weight: bold;
    position: absolute;
    left: 0;
    font-size: 18px !important; /* 列表符号大小 - 控制前面圆点的大小 */
}

.safe-grade-list li:last-child,
.safe-grade-list .list-item:last-child {
    border-bottom: none;
}

/* 有序列表特殊处理 */
.safe-grade-list.safe-grade-list ol {
    font-size: 0.9rem !important; /* 有序列表字体大小 */
}

.safe-grade-list.safe-grade-list ol li {
    font-size: 0.9rem !important; /* 有序列表项字体大小 */
}

/* 无数据提示 */
.grade-no-data {
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    text-align: center;
    color: #666;
    margin: 0 !important;
    font-size: 0.9rem !important; /* 无数据提示字体大小 */
}

/* 移除WordPress自动添加的段落标签空间 */
.safe-grade-table-wrap + br,
.safe-grade-table-wrap + p:empty {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 0 !important;
}

/* ==================== 移动端响应式 ==================== */

/* 平板设备 (768px及以下) */
@media (max-width: 768px) {
    .safe-grade-table-wrap,
    .safe-step-table-wrap {
        margin: 0 !important;
        padding: 0 !important;
        height: auto !important;
        min-height: 0 !important;
    }
    
    /* 移动端表格字体大小 */
    .safe-grade-table {
        font-size: 0.8rem !important; /* 平板表格字体大小 */
    }
    
    .safe-grade-table thead th,
    .safe-grade-table tbody td {
        padding: 8px 6px;
        font-size: 0.8rem !important; /* 平板表格单元格字体大小 */
    }
    
    .safe-grade-table .col-num {
        width: 18%;
        min-width: 50px;
        font-size: 0.8rem !important; /* 平板编号列字体大小 */
    }
    
    /* 平板设备 - 内容列保持 0.9rem */
    .safe-grade-table .col-content {
        width: 82%;
        font-size: 0.8rem !important; /* 平板内容列字体大小 - 保持 0.9rem */
    }
    
    /* 移动端列表字体大小 */
    .safe-grade-list-wrap {
        font-size: 0.8rem !important; /* 平板列表容器字体大小 */
    }
    
    .safe-grade-list {
        font-size: 0.8rem !important; /* 平板列表字体大小 */
    }
    
    .safe-grade-list li,
    .safe-grade-list .list-item {
        font-size: 0.8rem !important; /* 平板列表项字体大小 */
    }
}

/* 手机设备 (480px及以下) - 使用重复选择器提高优先级 */
@media (max-width: 480px) {
    /* 手机端表格字体大小 */
    .safe-grade-table.safe-grade-table {
        font-size: 0.8rem !important; /* 手机表格字体大小 - 重复选择器提高优先级 */
    }
    
    .safe-grade-table.safe-grade-table thead th,
    .safe-grade-table.safe-grade-table tbody td {
        padding: 6px 4px;
        font-size: 0.8rem !important; /* 手机表格单元格字体大小 - 重复选择器提高优先级 */
    }
    
    .safe-grade-table.safe-grade-table .col-num {
        font-size: 0.8rem !important; /* 手机编号列字体大小 - 重复选择器提高优先级 */
    }
    
    /* 手机设备 - 内容列改为 0.8rem（重复选择器大幅提高优先级）*/
    .safe-grade-table.safe-grade-table .col-content {
        font-size: 0.8rem !important; /* 手机内容列字体大小 - 重复选择器提高优先级，确保覆盖桌面端设置 */
    }
    
    /* 手机端列表字体大小 - 重复选择器提高优先级 */
    .safe-grade-list-wrap.safe-grade-list-wrap {
        font-size: 0.8rem !important; /* 手机列表容器字体大小 - 重复选择器提高优先级 */
    }
    
    .safe-grade-list.safe-grade-list {
        font-size: 0.8rem !important; /* 手机列表字体大小 - 重复选择器提高优先级 */
    }
    
    .safe-grade-list.safe-grade-list li,
    .safe-grade-list.safe-grade-list .list-item {
        font-size: 0.8rem !important; /* 手机列表项字体大小 - 重复选择器提高优先级 */
    }
}
