/* ============================================
   日历侧边栏悬浮样式
   ============================================ */

/* 主内容包装器 */
.main-wrapper {
    margin-right: 380px;
    transition: margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-wrapper.expanded {
    margin-right: 0;
}

/* 日历侧边栏 */
.calendar-sidebar {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 360px;
    max-height: calc(100vh - 40px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.calendar-sidebar.collapsed {
    width: 60px;
    max-height: none; /* 移除高度限制 */
    min-height: 60px; /* 最小高度 */
    right: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow: visible; /* 允许内容溢出显示按钮 */
}

.calendar-sidebar.collapsed .sidebar-content {
    display: none;
}

.calendar-sidebar.collapsed .sidebar-header {
    display: none;
}

/* 展开按钮 - 使用更强力的选择器 */
body .calendar-sidebar .sidebar-expand,
.calendar-sidebar .sidebar-expand {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: none;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: none !important;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    z-index: 1001;
}

/* 收起时显示 */
body .calendar-sidebar.collapsed .sidebar-expand,
.calendar-sidebar.collapsed .sidebar-expand {
    display: flex !important;
}

.sidebar-expand:hover {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

/* 侧边栏头部 */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    transition: all 0.3s ease;
}

.sidebar-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
}

.sidebar-toggle {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.calendar-sidebar.collapsed .sidebar-toggle {
    transform: rotate(180deg);
}

/* 侧边栏内容 */
.sidebar-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* 日历包装器 */
.calendar-wrapper {
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    overflow: hidden;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}

.calendar-nav {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.calendar-nav:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.calendar-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.weekday {
    padding: 12px 5px;
    text-align: center;
    font-size: 12px;
    color: #888;
    font-weight: 600;
}

.weekday:first-child,
.weekday:last-child {
    color: #ff6b6b;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    padding: 10px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    font-size: 13px;
    color: #333;
}

.calendar-day:hover {
    background: #f0f0f0;
}

.calendar-day.empty {
    cursor: default;
    background: transparent;
}

.calendar-day.other-month {
    color: #ccc;
}

.calendar-day.today {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-weight: 600;
}

.calendar-day.meeting-day {
    background: linear-gradient(135deg, #4caf50, #8bc34a);
    color: #fff;
    font-weight: 600;
}

.calendar-day.meeting-day::after {
    content: '📅';
    position: absolute;
    bottom: 3px;
    font-size: 8px;
}

.calendar-day.arrival-day {
    background: linear-gradient(135deg, #ff9800, #ffb74d);
    color: #fff;
    font-weight: 600;
}

.calendar-day.arrival-day::after {
    content: '🏨';
    position: absolute;
    bottom: 3px;
    font-size: 8px;
}

.calendar-day.selected {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.calendar-day.weekend {
    color: #ff6b6b;
}

.calendar-day.meeting-day.weekend,
.calendar-day.arrival-day.weekend {
    color: #fff;
}

/* 日历图例 */
.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #555;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-dot.meeting-day {
    background: linear-gradient(135deg, #4caf50, #8bc34a);
}

.legend-dot.arrival-day {
    background: linear-gradient(135deg, #ff9800, #ffb74d);
}

.legend-dot.today {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

/* 日期详情面板 */
.calendar-detail {
    margin-top: 15px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #e9ecef;
    overflow: hidden;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}

.detail-header h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.detail-close {
    width: 26px;
    height: 26px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.detail-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.detail-content {
    padding: 15px;
    max-height: 200px;
    overflow-y: auto;
}

.detail-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px dashed #e9ecef;
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-item-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.detail-item-content {
    flex: 1;
}

.detail-item-label {
    font-size: 11px;
    color: #888;
    display: block;
    margin-bottom: 3px;
}

.detail-item-value {
    font-size: 13px;
    color: #333;
    font-weight: 500;
}

.detail-item-value.meeting {
    color: #4caf50;
    font-weight: 600;
}

.detail-item-value.arrival {
    color: #ff9800;
    font-weight: 600;
}

.no-event {
    text-align: center;
    padding: 20px 15px;
    color: #888;
}

.no-event-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

/* 展开按钮 */
.sidebar-expand {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: none;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.sidebar-expand:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

/* 响应式 */
@media (max-width: 1200px) {
    .main-wrapper {
        margin-right: 0;
        padding-bottom: 20px;
    }

    .calendar-sidebar {
        position: relative;
        top: 0;
        right: 0;
        width: 100%;
        max-width: 400px;
        margin: 20px auto;
        max-height: none;
    }

    .calendar-sidebar.collapsed {
        width: 100%;
        max-width: 400px;
        max-height: 60px;
    }

    .sidebar-expand {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .calendar-sidebar {
        width: 100%;
        border-radius: 12px;
    }

    .sidebar-header {
        padding: 12px 15px;
    }

    .sidebar-header h3 {
        font-size: 14px;
    }

    .sidebar-content {
        padding: 15px;
    }

    .calendar-header {
        padding: 12px;
    }

    .calendar-nav {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .calendar-title {
        font-size: 14px;
    }

    .weekday {
        padding: 10px 3px;
        font-size: 11px;
    }

    .calendar-day {
        font-size: 12px;
    }

    .calendar-legend {
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px;
    }

    .legend-item {
        font-size: 10px;
    }
}

/* 打印样式 */
@media print {
    .calendar-sidebar {
        display: none;
    }

    .main-wrapper {
        margin-right: 0;
    }
}