/* ===================================================================
   카테고리 트리 레이아웃 스타일
   =================================================================== */

/* 추가 버튼을 셀렉트 바로 옆에 배치 */
.project_wrap .content_section .hospital_wrap .center_box .filter_box .form_box {
    display: flex !important;
    align-items: center;
}

.project_wrap .content_section .hospital_wrap .center_box .filter_box .form_box .right_btn_box {
    float: none !important;
    margin-left: 10px;
}

/* 트리 + 상세 패널 레이아웃 */
.category-tree-layout {
    display: flex;
    width: 100%;
    height: calc(100% - 140px);
    gap: 12px;
}

/* ---- 좌측 트리 패널 ---- */
.category-tree-panel {
    width: 380px;
    min-width: 300px;
    background: #fff;
    border: 1px solid #E9ECF0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tree-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 50px;
    padding: 0 16px;
    border-bottom: 1px solid #E9ECF0;
    background: #fff;
    box-sizing: border-box;
}

.tree-panel-title {
    font-size: 14px;
    font-weight: 700;
    color: #333;
}

.tree-panel-actions {
    display: flex;
    gap: 6px;
}

.tree-sub-header {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    border-bottom: 1px solid #E9ECF0;
    justify-content: flex-start;
    /* Changed to Left Align */
    background: #fff;
    align-items: center;
}

.tree-action-btn {
    padding: 2px 8px;
    font-size: 12px;
    color: #666;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

/* Button styles in Tree Header */
.tree-panel-actions,
.tree-sub-header {
    display: flex;
    gap: 4px;
    align-items: center;
}

.tree-panel-actions .tree-action-btn,
.tree-panel-actions .put_btn,
.tree-panel-actions .delete_btn,
.tree-sub-header .tree-action-btn {
    float: none !important;
    margin: 0 !important;
    padding: 2px 8px;
    font-size: 12px;
    height: 26px;
    /* Unified height */
    line-height: normal;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
}

.tree-panel-actions .put_btn img,
.tree-panel-actions .delete_btn img {
    width: 12px;
    height: 12px;
    margin: 0;
    position: static !important;
}

/* Specific colors */
.tree-panel-actions .put_btn {
    background: #3985EA;
    color: #fff;
    border: 1px solid #3985EA;
}

.tree-panel-actions .delete_btn {
    background: #FF2222;
    color: #fff;
    border: 1px solid #FF2222;
}

.tree-panel-actions .tree-action-btn {
    background: #fff;
    color: #666;
    border: 1px solid #ddd;
}


.tree-action-btn:hover {
    background: #3985EA;
    /* Primary Blue */
    color: #fff;
    border-color: #3985EA;
}

.category-tree-container {
    flex: 1;
    overflow: hidden;
    /* Changed from auto to hidden to prevent double scrollbars with Tabulator */
    padding: 0;
    /* Padding 제거 (Tabulator가 꽉 차게) */
}

#categoryTreeContainer {
    height: 100%;
    width: 100%;
}

/* Active Row Highlight */
.tabulator-row.row-active {
    background-color: #e6f7ff !important;
    /* Light Blue */
    font-weight: bold;
    color: #1890ff;
}


/* ---- 우측 상세 패널 ---- */
.category-detail-panel {
    flex: 1;
    background: #fff;
    border: 1px solid #E9ECF0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.detail-panel-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #E9ECF0;
    background: #fff;
    /* 밝게 변경 */
}

.detail-panel-title {
    font-size: 14px;
    font-weight: 700;
    color: #333;
}

.detail-panel-content {
    flex: 1;
    padding: 20px;
    overflow: auto;
}

.detail-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    font-size: 14px;
}

/* 폼 스타일 */
.detail-form-group {
    margin-bottom: 16px;
}

.detail-form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.detail-form-input,
.detail-form-select {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    border: 1px solid #E9ECF0;
    border-radius: 5px;
    font-size: 14px;
    color: #333;
    background: #fff;
    transition: border-color 0.2s;
}

.detail-form-input:focus,
.detail-form-select:focus {
    border-color: #3985EA;
    outline: none;
    box-shadow: 0 0 0 3px rgba(57, 133, 234, 0.1);
}

.detail-form-input[readonly] {
    background: #f5f5f5;
    color: #888;
}

.detail-form-select {
    appearance: none;
    background: #fff url('/image/web/select_arrow.svg') no-repeat right 10px center;
    cursor: pointer;
}

.detail-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 24px;
}

.detail-save-btn {
    padding: 8px 24px;
    background: #3985EA;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.detail-save-btn:hover {
    background: #2c6fd1;
}

.detail-cancel-btn {
    padding: 8px 24px;
    background: #fff;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.detail-cancel-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

/* 상세정보 표시 */
.detail-info-group {
    margin-bottom: 14px;
}

.detail-info-label {
    font-size: 12px;
    font-weight: 600;
    color: #999;
    margin-bottom: 4px;
}

.detail-info-value {
    font-size: 14px;
    color: #333;
    padding: 8px 12px;
    background: #f8f9fb;
    border-radius: 4px;
}


/* ===================================================================
   Tabulator Custom Styling (Light Theme)
   =================================================================== */
.tabulator {
    border: none;
    background-color: #fff;
}

/* Header */
.tabulator .tabulator-header {
    background-color: #fff;
    border-bottom: 1px solid #E9ECF0;
    font-weight: 600;
    color: #494E53;
}

.tabulator .tabulator-header .tabulator-col {
    background-color: #fff;
    border-right: 1px solid #E9ECF0;
}

.tabulator .tabulator-header .tabulator-col-content {
    padding: 10px;
}

/* Rows */
.tabulator .tabulator-row {
    background-color: #fff;
    border-bottom: 1px solid #E9ECF0;
    color: #333;
}

.tabulator .tabulator-row:nth-child(even) {
    background-color: #fff;
    /* Zebra striping 제거 혹은 연하게 */
}

.tabulator .tabulator-row:hover {
    background-color: rgba(57, 133, 234, 0.05) !important;
}

.tabulator .tabulator-row.tabulator-selected {
    background-color: rgba(57, 133, 234, 0.1) !important;
    border-color: #3985EA;
}

.tabulator .tabulator-cell {
    padding: 8px 10px;
    border-right: 1px solid #E9ECF0;
    font-size: 14px;
}

/* Group Headers */
.tabulator .tabulator-group {
    background-color: #f8f9fb !important;
    border-bottom: 1px solid #E9ECF0;
    border-top: 1px solid #E9ECF0;
    color: #2c3e50;
    font-weight: 700;
    padding: 8px 10px;
}

.tabulator .tabulator-group:hover {
    background-color: #f0f2f5 !important;
    cursor: pointer;
}

/* Checkbox (Row Selection) */
.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title input[type=checkbox],
.tabulator .tabulator-cell input[type=checkbox] {
    accent-color: #3985EA;
    width: 16px;
    height: 16px;
    cursor: pointer;
}


/* ---- 반응형 ---- */
@media only screen and (max-width:1280px) {
    .category-tree-panel {
        width: 280px;
        min-width: 240px;
    }

    .category-tree-layout {
        height: calc(100% - 120px);
    }
}

@media only screen and (max-width:1080px) {
    .category-tree-layout {
        flex-direction: column;
        height: auto;
    }

    .category-tree-panel {
        width: 100%;
        height: 300px;
    }

    .category-detail-panel {
        height: 300px;
    }
}

/* ===================================================================
   Grid Link Buttons (수정/등록)
   =================================================================== */
.grid-link-btn {
    display: inline-block;
    font-size: 12px;
    cursor: pointer;
    letter-spacing: -0.3px;
    transition: all 0.15s;
    user-select: none;
}

.grid-link-edit {
    color: #888;
}

.grid-link-edit:hover {
    color: #333;
    text-decoration: underline;
}

.grid-link-add {
    color: #3985EA;
    font-weight: 600;
}

.grid-link-add:hover {
    color: #2c6fd1;
    text-decoration: underline;
}

/* Compact row height for category grids */
.category-tree-container .tabulator .tabulator-cell {
    padding: 4px 6px;
}

.category-tree-container .tabulator .tabulator-header .tabulator-col-content {
    padding: 6px 6px;
}

/* 작은 컬럼 (순번, 순서) */
.tabulator .tabulator-cell.col-sm {
    font-size: 11px;
    padding: 4px 2px;
}

.tabulator .tabulator-header .tabulator-col.col-sm .tabulator-col-content {
    font-size: 11px;
    padding: 6px 2px;
}

/* ======= 커스텀 컨텍스트 메뉴 ======= */
.custom-context-menu {
    position: absolute;
    z-index: 10000;
    background-color: #ffffff;
    border: 1px solid #ddd;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    padding: 5px 0;
    min-width: 120px;
    display: none;
}

.custom-context-menu ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.custom-context-menu li {
    padding: 8px 15px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    transition: background 0.2s;
}

.custom-context-menu li:hover {
    background-color: #f5f5f5;
}

.custom-context-menu li.delete {
    color: #FF5252;
}

.custom-context-menu li img {
    width: 14px;
    vertical-align: middle;
    margin-right: 6px;
    position: relative;
    top: -1px;
}