/* 강의 프로그램 캘린더 위젯 스타일 */

.lecture-program-calendar-widget {
    position: relative;
    width: 100%;
    margin-bottom: 2rem;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
}

/* 캘린더 컨테이너 */
.calendar-container {
    padding: 1rem;
    width: 100%;
    box-sizing: border-box;
}

/* 컨트롤 영역 */
.calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eaeaea;
}

/* 캘린더 그리드 */
.calendar-grid {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    display: grid;
    grid-template-rows: auto 1fr;
    table-layout: fixed; /* 고정 테이블 레이아웃 */
    position: relative; /* 플로팅 버튼의 기준점 */
}

/* 플로팅 월 이동 버튼 */
.floating-month-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(68, 126, 155, 0.6); /* 기본 투명도 */
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.floating-month-btn.prev {
    left: 5px;
}

.floating-month-btn.next {
    right: 5px;
}

.floating-month-btn:hover {
    background-color: rgba(68, 126, 155, 0.9); /* 호버 시 투명도 감소 */
    box-shadow: 0 3px 8px rgba(0,0,0,0.3);
}

.floating-month-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.floating-month-btn svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: white;
    stroke-width: 2;
}
.date-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.date-controls label {
    margin-right: 5px;
    white-space: nowrap;
}

.date-controls input {
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

/* 버튼 스타일 */
.calendar-controls button {
    background-color: #298BA8;
    color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0.4rem 0.7rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.2s ease;
    width: 70px;
    white-space: nowrap;
}

.save-calendar-btn {
    width: 70px !important;
}

.calendar-controls button:hover {
    background-color: #e9e9e9;
}

.prev-month-btn, .next-month-btn {
    padding: 0.3rem;
}

.save-calendar-btn {
    background-color: #2a7fff;
    color: white;
    border-color: #2a7fff;
}

.save-calendar-btn:hover {
    background-color: #1a6eff;
}

.apply-date-btn {
    background-color: #4CAF50;
    color: white;
    border-color: #4CAF50;
    width: 80px;
    justify-content: center;
}

.apply-date-btn:hover {
    background-color: #3d9140;
}

/* 프로그램 선택 영역 */
.calendar-programs-selection {
    margin-bottom: 1rem;
    padding: 0.5rem;
    border: 1px solid #eaeaea;
    border-radius: 4px;
    background-color: #f9f9f9;
}

.calendar-programs-selection label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.program-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.program-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.7rem;
    border-radius: 4px;
    background-color: #ffffff;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* 초기화 데이터 스타일 */
.program-item.init-data {
    display: none; /* 초기화 데이터는 화면에 표시하지 않음 */
}

.program-item.selected {
    background-color: #f0f7ff;
    border-color: #c0d9ff;
}

.program-color-box {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    display: inline-block;
}

.program-name {
    font-size: 0.9rem;
}

.program-info-text {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.5rem;
}

.program-info-text p {
    margin: 0;
}

.grid-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background-color: #f5f5f5;
    border-bottom: 1px solid #ddd;
    width: 100%;
}

.grid-cell.weekday {
    padding: 0.5rem;
    text-align: center;
    font-weight: 600;
    border-right: 1px solid #ddd;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

.grid-cell.weekday.weekend {
    background-color: #f0f0f0;
    color: #ff5252;
}

.grid-cell.weekday:last-child {
    border-right: none;
}

.calendar-days {
    width: 100%;
    display: grid;
    grid-template-rows: repeat(auto-fit, minmax(100px, auto));
}

.calendar-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    border-bottom: 1px solid #ddd;
    width: 100%;
}

.calendar-week:last-child {
    border-bottom: none;
}

.calendar-day {
    min-height: 100px;
    border-right: 1px solid #ddd;
    padding: 0.3rem;
    position: relative;
    background-color: #fff;
    overflow: hidden;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    max-width: 100%;
    width: 100%; /* 모든 셀의 폭을 같게 설정 */
}

.calendar-day:last-child {
    border-right: none;
}

.calendar-day.weekend {
    background-color: #f9f9f9;
}

.calendar-day.today {
    background-color: #e6f7ff;
}

.calendar-day.outside-month {
    background-color: #f0f0f0;
    min-height: 0;
    height: 100%;
}

.date-display {
    font-weight: 600;
    padding: 0.2rem;
    margin-bottom: 0.3rem;
    text-align: right;
    font-size: 0.9rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.calendar-day.weekend .date-display {
    color: #ff5252;
}

.calendar-day.dragover {
    background-color: #e1f5fe;
}

/* 이벤트 컨테이너 스타일 */
.day-events {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-height: 2rem;
    padding: 0.1rem 0;
    width: 100%;
    box-sizing: border-box;
    flex: 1;
}

.day-events.reordering {
    background-color: #f0f7ff;
    border-radius: 3px;
}

/* 이벤트 스타일 */
.calendar-event {
    padding: 0.3rem 0.5rem;
    border-radius: 3px;
    background-color: #e8f4fd;
    border-left: 3px solid #2196F3;
    font-size: 0.8rem;
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    position: relative;
    z-index: 5;
    width: calc(100% - 4px); /* 패딩을 고려한 너비 */
    box-sizing: border-box;
    display: block;
    max-height: 22px;
    line-height: 1.2;
    margin: 1px 2px; /* 약간의 마진으로 테두리 간격 유지 */
}

.calendar-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 3px rgba(0,0,0,0.15);
}

.calendar-event.dragging {
    opacity: 0.7;
    transform: scale(0.98);
    box-shadow: 0 3px 6px rgba(0,0,0,0.16);
}

.event-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    max-width: 100%;
    display: block;
}

.event-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    max-width: 100%;
}

/* 프로그램 색상 클래스 */
.program-color-0 { border-left-color: #2196F3; background-color: #e3f2fd; }
.program-color-1 { border-left-color: #4CAF50; background-color: #e8f5e9; }
.program-color-2 { border-left-color: #FFC107; background-color: #fff8e1; }
.program-color-3 { border-left-color: #9C27B0; background-color: #f3e5f5; }
.program-color-4 { border-left-color: #F44336; background-color: #ffebee; }
.program-color-5 { border-left-color: #009688; background-color: #e0f2f1; }
.program-color-6 { border-left-color: #673AB7; background-color: #ede7f6; }
.program-color-7 { border-left-color: #FF9800; background-color: #fff3e0; }
.program-color-8 { border-left-color: #03A9F4; background-color: #e1f5fe; }
.program-color-9 { border-left-color: #8BC34A; background-color: #f1f8e9; }

/* 모달 스타일 */
.unit-details-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.unit-details-modal.visible {
    display: flex;
}

.modal-content {
    background-color: white;
    border-radius: 5px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #eaeaea;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.close-modal-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    padding: 0.3rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal-btn:hover {
    background-color: #f5f5f5;
    color: #000;
}

.unit-info {
    padding: 1rem;
}

.unit-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.unit-thumbnail {
    width: 60px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.unit-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 교재 표지 플레이스홀더 스타일 */
.unit-thumbnail .thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-radius: 4px;
}

/* 플레이스홀더 색상 변형 */
.unit-thumbnail .thumbnail-placeholder.color-1 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.unit-thumbnail .thumbnail-placeholder.color-2 {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.unit-thumbnail .thumbnail-placeholder.color-3 {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.unit-thumbnail .thumbnail-placeholder.color-4 {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.unit-thumbnail .thumbnail-placeholder.color-5 {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.unit-thumbnail .thumbnail-placeholder.color-6 {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #555;
}

.unit-title h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
}

.unit-title p {
    margin: 0.2rem 0;
    color: #666;
    font-size: 0.9rem;
}

.unit-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    justify-content: flex-end;
}

.unit-actions button {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}

.edit-unit-btn {
    background-color: #2196F3;
    color: white;
    border: none;
}

.remove-event-btn {
    background-color: #f44336;
    color: white;
    border: none;
}

/* 알림 스타일 */
.calendar-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    background-color: #333;
    color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 1100;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.calendar-notification.success {
    background-color: #4CAF50;
}

.calendar-notification.error {
    background-color: #F44336;
}

.calendar-notification.show {
    opacity: 1;
    transform: translateY(0);
} 

.w-form-width {
    width: 100%;
    max-width: 100% !important;
}

#panel-program_calendar-content > div {
    width: 100% !important;
    max-width: 100% !important;
}

/* 캘린더 전체의 equal-width 제어를 위한 추가 스타일 */
.grid-header, .calendar-week {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    width: 100%;
}

/* 유닛 이동 버튼 스타일 */
.move-units-weekday-down-btn {
    display: none; /* 기본적으로 숨김 */
}

/* 각 유닛의 1주 이동 버튼 */
.unit-move-btn {
    position: absolute;
    right: 3px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: rgba(68, 126, 155, 0.85);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0; /* 기본적으로 숨김 */
    transition: opacity 0.2s ease, background-color 0.2s ease;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    padding: 0;
    font-size: 10px;
    line-height: 1;
}

.calendar-event:hover .unit-move-btn {
    opacity: 1; /* 유닛 호버시 버튼 표시 */
}

.unit-move-btn:hover {
    background-color: rgba(68, 126, 155, 1);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.unit-move-btn::after {
    content: attr(data-tooltip);
    position: absolute;
    right: 26px; /* 버튼의 왼쪽에 배치 */
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 10px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.1s, visibility 0.1s;
    pointer-events: none;
    z-index: 100;
}

.unit-move-btn:hover::after {
    opacity: 1;
    visibility: visible;
}

/* 이동 중 애니메이션을 위한 스타일 */
.calendar-event.moving {
    animation: moveUnitAnimation 0.5s forwards;
    position: relative;
    z-index: 30;
}

@keyframes moveUnitAnimation {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    50% {
        transform: translateY(10px);
        opacity: 0.7;
    }
    100% {
        transform: translateY(20px);
        opacity: 0;
    }
}

/* 새 이벤트 애니메이션 (자연스러운 등장) */
@keyframes newUnitAnimation {
    0% {
        transform: translateY(-10px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 월 표시 및 네비게이션 */
.month-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.current-month-display {
    font-weight: 600;
    font-size: 1.1rem;
    min-width: 100px;
    text-align: center;
}

.month-nav-btn {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.month-nav-btn:hover {
    background-color: #e0e0e0;
    border-color: #ccc;
}

.month-nav-btn svg {
    width: 16px;
    height: 16px;
}

