.sidebar-header {
    background: #ffffff;
    color: #111827;
    
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
    
}

/* 대표 이미지: 한 번만 정의, 더 넓게 표시 */
.program-cover-full {
    width: 100%;
    height: auto;
    max-width: 1000px;
    aspect-ratio: 16 / 9;
    max-height: 70vh;
    object-fit: cover;
    object-position: left center;
    display: block;
    border-radius: 30px; /* 모달 대표이미지 둥근 모서리 */
    margin: 0;
    padding-top: 8px;
}

.sidebar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.btn {
    border: none;
    background: transparent;
    color: #111827;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 10px;
    border-radius: 10px;
    cursor: pointer;
}

.btn-edit {
    background: #f3f4f6;
}

.btn-edit:hover {
    background: #e5e7eb;
}

.btn-delete {
    background: #fee2e2;
    color: #b91c1c;
}

.btn-save {
    background: #2563eb;
    color: #ffffff;
}

.btn-save:hover {
    background: #1e40af;
}

.btn-delete:hover {
    background: #fecaca;
}

/* 닫기 버튼 */
.btn-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #111827;
    padding: 8px;
    cursor: pointer;
}
.btn-close:hover {
    background: #f3f4f6;
    opacity: 1;
}


/* ============================= */
/* 📌 내부 공통 패딩             */
/* ============================= */

.sidebar-content-inner {
    padding: 18px 20px 32px 20px;
}

 .admin-only {
     display: none;
 }

 body.admin-mode .admin-only {
     display: block;
 }


/* ============================= */
/* 📌 대표 이미지 영역          */
/* ============================= */


.program-cover-placeholder {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    max-height: 70vh;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 14px;
    cursor: pointer;
    border-radius: 0;
}


/* ============================= */
/* 📌 각 항목 스타일(TOP LEVEL) */
/* ============================= */

.detail-section {
    padding: 8px 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;

}

.detail-section.vertical {
    flex-direction: column;
    gap: 0;
    align-items: flex-start;
}

.detail-label {
    font-size: 18px;
    font-weight: 700;
    color: #0ea5e9;
    width: 150px;
    flex: 0 0 150px;
    padding-top: 0;
    display: flex;
    align-items: center;
}

 .detail-section.vertical .detail-label {
     width: auto;
     flex: initial;
 }

 .detail-section.vertical .detail-value {
     width: 100%;
 }

.detail-value {
    font-size: 16px;
    color: #111827;
    font-weight: normal;
    background: transparent;
    border: none;
    padding: 0;
    white-space: pre-line;
}


#linksContainer,
#ganttEditor {
    align-self: stretch;
    width: 100%;
    text-align: left;
}

.link-display {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.link-display a {
    display: block;
}

.detail-value.editable {
    cursor: default;
}



.detail-value.editing {
    color: #111827;
    border-bottom: none;
    padding-bottom: 0;
}

.detail-value.editable.editing {
    width: 100%;
    box-sizing: border-box;
    padding: 0;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    font-size: 16px;
    line-height: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: transparent;
    color: inherit;
    cursor: text;
}

 .detail-value.editable.editing:focus {
     outline: none;
     border-color: #2563eb;
     box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
 }


/* ============================= */
/* 📌 하단 저장 버튼             */
/* ============================= */

.save-btn {
    background: #111827;
    color: #ffffff;
    padding: 16px 18px;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 700;
    margin: 20px;
    display: none;
    transition: all 0.2s;
}

.save-btn:hover {
    background: #0b1220;
}

.save-btn.active {
    display: block;
    width: calc(100% - 40px);
    position: sticky;
    bottom: 16px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

 #ganttTasksContainer .gantt-task-row {
     display: grid;
     grid-template-columns: 84px 1fr 1fr 1.6fr 64px;
     gap: 8px;
     align-items: center;
 }

 #ganttEditor[data-mode="editing"] {
     white-space: normal !important;
     line-height: 1.2 !important;
     background: #ffffff;
     color: #111827;
 }

 #ganttEditor[data-mode="editing"] > .link-input-group {
     margin-bottom: 0 !important;
 }

 .link-input-group {
     display: flex;
     gap: 8px;
     align-items: center;
     flex-wrap: nowrap;
 }

 .link-input-group input[type="text"] {
     flex: 0 0 140px;
 }

 .link-input-group input[type="url"] {
     flex: 1 1 auto;
     min-width: 0;
 }

 .link-input-group input[type="text"],
 .link-input-group input[type="url"] {
     box-sizing: border-box;
     padding: 0;
     border: 2px solid #e2e8f0;
     border-radius: 6px;
     font-size: 16px;
     line-height: inherit;
     transition: border-color 0.2s, box-shadow 0.2s;
     background: transparent;
     color: inherit;
 }

 .link-input-group input[type="text"]:focus,
 .link-input-group input[type="url"]:focus {
     outline: none;
     border-color: #2563eb;
     box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
 }

 #ganttTasksContainer .gantt-task-row .event-form-input {
     width: 100%;
     min-width: 0;
 }

 #ganttTasksContainer .gantt-task-row .gantt-remove-btn {
     white-space: nowrap;
 }

 #ganttEditor:not([data-mode="editing"]) input,
 #ganttEditor:not([data-mode="editing"]) button {
     pointer-events: none;
 }

 #ganttEditor:not([data-mode="editing"]) .event-form-input {
     background: #f3f4f6;
     color: #6b7280;
 }

 #ganttEditor:not([data-mode="editing"]) #addGanttTaskBtn,
 #ganttEditor:not([data-mode="editing"]) .gantt-remove-btn {
     display: none;
 }

@media (max-width: 720px) {
    .sidebar {
        width: 100vw;
        right: -100vw;
    }
}

/* Program modal */
#programModal {
    position: absolute; /* fullpage 충돌 회피: fixed → absolute */
    inset: 0;
    display: none; /* 기본 숨김 */
    align-items: stretch;
    justify-content: stretch;
    z-index: 9999;
}
#programModal.show { display: flex; }

#programModal .modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

/* 모달 열릴 때 페이지 스크롤 방지 */
body.modal-open,
html.modal-open {
    overflow: hidden;
    height: 100%;
    overscroll-behavior: contain; /* 스크롤 체인 방지 */
}

#programModal .modal-content {
    position: relative;
    background: #fff;
    padding: clamp(72px, 12vh, 130px) clamp(16px, 6vw, 300px) 48px clamp(16px, 6vw, 300px);
    border-radius: 0;
    width: 100vw;
    height: 100vh;
    overflow-y: auto; /* 전체 컨텐츠에 스크롤 부착 */
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.22);
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

#programModal .modal-header {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
}

#programModal .modal-close.modal-close-floating {
    position: absolute;
    top: 28px;
    right: 28px;
    z-index: 2;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    padding: 8px;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

#programModal .modal-header.sidebar-header {
    position: relative; /* 고정 해제 후 상단에 배치 */
    top: auto;
    z-index: 1;
    align-items: flex-start;
    text-align: left;
    width: min(1000px, 100%);
    margin: 0 auto;
    padding-inline: clamp(8px, 2vw, 24px);
}

#programModal .modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    text-align: left;
}

#programModal .modal-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

#programModal .modal-close {
    position: static;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #0f172a;
    margin: 0;
    padding: 4px;
}

#programModal .modal-body {
    font-size: 14px;
    color: #1f2937;
    overscroll-behavior: contain; /* 모달 내부 스크롤이 바깥으로 전파되는 것 차단 */
    overflow: visible; /* 스크롤은 modal-content에서 처리 */
    flex: 1 0 auto;
    display: flex;
    justify-content: flex-start;
    align-items: stretch;
    width: 100%;
}

/* Program modal layout */
.program-modal-inner {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: stretch;
    width: min(1000px, 100%);
    margin: 0 auto;
    padding-inline: clamp(8px, 2vw, 24px);
}

@media (max-width: 1024px) {
    .program-modal-inner {
        display: flex;
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    /* 모바일에서 여백 더 줄이기 */
    #programModal .modal-content {
        padding: 64px 20px 36px 20px;
    }
    .program-modal-inner {
        width: 100%;
        padding-inline: 8px;
    }
}

.program-modal-left {
    align-self: stretch;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
}

.program-modal-right {
    min-height: 0;
    width: 100%;
    max-height: none;
    overflow: visible;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-right: 8px; /* scrollbar space */
    overscroll-behavior: contain; /* 내부 끝에서 바깥 스크롤로 번지지 않도록 */
    flex: 1 0 auto;
}

.modal-header-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    justify-content: flex-start;
    width: 100%;
    margin: 0 auto 28px;
}

.modal-title-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
    text-align: left;
    width: 100%;
}

.sidebar-title {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
}

.sidebar-subtitle {
    font-size: 36px;
    line-height: 1.4;
    color: #0ea5e9;
    font-weight: 600;
    margin: 0;
    padding: 0;
    word-break: keep-all;
}

.program-header-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.program-title-hero {
    margin: 0;
    font-size: 26px;
    line-height: 1.2;
    font-weight: 800;
    color: #0f172a;
    word-break: keep-all;
}

.program-subtitle-hero {
    margin: 0;
    font-size: 18px;
    line-height: 1.35;
    font-weight: 600;
    color: #0ea5e9;
    word-break: keep-all;
}
