/* 日历组件样式 */
.calendar-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 15px;
    height: 380px; /* 统一高度 */
    display: flex;
    flex-direction: column;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 0 8px;
}

.calendar-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    text-align: center;
    flex: 1;
}

.calendar-nav {
    background: #f8f9fa;
    border: none;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #666;
}

.calendar-nav:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.calendar-nav:active {
    transform: translateY(0);
}

.calendar-grid {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.calendar-weekdays > div {
    text-align: center;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    padding: 8px 4px;
}

.calendar-weekdays > div:first-child,
.calendar-weekdays > div:last-child {
    color: #ff6b6b;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    flex: 1;
}

.calendar-day {
    position: relative;
    min-height: 40px;
    padding: 3px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    background: #fff;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.calendar-day:hover,
.calendar-day:active {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 移动端触摸优化 */
@media (hover: none) {
    .calendar-day:hover {
        background: #fff;
        transform: none;
        box-shadow: none;
    }
    
    .calendar-day:active {
        background: #f8f9fa;
        transform: translateY(-1px);
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    }
}

.calendar-day.empty {
    background: transparent;
    border: none;
    cursor: default;
}

.calendar-day.empty:hover {
    background: transparent;
    transform: none;
    box-shadow: none;
}

.calendar-day.today {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    color: white;
}

.calendar-day.today .date-number {
    color: white;
    font-weight: 700;
}

.calendar-day.today .lunar-text {
    color: rgba(255, 255, 255, 0.9);
}

.calendar-day.weekend {
    background: #fff5f5;
    border-color: #ffe3e3;
}

.calendar-day.weekend .date-number {
    color: #ff6b6b;
}

.date-number {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
}

.lunar-text {
    font-size: 10px;
    color: #888;
    text-align: center;
    line-height: 1.2;
    margin-top: 2px;
}

.holiday-text {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ff6b6b;
    color: white;
    font-size: 8px;
    padding: 1px 3px;
    border-radius: 4px;
    font-weight: 500;
    line-height: 1;
}

.calendar-day.today .holiday-text {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(4px);
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .calendar-container {
        height: auto;
        min-height: 320px;
    }
    
    .calendar-grid {
        grid-template-columns: repeat(7, 1fr);
        gap: 3px;
    }
    
    .calendar-weekdays > div {
        font-size: 11px;
        padding: 6px 2px;
    }
    
    .calendar-day {
        min-height: 35px;
        padding: 2px;
    }
    
    .date-number {
        font-size: 11px;
    }
    
    .lunar-text {
        font-size: 8px;
    }
    
    .holiday-text {
        font-size: 7px;
        padding: 1px 2px;
    }
}

@media (max-width: 768px) {
    .calendar-container {
        padding: 10px;
        height: 300px; /* 移动端调整高度 */
    }
    
    .calendar-day {
        min-height: 32px;
        padding: 1px;
    }
    
    .date-number {
        font-size: 10px;
    }
    
    .lunar-text {
        font-size: 7px;
    }
    
    .holiday-text {
        font-size: 6px;
        padding: 1px 1px;
    }
    
    .calendar-header {
        margin-bottom: 12px;
        padding: 0 4px;
    }
    
    .calendar-title {
        font-size: 14px;
    }
    
    .calendar-nav {
        width: 28px;
        height: 28px;
    }
}

@media (max-width: 480px) {
    .calendar-container {
        height: 280px; /* 超小屏幕调整高度 */
        padding: 8px;
    }
    
    .calendar-day {
        min-height: 28px;
        padding: 0;
    }
    
    .calendar-weekdays > div {
        font-size: 10px;
        padding: 4px 1px;
    }
    
    .date-number {
        font-size: 9px;
    }
    
    .lunar-text {
        font-size: 6px;
    }
    
    .holiday-text {
        font-size: 5px;
        padding: 0 1px;
    }
    
    .calendar-header {
        margin-bottom: 8px;
    }
    
    .calendar-title {
        font-size: 12px;
    }
    
    .calendar-nav {
        width: 24px;
        height: 24px;
    }
    
    .calendar-nav em {
        font-size: 10px;
    }
}

/* 移动端滚动优化 */
.calendar-days {
    -webkit-overflow-scrolling: touch; /* iOS 平滑滚动 */
    overflow-y: auto;
    max-height: 250px;
}

.calendar-days::-webkit-scrollbar {
    width: 3px; /* Chrome/Safari 细滚动条 */
}

.calendar-days::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 1.5px;
}

.calendar-days::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.calendar-day {
    animation: fadeIn 0.3s ease forwards;
}

.calendar-day:nth-child(1) { animation-delay: 0.05s; }
.calendar-day:nth-child(2) { animation-delay: 0.1s; }
.calendar-day:nth-child(3) { animation-delay: 0.15s; }
.calendar-day:nth-child(4) { animation-delay: 0.2s; }
.calendar-day:nth-child(5) { animation-delay: 0.25s; }
.calendar-day:nth-child(6) { animation-delay: 0.3s; }
.calendar-day:nth-child(7) { animation-delay: 0.35s; }
.calendar-day:nth-child(8) { animation-delay: 0.4s; }
.calendar-day:nth-child(9) { animation-delay: 0.45s; }
.calendar-day:nth-child(10) { animation-delay: 0.5s; }
.calendar-day:nth-child(11) { animation-delay: 0.55s; }
.calendar-day:nth-child(12) { animation-delay: 0.6s; }
.calendar-day:nth-child(13) { animation-delay: 0.65s; }
.calendar-day:nth-child(14) { animation-delay: 0.7s; }
.calendar-day:nth-child(15) { animation-delay: 0.75s; }
.calendar-day:nth-child(16) { animation-delay: 0.8s; }
.calendar-day:nth-child(17) { animation-delay: 0.85s; }
.calendar-day:nth-child(18) { animation-delay: 0.9s; }
.calendar-day:nth-child(19) { animation-delay: 0.95s; }
.calendar-day:nth-child(20) { animation-delay: 1s; }
.calendar-day:nth-child(21) { animation-delay: 1.05s; }
.calendar-day:nth-child(22) { animation-delay: 1.1s; }
.calendar-day:nth-child(23) { animation-delay: 1.15s; }
.calendar-day:nth-child(24) { animation-delay: 1.2s; }
.calendar-day:nth-child(25) { animation-delay: 1.25s; }
.calendar-day:nth-child(26) { animation-delay: 1.3s; }
.calendar-day:nth-child(27) { animation-delay: 1.35s; }
.calendar-day:nth-child(28) { animation-delay: 1.4s; }
.calendar-day:nth-child(29) { animation-delay: 1.45s; }
.calendar-day:nth-child(30) { animation-delay: 1.5s; }
.calendar-day:nth-child(31) { animation-delay: 1.55s; }
.calendar-day:nth-child(32) { animation-delay: 1.6s; }
.calendar-day:nth-child(33) { animation-delay: 1.65s; }
.calendar-day:nth-child(34) { animation-delay: 1.7s; }
.calendar-day:nth-child(35) { animation-delay: 1.75s; }
.calendar-day:nth-child(36) { animation-delay: 1.8s; }
.calendar-day:nth-child(37) { animation-delay: 1.85s; }
.calendar-day:nth-child(38) { animation-delay: 1.9s; }
.calendar-day:nth-child(39) { animation-delay: 1.95s; }
.calendar-day:nth-child(40) { animation-delay: 2s; }

/* 加载状态 */
.calendar-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: #666;
    font-size: 14px;
}

.calendar-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e9ecef;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}