/* 日历容器：全屏适配，无多余留白 */
.calendar-container {
    width: 100%; /* 移动端占满宽度 */
    max-width: 100%;
    margin: 0 auto;
    background-color: #ffffff;
    border-radius: 8px; /* 移动端圆角更精致 */
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    height: auto;
    display: flex;
    flex-direction: column;
}

/* 日历头部：移动端紧凑布局 */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #8B0000;
    color: #FFD700;
    padding: 8px 12px; /* 移动端缩减内边距 */
    flex-shrink: 0;
    width: 100%;
}

.calendar-title {
    font-size: 16px; /* 移动端字号适配 */
    font-weight: 600;
    letter-spacing: 0.5px;
}

.calendar-btn {
    background: transparent;
    border: none;
    color: #FFD700;
    font-size: 15px;
    cursor: pointer;
    padding: 4px 8px; /* 移动端缩减点击区域 */
    border-radius: 4px;
    transition: background-color 0.2s ease;
    /* 移动端点击反馈 */
    touch-action: manipulation;
}

.calendar-btn:hover {
    background-color: rgba(255, 215, 0, 0.15);
}

.today-btn {
    background-color: #FFD700;
    color: #8B0000;
    font-weight: 600;
    padding: 4px 12px; /* 移动端缩减按钮内边距 */
    font-size: 13px; /* 移动端字号缩小 */
    border: none;
    border-radius: 4px;
}

.today-btn:hover {
    background-color: #F0C808;
}

/* 星期表头：极致紧凑，适配移动端 */
.calendar-week-header {
    display: flex;
    background-color: #A52A2A;
    color: #FFD700;
    padding: 2px 0; /* 进一步压缩内边距 */
    flex-shrink: 0;
    gap: 2px; /* 移动端列间距缩小 */
    height: auto;
}

/* 星期项：移动端最小化占用空间 */
.calendar-week-item {
    flex: 1; /* 自适应宽度，不再固定px，适配所有手机 */
    text-align: center;
    font-size: 11px; /* 移动端更小字号 */
    font-weight: 600;
    letter-spacing: 0.2px;
    padding: 1px 0;
    line-height: 1; /* 无多余行高 */
    height: 20px; /* 移动端更矮 */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 日历网格：移动端适配 */
.calendar-grid {
    display: flex;
    flex-direction: column;
    padding: 4px 0; /* 移动端缩减内边距 */
    gap: 2px; /* 行间距缩小 */
    width: 100%; /* 占满容器 */
    flex: 1;
    overflow-y: auto;
    /* 移动端滚动优化 */
    -webkit-overflow-scrolling: touch;
}

.calendar-row {
    display: flex;
    gap: 2px; /* 列间距与表头一致 */
    width: 100%; /* 占满宽度 */
}

/* 日期元素：移动端自适应宽度，高度优化 */
.calendar-day {
    flex: 1; /* 自适应列宽，适配所有手机 */
    min-width: 40px; /* 最小宽度限制，避免过窄 */
    height: 60px; /* 移动端缩短高度 */
    border-radius: 4px; /* 移动端圆角更小 */
    padding: 3px; /* 缩减内边距 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid #f0f0f0;
    overflow: hidden;
    /* 移动端点击反馈 */
    touch-action: manipulation;
}

/* 节日样式：移动端适配 */
.festival {
    color: #8B0000;
    font-weight: 600;
    text-align: center;
    width: 100%;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* 移动端最多2行，避免溢出 */
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 9px; /* 移动端更小字号 */
    line-height: 1.2;
    max-height: calc(1.2em * 2);
    padding: 0 1px;
}

/* 公历数字：移动端适配 */
.calender-number {
    font-size: 12px; /* 调整为更小的字体大小 */
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: center;
}

/* 农历样式：移动端适配 */
.day-number {
    font-size: 8px; /* 调整为更小的字体大小 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: center;
}

/* serial-number 容器样式 */
.serial-number {
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* 兼容旧的嵌套选择器 */
.serial-number .day-number {
    font-size: 8px; /* 调整为更小的字体大小 */
}

/* 非当月日期 */
.calendar-day.other-month {
    background-color: #faf8f5;
    color: #cccccc;
    border-color: #f5f5f5;
}

/* 当月日期 */
.calendar-day:not(.other-month) {
    background-color: #ffffff;
}

/* 今日日期 */
.calendar-day.today {
    border: 1.5px solid #FFD700;
}

/* 选中状态 */
.calendar-day.selected {
    background-color: #8B0000;
    color: #FFD700;
    border: 1.5px solid #FFD700;
    box-shadow: 0 0 0 1px rgba(139, 0, 0, 0.2);
}

/* 选中/今日 状态下的数字颜色 */
.calendar-day.selected .day-number,
.calendar-day.today .day-number {
    color: #FFD700;
    font-weight: 600;
}

/* 非当月数字颜色 */
.calendar-day.other-month .day-number {
    color: #cccccc;
}

/* 选中状态下的节日颜色 */
.calendar-day.selected .festival {
    color: #FFD700;
}

/* 鼠标 hover 效果：移动端隐藏（改用active） */
@media (hover: hover) {
    .calendar-day:not(.selected):not(.other-month):hover {
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
        border-color: #8B0000;
    }
}

/* 移动端点击active效果 */
.calendar-day:not(.selected):not(.other-month):active {
    background-color: #f8f5f2;
    transform: scale(0.98);
}