/*
 * 学院科协日历管理系统 - 样式文件
 * 作者：学院科协技术部
 * 版本：1.0
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 24px 32px;
    text-align: center;
}

.header h1 {
    font-size: 28px;
    margin-bottom: 16px;
    font-weight: 600;
}

.header-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.header-controls h2 {
    font-size: 24px;
    min-width: 180px;
    font-weight: 500;
}

.btn-nav {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.btn-nav:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* 图例说明 */
.legend {
    display: flex;
    justify-content: center;
    gap: 32px;
    padding: 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #495057;
}

.legend-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.activity-online {
    background: #e3f2fd;
    color: #1976d2;
}

.activity-offline {
    background: #e8f5e9;
    color: #388e3c;
}

.project-bg {
    background: #fff3e0;
    color: #f57c00;
}

/* 日历主体 */
.calendar {
    padding: 24px 32px;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.weekday {
    text-align: center;
    padding: 12px;
    font-weight: 600;
    color: #6c757d;
    font-size: 14px;
    background: #f8f9fa;
    border-radius: 6px;
}

/* 日历网格 */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.calendar-day {
    min-height: 88px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    background-color: #fff;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.2s;
}

.calendar-day:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    z-index: 10;
}

.calendar-day.other-month {
    background: #f8f9fa;
    color: #adb5bd;
}

.calendar-day.today {
    border: 2px solid #667eea;
    background: #f0f4ff;
}

.day-number {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: #495057;
    position: relative;
    z-index: 2;
}

.calendar-day.other-month .day-number {
    color: #adb5bd;
}

.calendar-day.today .day-number {
    color: #667eea;
}

/* ========== 三栏布局容器 ========== */
.day-blocks {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 2px;
    padding: 2px;
    position: relative;
    z-index: 3;
}

/* 每个独立的块区域（上、中、下） */
.day-block {
    flex: 1;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: white;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 3px;
    transition: background-color 0.3s;
}

/* 上块 */
.day-block-top {
    min-height: 24px;
}

/* 中块 */
.day-block-middle {
    min-height: 24px;
}

/* 下块 */
.day-block-bottom {
    min-height: 24px;
}

/* 默认空块样式 */
.day-block:empty {
    background-color: transparent;
}

.day-block--filled,
.day-block--interactive {
    cursor: pointer;
}

.day-block--activity-online {
    background: linear-gradient(135deg, #1976d2, #1565c0);
    color: #fff;
}

.day-block--activity-offline {
    background: linear-gradient(135deg, #43a047, #2e7d32);
    color: #fff;
}

.day-block--activity-stack {
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    line-height: 1.15;
    padding: 2px 1px;
}

.day-block-activity-title {
    font-size: 9.5px;
    font-weight: 600;
}

.day-block-activity-dates {
    font-size: 8px;
    font-weight: 600;
    opacity: 0.92;
    letter-spacing: -0.02em;
}

.day-block--activity-planned {
    opacity: 0.58;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

/* 项目开始日标签：与下方跨日轨道同色系统一色系 */
.day-block--project {
    color: #fff;
}

.day-block--project.color-1 {
    background: linear-gradient(135deg, #ff6b6b, #e03131);
}

.day-block--project.color-2 {
    background: linear-gradient(135deg, #26c6da, #00838f);
}

.day-block--project.color-3 {
    background: linear-gradient(135deg, #42a5f5, #1565c0);
}

.day-block--project.color-4 {
    background: linear-gradient(135deg, #81c784, #2e7d32);
}

.day-block--project.color-5 {
    background: linear-gradient(135deg, #ffd54f, #f9a825);
    color: #4a3b00;
}

.day-block--project.color-6 {
    background: linear-gradient(135deg, #b0bec5, #78909c);
    color: #263238;
}

/* 项目跨日「仅色带」：与起止日标签同一 palette，饱和度略低 */
.day-block--project-range.color-1 {
    background: rgba(255, 107, 107, 0.52);
    box-shadow: inset 0 0 0 1px rgba(224, 49, 49, 0.35);
}

.day-block--project-range.color-2 {
    background: rgba(38, 198, 218, 0.48);
    box-shadow: inset 0 0 0 1px rgba(0, 131, 143, 0.35);
}

.day-block--project-range.color-3 {
    background: rgba(66, 165, 245, 0.48);
    box-shadow: inset 0 0 0 1px rgba(21, 101, 192, 0.35);
}

.day-block--project-range.color-4 {
    background: rgba(129, 199, 132, 0.52);
    box-shadow: inset 0 0 0 1px rgba(46, 125, 50, 0.35);
}

.day-block--project-range.color-5 {
    background: rgba(255, 213, 79, 0.58);
    box-shadow: inset 0 0 0 1px rgba(249, 168, 37, 0.45);
}

.day-block--project-range.color-6 {
    background: rgba(176, 190, 197, 0.58);
    box-shadow: inset 0 0 0 1px rgba(120, 144, 156, 0.45);
}

/* 已开始项目的「未来结束日」旗标：浅色条 + 旗子 */
.day-block--project-end-flag {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* 同槽多项目并列（>3 重叠挤占时） */
.day-block--project-split {
    padding: 1px;
}

.day-block-project-split-inner {
    display: flex;
    flex: 1;
    flex-direction: row;
    gap: 2px;
    min-height: 22px;
    width: 100%;
    align-items: stretch;
}

.project-split-piece {
    flex: 1;
    min-width: 0;
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    transition: filter 0.15s ease;
}

.project-split-piece:hover {
    filter: brightness(1.08);
}

.project-split-piece--end-flag {
    font-size: 12px;
    font-weight: 700;
}

.project-split-piece--range {
    min-height: 10px;
}

.project-split-piece--labeled {
    color: #fff;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.35);
    font-size: 11px;
}

.project-split-piece.color-1 {
    background: rgba(255, 107, 107, 0.55);
    box-shadow: inset 0 0 0 1px rgba(224, 49, 49, 0.35);
}

.project-split-piece.color-2 {
    background: rgba(38, 198, 218, 0.5);
    box-shadow: inset 0 0 0 1px rgba(0, 131, 143, 0.35);
}

.project-split-piece.color-3 {
    background: rgba(66, 165, 245, 0.5);
    box-shadow: inset 0 0 0 1px rgba(21, 101, 192, 0.35);
}

.project-split-piece.color-4 {
    background: rgba(129, 199, 132, 0.55);
    box-shadow: inset 0 0 0 1px rgba(46, 125, 50, 0.35);
}

.project-split-piece.color-5 {
    background: rgba(255, 213, 79, 0.62);
    box-shadow: inset 0 0 0 1px rgba(249, 168, 37, 0.45);
    color: #4a3b00;
}

.project-split-piece.color-5.project-split-piece--labeled {
    color: #fff;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.35);
}

.project-split-piece.color-6 {
    background: rgba(176, 190, 197, 0.62);
    box-shadow: inset 0 0 0 1px rgba(120, 144, 156, 0.45);
    color: #263238;
}

.project-split-piece.color-6.project-split-piece--labeled {
    color: #fff;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.35);
}

/* 活动标记 */
.event-item {
    position: relative;
    z-index: 2;
    font-size: 11px;
    padding: 3px 6px;
    margin-bottom: 3px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s ease;
}

.event-item:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.event-item.online {
    background: #e3f2fd;
    color: #1565c0;
    border-left: 3px solid #1976d2;
}

.event-item.offline {
    background: #e8f5e9;
    color: #2e7d32;
    border-left: 3px solid #388e3c;
}

.event-item.project {
    background: #fff3e0;
    color: #e65100;
    border-left: 3px solid #f57c00;
}

/* 悬浮框样式 */
.tooltip {
    position: fixed;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    min-width: 320px;
    max-width: 400px;
    z-index: 1000;
    display: none;
    overflow: hidden;
}

.tooltip.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.tooltip-header {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tooltip-header span {
    font-weight: 600;
    font-size: 16px;
}

.tooltip-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.tooltip-close:hover {
    opacity: 1;
}

.tooltip-content {
    padding: 18px;
    max-height: 300px;
    overflow-y: auto;
}

.tooltip-item {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid;
}

.tooltip-item.online {
    background: #e3f2fd;
    border-color: #1976d2;
}

.tooltip-item.offline {
    background: #e8f5e9;
    border-color: #388e3c;
}

.tooltip-item.project {
    background: #fff3e0;
    border-color: #f57c00;
}

.tooltip-item h4 {
    margin-bottom: 8px;
    font-size: 14px;
}

.tooltip-item p {
    font-size: 13px;
    color: #495057;
    margin-bottom: 4px;
    line-height: 1.5;
}

.tooltip-item .meta {
    font-size: 12px;
    color: #6c757d;
    margin-top: 6px;
}

/* 底部信息栏 */
.bottom-bar {
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    padding: 16px 32px;
    display: none;
}

.bottom-bar.show {
    display: block;
}

.bottom-bar-content h3 {
    color: #495057;
    margin-bottom: 12px;
    font-size: 16px;
}

.bottom-bar-content .detail-item {
    background: white;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 4px solid;
}

.bottom-bar-content .detail-item.online { border-color: #1976d2; }
.bottom-bar-content .detail-item.offline { border-color: #388e3c; }
.bottom-bar-content .detail-item.project { border-color: #f57c00; }

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .header {
        padding: 16px 20px;
    }
    
    .header h1 {
        font-size: 20px;
    }
    
    .header-controls h2 {
        font-size: 18px;
        min-width: 120px;
    }
    
    .calendar {
        padding: 16px;
    }
    
    .calendar-day {
        min-height: 70px;
        padding: 4px;
    }
    
    .event-item {
        font-size: 9px;
        padding: 2px 4px;
    }
    
    .legend {
        gap: 16px;
        flex-wrap: wrap;
    }
}
