/* =============================================
   통합 캘린더 (csr_unified_calendar)
   ============================================= */

.csr-unified-cal-wrap {
    max-width: 1170px;
    margin: 32px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #fff;
    border-radius: 12px;
    box-shadow: none;
    border: 1px solid #e5e7eb;
    padding: 24px;
}

/* 헤더 (이전/다음 월 버튼) */
.csr-unified-cal-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-bottom: 16px;
}

.csr-ucal-prev,
.csr-ucal-next {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 4px 12px;
    cursor: pointer;
    font-size: 16px;
    color: #555;
    line-height: 1.6;
    transition: background 0.15s;
}
.csr-ucal-prev:hover,
.csr-ucal-next:hover {
    background: #f0f0f0;
}

.csr-ucal-month {
    font-size: 18px;
    font-weight: 700;
    color: #222;
    min-width: 140px;
    text-align: center;
}

/* 범례 */
.csr-unified-cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 12px;
    color: #555;
}

.csr-ucal-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 요일 행 */
.csr-unified-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #888;
    margin-bottom: 4px;
    border-bottom: 1px solid #eee;
    padding-bottom: 6px;
}

/* 날짜 그리드 */
.csr-unified-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

/* 날짜 셀 */
.csr-ucal-cell {
    min-height: 84px;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 4px 5px 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: #fff;
    overflow: hidden;
}

.csr-ucal-cell--empty {
    background: #fafafa;
    border-color: transparent;
}

.csr-ucal-cell--today {
    background: #f0f7ff;
    border-color: #78b5ed;
}

.csr-ucal-cell--sun .csr-ucal-date-num { color: #e94a48; }
.csr-ucal-cell--sat .csr-ucal-date-num { color: #78b5ed; }

/* 날짜 숫자 */
.csr-ucal-date-num {
    font-size: 12px;
    font-weight: 600;
    color: #444;
    line-height: 1.2;
}

/* 아이콘 (공간 뱃지 컬러 박스) */
.csr-ucal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

/* 뱃지 */
.csr-ucal-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: #333;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
}

.csr-ucal-badge-time {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    color: #555;
}

/* 3개 초과 뱃지 (데스크톱에서는 숨김, 모바일에서는 아이콘으로 노출) */
.csr-ucal-badge--extra {
    display: none;
}

/* 더보기 버튼 */
.csr-ucal-more {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 10px;
    color: #999;
    text-align: left;
    line-height: 1.4;
}
.csr-ucal-more:hover {
    color: #555;
    text-decoration: underline;
}

/* 로딩 */
.csr-ucal-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #aaa;
    font-size: 14px;
}

/* =============================================
   팝업
   ============================================= */
.csr-ucal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9998;
}

.csr-ucal-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 9999;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    min-width: 280px;
    max-width: 380px;
    width: 90%;
    overflow: hidden;
}

.csr-ucal-popup-inner {
    display: flex;
    flex-direction: column;
}

.csr-ucal-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.csr-ucal-popup-date {
    font-size: 15px;
    font-weight: 700;
    color: #222;
}

.csr-ucal-popup-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #888;
    line-height: 1;
    padding: 0 4px;
}
.csr-ucal-popup-close:hover {
    color: #333;
}

.csr-ucal-popup-list {
    padding: 12px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
}

.csr-ucal-popup-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: #f8f9fa;
}

.csr-ucal-popup-time {
    font-size: 13px;
    color: #444;
    font-weight: 600;
    white-space: nowrap;
}

.csr-ucal-popup-label {
    font-size: 13px;
    color: #666;
}

/* =============================================
   반응형
   ============================================= */
@media (max-width: 600px) {
    .csr-unified-cal-wrap {
        margin: 16px 16px;
        padding: 12px;
        border-radius: 8px;
    }
    .csr-ucal-cell {
        min-height: 60px;
        padding: 3px 3px 4px;
        flex-direction: row;
        flex-wrap: wrap;
        align-content: flex-start;
        gap: 2px;
    }
    /* 날짜 숫자는 한 줄 전체 차지 */
    .csr-ucal-cell .csr-ucal-date-num {
        width: 100%;
    }
    /* 아이템 있는 셀: 탭 가능 표시 */
    .csr-ucal-cell[data-items] {
        cursor: pointer;
    }
    /* 뱃지: 아이콘만 */
    .csr-ucal-badge {
        flex-direction: row;
        gap: 0;
    }
    /* 시간 텍스트 숨김 */
    .csr-ucal-badge-time {
        display: none;
    }
    .csr-ucal-icon {
        width: 16px;
        height: 16px;
        font-size: 9px;
    }
    .csr-ucal-month {
        font-size: 15px;
    }
}
