/* ===== 基础重置和全局样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
}

body {
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    width: 100%;
    min-height: 100vh;
    color: #333;
    line-height: 1.6;

    /* 背景设置 */
    background-image: url(https://bing.biturl.top/?resolution=1920&format=image&index=0&mkt=zh-C);
    background-position: center top;
    background-repeat: no-repeat;
    background-attachment: scroll;
}

/* ===== 主容器 ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    box-sizing: border-box;
    position: relative;
}

/* ===== 右上角按钮区域 ===== */
.top-right-buttons {
    position: absolute;
    top: 20px;
    right: 20px;
    display: none;
    flex-direction: column;
    gap: 10px;
    z-index: 1002;
}

/* 按钮通用样式 */
.top-button {
    background-color: rgba(255, 255, 255, 0.5);
    color: #333;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 14px;
    box-shadow: 0 1rem 2rem rgba(0,0,0,.3);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    backdrop-filter: blur(10px) saturate(180%);
    user-select: none;
    white-space: nowrap;
    text-decoration: none;
}

.top-button:hover {
    background-color: rgba(255, 255, 255, 0.7);
    transform: scale(1.05);
    box-shadow: 0 1.2rem 2.4rem rgba(0,0,0,.35);
}

.top-button svg {
    width: 16px;
    height: 16px;
    fill: #666;
    transition: fill 0.2s ease;
}

.top-button:hover svg {
    fill: #333;
}

/* ===== 页面标题和周次切换器 ===== */
.header-container {
    text-align: center;
    margin-bottom: 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1001;
}

/* 主标题样式 */
.main-title {
    color: #333;
    font-size: 28px;
    font-weight: 500;
    opacity: 1;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    width: 100%;
    text-shadow:
            0 0 8px rgba(255,255,255,0.9),
            0 2px 4px rgba(255,255,255,0.7),
            2px 2px 8px rgba(255,255,255,0.5);
}

.main-title.fade-out {
    opacity: 0;
    transform: translateY(-20px);
}

/* 周次切换器样式 */
.week-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: absolute;
    width: 100%;
    justify-content: center;
    pointer-events: none;
    user-select: none;
}

.week-selector.show {
    opacity: 1;
    transform: translateY(0);
}

/* 周次导航按钮 */
.week-nav-btn {
    background-color: rgba(255, 255, 255, 0.5);
    color: #333;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 1rem 2rem rgba(0,0,0,.3);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    backdrop-filter: blur(10px) saturate(180%);
    pointer-events: auto;
    user-select: none;
}

.week-nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.7);
    transform: scale(1.1);
    box-shadow: 0 1.2rem 2.4rem rgba(0,0,0,.35);
}

.week-nav-btn:disabled {
    background-color: rgba(255, 255, 255, 0.3);
    color: #999;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,.2);
}

.week-nav-btn:disabled:hover {
    transform: none;
}

/* 周次显示容器 */
.week-display {
    position: relative;
    display: inline-block;
}

.current-week {
    background-color: rgba(255, 255, 255, 0.5);
    color: #333;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.4);
    min-width: 120px;
    box-shadow: 0 1rem 2rem rgba(0,0,0,.3);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    backdrop-filter: blur(10px) saturate(180%);
    pointer-events: auto;
    user-select: none;
}

.current-week:hover {
    transform: translateY(-2px);
    background-color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 1.2rem 2.4rem rgba(0,0,0,.35);
}

/* 周次下拉菜单 */
.week-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 12px;
    padding: 8px;
    margin-top: 8px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    min-width: 200px;
    background-color: rgba(255, 255, 255, 0.5);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    backdrop-filter: blur(10px) saturate(180%);
    box-shadow: 0 1rem 2rem rgba(0,0,0,.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
    pointer-events: auto;
    user-select: none;
}

.week-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(5px);
}

.week-option {
    padding: 10px 16px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #333;
    user-select: none;
}

.week-option:hover {
    background: #f8f9fa;
    color: #007bff;
}

.week-option.current {
    background: rgba(255, 255, 255, 0.2);
    color: #333;
    font-weight: 600;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

/* 自定义滚动条 */
.week-dropdown::-webkit-scrollbar {
    width: 6px;
}

.week-dropdown::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.week-dropdown::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.week-dropdown::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* ===== 课程表主体 ===== */
.schedule-wrapper {
    position: relative;
    border-radius: 8px;
    box-shadow: 0 1rem 2rem rgba(0,0,0,.3);
    overflow: hidden;
    transition: opacity 0.3s ease;
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    backdrop-filter: blur(10px) saturate(180%);
    background-color: rgba(255,255,255,.5);
}

.schedule-wrapper.loading .course-overlay {
    opacity: 0.7;
}

/* 表格基础样式 */
.schedule-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.schedule-table th,
.schedule-table td {
    border: 1px solid rgba(224, 224, 224, 0.3);
    text-align: center;
    vertical-align: middle;
    position: relative;
}

.schedule-table th {
    background-color: rgba(248, 249, 250, 0.7);
    font-weight: 600;
    color: #495057;
    padding: 12px 8px;
    font-size: 16px;
}

.schedule-table td {
    background-color: transparent;
    padding: 0;
    font-size: 12px;
    color: #666;
}

/* 表头切换按钮样式 */
.first-th {
    text-align: center !important;
    vertical-align: middle !important;
    padding: 8px !important;
    width: 120px;
    position: relative;
}

.header-toggle-button {
    width: 80px;
    height: 30px;
    cursor: pointer;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    padding: 4px;
    margin: 0 auto;
    position: relative;
}

.header-toggle-button:hover {
    background-color: rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
}

.toggle-icon {
    width: 20px;
    height: 20px;
    fill: #666;
    transition: fill 0.2s ease;
    display: block;
}

.header-toggle-button:hover .toggle-icon {
    fill: #333;
}

/* 时间列和星期列样式 */
.schedule-table .time-column {
    width: 60px;
    background-color: rgba(248, 249, 250, 0.5);
    font-weight: 500;
    font-size: 16px;
    padding: 8px 4px;
}

.duration-column {
    font-size: 16px;
    margin-top: 2px;
}

.schedule-table .day-column {
    width: calc((100% - 60px) / 5);
}

/* ===== 课程块样式 ===== */
.course-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.course-overlay.loading {
    opacity: 0.7;
}

.course-block {
    position: absolute;
    border-radius: 8px;
    padding: 8px;
    font-size: 12px;
    color: white;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    line-height: 1.3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    transition: all 0.3s ease;
}

.course-block .course-name {
    font-weight: 600;
    margin-bottom: 2px;
    font-size: 16px;
}

.course-block .course-teacher {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 2px;
}

.course-block .course-location {
    font-size: 14px;
    opacity: 0.8;
}

/* ===== 高亮效果 ===== */
.today-highlight {
    background-color: rgba(255, 193, 7, 0.6) !important;
    color: #333 !important;
    font-weight: bold !important;
    box-shadow: inset 0 0 10px rgba(255, 193, 7, 0.3);
}

.current-time-highlight {
    background-color: rgba(255, 193, 7, 0.4) !important;
    font-weight: bold !important;
}

.current-time-cell-highlight {
    background-color: rgba(255, 193, 7, 0.2) !important;
    box-shadow: inset 0 0 5px rgba(255, 193, 7, 0.3);
}

/* ===== 页脚样式 ===== */
.footer {
    position: absolute;
    top: 960px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 12px;
    color: #666;
    z-index: 1000;
    white-space: nowrap;
}

.footer a {
    color: #007bff;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #2980b9;
}

.footer img {
    position: relative;
    top: -2px;
}

/* ===== 文字不可选中 ===== */
.main-title,
.week-selector,
.schedule-table th,
.schedule-table td {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ===== 移动端适配 ===== */
@media (max-width: 768px) {
    /* 基础布局 */
    .container {
        padding: 0 10px;
    }

    .header-container {
        top: 10px;
    }

    /* 标题和周次选择器 */
    .main-title {
        font-size: 24px;
    }

    .week-nav-btn {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }

    .current-week {
        padding: 10px 18px;
        font-size: 14px;
        min-width: 100px;
    }

    .week-selector {
        gap: 10px;
    }

    /* 表头切换按钮 */
    .first-th {
        width: 80px !important;
        padding: 6px 4px !important;
    }

    .header-toggle-button {
        width: 50px;
        height: 30px;
        padding: 3px;
    }

    .toggle-icon {
        width: 18px;
        height: 18px;
    }

    .schedule-table th {
        font-size: 14px;
    }

    /* 表格样式 */
    .schedule-table .time-column {
        width: 40px;
        font-size: 12px;
        padding: 6px 2px;
    }

    .duration-column {
        font-size: 12px;
        margin-top: 2px;
    }

    /* 课程块样式 */
    .course-block {
        font-size: 10px;
        padding: 6px;
    }

    .course-block .course-name {
        font-size: 12px;
    }

    .course-block .course-teacher {
        font-size: 10px;
    }

    .course-block .course-location {
        font-size: 10px;
    }

    .footer {
        top: 930px;
    }
}

@media (min-width: 1501px) {
    .top-right-buttons {
        display: flex;
    }
}