* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    background-color: #ffffff;
    color: #24292f;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 사이드바 스타일 */
#sidebarMenu {
    background-color: #161b22 !important;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
}

/* 사이드바 내부 패딩 및 스크롤 처리 */
#sidebarMenu .sidebar-sticky {
    position: relative;
    top: 0;
    height: 100vh;
    padding-top: 1rem;
    padding-bottom: 2rem;
    overflow-y: auto;
    overflow-x: hidden;
}

/* 메인 컨텐츠 최소 높이 설정 */
.main-content {
    background-color: #ffffff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Footer를 하단에 고정 */
.main-content > footer {
    font-size: 0.8rem;
    color: #666666;
    text-align: center;
    padding: 1.5rem 0;
    background-color: #F2F2F2;
    border-radius: 6px;
    margin-top: auto;
}

#sidebarMenu .nav-link {
    color: #c9d1d9;
    padding: 0.5rem 1.5rem;
    margin: 0.1rem 0.5rem;
    border-radius: 6px;
    border: 0;
}

#sidebarMenu .nav-link:hover {
    color: #ffffff;
    background-color: #212529;
}

#sidebarMenu .nav-link.active {
    color: #ffffff;
    font-weight: 600;
    background-color: #30363d;
}

.main-content {
    background-color: #ffffff;
}

.main-content > header {
    background-color: #ffffff;
    border-bottom: 1px solid #d0d7de !important;
    flex-shrink: 0;
}

/* Page Title Styles */
h1.h2 {
    font-weight: 600;
}


/* --- Component Styles --- */

.btn {
    border-radius: 6px;
    padding: 5px 16px;
    font-weight: 600;
    line-height: 20px;
    vertical-align: middle;
    cursor: pointer;
    transition: all .2s cubic-bezier(.3,0,.5,1);
}

/* Primary buttons (Solid Dark) */
.btn-primary, .btn-success, .btn-outline-success {
    color: #ffffff;
    background-color: #21262d;
    border: 1px solid #57606a;
}
.btn-primary:hover, .btn-success:hover, .btn-outline-success:hover {
    color: #ffffff;
    background-color: #30363d;
    border-color: #8b949e;
}

/* Secondary buttons (White Outline) */
.btn-secondary, .btn-outline-secondary, .btn-danger, .btn-outline-danger {
    color: #24292f;
    background-color: #ffffff;
    border: 1px solid #d0d7de;
}
.btn-secondary:hover, .btn-outline-secondary:hover, .btn-danger:hover, .btn-outline-danger:hover {
    background-color: #f3f4f6;
    border-color: #d0d7de;
    color: #24292f;
}

/* Styles for buttons inside TUI Grid to make them smaller */
.tui-grid-cell .btn {
    padding: 2px 8px;
    font-size: 0.8rem;
    line-height: 1.5;
    font-weight: 400;
}


.form-control, .form-select {
    border-radius: 6px;
    border: 1px solid #d0d7de;
    background-color: #ffffff; /* Use white background for inputs */
    color: #24292f;
}
.form-control:focus, .form-select:focus {
    border-color: #0969da;
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.3);
    background-color: #ffffff;
}

/* --- Select2 Custom Styles --- */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    border-radius: 6px;
    border: 1px solid #d0d7de;
    background-color: #ffffff; /* Use white background for Select2 */
    color: #24292f;
    height: 38px; /* Match form-control height */
    display: flex;
    align-items: center;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: #24292f;
    line-height: 36px; 
    padding-left: 12px;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #57606a;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 36px;
    right: 1px;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple {
    border-color: #0969da;
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.3);
    background-color: #ffffff;
}

.nav-tabs {
    border-bottom: 1px solid #d0d7de;
}
.nav-tabs .nav-link {
    color: #57606a;
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    color: #0d1117;
    font-weight: 600;
    border-color: #d0d7de;
    border-bottom-color: #ffffff;
    margin-bottom: -1px;
}

.card {
     border: 1px solid #d0d7de;
     border-radius: 6px;
     background-color: #ffffff; /* Add white background to cards */
}

/* TUI Tree CSS Conflict Fixes with Bootstrap */

/* Restore indentation for nested lists inside the tree */
#menu-tree ul {
    padding-left: 18px;
    margin-bottom: 0;
    list-style: none;
}

/* Ensure list items don't have extra styling from bootstrap */
#menu-tree li {
    padding: 0;
    margin: 0;
    list-style: none;
}

/* Prevent Bootstrap from styling the tree's internal buttons */
#menu-tree button.tui-tree-toggle-btn {
    border: 0;
    background-color: transparent;
    box-shadow: none;
    padding: 0;
    margin: 0;
    font-size: 0; /* Hide any text content like '+' or '-' */
    line-height: 1;
    vertical-align: middle;
    display: inline-flex;
    align-items: center; 
    justify-content: center;
    width: 16px; 
    height: 16px;
}

/* Ensure the actual icon inside the button is aligned */
#menu-tree .tui-tree-toggle-btn .tui-ico-tree {
    vertical-align: middle;
}
    
/* Ensure the content wrapper uses flexbox for main horizontal alignment */
#menu-tree .tui-tree-content-wrapper {
    display: flex;
    align-items: center; 
}

/* Ensure the text span (which contains folder icon and actual text) is inline-flex */
#menu-tree .tui-tree-text {
    display: inline-flex; 
    align-items: center; 
    vertical-align: middle; 
}

/* Ensure the folder/file icon within the text span is aligned */
#menu-tree .tui-tree-ico {
    vertical-align: middle;
    margin-right: 4px; /* Small space between icon and text */
}

/* TUI DatePicker/TimePicker CSS Conflict Fixes with Bootstrap */
.tui-datepicker-body .tui-timepicker {
    display: inline-block;
    vertical-align: top;
}

/* TUI DatePicker z-index 설정 */
.tui-datepicker {
    z-index: 1050 !important;
}

.tui-calendar {
    z-index: 1050 !important;
}

/* Fix for tui-timepicker-row conflicting with Bootstrap .row styles */
.tui-timepicker-row {
    display: flex;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 5px; /* Add spacing between columns */
    margin: 0;
    padding: 0;
}

/* CKEditor 컨텐츠 및 뷰어 내 이미지 정렬 및 기본 스타일 */
.cke_contents p img,
.cke_contents figure img {
    display: block; /* 이미지를 블록 요소로 만들어 margin: auto가 작동하도록 함 */
    margin-left: auto;
    margin-right: auto;
    width: 100%; /* 사용자 요구사항 */
    height: auto;
    max-width: 100%; /* 부모 요소를 넘어가지 않도록 보장 */
}

/* 텍스트 정렬에 따른 이미지 정렬 (부모 p/figure에 text-align이 적용될 때) */
.cke_contents p[style*="text-align:left"] img,
.cke_contents figure[style*="text-align:left"] img {
    margin-left: 0;
    margin-right: auto;
}
.cke_contents p[style*="text-align:right"] img,
.cke_contents figure[style*="text-align:right"] img {
    margin-left: auto;
    margin-right: 0;
}
.cke_contents p[style*="text-align:center"] img,
.cke_contents figure[style*="text-align:center"] img {
    margin-left: auto;
    margin-right: auto;
}

.required::after {
    content: " *";
    color: red;
}

.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

h5 {
    color: #495057;
    font-weight: 600;
}

.form-check-label {
    cursor: pointer;
}

/* 모달 스타일 */
.content-tree-container-modal {
    display: flex;
    gap: 20px;
    height: 500px;
}

.folder-tree-panel-modal {
    flex: 0 0 280px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
    overflow-y: auto;
    background: #f8f9fa;
}

.content-list-panel-modal {
    flex: 1;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 15px;
}

.tree-item-modal {
    margin-bottom: 2px;
}

.tree-node-modal {
    padding: 5px 10px;
    cursor: pointer;
    user-select: none;
    border-radius: 3px;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
}

.tree-node-modal:hover {
    background: #e9ecef;
}

.tree-node-modal.selected {
    background: #0d6efd;
    color: white;
}

.tree-children-modal {
    margin-left: 20px;
}

.folder-icon::before {
    content: "📁 ";
}

.tree-toggle-modal {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin-right: 4px;
}

.tree-toggle-modal.collapsed::before {
    content: "▶";
    font-size: 10px;
}

.tree-toggle-modal.expanded::before {
    content: "▼";
    font-size: 10px;
}

.tree-node-content-modal {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.tree-node-text-modal {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.root-selector-modal {
    padding: 8px 12px;
    margin-bottom: 10px;
    cursor: pointer;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: white;
    display: flex;
    align-items: center;
}

.root-selector-modal:hover {
    background: #e9ecef;
}

.root-selector-modal.selected {
    background: #0d6efd;
    color: white;
    border-color: #0d6efd;
}

.content-item-modal {
    cursor: pointer;
    transition: all 0.2s;
}

.content-item-modal:hover {
    background-color: #f8f9fa;
}

.content-item-modal.active {
    background-color: #0d6efd !important;
    color: white;
    border-color: #0d6efd;
}

.content-item-modal.active h6,
.content-item-modal.active small {
    color: white !important;
}

.content-item-modal .badge {
    opacity: 0;
    transition: opacity 0.2s;
}

.content-item-modal:hover .badge,
.content-item-modal.active .badge {
    opacity: 1;
}

