/* ========================================
   Calendar App Styles
   カレンダー
   ======================================== */

/* 日历容器 */
.calendar-app {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 16px;
    gap: 16px;
    background: linear-gradient(180deg,
        rgba(20, 18, 28, 0.95) 0%,
        rgba(30, 25, 40, 0.98) 100%);
}

/* 日历头部 - 年月显示 */
.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 4px;
}

.calendar-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.calendar-year {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 300;
    letter-spacing: 0.5px;
}

.calendar-month {
    font-size: 24px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 1px;
}

.calendar-nav {
    display: flex;
    gap: 8px;
}

.calendar-nav-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.calendar-nav-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.9);
}

.calendar-nav-btn svg {
    width: 18px;
    height: 18px;
}

/* 星期标题行 */
.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.calendar-weekday {
    text-align: center;
    font-size: 11px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.4);
    padding: 4px 0;
    letter-spacing: 0.5px;
}

.calendar-weekday.sunday {
    color: rgba(220, 100, 100, 0.7);
}

.calendar-weekday.saturday {
    color: rgba(100, 150, 220, 0.7);
}

/* 日期网格 - 固定6行避免布局跳动 */
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 4px;
    flex: 1;
    min-height: 0; /* 防止flex子项溢出 */
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    font-weight: 400;
    gap: 2px;
}

.calendar-day:hover {
    background: rgba(255, 255, 255, 0.08);
}

.calendar-day.other-month {
    color: rgba(255, 255, 255, 0.2);
}

.calendar-day.sunday {
    color: rgba(220, 120, 120, 0.9);
}

.calendar-day.saturday {
    color: rgba(120, 160, 220, 0.9);
}

.calendar-day.other-month.sunday,
.calendar-day.other-month.saturday {
    color: rgba(255, 255, 255, 0.15);
}

/* 今天 */
.calendar-day.today {
    background: rgba(200, 160, 100, 0.15);
    border: 1px solid rgba(200, 160, 100, 0.4);
}

.calendar-day.today .calendar-day-num {
    color: #c9a86c;
    font-weight: 500;
}

/* 选中的日期 */
.calendar-day.selected {
    background: rgba(200, 160, 100, 0.25);
    border: 1px solid rgba(200, 160, 100, 0.6);
}

/* 有事件的日期 */
.calendar-day.has-event::after {
    content: '';
    position: absolute;
    bottom: 6px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #c9a86c;
}

/* 重要日期（如11月25日）*/
.calendar-day.important {
    background: linear-gradient(135deg,
        rgba(200, 100, 120, 0.2) 0%,
        rgba(200, 160, 100, 0.2) 100%);
    border: 1px solid rgba(200, 120, 120, 0.4);
}

.calendar-day.important .calendar-day-num {
    color: #e8a0a0;
    font-weight: 500;
}

/* 日期数字 */
.calendar-day-num {
    font-size: 14px;
    line-height: 1;
}

/* 日历事件列表区域 - 固定高度避免布局跳动 */
.calendar-events {
    flex: 0 0 auto;
    height: 140px;
    min-height: 140px;
    max-height: 140px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 12px;
}

.calendar-events::-webkit-scrollbar {
    width: 4px;
}

.calendar-events::-webkit-scrollbar-track {
    background: transparent;
}

.calendar-events::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
}

.calendar-events-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.calendar-events-date {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
}

.calendar-events-weekday {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

.calendar-event-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.calendar-event-item:last-child {
    border-bottom: none;
}

.calendar-event-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    min-width: 45px;
    padding-top: 2px;
}

.calendar-event-content {
    flex: 1;
}

.calendar-event-title {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2px;
    line-height: 1.4;
}

.calendar-event-note {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    line-height: 1.4;
}

/* 事件类型标记 */
.calendar-event-item.work .calendar-event-title::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6b8fb8;
    margin-right: 6px;
    vertical-align: middle;
}

.calendar-event-item.personal .calendar-event-title::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #c9a86c;
    margin-right: 6px;
    vertical-align: middle;
}

.calendar-event-item.special .calendar-event-title::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #e08080;
    margin-right: 6px;
    vertical-align: middle;
}

/* 无事件提示 */
.calendar-no-events {
    text-align: center;
    padding: 20px;
    color: rgba(255, 255, 255, 0.3);
    font-size: 13px;
}

/* 移动端适配 */
@media (max-width: 380px) {
    .calendar-app {
        padding: 12px;
        gap: 12px;
    }

    .calendar-month {
        font-size: 20px;
    }

    .calendar-day {
        font-size: 13px;
    }

    .calendar-events {
        max-height: 150px;
    }
}
