/* ========== 日历页样式 ========== */

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}
.cal-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}
.cal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    min-width: 140px;
    text-align: center;
}
.cal-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-light);
    transition: all 0.2s;
}
.cal-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.cal-btn.primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.cal-btn.primary:hover {
    background: var(--primary-dark);
}
.cal-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.view-toggle {
    display: flex;
    background: #f5f5f5;
    border-radius: 8px;
    padding: 3px;
}
.view-btn {
    padding: 5px 14px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-light);
    transition: all 0.2s;
}
.view-btn.active {
    background: #fff;
    color: var(--primary);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* 图例 */
.cal-legend {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: var(--text-light);
    flex-wrap: wrap;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.dot.red { background: #c41e2a; }
.dot.blue { background: #2c5aa0; }
.dot.green { background: #1a8a3d; }
.dot.orange { background: #d48806; }

/* 日历网格 */
.calendar-grid {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #fafafa;
    border-bottom: 1px solid var(--border);
}
.cal-weekdays > div {
    padding: 12px 8px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
}
.cal-weekdays > div:nth-child(6),
.cal-weekdays > div:nth-child(7) {
    color: var(--text-lighter);
}
.cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: minmax(90px, auto);
}
.cal-day {
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 6px 8px;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.cal-day:hover { background: #fafafa; }
.cal-day:nth-child(7n) { border-right: none; }
.cal-day.other-month {
    background: #fafafa;
    color: #ccc;
}
.cal-day.other-month:hover { background: #f5f5f5; }
.cal-day.today .day-num {
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
.cal-day.selected {
    background: var(--primary-light);
}
.day-num {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    margin-bottom: 2px;
}
.cal-class-item {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
}
.cal-class-item.red { background: #c41e2a; }
.cal-class-item.blue { background: #2c5aa0; }
.cal-class-item.green { background: #1a8a3d; }
.cal-class-item.orange { background: #d48806; }
.cal-class-more {
    font-size: 11px;
    color: var(--text-lighter);
    padding-left: 4px;
}

/* 班次详情 */
.day-class-detail {
    padding: 12px 0;
    border-bottom: 1px dashed var(--border);
}
.day-class-detail:last-child { border-bottom: none; }
.day-class-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.day-class-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    color: #fff;
    font-weight: 500;
}
.day-class-tag.red { background: #c41e2a; }
.day-class-tag.blue { background: #2c5aa0; }
.day-class-tag.green { background: #1a8a3d; }
.day-class-tag.orange { background: #d48806; }
.day-course-row {
    display: flex;
    gap: 12px;
    padding: 6px 0;
    font-size: 13px;
    color: var(--text-light);
    align-items: center;
}
.day-course-time {
    flex-shrink: 0;
    width: 100px;
    font-variant-numeric: tabular-nums;
    color: var(--primary);
    font-weight: 500;
}
.day-course-name { flex: 1; color: var(--text); }
.day-course-location {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--text-lighter);
    background: #f5f5f5;
    padding: 2px 8px;
    border-radius: 4px;
}

/* 本月班次列表 */
.month-class-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.month-class-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: #fafafa;
    border-radius: 8px;
    border-left: 4px solid #ccc;
    transition: all 0.2s;
}
.month-class-item:hover {
    background: var(--primary-light);
    transform: translateX(4px);
}
.month-class-item.red { border-left-color: #c41e2a; }
.month-class-item.blue { border-left-color: #2c5aa0; }
.month-class-item.green { border-left-color: #1a8a3d; }
.month-class-item.orange { border-left-color: #d48806; }
.month-class-info { flex: 1; min-width: 0; }
.month-class-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}
.month-class-dates {
    font-size: 13px;
    color: var(--text-light);
}
.month-class-meta {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.month-class-meta .tag {
    font-size: 11px;
    padding: 2px 8px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-light);
}

/* 响应式 */
@media (max-width: 768px) {
    .cal-days { grid-auto-rows: minmax(70px, auto); }
    .cal-day { padding: 4px; }
    .cal-class-item { font-size: 10px; padding: 1px 4px; }
    .cal-class-more { display: none; }
    .calendar-header { flex-direction: column; align-items: stretch; }
    .cal-nav { justify-content: space-between; }
    .cal-actions { justify-content: space-between; }
}


/* 扩展颜色：purple/teal/pink/brown 用于更多班次的颜色区分 */
.cal-class-item.purple { background: #722ed1; }
.cal-class-item.teal { background: #08979c; }
.cal-class-item.pink { background: #c41d7f; }
.cal-class-item.brown { background: #874d00; }

.day-class-tag.purple { background: #722ed1; }
.day-class-tag.teal { background: #08979c; }
.day-class-tag.pink { background: #c41d7f; }
.day-class-tag.brown { background: #874d00; }

.month-class-item.purple { border-left-color: #722ed1; }
.month-class-item.teal { border-left-color: #08979c; }
.month-class-item.pink { border-left-color: #c41d7f; }
.month-class-item.brown { border-left-color: #874d00; }

/* 历史班次按钮 */
.history-btn {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: #fff !important;
    border-color: #ff9800 !important;
    text-decoration: none;
    font-weight: 500;
}
.history-btn:hover {
    background: linear-gradient(135deg, #f57c00, #e65100);
    border-color: #f57c00 !important;
    color: #fff !important;
}

/* 历史班次密码验证 */
.history-pwd-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.history-pwd-box {
    background: #fff;
    border-radius: 16px;
    padding: 32px 28px 24px;
    width: 340px;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.history-pwd-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.history-pwd-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 6px;
}

.history-pwd-desc {
    font-size: 13px;
    color: #999;
    margin-bottom: 20px;
}

.history-pwd-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    outline: none;
    text-align: center;
    letter-spacing: 3px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.history-pwd-input:focus {
    border-color: #c0392b;
}

.history-pwd-error {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 8px;
    min-height: 16px;
    text-align: left;
}

.history-pwd-btns {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.history-pwd-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.history-pwd-cancel {
    background: #f0f0f0;
    color: #666;
}

.history-pwd-cancel:hover {
    background: #e0e0e0;
}

.history-pwd-confirm {
    background: linear-gradient(135deg, #c0392b, #e74c3c);
    color: #fff;
    font-weight: 500;
}

.history-pwd-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(192, 57, 43, 0.3);
}

.history-pwd-confirm:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 历史班次锁标识 */
.history-lock-icon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #e67e22;
    background: #fff5e6;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 6px;
}

/* 历史班次样式（灰色调） */
.cal-class-item.is-history {
    opacity: 0.6;
    background: #f0f0f0 !important;
    color: #999 !important;
    font-style: italic;
}

.month-class-item.is-history {
    opacity: 0.7;
    border-left-color: #ccc !important;
}

.day-class-detail.is-history {
    border-left: 3px solid #ccc;
    background: #fafafa;
}

.day-history-locked {
    margin-top: 8px;
    padding: 10px 12px;
    background: #fff5e6;
    color: #e67e22;
    font-size: 13px;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s;
}

.day-history-locked:hover {
    background: #ffe8cc;
}
