/* ==================== 日历模块样式（Google Calendar 风格） ==================== */

.calendar-page {
    display: flex;
    flex-direction: column;
    gap: 0;
    height: calc(100vh - var(--topbar-height) - 40px);
    background: #fff;
    border-radius: 12px;
    border: 1px solid #dadce0;
    overflow: hidden;
}

/* 顶部工具栏 */
.calendar-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid #dadce0;
    background: #fff;
    flex-shrink: 0;
}

.calendar-nav-btn {
    background: none;
    border: 1px solid #dadce0;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 18px;
    cursor: pointer;
    color: #5f6368;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    line-height: 1;
    padding: 0;
}

.calendar-nav-btn:hover {
    background: #f1f3f4;
}

.calendar-title {
    font-size: 18px;
    font-weight: 500;
    color: #3c4043;
    min-width: 140px;
}

.calendar-today-btn {
    background: #fff;
    color: #1a73e8;
    border: 1px solid #dadce0;
    border-radius: 6px;
    padding: 5px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.calendar-today-btn:hover {
    background: #e8f0fe;
    border-color: #1a73e8;
}

.calendar-toolbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-add-btn {
    background: #fff;
    color: #3c4043;
    border: 1px solid #dadce0;
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.15s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.calendar-add-btn:hover {
    background: #f1f3f4;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

/* 筛选按钮组 */
.calendar-filters {
    display: flex;
    gap: 2px;
    margin-left: 8px;
    flex-wrap: wrap;
}

.calendar-filter-btn {
    padding: 4px 8px;
    border: none;
    background: transparent;
    color: #80868b;
    font-size: 12px;
    cursor: pointer;
    border-radius: 16px;
    transition: all 0.15s;
    white-space: nowrap;
}

.calendar-filter-btn:hover {
    color: #3c4043;
    background: #f1f3f4;
}

.calendar-filter-btn.active {
    color: #1a73e8;
    background: #e8f0fe;
    font-weight: 500;
}


/* 日历网格容器 */
.calendar-grid-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* 星期头部 */
.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid #dadce0;
    flex-shrink: 0;
    background: #fff;
}

.calendar-weekday {
    padding: 6px 0;
    text-align: center;
    font-size: 11px;
    font-weight: 500;
    color: #70757a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 日期网格 */
.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(6, 1fr);
    flex: 1;
    min-height: 0;
}

.calendar-day {
    border-right: 1px solid #dadce0;
    border-bottom: 1px solid #dadce0;
    padding: 2px;
    min-height: 0;
    cursor: pointer;
    transition: background 0.1s;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.calendar-day:nth-child(7n) {
    border-right: none;
}

/* 最后一行去掉底部边框 */
.calendar-day:nth-last-child(-n+7) {
    border-bottom: none;
}

.calendar-day:hover {
    background: #f8f9fa;
}

.calendar-day.other-month {
    background: #f8f9fa;
}

.calendar-day.other-month .calendar-day-num {
    color: #b0b3b8;
}

.calendar-day.today {
    background: #fff;
}

.calendar-day-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: 24px;
    margin: 1px 2px 2px;
    flex-shrink: 0;
}

/* 日期数字 */
.calendar-day-num {
    font-size: 13px;
    font-weight: 700;
    color: #3c4043;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin: 0;
    line-height: 1;
}

.calendar-day-lunar {
    font-size: 11px;
    font-weight: 500;
    color: #5f6368;
    line-height: 1;
    white-space: nowrap;
}

.calendar-day.today .calendar-day-num {
    background: #1a73e8;
    color: #fff;
    font-weight: 700;
}

.calendar-day.other-month .calendar-day-lunar {
    color: #b0b3b8;
}

/* 事件列表 */
.calendar-day-events {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.calendar-event-item {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #fff;
    font-weight: 500;
    line-height: 18px;
    cursor: pointer;
    transition: opacity 0.1s;
}

.calendar-event-item:hover {
    opacity: 0.85;
}

.calendar-day-more {
    font-size: 11px;
    color: #1a73e8;
    padding: 0 6px;
    cursor: pointer;
    font-weight: 500;
    line-height: 18px;
}

.calendar-day-more:hover {
    text-decoration: underline;
}

.calendar-type-icon {
    font-size: 10px;
    margin-right: 2px;
}


/* ==================== 日期详情弹窗 ==================== */
.calendar-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.32);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.15s;
}

.calendar-detail-overlay.show {
    opacity: 1;
    visibility: visible;
}

.calendar-detail-box {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    width: 420px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.96);
    transition: transform 0.15s;
}

.calendar-detail-overlay.show .calendar-detail-box {
    transform: scale(1);
}

.calendar-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid #e8eaed;
}

.calendar-detail-date {
    font-size: 16px;
    font-weight: 500;
    color: #3c4043;
}

.calendar-detail-close {
    background: none;
    border: none;
    font-size: 18px;
    color: #5f6368;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 50%;
    transition: background 0.15s;
    line-height: 1;
}

.calendar-detail-close:hover {
    background: #f1f3f4;
}

.calendar-detail-body {
    padding: 8px 20px 16px;
}

.calendar-detail-event {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #e8eaed;
}

.calendar-detail-event:last-child {
    border-bottom: none;
}

.calendar-detail-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}

.calendar-detail-info {
    flex: 1;
    min-width: 0;
}

.calendar-detail-title {
    font-size: 14px;
    font-weight: 500;
    color: #3c4043;
    line-height: 1.4;
}

.calendar-detail-meta {
    font-size: 12px;
    color: #70757a;
    margin-top: 2px;
}

.calendar-detail-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.calendar-detail-action-btn {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    opacity: 0.6;
    transition: all 0.15s;
}

.calendar-detail-action-btn:hover {
    opacity: 1;
    background: #f1f3f4;
}

.calendar-detail-empty {
    text-align: center;
    padding: 24px;
    color: #70757a;
    font-size: 14px;
}

/* ==================== 新建事件表单 ==================== */
.calendar-form {
    padding: 16px 20px 20px;
}

.calendar-form .form-group {
    margin-bottom: 14px;
}

.calendar-form .form-row {
    display: flex;
    gap: 12px;
}

.calendar-form .form-row .form-group {
    flex: 1;
}

.calendar-color-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.calendar-color-opt {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}

.calendar-color-opt:hover {
    transform: scale(1.15);
}

.calendar-color-opt.active {
    border-color: #3c4043;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #3c4043;
}
