/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 全局渐变主题优化 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', 'SimHei', sans-serif;
    background: linear-gradient(-45deg, #667eea, #764ba2, #f093fb, #f5576c);
    background-size: 400% 400%;
    background-attachment: fixed;
    color: #2c3e50;
    line-height: 1.6;
    min-height: 100vh;
    animation: gradientBg 15s ease infinite;
}

@keyframes gradientBg {
    0%, 100% { background-position: 0% 50%; }
    25% { background-position: 100% 50%; }
    50% { background-position: 100% 100%; }
    75% { background-position: 0% 100%; }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    animation: fadeIn 0.8s ease-in;
    position: relative;
}

/* 添加背景流光效果 */
.container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%),
                radial-gradient(circle at 40% 80%, rgba(120, 219, 226, 0.3) 0%, transparent 50%);
    z-index: -1;
    animation: floatingBg 20s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes floatingBg {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-20px, -10px) rotate(1deg); }
    66% { transform: translate(20px, 10px) rotate(-1deg); }
}

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

/* 头部现代化样式 */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(1.8);
    border-radius: 20px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.1),
        0 2px 8px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    padding: 20px;
    margin-bottom: 20px;
    position: relative;
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg,
        rgba(255, 255, 255, 0.1) 0%,
        transparent 50%,
        rgba(255, 255, 255, 0.05) 100%);
    border-radius: inherit;
    pointer-events: none;
}

.header h1 {
    color: #2c3e50;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 15px;
    text-align: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative;
    z-index: 1;
    letter-spacing: -0.5px;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

/* 日期导航样式 */
.date-navigation {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-btn, .today-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 4px 16px rgba(102, 126, 234, 0.4),
        0 2px 8px rgba(118, 75, 162, 0.3);
}

.nav-btn::before, .today-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s;
}

.nav-btn:hover::before, .today-btn:hover::before {
    left: 100%;
}

.nav-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 18px;
}

.today-btn {
    padding: 12px 20px;
    font-size: 14px;
    margin-left: 15px;
    border-radius: 25px;
}

.nav-btn:hover, .today-btn:hover {
    background: linear-gradient(135deg, #5a6fd8, #6b4494);
    transform: translateY(-2px);
    box-shadow:
        0 8px 25px rgba(102, 126, 234, 0.5),
        0 4px 12px rgba(118, 75, 162, 0.4);
}

.nav-btn:active, .today-btn:active {
    transform: translateY(0px);
    box-shadow:
        0 2px 8px rgba(102, 126, 234, 0.4),
        0 1px 4px rgba(118, 75, 162, 0.3);
}

.current-date {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    min-width: 120px;
    text-align: center;
}

/* 班次筛选按钮现代化样式 */
.team-filter {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.9);
    color: #667eea;
    border: 2px solid rgba(102, 126, 234, 0.2);
    padding: 10px 18px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 14px;
    font-weight: 600;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow:
        0 2px 8px rgba(102, 126, 234, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea, #764ba2);
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: inherit;
}

.filter-btn span {
    position: relative;
    z-index: 1;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 1);
    border-color: rgba(102, 126, 234, 0.4);
    transform: translateY(-2px);
    box-shadow:
        0 8px 16px rgba(102, 126, 234, 0.2),
        0 4px 8px rgba(118, 75, 162, 0.15);
}

.filter-btn.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow:
        0 6px 20px rgba(102, 126, 234, 0.4),
        0 3px 10px rgba(118, 75, 162, 0.3);
}

.filter-btn.active::before {
    opacity: 1;
}

.filter-btn:active {
    transform: translateY(0px);
}

/* 图例样式 */
.legend {
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
}

.legend-text {
    font-size: 14px;
    color: #555;
}

/* 班次颜色定义 */
.early-shift {
    background: linear-gradient(135deg, #ff9a9e, #fecfef);
}

.middle-shift {
    background: linear-gradient(135deg, #a8e6cf, #dcedc8);
}

.night-shift {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.rest-day {
    background: linear-gradient(135deg, #f6f6f6, #e0e0e0);
}

/* 日历容器样式 */
.calendar-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* 星期标题样式 */
.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #34495e;
    color: white;
}

.weekday {
    padding: 15px;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
}

/* 日历网格样式 */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #bdc3c7;
    transition: opacity 0.3s ease;
}

.calendar-day {
    background: #fff;
    min-height: 120px;
    padding: 8px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.calendar-day:hover {
    background: #f8f9fa;
    transform: scale(1.02);
    z-index: 1;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.calendar-day.today {
    position: relative;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    box-shadow:
        0 8px 32px rgba(102, 126, 234, 0.4),
        0 4px 16px rgba(118, 75, 162, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transform: scale(1.02);
    overflow: hidden;
}

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

.calendar-day.today::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg,
        #667eea, #764ba2, #f093fb, #f5576c, #4facfe, #00f2fe);
    background-size: 300% 300%;
    border-radius: inherit;
    z-index: -1;
    animation: gradientShift 3s ease infinite;
    opacity: 0.7;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.calendar-day.today .day-number {
    color: white;
    font-weight: 800;
    font-size: 18px;
    text-shadow:
        0 2px 4px rgba(0, 0, 0, 0.3),
        0 1px 2px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    margin: 0 auto 8px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.calendar-day.today .team-shift {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #2c3e50;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px);
    position: relative;
    z-index: 2;
}

.calendar-day.today .team-shift.highlighted {
    background: white !important;
    color: #667eea;
    font-weight: 700;
    transform: scale(1.05);
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 2px 4px rgba(102, 126, 234, 0.3);
}

/* 桌面端今天样式增强 */
@media (min-width: 769px) {
    .calendar-day.today:hover {
        transform: scale(1.05);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .calendar-day.today .day-number {
        font-size: 20px;
        width: 36px;
        height: 36px;
    }
}

.calendar-day.other-month {
    background: #f8f9fa;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.calendar-day.other-month:hover {
    opacity: 0.8;
}

.calendar-day.other-month .day-number {
    color: #bdc3c7;
}

.calendar-day.other-month .team-shift {
    opacity: 0.7;
    font-size: 10px;
}

.day-number {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #2c3e50;
}

.shift-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.team-shift {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    text-align: center;
    color: #2c3e50;
    font-weight: 500;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.team-shift.early {
    background: linear-gradient(135deg, #ff9a9e, #fecfef);
}

.team-shift.middle {
    background: linear-gradient(135deg, #a8e6cf, #dcedc8);
}

.team-shift.night {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.team-shift.rest {
    background: linear-gradient(135deg, #f6f6f6, #e0e0e0);
    color: #7f8c8d;
}

.team-shift.filtered {
    display: none;
}

.team-shift.highlighted {
    font-size: 14px;
    font-weight: 700;
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(0, 0, 0, 0.3);
    z-index: 2;
    position: relative;
}

/* 移动端触摸优化 */
@media (max-width: 768px) {
    /* 改善触摸响应 */
    .calendar-day {
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .calendar-day:active {
        background: #e8f4f8;
        transform: scale(0.98);
        transition: all 0.1s ease;
    }

    .nav-btn, .today-btn, .filter-btn {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        user-select: none;
    }

    .nav-btn:active, .today-btn:active {
        transform: scale(0.95);
        transition: all 0.1s ease;
    }

    .filter-btn:active {
        transform: scale(0.95) translateY(1px);
        transition: all 0.1s ease;
    }

    /* 改善滚动体验 */
    .calendar-container {
        overflow: hidden;
        -webkit-overflow-scrolling: touch;
    }

    /* 添加加载状态指示 */
    .calendar-grid.loading {
        opacity: 0.7;
        pointer-events: none;
    }

    /* 今天的样式在移动端的特殊适配 */
    .calendar-day.today .day-number {
        font-size: 16px;
        width: 28px;
        height: 28px;
    }
}

/* 节假日样式 - 红色文字 */
.holiday-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    color: #e74c3c;
    background: transparent;
    z-index: 3;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 移除所有节假日颜色类 */
.holiday-major,
.holiday-national,
.holiday-normal,
.holiday-memorial {
    background: transparent;
    box-shadow: none;
}

/* 移除节假日日期的背景色和边框 */
.calendar-day.has-holiday {
    border: none;
}

.calendar-day.holiday-major,
.calendar-day.holiday-national,
.calendar-day.holiday-normal,
.calendar-day.holiday-memorial {
    background: #fff;
}

/* 班别筛选提示信息样式 - 紧凑设计 */
.shift-info-banner {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(1.8);
    border-radius: 12px;
    padding: 8px 16px;
    margin: 12px auto;
    max-width: 1200px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

.shift-info-content {
    font-size: 14px;
    font-weight: 600;
    color: #2c3e50;
    text-align: center;
    line-height: 1.5;
    white-space: pre-line;
}

.shift-info-content .today-shift,
.shift-info-content .tomorrow-shift {
    display: inline-block;
    margin: 0 6px;
    padding: 4px 12px;
    border-radius: 6px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 13px;
}

/* 移动端节假日样式优化 */
@media (max-width: 768px) {
    .holiday-badge {
        font-size: 8px;
        padding: 1px 3px;
        max-width: 45px;
        top: 2px;
        right: 2px;
        line-height: 1.2;
    }

    /* 确保节假日标签不遮挡班次信息 */
    .calendar-day.has-holiday .shift-info {
        margin-top: 2px;
    }

    /* 移动端班别筛选提示信息样式 */
    .shift-info-banner {
        padding: 6px 12px;
        margin: 10px;
        border-radius: 10px;
    }

    .shift-info-content {
        font-size: 13px;
        line-height: 1.4;
    }

    .shift-info-content .today-shift,
    .shift-info-content .tomorrow-shift {
        display: inline-block;
        margin: 0 4px;
        padding: 3px 10px;
        font-size: 12px;
    }

    /* 移动端节假日文字优化 */
    .holiday-badge {
        font-size: 8px;
    }
}

/* 移动端全面优化 */
@media (max-width: 768px) {
    .container {
        padding: 15px 10px;
    }

    .header {
        padding: 15px;
        margin-bottom: 15px;
    }

    .header h1 {
        font-size: 24px;
        margin-bottom: 12px;
    }

    .controls {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .date-navigation {
        justify-content: center;
        gap: 12px;
        flex-wrap: wrap;
    }

    .nav-btn {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }

    .today-btn {
        padding: 10px 20px;
        font-size: 16px;
        margin-left: 8px;
        margin-top: 0;
    }

    .current-date {
        font-size: 18px;
        min-width: 100px;
    }

    .team-filter {
        justify-content: center;
        gap: 6px;
    }

    .filter-btn {
        padding: 10px 16px;
        font-size: 16px;
        min-height: 44px;
        flex: 1;
        max-width: 80px;
    }

    .legend {
        gap: 15px;
        padding: 12px;
        margin-bottom: 15px;
    }

    .legend-text {
        font-size: 15px;
    }

    .legend-color {
        width: 18px;
        height: 18px;
    }

    .weekday {
        padding: 12px 8px;
        font-size: 15px;
    }

    .calendar-day {
        min-height: 110px;
        padding: 8px 6px;
    }

    .day-number {
        font-size: 16px;
        margin-bottom: 6px;
    }

    .team-shift {
        font-size: 11px;
        padding: 4px 6px;
        margin-bottom: 2px;
        border-radius: 4px;
    }

    .team-shift.highlighted {
        font-size: 13px;
        font-weight: 700;
        padding: 5px 7px;
    }
}

/* 中等屏幕手机优化 (414px - iPhone 6 Plus等) */
@media (max-width: 414px) and (min-width: 376px) {
    .container {
        padding: 12px 8px;
    }

    .team-filter {
        flex-wrap: wrap;
    }

    .filter-btn {
        flex: 0 0 calc(20% - 6px);
        font-size: 14px;
        padding: 8px 12px;
    }

    .calendar-day {
        min-height: 105px;
        padding: 6px 5px;
    }

    .team-shift {
        font-size: 10px;
        padding: 3px 5px;
    }

    .team-shift.highlighted {
        font-size: 12px;
        padding: 4px 6px;
    }
}

/* 小屏幕手机优化 (iPhone SE等) */
@media (max-width: 375px) {
    .container {
        padding: 10px 6px;
    }

    .header {
        padding: 15px;
        margin-bottom: 15px;
    }

    .header h1 {
        font-size: 22px;
        margin-bottom: 12px;
    }

    .date-navigation {
        gap: 8px;
    }

    .nav-btn {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    .today-btn {
        padding: 8px 16px;
        font-size: 14px;
    }

    .current-date {
        font-size: 16px;
        min-width: 90px;
    }

    .team-filter {
        flex-wrap: wrap;
        gap: 6px;
    }

    .filter-btn {
        flex: 0 0 calc(20% - 5px);
        font-size: 13px;
        padding: 8px 10px;
    }

    .legend {
        gap: 8px;
        padding: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .legend-item {
        flex: 0 0 auto;
    }

    .legend-text {
        font-size: 13px;
    }

    .legend-color {
        width: 16px;
        height: 16px;
    }

    .weekday {
        padding: 10px 4px;
        font-size: 14px;
    }

    .calendar-day {
        min-height: 95px;
        padding: 5px 4px;
    }

    .day-number {
        font-size: 15px;
        margin-bottom: 5px;
    }

    .team-shift {
        font-size: 9px;
        padding: 2px 4px;
        margin-bottom: 1px;
    }

    .team-shift.highlighted {
        font-size: 11px;
        font-weight: 700;
        padding: 3px 5px;
    }
}

/* 超小屏幕优化 (320px) */
@media (max-width: 320px) {
    .container {
        padding: 8px 4px;
    }

    .header {
        padding: 12px;
    }

    .header h1 {
        font-size: 20px;
        margin-bottom: 10px;
    }

    .controls {
        gap: 12px;
    }

    .date-navigation {
        gap: 6px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .today-btn {
        padding: 6px 12px;
        font-size: 13px;
        margin-top: 5px;
        order: 3;
        width: 100%;
    }

    .current-date {
        font-size: 16px;
        order: 2;
        width: 100%;
        text-align: center;
        margin: 5px 0;
    }

    .team-filter {
        flex-wrap: wrap;
        gap: 4px;
    }

    .filter-btn {
        flex: 0 0 calc(20% - 3px);
        font-size: 12px;
        padding: 6px 8px;
    }

    .legend {
        gap: 6px;
        padding: 8px;
        justify-content: space-around;
    }

    .legend-text {
        font-size: 12px;
    }

    .legend-color {
        width: 14px;
        height: 14px;
    }

    .weekday {
        padding: 8px 2px;
        font-size: 13px;
    }

    .calendar-day {
        min-height: 85px;
        padding: 4px 3px;
    }

    .day-number {
        font-size: 14px;
        margin-bottom: 4px;
    }

    .team-shift {
        font-size: 8px;
        padding: 2px 3px;
        margin-bottom: 1px;
        border-radius: 3px;
    }

    .team-shift.highlighted {
        font-size: 10px;
        font-weight: 700;
        padding: 3px 4px;
        transform: scale(1.05);
    }
}