/* 관리자 인터페이스 커스텀 스타일 */

/* JSON Form 필드 너비 최대화 */
.rjf-form-group-wrapper {
    width: 100% !important;
    max-width: 100% !important;
}

.rjf-form-group-wrapper .rjf-form-control {
    width: 100% !important;
}

/* 폼 필드 레이아웃 개선 */
.field-content {
    width: 100% !important;
}

.django-jsonform-container .array-item-wrapper {
    width: 100% !important;
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .field-row {
        flex-direction: column;
    }
    
    .field-col {
        width: 100% !important;
    }
}

/* 필터링된 선택 위젯 스타일 */
.filtered-select {
    min-height: 200px !important;
    width: 100% !important;
}

.filtered-select option {
    padding: 5px 10px;
    margin: 2px 0;
    border-radius: 3px;
}

.filtered-select option:hover {
    background-color: #f0f0f0;
}

/* 검색 필터 스타일 */
.select-filter {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* 선택 위젯 컨테이너 */
.select-container {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.select-box {
    flex: 1;
    min-width: 200px;
}

.select-box h3 {
    margin-bottom: 10px;
    font-size: 14px;
    color: #666;
}

/* 검색 입력 필드 스타일 */
.filter-search-input {
    width: 100%;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 13px;
}

.filter-search-input:focus {
    outline: none;
    border-color: #447e9b;
    box-shadow: 0 0 5px rgba(68, 126, 155, 0.3);
}

/* 필터 위젯 컨테이너 스타일 */
.filter-container {
    margin-bottom: 15px;
}

/* 단일 선택 위젯을 위한 스타일 - 이미지와 동일하게 수정 */
.enhanced-select {
    display: block;
    width: 100%;
    margin-bottom: 15px;
    border-radius: 4px;
    box-shadow: none;
    font-family: "Open Sans", Arial, sans-serif;
    position: relative;
}

.enhanced-select-header {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    padding: 0;
}

/* 검색 입력 필드 컨테이너 */
.searchable-select-search-container {
    position: relative;
    width: 100%;
    margin-bottom: 10px;
}

/* 검색 입력 필드 */
.searchable-select-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    box-sizing: border-box;
    font-size: 13px;
    background-color: #fff;
    cursor: pointer;
}

.searchable-select-search:focus {
    outline: none;
    border-color: #447e9b;
    box-shadow: 0 0 3px rgba(68, 126, 155, 0.2);
}

/* 선택된 값이 있을 때 강조 표시 */
.searchable-select-search.has-selection {
    border-color: #43b1b0;
    background-color: #f0f8ff;
    font-weight: 500;
    color: #333;
}

/* 썸네일이 있는 경우 패딩 조정 */
.searchable-select-search.with-thumb {
    padding-left: 52px; /* 썸네일 공간 + 여백 */
    height: 80px;
}

/* 검색 필드 내 썸네일 컨테이너 */
.input-thumb-container {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 45px;
    overflow: hidden;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    z-index: 1;
    margin-top: -5px;
}

/* 검색 필드 내 썸네일 이미지 */
.input-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* 옵션 목록 컨테이너 - 박스로 깔끔하게 감싸기 */
.searchable-select-dropdown {
    width: 100%;
    max-height: 200px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow-y: auto;
    margin-bottom: 5px;
    display: block;
    position: static;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    z-index: 100;
    opacity: 1;
    transition: opacity 0.2s ease, max-height 0.2s ease;
}

.searchable-select-dropdown[style*="display: none"] {
    opacity: 0;
    max-height: 0;
    border: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* 옵션 항목 */
.searchable-select-option {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #f5f5f5;
    transition: background-color 0.15s ease;
    position: relative;
}

.searchable-select-option:last-child {
    border-bottom: none;
}

/* 선택 및 호버 효과 강화 */
.searchable-select-option:hover {
    background-color: #e8f5fa;
}

.searchable-select-option.selected {
    background-color: #d5e8f3;
    font-weight: bold;
    position: relative;
}

/* 선택된 옵션에 왼쪽 파란 막대 추가 */
.searchable-select-option.selected:before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: #43b1b0;
}

/* 선택된 옵션에 체크 표시 추가 */
.searchable-select-option.selected:after {
    content: "✓";
    position: absolute;
    right: 12px;
    color: #43b1b0;
    font-weight: bold;
}

/* 단일 선택 버튼 (기존) 숨김 */
.searchable-select {
    display: none;
}

/* Wagtail 기본 선택 필드 스타일 */
.w-field__input select {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    font-size: 13px;
}

/* 교재 선택 위젯 스타일 */
.textbook-select .searchable-select-dropdown {
    max-height: 350px;
}

/* 교재 옵션 스타일 */
.textbook-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    gap: 10px;
    min-height: 60px;
}

/* 교재 썸네일 컨테이너 */
.option-thumb-container {
    flex: 0 0 auto;
    width: 40px;
    height: 60px;
    overflow: hidden;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* 교재 썸네일 이미지 */
.option-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* 교재 텍스트 컨테이너 */
.option-text {
    flex: 1 1 auto;
}

/* 선택된 썸네일 (푸터에 표시) */
.selected-thumb {
    width: 30px;
    height: 45px;
    object-fit: cover;
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-right: 8px;
    vertical-align: middle;
}

/* 교재 선택 푸터 스타일 */
.textbook-footer {
    display: flex;
    align-items: center;
}

.textbook-footer .enhanced-select-status {
    flex: 1;
}

/* 선택된 교재 옵션 추가 스타일 */
.textbook-option.selected {
    background-color: #d5e8f3;
}

/* 교재 썸네일 선택 시 강조 효과 */
.textbook-option.selected .option-thumb-container {
    box-shadow: 0 0 0 2px #43b1b0;
}

/* 옵션 컨테이너 스타일 */
.option-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    position: relative;
}

/* 옵션 텍스트 컨텐츠 스타일 */
.option-text-content {
    flex: 1;
    padding-right: 30px;
}

/* 옵션 수정 링크 스타일 - SVG 아이콘을 위한 스타일 개선 */
.option-edit-link {
    position: absolute;
    right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background-color: #f0f0f0;
    color: #43b1b0;
    border-radius: 50%;
    text-decoration: none;
    opacity: 0;
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: scale(0.8);
    z-index: 2;
}

.option-edit-link svg {
    color: #43b1b0;
}

.searchable-select-option:hover .option-edit-link {
    opacity: 1;
    transform: scale(1);
    /* background-color: #f0f0f0; */
}

.searchable-select-option:hover .option-edit-link:hover {
    background-color: #43b1b0;
    color: #f0f0f0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transform: translateX(3px) scale(1.1);
}

.searchable-select-option:hover .option-edit-link:hover svg {
    color: #f0f0f0;
}

.option-edit-link:active {
    transform: translateX(1px) scale(0.95);
}

/* SVG 아이콘 스타일 */
.edit-icon {
    stroke-width: 2.5;
    transition: all 0.2s ease;
}

/* 검색창 영역의 수정 버튼 스타일 */
.search-edit-button-container {
    position: absolute;
    right: 15px;
    top: 45%;
    transform: translateY(-50%);
    z-index: 3;
}

.search-edit-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background-color: #f0f0f0;
    color: #43b1b0;
    border-radius: 50%;
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.search-edit-link:hover {
    background-color: #43b1b0;
    color: #f0f0f0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transform: translateX(3px) scale(1.1);
}

.search-edit-link:hover svg {
    color: #f0f0f0;
}

.search-edit-link:active {
    transform: translateX(1px) scale(0.95);
}

/* 검색 입력 필드 패딩 조정 (버튼을 위한 공간 확보) */
.searchable-select-search {
    padding-right: 40px;
}

/* 검색 입력 필드 썸네일 있을 때의 패딩 조정 */
.searchable-select-search.with-thumb {
    padding-left: 52px;
    padding-right: 40px;
    height: 80px;
}

/* 항목 수정 버튼 컨테이너 (기존 코드 유지) */
.edit-button-container {
    margin-top: 8px;
    text-align: right;
}

/* 항목 수정 버튼 스타일 */
.edit-item-button {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    color: #43b1b0;
    background-color: #f2f9f9;
    border: 1px solid #43b1b0;
    border-radius: 3px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.edit-item-button:hover {
    background-color: #43b1b0;
    color: white;
    text-decoration: none;
}

.edit-item-button:active {
    transform: translateY(1px);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

/* 패널 전체 스타일 개선 */
[id^="inline_child_units-"] {
    margin-bottom: 10px;
    /* margin-left: 10px; */
    border-radius: 4px;
    overflow: hidden;
}

[id^="inline_child_units-"] .w-panel {
    margin-left: 5px;
    background-color: #f9f9f9;
    border-radius: 4px;
    padding: 5px;
    color: #1a237e;
}


[id^="inline_child_units-"] .w-panel:hover {
    background-color: #43b1b0;
}
   

[id^="inline_child_units-"] .w-panel:hover span {
    color: white !important;
}

[id^="inline_child_units-"] .w-panel:hover svg {
    color: white !important;
}

[id^="inline_child_units-"] .w-panel:hover label {
    color: white !important;
}

[id^="inline_child_units-"] .w-panel:hover .w-panel__divider {
    background-color: white !important;
}


/* 교재 인라인 패널 (유닛 목록) 가로 레이아웃 */
[id^="inline_child_units-"] .w-panel__content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
}

[id^="inline_child_units-"] .w-panel__content .w-panel__wrapper {
    margin: 0;
    flex: 0 0 auto;
    position: relative;
}

/* 유닛명 필드 너비 조정 */
[id^="inline_child_units-"] .w-panel__content .w-panel__wrapper:first-child {
    flex: 1 1 250px;
    min-width: 200px;
}

/* 활성화 여부 필드 너비 조정 */
[id^="inline_child_units-"] .w-panel__content .w-panel__wrapper:nth-child(2) {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

/* 라벨 표시 방식 조정 - 인라인으로 표시 */
[id^="inline_child_units-"] .w-panel__content .w-panel__wrapper .w-field__label {
    display: inline-block;
    width: auto;
    margin-right: 8px;
    font-size: 13px;
    font-weight: normal;
}

/* 유닛명 라벨은 숨김 처리 (필요시) */
[id^="inline_child_units-"] .w-panel__content .w-panel__wrapper:first-child .w-field__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 필드 간격 조정 */
[id^="inline_child_units-"] .w-field__wrapper {
    padding: 0;
    margin: 0;
}

/* 인풋 필드 스타일 조정 */
[id^="inline_child_units-"] .w-field__input {
    padding: 0;
    margin-left: 20px;
}

/* 숨겨진 필드 처리 */
[id^="inline_child_units-"] .w-panel__content input[type="hidden"] {
    display: none;
}

/* 활성화 여부 체크박스 컨테이너 정렬 */
[id^="inline_child_units-"] .w-field--checkbox_input {
    display: flex;
    align-items: center;
}

/* 체크박스 정렬 개선 */
[id^="inline_child_units-"] .w-field--checkbox_input .w-field__input {
    display: flex;
    align-items: center;
    padding-left: 0;
    margin-left: 0;
    margin-top: 0;
}

/* 상세편집 버튼 스타일 개선 */
[id^="inline_child_units-"] .w-panel__content .w-panel__wrapper:nth-child(3) .button {
    padding: 0px 15px;
    font-size: 13px;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    color: #444;
    transition: all 0.2s ease;
}

[id^="inline_child_units-"] .w-panel__content .w-panel__wrapper:nth-child(3) .button:hover {
    background-color: #43b1b0;
    border-color: #43b1b0;
    color: white;
}

/* 모바일 반응형 처리 */
@media (max-width: 768px) {
    [id^="inline_child_units-"] .w-panel__content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    [id^="inline_child_units-"] .w-panel__content .w-panel__wrapper {
        margin-bottom: 10px;
        width: 100%;
    }
    
    [id^="inline_child_units-"] .w-panel__content .w-panel__wrapper:nth-child(3) {
        margin-left: 0;
    }
    
    /* 모바일에서는 라벨을 다시 표시 */
    [id^="inline_child_units-"] .w-panel__content .w-panel__wrapper:first-child .w-field__label {
        position: static;
        width: auto;
        height: auto;
        clip: auto;
        white-space: normal;
        margin-bottom: 5px;
        display: block;
    }
}

/* 드롭다운 메뉴 내 버튼 폰트 사이즈 */
button[name="_save_and_continue"],
.w-dropdown__content a.button {
    font-size: 16px !important;
}
