@import url('https://cdn.rawgit.com/moonspam/NanumSquare/master/nanumsquare.css');

:root {
    --todoup-header-bg: linear-gradient(to bottom, rgb(from var(--container-bg-color) r g b / 0.7), rgb(from var(--card-bg-color) r g b / 0.5));
}

#todoup-widget {
    pointer-events: auto;
    /* 클릭 허용 */
}

/* 전역 버튼 - 40x40 사각형 버튼 (좌측 하단 고정) */
#todoup-toggle-btn {
    position: fixed;
    bottom: 20px;
    left: 3%;
    z-index: 1000;
    display: flex;
    width: 40px;
    height: 40px;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    border: none;
    border-radius: var(--btn-primary-radius, 8px);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
    justify-content: center;
    align-items: center;
    font-size: 18px;
}

#todoup-toggle-btn:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

#todoup-widget-body {
    display: none;
    position: fixed;
    bottom: 6%;
    left: 3%;
    flex-direction: column;
    min-height: 200px;
    min-width: 400px;
    max-height: calc(100vh - 100px);
    background: var(--container-bg-color);
    border: 1px solid var(--container-border-color);
    border-radius: var(--container-border-radius, 8px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 99999;
    overflow: hidden;
    box-sizing: border-box;
}


#todoup-widget-body .todoup-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px;
    margin-top: 10px;
    box-sizing: border-box;
    height: 100%;
}

#todoup-widget-body div#todoup-form {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    margin-bottom: 5px;
    padding: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* 헤드 */
#todoup-widget-body .todo-head {
    display: flex;
    flex-direction: column;
    color: var(--content-font-color);
    font-family: 'NanumSquare';
    font-weight: 900;
    font-size: 10px;
    position: sticky;
    top: 0;
    background: var(--todoup-header-bg);
    z-index: 10;
    align-items: center;
    padding: 6px;
    gap: 0px;
}

/* 아래는 크기 조절 및 드래그 기능을 위한 추가 CSS */
#todoup-widget-body .todo-head {
    cursor: move;
    /* 드래그 가능함을 표시 */
    user-select: none;
    /* 텍스트 선택 방지 */
}

/* 최대화 버튼 스타일 */
#todoup-widget-body #todoup-maximize-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: var(--todoup-e);
    margin-left: 10px;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#todoup-widget-body #todoup-maximize-btn:hover {
    color: var(--todoup-acc);
}

/* 크기 조절 핸들 스타일 */
#todoup-widget-body .ui-resizable-handle {
    background: rgba(200, 200, 200, 0.1);
    border-radius: 10px;
}

#todoup-widget-body .ui-resizable-handle:hover {
    background: rgba(180, 180, 180, 0.3);
}

#todoup-widget-body .ui-resizable-handle.ui-resizable-w,
#todoup-widget-body .ui-resizable-handle.ui-resizable-e {
    width: 0px !important;
    padding: 0px !important;
}

#todoup-widget-body .ui-resizable-handle.ui-resizable-s,
#todoup-widget-body .ui-resizable-handle.ui-resizable-n {
    height: 0px !important;
    padding: 0px !important;
}

#todoup-widget-body .ui-resizable-handle.ui-resizable-nw,
#todoup-widget-body .ui-resizable-handle.ui-resizable-ne,
#todoup-widget-body .ui-resizable-handle.ui-resizable-se,
#todoup-widget-body .ui-resizable-handle.ui-resizable-sw {
    width: 20px;
    height: 20px;
    padding: 0px !important;
}

/* 크기 조절 시 오버플로우 처리 */
.ui-resizable {
    position: relative;
}

/* 드래그 중일 때 스타일 */
#todoup-widget-body .ui-draggable-dragging {
    opacity: 0.8;
}

#todoup-widget-body .todoup-flex {
    display: flex;
    width: 100%;
    justify-content: space-between;
    gap: 3px;
}

#todoup-widget-body .todoup-flex.padding {
    padding: 5px;
    box-sizing: border-box;
    background: var(--card-bg-color);
}

#todoup-widget-body .todoup-flex-l {
    display: flex;
    gap: 3px;
}

#todoup-widget-body .todoup-flex-c {
    display: flex;
    gap: 5px;
    align-items: center;
    margin-top: 5px;
}

#todoup-widget-body #todoup-toggle-completed, #todoup-widget-body #todoup-toggle-all {
    border-radius: 20px;
    border: 2px inset var(--btn-primary-bg);
    font-size: 10px;
    font-family: 'NanumSquare';
    padding: 0px 5px;
    background: var(--btn-primary-bg);
    color: var(--btn-primary-text);
    height: 22px;
    border-radius: 10px;
    line-height: 1;
}

#todoup-widget-body #todoup-toggle-completed:hover {
    background: var(--todoup-9);
    color: var(--todoup-e);
}

#todoup-widget-body .todoup-flex-l #todoup-filter {
    margin-bottom: 10px;
    max-width: 110px;
    border-radius: 20px;
    background: var(--todoup-5);
    border: 1px solid var(--todoup-7);
    color: var(--todoup-e);
}

/* 하단 알림 */
#todoup-widget-body #todoup-notice {
    position: absolute;
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    border: 1px solid #fff;
    text-align: center;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 500;
    width: auto;
    min-width: 250px;
    max-width: 80%;
    z-index: 100;
    white-space: pre-line;
}

/* 숨김 처리 */
#todoup-widget-body .todoup-group-header.editing .todoup-subject-container {
    display: none;
}

/* 요소 */

#todoup-widget-body #todoup-category {
    flex: 1;
}

#todoup-widget-body textarea {
    border-radius: 10px !important;
    padding: 5px 6px !important;
    background: var(--card-bg-color) !important;
    color: var(--content-font-color) !important;
    font-size: 11px !important;
    font-family: 'NanumSquare' !important;
}

#todoup-widget-body select {
    border-radius: 8px !important;
    padding: 0px 5px !important;
    background: var(--form-bg-color) !important;
    border: 1px solid var(--form-border-color) !important;
    color: var(--form-text-color);
    font-size: 0.8rem !important;
    font-family: 'NanumSquare' !important;
    max-width: 100px !important;
    box-sizing: border-box;
    line-height: 1;
    height: 22px;
}

#todoup-widget-body #todoup-form .todoup-add-form #todoup-category {
    flex: 1;
    width: 100%;
    height: 30px;
}

#todoup-widget-body #todoup-form #todoup-category::placeholder,
#todoup-widget-body .todoup-group-add #group-add-input::placeholder {
    color: var(--text-muted);
    font-size: 0.9em;
}

#todoup-widget-body input[type="text"],
#todoup-widget-body #todoup-form input#todoup-category,
#todoup-widget-body .todoup-group-manage input.group-edit-input,
#todoup-widget-body .todoup-group-manage input#group-add-input {
    border-radius: 10px !important;
    padding: 5px 10px !important;
    background: var(--form-bg-color) !important;
    border: 1px solid var(--form-border-color) !important;
    color: var(--form-text-color)!important;
    font-size: 1em;
    font-family: 'NanumSquare' !important;
    width: auto;
}

#todoup-widget-body input[type="text"].todoup-edit-input {
    max-width: 100% !important;
}

#todoup-widget-body textarea::placeholder,
#todoup-widget-body input[type="text"]::placeholder {
    color: var(--todoup-7) !important;
}

#todoup-widget-body .todoup-editing input[type="checkbox"] {
    display: none;
}

#todoup-widget-body .todoup-group.editing .todoup-group-complete {
    display: none;
}

/* 옵션 체크박스 */
#todoup-widget-body .todoup-edit-plip,
#todoup-widget-body .todoup-edit-secret,
#todoup-widget-body .todoup-edit-highlight-check {
    width: 11px;
    height: 11px;
    vertical-align: middle;
    position: relative;
    left: 3px;
    cursor: pointer;
    margin-right: 2px;
}

#todoup-widget-body .todoup-edit-plip+label {
    cursor: pointer;
    user-select: none;
}

#todoup-widget-body .todoup-edit-meta label {
    font-size: 11px;
    font-family: 'NanumSquare';
    font-weight: 400;
}

#todoup-widget-body .todoup-edit-time {
    width: 84px;
    background: var(--form-bg-color);
    color: var(--form-text-color);
    font-size: 0.8rem;
    font-family: 'NanumSquare';
    padding: 2px 5px;
    border: 0;
    border-radius: 8px;
}

#todoup-widget-body #todoup-time {
    width: 130px;
    background: var(--form-bg-color);
    color: var(--form-text-color);
    border: 1px solid var(--form-border-color) !important;
    font-size: 0.8rem;
    font-family: 'NanumSquare';
    padding: 2px 5px;
    border: 0;
    border-radius: 8px;
}

#todoup-widget-body .todoup-group-manage {
    flex-shrink: 0;
    background: var(--card-bg-color);
    border-top: 1px solid var(--card-border-color);
    padding: 10px;
    box-sizing: border-box;
    width: 100%;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.todoup-group-manage-body #group-add-input {
    width: calc(100% - 30px) !important;
}

#todoup-widget-body ul {
    list-style: none;
    padding: 0;
}

#todoup-widget-body li label {
    cursor: pointer;
}

#todoup-widget-body .todoup-widget-buttons {
    margin-top: 10px;
    display: flex;
    gap: 5px;
}

/* 편집 모드 스타일: li에 .edit-mode 클래스가 있으면 주황색 점선 테두리 적용 */
#todoup-widget-body .todoup-list li.edit-mode {
    border: 2px dashed orange;
    background: #fff7e6;
}

#todoup-widget-body .todoup-group-header.editing {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0px;
}

#todoup-widget-body .todoup-group-header.editing .button-container {
    display: flex;
    flex-direction: row;
    min-width: 50px;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding-right: 5px;
    padding-bottom: 5px;
}

/* 체크리스트 */
#todoup-widget-body .todoup-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#todoup-widget-body .todoup-item {
    display: flex;
    align-items: flex-start;
    margin: 0;
    padding: 0;
}

#todoup-widget-body .todoup-checkbox {
    flex: 0 0 auto;
    margin-right: 5px;
    padding-top: 2px;
    /* 체크박스 상단 정렬 조정 */
}

#todoup-widget-body .todoup-item-content {
    flex: 1;
    word-break: break-word;
    display: flex;
    align-items: center;
}

#todoup-widget-body .todoup-item-actions {
    flex: 0 0 auto;
    display: flex;
    margin-left: 5px;
    /* 버튼 간격 좁힘 */
}

#todoup-widget-body .todoup-item-actions button {
    white-space: nowrap;
    padding: 2px;
}

#todoup-widget-body .todoup-group-add button {
    border-radius: 8px;
    background: var(--btn-accent-bg);
    border: 0;
    color: var(--btn-accent-text);
    font-size: 11px;
    font-family: 'NanumSquare';
    padding: 5px;
    width: 25px;
}

#todoup-widget-body .todoup-group-manage-body #todoup-group-list li {
    align-items: center !important;
    border: 0;
    margin-bottom: 5px;
    gap: 3px;
}

#todoup-widget-body .todoup-title.toggle-group-manage {
    color: var(--content-font-color);
    margin-bottom: 5px;
}

#todoup-widget-body .group-name {
    line-height: 1;
    font-size: 0.9rem;
    color: var(--content-font-color);
}

#todoup-widget-body .group-manage-edit-btn,
#todoup-widget-body .group-manage-delete-btn,
#todoup-widget-body .group-manage-save-btn {
    background: 0;
    border: 0;
    font-size: 0.7rem;
    font-family: 'NanumSquare';
    color: var(--btn-accent-bg);
    align-items: center;
    line-height: 1;
}

#todoup-widget-body .todoup-group-add {
    margin: 10px 0;
    padding: 3px 10px;
    background: var(--btn-secondary-bg);
    border-radius: 8px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

#todoup-widget-body .todoup-group-add input[type="text"] {
    padding: 0px 10px;
    height: 25px;
}

#todoup-widget-body .todoup-title {
    color: var(--btn-secondary-text);
    font-size: 12px;
    font-family: 'NanumSquare';
    font-weight: 600;
}

/* 카테고리 이름 */
#todoup-widget-body .todoup-caname {
    font-size: 14px;
    font-family: 'NanumSquare';
    font-weight: bold;
    border-radius: 8px;
    padding: 0px 5px;
    width: fit-content;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.todoup-caname .category-title {
    color: var(--content-font-color);
    line-height: 1;
}

#todoup-widget-body .category-add-btn {
    width: 15px;
    height: 15px;
    border: 0;
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-text);
    border-radius: 5px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'NanumSquare';
    position: relative;
}

#todoup-widget-body .category-add-btn:hover {
    background: var(--btn-accent-bg);
    color: var(--btn-accent-text);
}

#todoup-widget-body .todoup-group-edit-btn,
#todoup-widget-body .todoup-group-delete-btn,
#todoup-widget-body .todoup-cancel-line-btn,
#todoup-widget-body .todoup-save-line-btn,
#todoup-widget-body .todoup-group-cancel-btn,
#todoup-widget-body .todoup-group-save-btn {
    border: 0;
    background: 0;
    font-family: 'NanumSquare';
    font-size: 10px;
    width: 20px;
}

#todoup-widget-body .todoup-edit-btn,
#todoup-widget-body .todoup-delete-btn {
    border: 0;
    background: 0;
    font-family: 'NanumSquare';
    font-size: 0.9rem;
    width: 20px;
    color: var(--btn-accent-bg);
}

#todoup-widget-body .todoup-group-edit-btn,
#todoup-widget-body .todoup-group-delete-btn,
#todoup-widget-body .todoup-group-cancel-btn,
#todoup-widget-body .todoup-group-save-btn {
    color: var(--btn-secondary-bg);
}

#todoup-widget-body .todoup-category-block {
    margin-bottom: 10px;
}

/* 제목 */
#todoup-widget-body .todoup-group-header {
    display: flex;
    align-items: center;
    gap: 5px;
    position: relative;
    background: var(--card-bg-color);
    border-radius: 8px;
    padding: 5px;
    color: var(--content-font-color);
    font-family: 'NanumSquare';
    font-size: 11.5px;
    font-weight: 600;
    margin-bottom: 5px;
}

/* 접기/펼치기 화살표 추가 (하위 항목이 있는 경우에만) */
#todoup-widget-body .todoup-group-header.has-children .todoup-subject-container::after {
    content: "▼";
    font-size: 0.9rem;
    color: var(--btn-accent-bg);
    transition: transform 0.2s ease;
    margin-left: 5px;
}

/* 접힌 상태일 때 화살표 회전 */
#todoup-widget-body .todoup-collapsed .todoup-group-header.has-children .todoup-subject-container::after {
    transform: rotate(-90deg);
}

#todoup-widget-body .todoup-group-header .todoup-meta {
    font-size: 11px;
    font-family: 'NanumSquare';
    color: var(--todoup-7);
}

#todoup-widget-body .todoup-group-complete {
    flex: 0 0 auto;
}

#todoup-widget-body .todoup-subject-container {
    flex: 1;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
    overflow: hidden;
}

#todoup-widget-body .todoup-title-wrapper {
    display: flex;
    align-items: center;
    max-width: 100%;
    overflow: hidden;
}

#todoup-widget-body .todoup-subject {
    display: inline;
    overflow: hidden;
    max-width: 100%;
    line-height: 1.5;
    font-size: 0.9rem;
}

#todoup-widget-body .priority-icon {
    flex-shrink: 0;
    margin-right: 5px;
}

#todoup-widget-body .todoup-meta {
    font-size: 0.9em;
    color: #888;
    display: inline;
    margin-left: 4px;
}

#todoup-widget-body .todoup-group-header .button-container {
    flex: 0 0 auto;
    display: flex;
    gap: 4px;
    margin-right: 8px;
}

#todoup-widget-body .todoup-group-header .button-container button {
    white-space: nowrap;
}

#todoup-widget-body .todoup-group-header.editing .todoup-progress-container {
    display: none;
}

#todoup-widget-body .todoup-group-header.editing .todoup-memo-container {
    display: none;
}

#todoup-widget-body .todoup-group-header.editing .todoup-group-edit-container {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    padding: 5px;
    width: 100%;
    box-sizing: border-box;
}

#todoup-widget-body .todoup-group-header.editing .todoup-options-meta-container {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
    align-items: center;
}

#todoup-widget-body .todoup-edit-meta {
    display: flex;
    flex-direction: row;
    gap: 3px;
    flex-wrap: wrap;
    align-items: center;
}

#todoup-widget-body .todoup-edit-meta-options {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 내용 */
#todoup-widget-body li {
    display: flex;
    position: relative;
    padding: 2px 4px;
    margin: 0px 0px 3px 5px;
    font-size: 11px;
    font-family: 'NanumSquare';
    color: var(--todoup-7);
    border-radius: 8px;
    align-items: flex-start;
}

#todoup-widget-body li.todoup-item.ui-sortable-handle {
    background: var(--todoup-gbg);
}

#todoup-widget-body li input[type="checkbox"] {
    transform: scale(0.8);
    /* 80% 크기로 축소 */
    -webkit-transform: scale(0.8);
    transform-origin: center;
    -webkit-transform-origin: center;
}

#todoup-widget-body li .button-container {
    position: absolute;
    right: 5px;
    display: flex;
    gap: 2px;
}

#todoup-widget-body .todoup-line-add-btn {
    position: relative;
    width: 100%;
    height: 12px;
    border: 0;
    background: var(--card-bg-color);
    color: var(--todoup-e);
    border-radius: 5px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'NanumSquare';
    font-weight: 100;
    margin-bottom: 5px;
}

#todoup-widget-body #todoup-add-btn {
    width: 20px;
    height: 20px;
    border: 0;
    background: var(--btn-accent-bg);
    color: var(--btn-accent-text);
    border-radius: 5px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'NanumSquare';
    position: relative;
}

#todoup-widget-body .todoup-line-add-btn:hover,
#todoup-widget-body #todoup-add-btn:hover {
    background: var(--gray-700);
    color: var(--todoup-acc);
}

#todoup-widget-body .todoup-info {
    color: var(--content-font-color);
    font-size: 10px;
    font-family: 'NanumSquare';
    padding: 0px 0px 0px 5px;
    margin-top: 5px;
}

#todoup-widget-body .todoup-flex-c label {
    color: var(--content-font-color);
    background: var(--card-bg-color);
    padding: 2px 5px;
    border-radius: 8px;
    font-size: 11px;
    font-family: 'NanumSquare';
    display: none;
}

/* 완료된 항목 숨기기 */
#todoup-widget-body.hide-completed .todoup-item input[type="checkbox"]:checked+.todoup-item-content {
    display: none;
}

#todoup-widget-body.hide-completed .todoup-item[data-completed="1"] {
    display: none;
}

/* 형광펜 효과 제목 css */
#todoup-widget-body .todoup-highlight-options {
    display: flex;
    flex-direction: row;
    align-items: center;
}

/* 형광펜 효과 */
#todoup-widget-body .todoup-subject-highlight {
    position: relative;
    display: inline;
}

#todoup-widget-body .todoup-subject-highlight::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 0.5em;
    z-index: 1;
    opacity: 0.6;
    background: var(--highlight-color, #FFFF00);
    mix-blend-mode: hard-light;
}

/* 체크박스 그룹 스타일 */
#todoup-widget-body .todoup-options {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

/* 형광펜 옵션 스타일링 */
#todoup-widget-body .todoup-highlight-option {
    display: flex;
    align-items: center;
}

#todoup-widget-body .todoup-options label {
    background: var(--form-bg-color);
    color: var(--form-text-color);
    font-size: 11px;
    font-family: 'NanumSquare';
    padding: 0px 8px;
    border: 0;
    border-radius: 8px;
}

#todoup-widget-body .todoup-options input[type="checkbox"] {
    transform: scale(0.8);
    /* 80% 크기로 축소 */
    -webkit-transform: scale(0.8);
    transform-origin: center;
    -webkit-transform-origin: center;
}

/* 컬러 피커 스타일링 */
#todoup-widget-body #todoup-highlight-color,
#todoup-widget-body .todoup-edit-highlight-color {
    width: 17px;
    height: 20px;
    padding: 0;
    border: none;
    cursor: pointer;
    background: transparent;
}

/* 달성률 바 */
#todoup-widget-body .todoup-progress-container {
    display: flex;
    align-items: center;
    margin-left: 15px;
    margin-right: auto;
    position: relative;
}

#todoup-widget-body .todoup-progress-bar {
    width: 50px;
    height: 10px;
    background: #eee;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

#todoup-widget-body .todoup-progress-fill {
    height: 100%;
    background: #4CAF50;
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

#todoup-widget-body .todoup-progress-text {
    font-size: 10px;
    font-weight: 600;
    color: #333;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 100%;
    z-index: 2;
    text-shadow: 0px 0px 2px rgba(255, 255, 255, 0.8);
    white-space: nowrap;
}

#todoup-widget-body .todoup-title.todoup-form-toggle {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#todoup-widget-body .todoup-add-form {
    padding: 8px 5px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#todoup-widget-body .todoup-flex-w {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

/* 계층 구조를 위한 CSS 스타일 */
#todoup-widget-body .todoup-depth-0 {
    margin-left: 0;
}

#todoup-widget-body .todoup-depth-1 {
    margin-left: 20px;
    border-left: 2px solid #f0f0f0;
    padding-left: 10px;
}

#todoup-widget-body .todoup-depth-2 {
    margin-left: 20px;
    border-left: 2px solid #e5e5e5;
    padding-left: 10px;
}

#todoup-widget-body .todoup-depth-3 {
    margin-left: 20px;
    border-left: 2px solid #e0e0e0;
    padding-left: 10px;
}

#todoup-widget-body .todoup-caname.has-children {
    cursor: pointer;
    display: flex;
    align-items: center;
    font-weight: bold;
    background: #f5f5f5;
    border-radius: 5px;
    padding: 6px 10px;
    margin-bottom: 6px;
    transition: background-color 0.2s;
}

#todoup-widget-body .todoup-caname.has-children:hover {
    background: #eaeaea;
}

#todoup-widget-body .todoup-toggle-icon {
    display: inline-block;
    margin-right: 8px;
    cursor: pointer;
    transition: transform 0.2s;
    font-size: 0.85em;
    line-height: 1;
}

#todoup-widget-body .todoup-subgroups {
    margin-top: 5px;
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

/* 그룹 관리 메뉴 내 계층 표시 */
#todoup-widget-body #todoup-group-list li[data-depth="1"] {
    margin-left: 20px;
    padding-left: 8px;
    border-left: 2px solid #f0f0f0;
}

#todoup-widget-body #todoup-group-list li[data-depth="2"] {
    margin-left: 40px;
    padding-left: 8px;
    border-left: 2px solid #e5e5e5;
}

#todoup-widget-body #todoup-group-list li[data-depth="3"] {
    margin-left: 60px;
    padding-left: 8px;
    border-left: 2px solid #e0e0e0;
}

/* 그룹 선택 관련 스타일 */
#todoup-widget-body .group-parent-select {
    margin-left: 10px;
    padding: 3px 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.9em;
}

#todoup-widget-body .group-edit-input {
    padding: 3px 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.9em;
    width: 120px;
}

/* 카테고리 그룹 부모-자식 관계 표시 */
#todoup-widget-body .todoup-category-block {
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

/* 부모 그룹 선택 드롭다운 */
#todoup-widget-body #group-parent-select {
    margin-left: 5px;
    padding: 5px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: auto;
}

/* 하위 그룹 스타일링 */
#todoup-widget-body .todoup-nested-group {
    border-left: 2px solid #e0e0e0;
    position: relative;
}

/* 계층 구조 개선을 위한 CSS - 수정본 */

/* 그룹 헤더 내 계층 레벨 표시 제거 (동그라미 제거) - 이미 화살표로 대체함 */
/* #todoup-widget-body .todoup-group-header::before {
    display: none;
} */

/* 기본 그룹 스타일 - 간격 축소 */
#todoup-widget-body .todoup-group {
    margin-bottom: 5px;
    /* 10px에서 5px로 축소 */
    border-radius: 8px;
    transition: all 0.2s ease;
}

/* 중첩 레벨에 따른 배경색 미세 변경 - 변수 사용 */
#todoup-widget-body .todoup-group[data-level="0"] .todoup-group-header {
    background: var(--card-bg-color);
}

#todoup-widget-body .todoup-group[data-level="1"] .todoup-group-header,
#todoup-widget-body .todoup-group[data-level="2"] .todoup-group-header,
#todoup-widget-body .todoup-group[data-level="3"] .todoup-group-header {
    background: var(--todoup-e);
    padding: 2px 2px;
    font-weight: 400;
    font-size: 11px;
    border-bottom: 1px dashed var(--card-bg-color);
    border-radius: 0px;
    margin: 0;
}

#todoup-widget-body .todoup-group[data-level="1"] .todoup-group-header .todoup-progress-bar,
#todoup-widget-body .todoup-group[data-level="2"] .todoup-group-header .todoup-progress-bar,
#todoup-widget-body .todoup-group[data-level="3"] .todoup-group-header .todoup-progress-bar {
    background: var(--white);
}

#todoup-widget-body .todoup-group[data-level="1"] .todoup-group-header input[type="checkbox"],
#todoup-widget-body .todoup-group[data-level="2"] .todoup-group-header input[type="checkbox"],
#todoup-widget-body .todoup-group[data-level="3"] .todoup-group-header input[type="checkbox"] {
    transform: scale(0.8);
    /* 80% 크기로 축소 */
    -webkit-transform: scale(0.8);
    transform-origin: center;
    -webkit-transform-origin: center;
}

#todoup-widget-body .todoup-group[data-level="1"] .todoup-group-header .todoup-group-delete-btn,
#todoup-widget-body .todoup-group[data-level="1"] .todoup-group-header .todoup-group-edit-btn,
#todoup-widget-body .todoup-group[data-level="2"] .todoup-group-header .todoup-group-delete-btn,
#todoup-widget-body .todoup-group[data-level="2"] .todoup-group-header .todoup-group-edit-btn,
#todoup-widget-body .todoup-group[data-level="3"] .todoup-group-header .todoup-group-delete-btn,
#todoup-widget-body .todoup-group[data-level="3"] .todoup-group-header .todoup-group-edit-btn {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* 하위 항목 체크리스트 스타일 개선 - 간격 축소 */
#todoup-widget-body .todoup-list {
    margin-left: 3px;
    /* 5px에서 3px로 축소 */
    margin-bottom: 3px;
    /* 하단 여백 추가 */
}

/* 계층 구조 시각적 표현 강화 - 간격 축소 */
#todoup-widget-body .todoup-category-block {
    position: relative;
    padding-bottom: 5px;
    /* 10px에서 5px로 축소 */
    margin-bottom: 8px;
    /* 12px에서 8px로 축소 */
}

/* 새 항목 입력 UI 스타일 */
#todoup-widget-body .todoup-item.new-item {
    padding: 0;
    margin: 0;
}

#todoup-widget-body .todoup-new-subject-input {
    width: 100%;
    padding: 5px;
    border: 1px solid var(--todoup-c);
    border-radius: 4px;
    flex: 1;
}

#todoup-widget-body .todoup-save-subject-btn,
#todoup-widget-body .todoup-cancel-subject-btn {
    padding: 3px 8px;
    margin-right: 5px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
}

#todoup-widget-body .todoup-save-subject-btn {
    background: var(--todoup-5);
    color: white;
}

#todoup-widget-body .todoup-cancel-subject-btn {
    background: var(--card-bg-color);
}

#todoup-widget-body .todoup-batch-actions {
    border: 0;
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    gap: 3px;
}

button.todoup-batch-save-btn,
button.todoup-batch-cancel-btn {
    font-size: 10px;
    font-family: 'NanumSquare';
    padding: 0px 5px;
    background: var(--todoup-c);
    color: var(--todoup-5);
    height: 22px;
    line-height: 1;
    border: 1px solid var(--todoup-b);
    border-radius: 4px;
    margin-bottom: 5px;
}

#todoup-widget-body .todoup-item-content input.todoup-new-subject-input {
    width: 100%;
    margin-bottom: 3px;
}

.todoup-remove-input-btn {
    width: 16px;
    height: 16px;
    border: 0;
    background: var(--todoup-c);
    color: var(--todoup-e);
    border-radius: 5px;
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'NanumSquare';
    font-weight: 100;
    margin-bottom: 5px;
    margin-left: 5px;
}

.todoup-remove-input-btn:hover {
    background: var(--gray-700);
}

/* 드래그 중인 항목 스타일 */
.being-dragged {
    opacity: 0.4 !important;
}

/* 드롭 영역 기본 상태 */
.todoup-drop-zone {
    height: 0;
    padding: 0;
    margin: 0;
    transition: all 0.2s;
    border-radius: 3px;
    overflow: hidden;
}

/* 드래그 중에 드롭 영역은 감지 가능한 영역 확보 */
body.todoup-dragging-active .todoup-drop-zone {
    height: 0;
    padding: 1px 0;
    /* 감지 영역을 위한 패딩 추가 */
    margin: -3px 0;
    /* 패딩으로 인한 높이 증가를 상쇄 */
    border: 2px dashed transparent;
    box-sizing: border-box;
}

.todoup-drop-zone-category {
    position: relative;
    z-index: 10;
}

/* 드래그 중에 호버 상태인 드롭 영역만 확장 */
body.todoup-dragging-active .todoup-drop-zone:hover,
body.todoup-dragging-active .todoup-drop-zone.todoup-drop-hover {
    padding: 5px 0;
    /* 호버 시 패딩 증가 */
    margin: -7px 0;
    /* 마진은 유지 */
    border-color: var(--accent-color);
    background: var(--accent-color);
}

/* 카테고리 드롭 영역 호버 스타일 */
.todoup-caname-drop-hover {
    background: var(--todoup-acc);
    border: 2px dashed var(--accent-color);
    transition: all 0.2s ease;
}

/* 완료된 항목 스타일 */
.todoup-item.todoup-checked .todoup-line-label {
    text-decoration: line-through;
    opacity: 0.6;
}

.todoup-checked .todoup-subject {
    text-decoration: line-through;
    opacity: 0.6;
}

/* 제목 영역 드롭 존 스타일 - 드래그 중에만 활성화 */
.todoup-group-header-drop-hover {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    z-index: 5;
    display: none;
    /* 기본적으로 숨김 */
}

/* 드래그 중 호버 시 스타일 */
body.todoup-dragging-active .todoup-group-header-drop-hover:hover,
body.todoup-dragging-active .todoup-group-header-drop-hover {
    display: block;
    background: var(--accent-color);
    border: 2px dashed var(--accent-color);
    box-sizing: border-box;
    /* 테두리가 크기에 포함되도록 설정 */
    margin: -2px;
    /* 테두리로 인한 위치 이동 보정 */
    z-index: 10;
}


/* 로딩 인디케이터 스타일 */
.todoup-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--white);
    padding: 10px 15px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    color: var(--gray-700);
    font-family: 'NanumSquare';
    font-weight: 400;
    font-size: 13px;
    z-index: 1000;
}

.todoup-scroll-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 120px;
}

#todoup-widget-body .todoup-group-content .todoup-group .todoup-line-add-btn {
    display: none;
}

/* 기본적으로 버튼을 숨김 */
#todoup-widget-body #todoup-edit-mode-btn {
    display: inline-block;
    border-radius: 5px;
    border: 2px inset var(--btn-accent-bg);
    background: var(--btn-accent-bg);
    color: var(--btn-accent-text);
    font-size: 10px;
    font-family: 'NanumSquare';
    padding: 0px 7px;
    height: 20px;
    line-height: 1;
}

#todoup-widget-body #todoup-edit-mode-btn:hover {
    background: var(--container-bg-color);
    color: var(--content-font-color);
}

/* 모바일 화면 */
@media screen and (max-width: 768px) {
    #todoup-widget #todoup-toggle-btn {
        bottom: 15px;
        left: 15px;
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    #todoup-widget-body {
        left: 2%;
        right: 2%;
        bottom: 60px;
        min-width: auto;
        width: 96%;
    }

    #todoup-maximize-btn {
        display: none !important;
    }

    #todoup-widget-body .todo-head {
        display: flex;
        flex-direction: row;
        justify-content: center;
        font-size: 14px;
        height: 20px;
    }
}