/* 表格基础样式 */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.05);
}

th, td {
    padding: 12px 15px;
    text-align: left;
    vertical-align: top;
}

th {
    background-color: var(--primary-color);
    font-weight: 600;
    color: white;
    padding: 15px;
}

td {
    border-bottom: 1px solid #eee;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:nth-child(odd) {
    background-color: var(--light-bg);
}

tbody tr:hover {
    background-color: #f9f9f9;
}

/* 课程备注样式 */
.course-remark {
    font-size: 0.85em;
    color: #888;
    margin-left: 5px;
}

.flexible-courses-note {
    margin-top: 30px;
    padding: 15px;
    background-color: #f0f0f0;
    border-radius: 8px;
    border: 1px solid #ddd;
    text-align: left;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.flexible-courses-note p {
    margin-bottom: 8px;
    line-height: 1.5;
}

.flexible-courses-note strong {
    color: var(--primary-dark);
    display: block;
    margin-bottom: 10px;
    font-size: 1.1em;
    text-align: center;
}

/* 添加表情符号的动画效果 */
[data-label="科目"] {
    position: relative;
}

[data-label="科目"] span {
    display: inline-block;
    transition: transform 0.3s;
}

tr:hover [data-label="科目"] span {
    transform: scale(1.2);
}

/* 响应式表格样式 */
@media (max-width: 768px) {
    /* 默认表格响应式处理 */
    table:not(#all-courses table) {
        width: 100%;
        display: block;
        overflow-x: auto;
    }
    
    table:not(#all-courses table), 
    table:not(#all-courses table) thead, 
    table:not(#all-courses table) tbody, 
    table:not(#all-courses table) th, 
    table:not(#all-courses table) td, 
    table:not(#all-courses table) tr {
        display: block;
    }
    
    table:not(#all-courses table) thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    table:not(#all-courses table) tr {
        border: 1px solid #ccc;
        margin-bottom: 8px;
        border-radius: 6px;
        overflow: hidden;
    }
    
    table:not(#all-courses table) td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 45%;
        text-align: left;
        padding-top: 8px;
        padding-bottom: 8px;
        min-height: 2.5em;
        word-break: break-word;
        display: flex;
        flex-direction: column;
        justify-content: center;
        font-size: 0.9em;
        line-height: 1.4;
    }
    
    table:not(#all-courses table) td:last-child {
        border-bottom: none;
    }
    
    table:not(#all-courses table) td:before {
        position: absolute;
        top: 8px;
        left: 10px;
        width: 45%;
        padding-right: 10px;
        white-space: normal;
        text-align: left;
        font-weight: bold;
        content: attr(data-label);
        color: var(--primary-dark);
        display: block;
        margin-bottom: 5px;
        font-size: 0.9em;
        line-height: 1.2;
    }
    
    /* 所有课程表格在移动端的特殊处理 - 水平滚动方式 */
    #all-courses table, 
    #all-courses thead, 
    #all-courses tbody, 
    #all-courses th, 
    #all-courses td, 
    #all-courses tr {
        display: table;
        width: auto;
    }
    
    #all-courses table {
        display: table;
        width: 100%;
        font-size: 14px;
    }
    
    #all-courses tr {
        display: table-row;
        border: none;
        margin: 0;
        border-radius: 0;
    }
    
    #all-courses th, 
    #all-courses td {
        display: table-cell;
        padding: 8px 10px;
        white-space: nowrap;
        position: static;
        border-bottom: 1px solid #eee;
        text-align: left;
    }
    
    /* 调整序号列宽度 */
    #all-courses th:first-child,
    #all-courses td:first-child {
        width: 40px;
        min-width: 40px;
        max-width: 40px;
        padding-left: 5px;
        padding-right: 5px;
        text-align: center;
    }
    
    /* 调整课时列宽度 */
    #all-courses th:last-child,
    #all-courses td:last-child {
        width: 60px;
        min-width: 60px;
    }
    
    /* 移除之前的伪元素标签 */
    #all-courses td:before {
        display: none;
        content: none;
    }
    
    /* 确保表格容器允许水平滚动 */
    .course-view {
        overflow-x: auto;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 保留表头样式 */
    #all-courses thead {
        display: table-header-group;
    }
    
    #all-courses thead tr {
        position: static;
    }
}

/* 针对更小的屏幕 (例如宽度小于 480px) */
@media (max-width: 480px) {
    /* 进一步减小表格字体和内边距 */
    #all-courses table {
        font-size: 12px;
    }
    
    #all-courses th, 
    #all-courses td {
        padding: 6px 8px;
    }
    
    /* 调整普通表格的样式 */
    table:not(#all-courses table) td {
        padding-top: 6px;
        padding-bottom: 6px;
        padding-left: 38%;
        font-size: 0.85em;
        line-height: 1.3;
    }
    
    table:not(#all-courses table) td:before {
        top: 6px;
        width: 35%;
        font-size: 0.85em;
    }
}