/* 日历页面样式 */

/* 日历控制栏 */
.calendar-controls {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.date-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
}

.date-nav button {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 8px 25px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.date-nav button:hover {
    background: #e9ecef;
}

.date-nav span {
    flex: 1;
    text-align: center;
    font-size: 18px;
    font-weight: 500;
    color: #333;
}

.view-tabs {
    display: flex;
    gap: 8px;
}

.view-tab {
    padding: 8px 10px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.view-tab:hover {
    background: #e9ecef;
}

.view-tab.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

/* 月视图样式 */
.calendar-month-view {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.calendar-weekdays {
    display: flex;
    background: #f5f5f5;
    border-bottom: 1px solid #eee;
}

.weekday {
    flex: 1;
    text-align: center;
    padding: 12px;
    font-weight: 500;
    color: #666;
}

.calendar-grid {
    display: flex;
    flex-direction: column;
    border: 1px solid #eee;
}

.calendar-week {
    display: flex;
    min-height: 100px;
}

.calendar-day {
    flex: 1;
    border-right: 1px solid #eee;
    border-bottom: 1px solid #eee;
    min-height: 100px;
    padding: 8px;
    cursor: pointer;
    position: relative;
}

.calendar-day:hover {
    background-color: #f8f9fa;
}

.calendar-day.today {
    background-color: #e3f2fd;
}

.calendar-day.other-month {
    color: #ccc;
    background-color: #fafafa;
}

.day-number {
    margin-bottom: 4px;
}

.calendar-day.today .day-number {
    font-weight: bold;
    color: #2196F3;
}

.day-events {
    position: absolute;
    top: 28px;
    left: 4px;
    right: 4px;
    bottom: 4px;
}

.event-dot {
    background: #e3f2fd;
    border-left: 3px solid #2196F3;
    padding: 2px 4px;
    margin: 1px 0;
    border-radius: 2px;
    font-size: 11px;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    transition: background 0.2s;
}

.event-dot:hover {
    background: #bbdefb;
}

.event-more {
    font-size: 10px;
    color: #666;
    text-align: center;
    margin-top: 2px;
}

/* 周视图样式 - 重新设计以确保对齐 */
.calendar-week-view, .week-view {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 周视图头部 - 使用grid布局 */
.week-header {
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    background: #f5f5f5;
    border-bottom: 1px solid #eee;
}

.week-time-label {
    padding: 12px;
    text-align: center;
    font-weight: 500;
    color: #666;
    border-right: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
}

.week-day-header {
    padding: 12px;
    text-align: center;
    border-right: 1px solid #eee;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.week-day-header:last-child {
    border-right: none;
}

.week-day-header.today {
    background-color: #e3f2fd;
    color: #2196F3;
    font-weight: bold;
}

.day-name {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.week-day-header.today .day-name {
    color: #1976D2;
}

.day-date {
    font-size: 16px;
    font-weight: 500;
}

/* 周视图主体 - 使用相同的grid布局 */
.week-body {
    display: flex;
    flex-direction: column;
}

.week-hour-row {
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    border-bottom: 1px solid #eee;
    min-height: 60px;
}

.week-hour-row:last-child {
    border-bottom: none;
}

.week-time-cell {
    padding: 8px 12px;
    text-align: right;
    color: #666;
    font-size: 14px;
    border-right: 1px solid #eee;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    background: #fafafa;
}

.week-event-cell {
    padding: 4px;
    border-right: 1px solid #eee;
    cursor: pointer;
    min-height: 52px;
    transition: background 0.2s;
    position: relative;
}

.week-event-cell:last-child {
    border-right: none;
}

.week-event-cell:hover {
    background-color: #f8f9fa;
}

.week-event {
    background: #e3f2fd;
    border-left: 3px solid #2196F3;
    padding: 2px 6px;
    margin: 1px 0;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
    word-break: break-word;
    position: relative;
    z-index: 1;
}

.week-event:hover {
    background: #bbdefb;
    transform: scale(1.02);
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* 日视图样式 */
.calendar-day-view {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.day-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #eee;
}

.day-header h2 {
    margin: 0 0 8px 0;
    color: #333;
}

.day-header p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

.all-day-events {
    margin-bottom: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 6px;
}

.all-day-events h4 {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 14px;
}

.all-day-event {
    border-left: 3px solid #4A90E2;
    margin-bottom: 4px;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.all-day-event:hover {
    background: #e6f3ff;
}

.day-timeline {
    border: 1px solid #eee;
    border-radius: 6px;
    overflow: hidden;
}

.hour-slot {
    display: flex;
    border-bottom: 1px solid #eee;
    min-height: 60px;
    padding: 8px 0;
}

.hour-slot:last-child {
    border-bottom: none;
}

.hour-label {
    width: 80px;
    text-align: right;
    color: #666;
    font-size: 14px;
    padding-right: 12px;
    border-right: 1px solid #eee;
}

.hour-content {
    flex: 1;
    padding-left: 12px;
}

.day-event {
    background: #f0f8ff;
    border-left: 3px solid #4A90E2;
    margin-bottom: 4px;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.day-event:hover {
    background: #e6f3ff;
}

.event-time {
    font-size: 12px;
    color: #666;
    margin-bottom: 2px;
}

.event-title {
    font-weight: 500;
    color: #333;
}

.event-location {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.event-item {
    background: white;
    border: 1px solid #eee;
    border-left: 4px solid #2196F3;
    margin-bottom: 12px;
    padding: 16px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s;
}

.event-item:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.event-title {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
}

.event-time {
    font-size: 14px;
    color: #666;
    margin-bottom: 6px;
}

.event-description {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state h3 {
    margin-bottom: 8px;
    color: #333;
}

.empty-state p {
    margin-bottom: 20px;
}

/* 加载状态样式 */
.loading-state {
    text-align: center;
    padding: 60px 20px;
}

.loading-state div {
    font-size: 48px;
    margin-bottom: 16px;
}

/* 移除旧的周视图样式以避免冲突 */
.time-column, .day-column, .week-grid, .hour-row, .time-slot, .hour-cell {
    /* 这些样式已被新的grid布局替代 */
    display: none !important;
}

/* 新的日历视图容器样式 */
.calendar-view {
    width: 100%;
    min-height: 400px;
}

.calendar-view:not([style*="display: block"]) {
    display: none !important;
}

/* 响应式优化 */
@media (max-width: 768px) {
    .calendar-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .view-tabs {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .view-tab {
        flex: 1;
        min-width: 65px;
        margin: 2px;
        font-size:10px;
        padding:16px 10px;
    }
    
    /* 月视图移动端优化 */
    .calendar-day {
        min-height: 80px;
        font-size: 12px;
    }
    
    .day-number {
        font-size: 14px;
    }
    
    .event-dot {
        font-size: 10px;
        padding: 1px 3px;
    }
    
    /* 周视图移动端优化 */
    .week-header {
        grid-template-columns: 60px repeat(7, 1fr);
    }
    
    .week-hour-row {
        grid-template-columns: 60px repeat(7, 1fr);
    }
    
    .week-time-label, .week-time-cell {
        font-size: 12px;
        padding: 8px 4px;
    }
    
    .week-day-header {
        padding: 8px 4px;
    }
    
    .day-name {
        font-size: 10px;
    }
    
    .day-date {
        font-size: 14px;
    }
    
    .week-event {
        font-size: 10px;
        padding: 1px 3px;
    }
    
    /* 日视图移动端优化 */
    .hour-label {
        width: 60px;
        font-size: 12px;
    }
    
    .hour-content {
        padding-left: 8px;
    }
}

/* 跨日期事件和全天事件样式 */

/* 月视图中的事件样式优化 */
.event-dot.all-day {
    background: var(--primary-blue);
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    margin: 1px 0;
    font-size: 10px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-dot.timed {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1px 4px;
    margin: 1px 0;
    font-size: 9px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 跨日期事件的不同位置样式 */
.multi-day-start {
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}

.multi-day-middle {
    border-radius: 4px;
}

.multi-day-end {
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

/* 日视图全天事件区域 */
.all-day-events-section {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 16px;
    overflow: hidden;
}

.all-day-header {
    display: flex;
    min-height: 40px;
}

.all-day-label {
    background: #e9ecef;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #6c757d;
    display: flex;
    align-items: center;
    min-width: 60px;
    border-right: 1px solid #dee2e6;
}

.all-day-content {
    flex: 1;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.all-day-event {
    background: var(--primary-blue);
    color: white;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid rgba(255, 255, 255, 0.3);
}

.all-day-event:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.all-day-event .event-title {
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 2px;
}

.all-day-event .event-location {
    font-size: 12px;
    opacity: 0.9;
}

.multi-day-indicator {
    float: right;
    font-size: 12px;
    opacity: 0.8;
    margin-left: 8px;
}

/* 周视图全天事件样式 */
.week-all-day-section {
    background: rgba(74, 144, 226, 0.1);
    border-radius: 4px;
    padding: 2px;
    margin-bottom: 2px;
}

.week-all-day-event {
    background: var(--primary-blue);
    color: white;
    border-radius: 3px;
    padding: 2px 4px;
    font-size: 10px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.week-all-day-event:hover {
    opacity: 0.9;
}

/* 时间事件样式优化 */
.day-event {
    background: white;
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.day-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.day-event .event-time {
    font-size: 12px;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 2px;
}

.day-event .event-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
}

.day-event .event-location {
    font-size: 12px;
    color: #6c757d;
}

.multi-day-badge {
    display: inline-block;
    background: rgba(0, 0, 0, 0.1);
    color: #666;
    border-radius: 10px;
    padding: 1px 6px;
    font-size: 10px;
    float: right;
    margin-top: 2px;
}

/* 周视图事件样式优化 */
.week-event {
    background: white;
    border-radius: 3px;
    padding: 2px 4px;
    margin-bottom: 1px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.week-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* 响应式调整 */
@media (max-width: 768px) {
    .all-day-label {
        min-width: 50px;
        padding: 6px 8px;
        font-size: 11px;
    }
    
    .all-day-event {
        padding: 4px 6px;
        font-size: 12px;
    }
    
    .event-dot.all-day,
    .event-dot.timed {
        font-size: 9px;
        padding: 1px 3px;
    }
    
    .week-all-day-event {
        font-size: 9px;
        padding: 1px 2px;
    }
}

/* 颜色主题变量 */
.all-day-event.priority-high {
    background: #dc3545;
}

.all-day-event.priority-medium {
    background: #ffc107;
    color: #333;
}

.all-day-event.priority-low {
    background: #28a745;
}

/* 事件类型颜色 */
.event-category-meeting {
    background: #6f42c1;
}

.event-category-task {
    background: #fd7e14;
}

.event-category-reminder {
    background: #20c997;
}

.event-category-appointment {
    background: #e83e8c;
}