/* 自定义样式 */
body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    font-family: 'Microsoft YaHei', sans-serif;
    min-height: 100vh;
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 成功消息动画 */
.alert-success {
    animation: slideInDown 0.5s ease-out;
}

.alert-error {
    animation: shake 0.5s ease-in-out;
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.navbar-brand {
    font-weight: bold;
}

.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.card-header {
    border-radius: 12px 12px 0 0 !important;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

/* 课程卡片特殊样式 */
.course-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
}

.course-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.course-card.type-required {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
}

.course-card.type-elective {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
}

.course-card.type-practice {
    background: linear-gradient(135deg, #feca57 0%, #ff9ff3 100%);
}

.btn {
    border-radius: 8px;
    font-weight: 500;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

/* 课程表样式 */
.schedule-day {
    margin-bottom: 1.5rem;
}

.schedule-day-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px 8px 0 0;
    font-weight: bold;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.schedule-day-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.schedule-day-header:hover::before {
    left: 100%;
}

/* 响应式优化 */
@media (max-width: 768px) {
    .card {
        margin-bottom: 1rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .course-card {
        padding: 0.5rem;
        font-size: 0.875rem;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
    }
}

.course-item {
    border: 1px solid #e9ecef;
    border-top: none;
    padding: 1rem;
    background: white;
    transition: all 0.3s ease;
}

.course-item:hover {
    background-color: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.course-item:last-child {
    border-radius: 0 0 8px 8px;
}

.course-name {
    font-weight: bold;
    color: #495057;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.course-detail {
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.course-section {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    display: inline-block;
    margin-bottom: 0.5rem;
}

.no-courses {
    text-align: center;
    color: #6c757d;
    padding: 2rem;
    border: 1px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 8px 8px;
    background: white;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .course-item {
        padding: 0.75rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }
}

/* 加载动画 */
.spinner-border {
    width: 3rem;
    height: 3rem;
}

/* 统计信息样式 */
.stats-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    text-align: center;
}

.stats-number {
    font-size: 2rem;
    font-weight: bold;
    display: block;
}

.stats-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* 学生信息样式 */
.student-info {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid #0d6efd;
}

.student-name {
    font-weight: bold;
    color: #495057;
    font-size: 1.1rem;
}

.student-class {
    color: #6c757d;
    font-size: 0.9rem;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

/* 网格式课程表样式 */
.schedule-grid-container {
    overflow-x: auto;
    margin: 1.5rem 0;
    padding: 1rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 16px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.schedule-grid {
    display: grid;
    grid-template-columns: 90px repeat(7, 1fr);
    gap: 1px;
    background-color: #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    min-width: 800px;
    width: 100%;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    position: relative;
}

.schedule-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0.5rem;
    text-align: center;
    font-weight: bold;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.schedule-time-slot {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 0.5rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: #495057;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 80px;
    border: 1px solid #dee2e6;
}

.time-period {
    font-size: 0.7rem;
    color: #6c757d;
    margin-top: 3px;
    line-height: 1.2;
}

.schedule-cell {
    background: white;
    min-height: 80px;
    position: relative;
    padding: 3px;
    border: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.course-block {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    padding: 0.5rem 0.4rem;
    border-radius: 8px;
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.3;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
    border: 1px solid rgba(255,255,255,0.2);
}

.course-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.course-name-grid {
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 0.85rem;
    line-height: 1.2;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-height: 2.4em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.course-location {
    font-size: 0.7rem;
    opacity: 0.95;
    margin-top: 2px;
    font-weight: 500;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.1;
}

/* 不同颜色的课程块 */
.course-block.color-1 { background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%); }
.course-block.color-2 { background: linear-gradient(135deg, #a55eea 0%, #8854d0 100%); }
.course-block.color-3 { background: linear-gradient(135deg, #26de81 0%, #20bf6b 100%); }
.course-block.color-4 { background: linear-gradient(135deg, #fd79a8 0%, #e84393 100%); }
.course-block.color-5 { background: linear-gradient(135deg, #778ca3 0%, #4b6584 100%); }
.course-block.color-6 { background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%); }
.course-block.color-7 { background: linear-gradient(135deg, #00d2d3 0%, #01a3a4 100%); }
.course-block.color-8 { background: linear-gradient(135deg, #ff7675 0%, #d63031 100%); }

/* 课程详情弹窗 */
.course-detail-modal .modal-content {
    border-radius: 12px;
    border: none;
}

.course-detail-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.course-detail-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f3f4;
}

.course-detail-item:last-child {
    border-bottom: none;
}

.course-detail-label {
    font-weight: bold;
    color: #495057;
    margin-right: 0.5rem;
}

.course-detail-value {
    color: #6c757d;
}

/* 周信息显示 */
.week-info {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 500;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .schedule-grid {
        grid-template-columns: 70px repeat(7, 1fr);
        min-width: 700px;
        gap: 1px;
    }
    
    .schedule-header {
        padding: 0.75rem 0.3rem;
        font-size: 0.8rem;
        min-height: 50px;
    }
    
    .schedule-time-slot {
        padding: 0.4rem 0.2rem;
        font-size: 0.7rem;
        min-height: 70px;
    }
    
    .schedule-cell {
        min-height: 70px;
        padding: 2px;
    }
    
    .course-block {
        padding: 0.3rem 0.2rem;
        font-size: 0.7rem;
        border-radius: 6px;
    }
    
    .course-name-grid {
        font-size: 0.7rem;
        margin-bottom: 2px;
    }
    
    .course-location {
        font-size: 0.6rem;
    }
    
    .time-period {
        font-size: 0.6rem;
    }
}

/* 课程表容器增强 */
.schedule-grid-container:hover {
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

/* 头部单元格增强效果 */
.schedule-header:first-child {
    border-top-left-radius: 12px;
}

.schedule-header:last-child {
    border-top-right-radius: 12px;
}

/* 课程表阴影效果 */
.schedule-grid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.schedule-grid:hover::before {
    opacity: 1;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #c1c1c1 0%, #a8a8a8 100%);
    border-radius: 4px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #a8a8a8 0%, #8c8c8c 100%);
}

/* 新增样式 - 微信绑定和课程编辑功能 */

/* 微信绑定提示样式 */
.wechat-binding-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    text-align: center;
}

.wechat-binding-info .fas {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* 自定义课程样式 */
.course-block.custom-course {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    position: relative;
}

.custom-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
}

/* 课程详情增强样式 */
.course-detail-info {
    padding: 0.5rem 0;
}

.course-detail-info .row {
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid #eee;
}

.course-detail-info .row:last-child {
    border-bottom: none;
}

/* 导入按钮特殊样式 */
.btn-import {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: none;
    color: white;
}

.btn-import:hover {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    color: white;
}

/* 课程表格样式增强 */
.schedule-table {
    font-size: 0.85rem;
    margin-bottom: 0;
}

.schedule-table th {
    background-color: #007bff !important;
    color: white;
    font-weight: 600;
    text-align: center;
    vertical-align: middle;
    padding: 0.5rem;
}

.schedule-table td {
    height: 60px;
    vertical-align: middle;
    padding: 0.25rem;
    border: 1px solid #dee2e6;
    position: relative;
}

.course-cell {
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
    margin: 1px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.system-course {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.course-cell:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.course-content {
    padding: 0.25rem;
    text-align: center;
    position: relative;
    width: 100%;
}

.course-name {
    font-weight: bold;
    font-size: 0.8rem;
    margin-bottom: 2px;
    line-height: 1.1;
}

.course-teacher {
    font-size: 0.7rem;
    opacity: 0.9;
    margin-bottom: 1px;
}

.course-place {
    font-size: 0.65rem;
    opacity: 0.8;
}

.empty-cell {
    background-color: #f8f9fa;
}

.time-slot {
    background-color: #e9ecef !important;
    font-weight: 600;
    text-align: center;
    width: 80px;
}

.section-number {
    font-size: 0.75rem;
    margin-bottom: 2px;
}

.time-text {
    font-size: 0.65rem;
    color: #6c757d;
}

/* 现代化课程表样式 */
.modern-schedule-container {
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin: 1rem 0;
}

.modern-schedule-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 1px;
    font-family: 'Microsoft YaHei', 'PingFang SC', -apple-system, BlinkMacSystemFont, sans-serif;
    table-layout: fixed;
    background: #e9ecef;
    border-radius: 12px;
    overflow: hidden;
}

.modern-schedule-table thead th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0.5rem;
    font-weight: 600;
    text-align: center;
    border: none;
    font-size: 0.95rem;
    height: 60px;
    vertical-align: middle;
}

.time-header {
    width: 90px;
    min-width: 90px;
}

.day-header {
    width: calc((100% - 90px) / 7);
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    white-space: nowrap;
}

.modern-schedule-table tbody tr {
    border-bottom: none;
}

.time-cell {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    text-align: center;
    vertical-align: middle;
    padding: 0.75rem 0.5rem;
    border: none;
    width: 90px;
    min-width: 90px;
    height: 80px;
    font-weight: 600;
    color: #495057;
}

.section-number {
    font-weight: bold;
    font-size: 0.8rem;
    color: #495057;
    margin-bottom: 3px;
}

.time-range {
    font-size: 0.7rem;
    color: #6c757d;
    line-height: 1.2;
}

.course-cell {
    padding: 8px;
    vertical-align: middle;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: 80px;
    width: calc((100% - 90px) / 7);
}

.course-cell:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    z-index: 10;
}

.empty-cell {
    background: #ffffff;
    border: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    height: 80px;
    width: calc((100% - 90px) / 7);
}

.course-content {
    padding: 0.3rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    line-height: 1.3;
}

.course-name {
    font-weight: bold;
    font-size: 0.85rem;
    margin-bottom: 3px;
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
}

.course-teacher {
    font-size: 0.7rem;
    opacity: 0.9;
    margin-bottom: 2px;
    text-align: center;
    line-height: 1.1;
}

.course-place {
    font-size: 0.65rem;
    opacity: 0.85;
    text-align: center;
    line-height: 1.1;
}

/* 课程颜色方案 - 参考图片风格 */
.course-color-1 { 
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); 
}

.course-color-2 { 
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); 
}

.course-color-3 { 
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); 
}

.course-color-4 { 
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); 
}

.course-color-5 { 
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #555 !important;
}

.course-color-6 { 
    background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    color: #555 !important;
}

.course-color-7 { 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 
}

.course-color-8 { 
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #555 !important;
}

.custom-course {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-left: 4px solid #f093fb;
}

.custom-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .modern-schedule-table {
        font-size: 0.8rem;
    }
    
    .course-name {
        font-size: 0.75rem;
    }
    
    .course-teacher {
        font-size: 0.65rem;
    }
    
    .course-place {
        font-size: 0.6rem;
    }
    
    .time-cell {
        width: 60px;
        min-width: 60px;
        padding: 0.3rem;
    }
    
    .section-number {
        font-size: 0.7rem;
    }
    
    .time-range {
        font-size: 0.6rem;
    }
}

/* 周次选择器样式 */
.week-selector {
    display: flex;
    flex-direction: column;
    align-items: end;
}

.week-selector label {
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
}

.week-selector select {
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    backdrop-filter: blur(10px);
}

.week-selector select:focus {
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.15);
}

.week-selector select option {
    background: #007bff;
    color: white;
}

/* 跨节次课程样式 - 创建视觉合并效果 */
.multi-section-first {
    border-bottom: none !important;
    position: relative;
}

.multi-section-middle {
    border-top: none !important;
    border-bottom: none !important;
    position: relative;
}

.multi-section-last {
    border-top: none !important;
    position: relative;
}

/* 为跨节次课程添加连接效果 */
.multi-section-first::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
}

.multi-section-middle::before,
.multi-section-middle::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
}

.multi-section-middle::before {
    top: 0;
}

.multi-section-middle::after {
    bottom: 0;
}

.multi-section-last::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
}

/* 跨节次课程标识 */
.section-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.65rem;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: bold;
    line-height: 1;
    z-index: 10;
}

/* CSS Grid 课程表布局 */
.grid-schedule-container {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin: 20px 0;
}

.schedule-grid {
    display: grid;
    grid-template-columns: 80px repeat(7, minmax(100px, 1fr));
    grid-template-rows: 50px repeat(12, 70px);
    gap: 2px;
    background-color: #e9ecef;
    border-radius: 8px;
    padding: 2px;
    width: 100%;
    overflow-x: auto;
    min-width: 0;
    max-width: 100%;
}

.grid-item {
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    position: relative;
    font-size: 12px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
    /* 确保基础样式为水平文字 */
    writing-mode: horizontal-tb !important;
    text-orientation: mixed !important;
    direction: ltr !important;
    white-space: nowrap;
}

.grid-item.header-item {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    font-weight: bold;
    font-size: 16px;
    cursor: default;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    direction: ltr;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    letter-spacing: 1px;
}

/* 专门针对星期几标题的样式 */
.grid-item.header-item.day-header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 2px 6px rgba(0,0,0,0.4);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px 4px 0 0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    z-index: 10;
    /* 强制水平文字显示 */
    writing-mode: horizontal-tb !important;
    text-orientation: upright !important;
    direction: ltr !important;
    white-space: nowrap !important;
    word-break: keep-all !important;
    text-transform: none !important;
    /* Flexbox布局确保居中 */
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    min-height: 50px;
    min-width: 100px;
    padding: 8px 4px;
    /* 防止任何可能的旋转 */
    transform: rotate(0deg) !important;
    line-height: 1.2;
    letter-spacing: 0;
}

.grid-item.header-item.day-header:hover {
    background: linear-gradient(135deg, #2c5282 0%, #3182ce 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.grid-item.header-item.day-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.15) 0%, transparent 50%, rgba(255,255,255,0.15) 100%);
    pointer-events: none;
}

.grid-item.header-item.day-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #ffffff, transparent);
    border-radius: 3px;
}

/* 时间列标题样式 */
.grid-item.header-item.time-header {
    background: linear-gradient(135deg, #8e44ad 0%, #9b59b6 100%);
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px 0 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
    writing-mode: horizontal-tb;
    white-space: nowrap;
}

.grid-item.time-item {
    background: linear-gradient(135deg, #e8f5e8 0%, #d4e6d4 100%);
    color: #2d5a2d;
    font-weight: bold;
    flex-direction: column;
    font-size: 11px;
    cursor: default;
    text-shadow: none;
    border-right: 2px solid #c8e6c9;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 70px;
    padding: 4px 2px;
    writing-mode: horizontal-tb;
    white-space: nowrap;
    max-width: 80px;
    overflow: hidden;
    text-align: center;
}

.time-item .section-number {
    font-weight: 700;
    font-size: 14px;
    color: #1b5e20;
    margin-bottom: 2px;
    white-space: nowrap;
}

.time-item .time-range {
    font-size: 9px;
    color: #388e3c;
    font-weight: 500;
    line-height: 1.1;
    white-space: nowrap;
    text-align: center;
}

.grid-item.course-item {
    color: white;
    font-weight: bold;
    padding: 8px;
    flex-direction: column;
    justify-content: center;
    line-height: 1.3;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transform: scale(1);
    transition: all 0.3s ease;
}

.grid-item.course-item:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    z-index: 10;
}

.grid-item.empty-item {
    background: #f8f9fa;
    border: 1px dashed #dee2e6;
    cursor: default;
}

.grid-item .course-name {
    font-weight: bold;
    margin-bottom: 4px;
    font-size: 12px;
    word-break: break-word;
    line-height: 1.2;
    text-align: center;
}

.grid-item .course-teacher {
    font-size: 10px;
    opacity: 0.9;
    margin-bottom: 2px;
    word-break: break-word;
    line-height: 1.1;
    text-align: center;
}

.grid-item .course-place {
    font-size: 10px;
    opacity: 0.8;
    word-break: break-word;
    line-height: 1.1;
    text-align: center;
}

.grid-item .section-number {
    font-weight: bold;
    font-size: 12px;
}

.grid-item .time-range {
    font-size: 9px;
    opacity: 0.9;
    margin-top: 2px;
}

/* 课程颜色 - Grid版本 */
.grid-item.course-color-1 { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.grid-item.course-color-2 { background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%); }
.grid-item.course-color-3 { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.grid-item.course-color-4 { background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%); }
.grid-item.course-color-5 { background: linear-gradient(135deg, #fa709a 0%, #fee140 100%); }
.grid-item.course-color-6 { background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%); }
.grid-item.course-color-7 { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); }
.grid-item.course-color-8 { background: linear-gradient(135deg, #ff8a80 0%, #ffb74d 100%); }

.grid-item.custom-course {
    background: linear-gradient(135deg, #8e2de2 0%, #4a00e0 100%);
    border: 2px solid #ffffff;
}

.grid-item .custom-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
}

/* 响应式布局 - 优化移动端显示 */
@media (max-width: 1200px) {
    .schedule-grid {
        grid-template-columns: 80px repeat(7, 1fr);
        grid-template-rows: 45px repeat(12, 55px);
    }
    
    .grid-item {
        font-size: 11px;
    }
    
    .grid-item .course-name {
        font-size: 11px;
    }
    
    .grid-item .course-teacher,
    .grid-item .course-place {
        font-size: 9px;
    }
}

@media (max-width: 768px) {
    .week-selector {
        align-items: center;
        margin-top: 0.5rem;
    }
    
    .week-selector select {
        width: 100px !important;
    }
    
    .section-indicator {
        font-size: 0.55rem;
        padding: 1px 3px;
    }
    
    .grid-schedule-container {
        padding: 10px;
        margin: 10px 0;
    }
    
    .schedule-grid {
        grid-template-columns: 70px repeat(7, minmax(80px, 1fr));
        grid-template-rows: 40px repeat(12, 70px);
        gap: 1px;
        font-size: 10px;
        min-width: 0;
        max-width: 100%;
    }
    
    .grid-item {
        font-size: 9px;
        padding: 2px;
    }
    
    .grid-item.header-item {
        font-size: 12px;
        font-weight: bold;
        padding: 6px 2px;
        min-height: 40px;
    }
    
    .grid-item.header-item.day-header {
        font-size: 16px;
        font-weight: 700;
        border: 1px solid rgba(255, 255, 255, 0.3);
        text-shadow: 0 1px 3px rgba(0,0,0,0.4);
        writing-mode: horizontal-tb !important;
        text-orientation: upright !important;
        direction: ltr !important;
        white-space: nowrap !important;
        min-width: 80px;
    }
    
    .grid-item.header-item.time-header {
        font-size: 11px;
        font-weight: 600;
    }
    
    .grid-item.time-item {
        font-size: 8px;
        padding: 2px;
        max-width: 70px;
        white-space: nowrap;
        overflow: hidden;
    }
    
    .time-item .section-number {
        font-size: 12px;
        margin-bottom: 1px;
    }
    
    .time-item .time-range {
        font-size: 7px;
        line-height: 1.1;
    }
    
    .grid-item.course-item {
        padding: 4px 2px;
        line-height: 1.2;
    }
    
    .grid-item .course-name {
        font-size: 9px;
        margin-bottom: 2px;
        font-weight: bold;
        line-height: 1.1;
    }
    
    .grid-item .course-teacher {
        font-size: 7px;
        margin-bottom: 1px;
        opacity: 0.9;
    }
    
    .grid-item .course-place {
        font-size: 7px;
        opacity: 0.8;
    }
    
    .grid-item .section-number {
        font-size: 10px;
        font-weight: bold;
    }
    
    .grid-item .time-range {
        font-size: 6px;
        margin-top: 1px;
        opacity: 0.8;
    }
    
    .grid-item .custom-badge {
        width: 12px;
        height: 12px;
        font-size: 6px;
        top: 1px;
        right: 1px;
    }
}

/* ==============================================
   移动端专用样式 - 全新设计
   ============================================== */

/* 移动端基础设置 */
@media (max-width: 480px) {
    /* 基础页面设置 */
    body {
        margin: 0;
        padding: 0;
        overflow-x: hidden;
        font-size: 14px;
        line-height: 1.4;
        background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
        min-height: 100vh;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    }
    
    .container-fluid {
        padding: 8px;
        max-width: 100vw;
        overflow-x: hidden;
    }
    
    /* ==============================================
       移动端顶部导航优化
       ============================================== */
    
    /* 移动端页面标题已合并到导航栏中 */
    
    /* 重新设计移动端导航栏 */
    #mainNavbar {
        display: flex !important;
        position: sticky;
        top: 0;
        z-index: 1000;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(20px);
        border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        margin: -8px -8px 16px -8px;
        padding: 8px 16px !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }
    
    #mainNavbar .container-fluid {
        padding: 0 !important;
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
    
    /* 移动端品牌名称 */
    #mainNavbar .navbar-brand {
        font-size: 16px !important;
        font-weight: 600 !important;
        color: #333 !important;
        margin: 0 !important;
    }
    
    /* 移动端导航按钮容器 */
    #mainNavbar .navbar-nav {
        flex-direction: row !important;
        margin: 0 !important;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    /* 移动端导航按钮样式 */
    #mainNavbar .nav-link {
        padding: 6px 12px !important;
        margin: 0 2px !important;
        border-radius: 20px !important;
        font-size: 12px !important;
        color: #666 !important;
        background: rgba(102, 126, 234, 0.1) !important;
        border: 1px solid rgba(102, 126, 234, 0.2) !important;
        text-decoration: none !important;
        transition: all 0.3s ease !important;
        white-space: nowrap !important;
        display: flex !important;
        align-items: center !important;
        min-width: auto !important;
    }
    
    #mainNavbar .nav-link:hover,
    #mainNavbar .nav-link.active {
        background: #667eea !important;
        color: white !important;
        border-color: #667eea !important;
        transform: translateY(-1px) !important;
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3) !important;
    }
    
    /* 隐藏移动端不需要的元素 */
    #mainNavbar .navbar-text {
        display: none !important;
    }
    
    /* 简化移动端图标 */
    #mainNavbar .fas {
        font-size: 12px !important;
        margin-right: 4px !important;
    }
    
    /* 移动端下拉菜单优化 */
    #mainNavbar .dropdown-menu {
        position: absolute !important;
        top: 100% !important;
        bottom: auto !important;
        left: auto !important;
        right: 0 !important;
        transform: none !important;
        width: 180px !important;
        border-radius: 12px !important;
        border: 1px solid rgba(102, 126, 234, 0.2) !important;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
        background: rgba(255, 255, 255, 0.98) !important;
        backdrop-filter: blur(20px) !important;
        margin-top: 8px !important;
        z-index: 9999 !important;
    }
    
    /* 确保下拉菜单容器有正确的定位 */
    #mainNavbar .dropdown {
        position: relative !important;
    }
    
    #mainNavbar .dropdown-item {
        padding: 12px 16px !important;
        font-size: 14px !important;
        color: #333 !important;
        border-radius: 8px !important;
        margin: 4px 8px !important;
        transition: all 0.2s ease !important;
    }
    
    #mainNavbar .dropdown-item:hover {
        background: rgba(102, 126, 234, 0.1) !important;
        color: #667eea !important;
    }
    
    /* 移动端导航按钮文字优化 */
    #myScheduleNav { 
        order: 1; 
    }
    #manageScheduleNav { 
        order: 2; 
    }
    #settingsDropdown { 
        order: 3; 
    }
    
    /* 超小屏幕优化 (360px以下) */
    @media (max-width: 360px) {
        #mainNavbar .nav-link {
            font-size: 10px !important;
            padding: 4px 8px !important;
        }
        
        #mainNavbar .navbar-brand {
            font-size: 14px !important;
        }
        
        #mainNavbar .fas {
            display: none !important; /* 超小屏隐藏图标 */
        }
    }
    
    /* 确保导航栏在所有移动端都显示 */
    #mainNavbar {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* 移动端底部按钮布局优化 */
    @media (max-width: 768px) {
        #scheduleControlCard .row {
            flex-direction: column !important;
            gap: 16px !important;
        }
        
        #scheduleControlCard .col-md-3 {
            flex: none !important;
            width: 100% !important;
            max-width: none !important;
        }
        
        /* 底部按钮容器 */
        #scheduleControlCard .row .col-md-3:nth-child(3),
        #scheduleControlCard .row .col-md-3:nth-child(4) {
            width: 50% !important;
            flex: 1 !important;
        }
        
        /* 底部按钮行 */
        #scheduleControlCard .row .col-md-3:nth-child(3) ~ .col-md-3 {
            margin-top: 0 !important;
        }
        
        /* 创建底部按钮的弹性容器 */
        #scheduleControlCard .row {
            display: flex !important;
            flex-wrap: wrap !important;
        }
        
        /* 前两个元素占满宽度 */
        #scheduleControlCard .row .col-md-3:nth-child(1),
        #scheduleControlCard .row .col-md-3:nth-child(2) {
            width: 100% !important;
        }
        
        /* 后两个按钮并排 */
        #scheduleControlCard .row .col-md-3:nth-child(3),
        #scheduleControlCard .row .col-md-3:nth-child(4) {
            width: 50% !important;
            padding-left: 8px !important;
            padding-right: 8px !important;
        }
        
        /* 按钮样式优化 */
        #scheduleControlCard .btn {
            width: 100% !important;
            font-size: 14px !important;
            padding: 12px 8px !important;
        }
        
        /* 学年学期选择框优化 */
        #scheduleControlCard .form-select {
            font-size: 16px !important;
            padding: 12px !important;
        }
        
        #scheduleControlCard .form-label {
            font-size: 14px !important;
            font-weight: 600 !important;
            margin-bottom: 8px !important;
        }
        
        /* 创建专门的按钮行容器 */
        #scheduleControlCard .row .col-md-3:nth-child(3) {
            display: flex !important;
            flex-direction: column !important;
            width: 50% !important;
        }
        
        #scheduleControlCard .row .col-md-3:nth-child(4) {
            display: flex !important;
            flex-direction: column !important; 
            width: 50% !important;
        }
        
        /* 确保按钮容器在同一行 */
        #scheduleControlCard .row .col-md-3:nth-child(3),
        #scheduleControlCard .row .col-md-3:nth-child(4) {
            margin-top: 16px !important;
        }
        
        /* 加载指示器在移动端隐藏或调整 */
        #scheduleLoadingIndicator {
            margin-top: 8px !important;
            font-size: 12px !important;
        }
    }
    
    /* 更小屏幕的额外优化 */
    @media (max-width: 480px) {
        #scheduleControlCard .btn {
            font-size: 12px !important;
            padding: 10px 6px !important;
        }
        
        #scheduleControlCard .row .col-md-3:nth-child(3),
        #scheduleControlCard .row .col-md-3:nth-child(4) {
            padding-left: 4px !important;
            padding-right: 4px !important;
        }
    }
    
    /* 移动端额外的整体优化 */
    @media (max-width: 768px) {
        /* 确保所有卡片在移动端有合适的边距 */
        .card {
            margin-bottom: 16px !important;
        }
        
        /* 优化卡片内边距 */
        .card-body {
            padding: 16px !important;
        }
        
        /* 优化课程表容器 */
        .schedule-container {
            padding: 0 !important;
            margin: 0 !important;
        }
        
        /* 移动端页面整体优化 */
        .container-fluid {
            padding-left: 12px !important;
            padding-right: 12px !important;
        }
        
        /* 优化标题间距 */
        h1, h2, h3, h4, h5 {
            margin-bottom: 16px !important;
        }
        
        /* 响应式字体大小 */
        body {
            font-size: 14px !important;
            line-height: 1.5 !important;
        }
    }

    /* ==============================================
       移动端卡片和头部优化
       ============================================== */
    
    /* 主卡片样式 */
    .card {
        border-radius: 16px !important;
        border: none !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
        margin-bottom: 16px !important;
    }
    
    .card-header {
        border-radius: 16px 16px 0 0 !important;
        padding: 16px !important;
        border-bottom: none !important;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    }
    
    .card-header h5 {
        font-size: 18px !important;
        font-weight: 600 !important;
        margin-bottom: 4px !important;
    }
    
    .card-header small {
        font-size: 13px !important;
        opacity: 0.9;
    }
    
    /* 刷新按钮优化 */
    #refreshBtn {
        background: rgba(255, 255, 255, 0.2) !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
        border-radius: 12px !important;
        padding: 8px 16px !important;
        font-size: 13px !important;
        backdrop-filter: blur(10px);
    }
    
    #refreshBtn:hover {
        background: rgba(255, 255, 255, 0.3) !important;
        transform: translateY(-1px);
    }
    
    /* 周次选择器样式 */
    .form-select {
        border-radius: 12px !important;
        border: 2px solid #e9ecef !important;
        padding: 12px 16px !important;
        font-size: 15px !important;
        font-weight: 500 !important;
        background-color: #fff !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
    }
    
    .form-select:focus {
        border-color: #667eea !important;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
    }
    
    /* ==============================================
       移动端课程表网格重新设计
       ============================================== */
    
    .grid-schedule-container {
        padding: 0 !important;
        margin: 16px 0 !important;
        border-radius: 16px !important;
        background: #fff;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
        overflow: hidden;
    }
    
    .schedule-grid {
        display: grid !important;
        grid-template-columns: 70px repeat(7, 1fr) !important;
        grid-template-rows: 50px repeat(12, 70px) !important;
        gap: 1px !important;
        width: 100% !important;
        background-color: #f8f9fa !important;
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    }
    
    /* ==============================================
       移动端头部样式优化
       ============================================== */
    
    /* 时间头部 */
    .grid-item.header-item.time-header {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        color: white !important;
        font-size: 14px !important;
        font-weight: 700 !important;
        padding: 8px 4px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        border-radius: 0 !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    }
    
    /* 星期头部 */
    .grid-item.header-item.day-header {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
        color: white !important;
        font-size: 16px !important;
        font-weight: 700 !important;
        padding: 8px 4px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        border-radius: 0 !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
        writing-mode: horizontal-tb !important;
        letter-spacing: 1px;
    }
    
    /* ==============================================
       移动端时间列样式
       ============================================== */
    
    .grid-item.time-item {
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
        border: 1px solid #dee2e6 !important;
        padding: 6px 4px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        box-sizing: border-box !important;
    }
    
    .time-item .section-number {
        font-size: 16px !important;
        font-weight: 700 !important;
        color: #495057 !important;
        margin-bottom: 2px !important;
        line-height: 1;
    }
    
    .time-item .time-range {
        font-size: 10px !important;
        color: #6c757d !important;
        font-weight: 500 !important;
        line-height: 1.1 !important;
        white-space: nowrap;
    }
    
    /* ==============================================
       移动端课程单元格样式
       ============================================== */
    
    .grid-item.course-item {
        padding: 6px 4px !important;
        border-radius: 8px !important;
        margin: 2px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
        position: relative !important;
        overflow: hidden !important;
        backdrop-filter: blur(10px);
    }
    
    /* 课程名称 */
    .grid-item .course-name {
        font-size: 12px !important;
        font-weight: 600 !important;
        line-height: 1.2 !important;
        margin-bottom: 2px !important;
        color: inherit !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
        word-break: break-word;
        hyphens: auto;
        overflow-wrap: break-word;
    }
    
    /* 教师姓名 */
    .grid-item .course-teacher {
        font-size: 9px !important;
        font-weight: 500 !important;
        opacity: 0.9 !important;
        margin-bottom: 1px !important;
        color: inherit !important;
    }
    
    /* 上课地点 */
    .grid-item .course-place {
        font-size: 9px !important;
        font-weight: 500 !important;
        opacity: 0.85 !important;
        color: inherit !important;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
        max-width: 100%;
    }
    
    /* ==============================================
       移动端空单元格样式
       ============================================== */
    
    .grid-item.empty-cell {
        background: #ffffff !important;
        border: 1px solid #f0f0f0 !important;
        margin: 2px !important;
        border-radius: 8px !important;
        box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    }
    
    /* ==============================================
       移动端课程颜色优化
       ============================================== */
    
    .grid-item.course-item[style*="background-color: rgb(255, 193, 7)"] {
        background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%) !important;
        color: #333 !important;
    }
    
    .grid-item.course-item[style*="background-color: rgb(220, 53, 69)"] {
        background: linear-gradient(135deg, #dc3545 0%, #e85a6d 100%) !important;
        color: white !important;
    }
    
    .grid-item.course-item[style*="background-color: rgb(40, 167, 69)"] {
        background: linear-gradient(135deg, #28a745 0%, #4caf50 100%) !important;
        color: white !important;
    }
    
    .grid-item.course-item[style*="background-color: rgb(0, 123, 255)"] {
        background: linear-gradient(135deg, #007bff 0%, #42a5f5 100%) !important;
        color: white !important;
    }
    
    .grid-item.course-item[style*="background-color: rgb(108, 117, 125)"] {
        background: linear-gradient(135deg, #6c757d 0%, #868e96 100%) !important;
        color: white !important;
    }
    
    .grid-item.course-item[style*="background-color: rgb(111, 66, 193)"] {
        background: linear-gradient(135deg, #6f42c1 0%, #8e44ad 100%) !important;
        color: white !important;
    }
    
    .grid-item.course-item[style*="background-color: rgb(255, 87, 34)"] {
        background: linear-gradient(135deg, #ff5722 0%, #ff7043 100%) !important;
        color: white !important;
    }
}

/* ==============================================
   极小屏幕优化（iPhone SE等） - 全新设计
   ============================================== */
@media (max-width: 360px) {
    .container-fluid {
        padding: 6px !important;
    }
    
    /* 卡片样式调整 */
    .card-header {
        padding: 12px !important;
    }
    
    .card-header h5 {
        font-size: 16px !important;
    }
    
    /* 课程表网格调整 */
    .schedule-grid {
        grid-template-columns: 60px repeat(7, 1fr) !important;
        grid-template-rows: 45px repeat(12, 65px) !important;
    }
    
    /* 头部样式调整 */
    .grid-item.header-item.time-header {
        font-size: 12px !important;
    }
    
    .grid-item.header-item.day-header {
        font-size: 14px !important;
        letter-spacing: 0.5px;
    }
    
    /* 时间列调整 */
    .time-item .section-number {
        font-size: 14px !important;
    }
    
    .time-item .time-range {
        font-size: 9px !important;
    }
    
    /* 课程内容字体调整 */
    .grid-item .course-name {
        font-size: 11px !important;
    }
    
    .grid-item .course-teacher {
        font-size: 8px !important;
    }
    
    .grid-item .course-place {
        font-size: 8px !important;
    }
}

/* ==============================================
   新增：移动端特定的交互优化
   ============================================== */
@media (max-width: 480px) {
    /* 触摸优化 */
    .grid-item.course-item {
        transition: all 0.2s ease !important;
        cursor: pointer !important;
    }
    
    .grid-item.course-item:active {
        transform: scale(0.98) !important;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2) !important;
    }
    
    /* 周次选择器的下拉箭头优化 */
    .form-select {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23667eea' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m1 6 7 7 7-7'/%3e%3c/svg%3e") !important;
        background-repeat: no-repeat !important;
        background-position: right 12px center !important;
        background-size: 16px 12px !important;
    }
    
    /* 滚动优化 */
    .grid-schedule-container {
        -webkit-overflow-scrolling: touch !important;
        scroll-behavior: smooth !important;
    }
    
    /* 页面加载动画 */
    .schedule-grid {
        animation: fadeInUp 0.6s ease-out;
    }
    
    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    /* 改进的渐变背景 */
    .card-header {
        background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%) !important;
        background-size: 200% 200% !important;
        animation: gradientShift 3s ease infinite !important;
    }
    
    @keyframes gradientShift {
        0% { background-position: 0% 50%; }
        50% { background-position: 100% 50%; }
        100% { background-position: 0% 50%; }
    }
    
    /* 课程信息显示优化 */
    .grid-item .course-name {
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-height: 2.4em !important;
    }
    
    /* 状态栏和安全区域适配 */
    body {
        padding-top: env(safe-area-inset-top) !important;
        padding-bottom: env(safe-area-inset-bottom) !important;
        padding-left: env(safe-area-inset-left) !important;
        padding-right: env(safe-area-inset-right) !important;
    }
    
    /* 改进的课程卡片悬停效果 */
    .grid-item.course-item:hover {
        transform: translateY(-2px) scale(1.02) !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
        z-index: 10 !important;
    }
    
    /* ==============================================
       移动端专用：防止文本选择和缩放
       ============================================== */
    
    * {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* 允许输入框选择文本 */
    input, textarea, [contenteditable] {
        -webkit-user-select: auto !important;
        -khtml-user-select: auto !important;
        -moz-user-select: auto !important;
        -ms-user-select: auto !important;
        user-select: auto !important;
    }
    
    /* ==============================================
       移动端专用：改进的加载状态
       ============================================== */
    
    .loading-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(255, 255, 255, 0.9);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 9999;
        backdrop-filter: blur(5px);
    }
    
    .loading-spinner {
        width: 40px;
        height: 40px;
        border: 4px solid #f3f3f3;
        border-top: 4px solid #667eea;
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }
    
    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
    
    /* ==============================================
       移动端专用：课程详情弹窗优化
       ============================================== */
    
    .course-detail-modal {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-radius: 20px 20px 0 0;
        padding: 20px;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        z-index: 1001;
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    }
    
    .course-detail-modal.show {
        transform: translateY(0);
    }
    
    .course-detail-modal .modal-handle {
        width: 40px;
        height: 4px;
        background: #ddd;
        border-radius: 2px;
        margin: 0 auto 16px;
    }
    
    /* ==============================================
       移动端专用：下拉刷新效果
       ============================================== */
    
    .pull-to-refresh {
        position: absolute;
        top: -60px;
        left: 0;
        width: 100%;
        height: 60px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(102, 126, 234, 0.1);
        color: #667eea;
        font-size: 14px;
        font-weight: 500;
        transition: all 0.3s ease;
    }
    
    .pull-to-refresh.active {
        background: rgba(102, 126, 234, 0.2);
    }
}

/* 管理页面优化 */
#manageCard {
    border-radius: 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

#manageCard .card-header {
    border-radius: 16px 16px 0 0;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

#quickImportBtn {
    padding: 12px 20px;
    font-weight: 600;
    border-radius: 12px;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
}

#quickImportBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(40, 167, 69, 0.3);
}

@media (max-width: 480px) {
    #manageCard .col-md-8 {
        padding: 0 10px;
    }
    
    #quickImportBtn {
        font-size: 14px;
        padding: 10px 16px;
    }
    
    .card-header h6 {
        font-size: 14px;
    }
    
    .form-control {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    .form-label {
        font-size: 13px;
        font-weight: 600;
    }
    
    #scheduleInfo {
        margin-top: 5px;
    }
    
    #scheduleInfo small {
        font-size: 12px;
    }
}