@import url('https://fastly.jsdelivr.net/npm/galmuri@latest/dist/galmuri.css');

/* 위젯 wrapper가 공간을 차지하지 않도록 */
.widget-widget_jellymenu {
    position: absolute !important;
    height: 0 !important;
    width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
}

/* 메인 위젯 컨테이너 - Windows 98 스타일 */
.jellymenu-widget {
    position: fixed;
    top: 100px;
    left: 20px;
    width: 250px;
    min-height: 200px;
    max-height: 600px;
    font-family: 'Galmuri11', 'MS Sans Serif', sans-serif;
    font-size: 11px;
    z-index: 100000;
    background: var(--jm-bg-color, #c0c0c0);
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    box-shadow:
        inset 1px 1px 0 #dfdfdf,
        inset -1px -1px 0 #000000,
        2px 2px 5px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: visible;
    transition: none;
}

.jellymenu-widget.minimized {
    min-height: auto;
    height: auto;
}

.jellymenu-widget.minimized .jellymenu-body {
    display: none;
}

/* 타이틀바 - Windows 98 스타일 */
.jellymenu-header {
    background: linear-gradient(90deg,
        var(--jm-primary-color, #000080) 0%,
        var(--jm-primary-color, #1084d0) 100%);
    padding: 2px 2px 2px 4px;
    border-bottom: 1px solid #000;
    cursor: grab;
    user-select: none;
}

.jellymenu-header:active {
    cursor: grabbing;
}

.jellymenu-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 18px;
}

.jellymenu-title {
    color: #ffffff;
    font-weight: bold;
    font-size: 11px;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.5);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 최소화 버튼 - Windows 98 스타일 */
.jellymenu-minimize-btn {
    width: 16px;
    height: 14px;
    background: var(--jm-bg-color, #c0c0c0);
    border: 1px solid;
    border-color: #ffffff #000000 #000000 #ffffff;
    box-shadow:
        inset 1px 1px 0 #dfdfdf,
        inset -1px -1px 0 #808080;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    color: #000000;
    line-height: 1;
}

.jellymenu-minimize-btn:hover {
    background: #d4d0c8;
}

.jellymenu-minimize-btn:active {
    border-color: #000000 #ffffff #ffffff #000000;
    box-shadow:
        inset -1px -1px 0 #dfdfdf,
        inset 1px 1px 0 #808080;
    padding-top: 1px;
    padding-left: 1px;
}

/* 본문 */
.jellymenu-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--jm-bg-color, #c0c0c0);
}

/* 메뉴 리스트 */
.jellymenu-list {
    list-style: none;
    margin: 0;
    padding: 2px;
    flex: 1;
    overflow-y: auto;
    overflow-x: visible;
}

.jellymenu-list::-webkit-scrollbar {
    width: 16px;
    height: 16px;
}

.jellymenu-list::-webkit-scrollbar-track {
    background: #dfdfdf;
    border: 1px solid #808080;
}

.jellymenu-list::-webkit-scrollbar-thumb {
    background: var(--jm-bg-color, #c0c0c0);
    border: 1px solid;
    border-color: #ffffff #000000 #000000 #ffffff;
    box-shadow: inset 1px 1px 0 #dfdfdf;
}

.jellymenu-list::-webkit-scrollbar-button {
    background: var(--jm-bg-color, #c0c0c0);
    border: 1px solid;
    border-color: #ffffff #000000 #000000 #ffffff;
    height: 16px;
    width: 16px;
}

.jellymenu-list::-webkit-scrollbar-button:vertical:decrement {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M 8 6 L 4 10 L 12 10 Z" fill="%23000"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
}

.jellymenu-list::-webkit-scrollbar-button:vertical:increment {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M 8 10 L 4 6 L 12 6 Z" fill="%23000"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
}

/* 메뉴 아이템 */
.jellymenu-item {
    margin-bottom: 1px;
    position: relative;
    overflow: visible;
}

.jellymenu-folder,
.jellymenu-link {
    display: flex;
    align-items: center;
    padding: 4px 6px;
    cursor: pointer;
    text-decoration: none;
    color: var(--jm-text-color, #000000);
    border: 1px solid transparent;
    background: transparent;
    transition: none;
}

.jellymenu-folder:hover,
.jellymenu-link:hover {
    background: var(--jm-primary-color, #000080);
    color: #ffffff;
}

.jellymenu-folder:active,
.jellymenu-link:active {
    background: var(--jm-primary-color, #000080);
    color: #ffffff;
    border: 1px dotted #ffffff;
}

/* 아이콘 */
.jellymenu-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 6px;
    flex-shrink: 0;
}

.jellymenu-icon img {
    max-width: 100%;
    max-height: 100%;
    image-rendering: pixelated;
}

.jellymenu-icon i {
    font-size: 16px;
}

/* 텍스트 */
.jellymenu-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
}

/* 화살표 */
.jellymenu-arrow {
    margin-left: 4px;
    font-size: 8px;
    flex-shrink: 0;
}

/* 서브메뉴 - Windows 98 팝업 스타일 */
.jellymenu-submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: -3px;
    list-style: none;
    margin: 0;
    padding: 2px;
    min-width: 180px;
    background: var(--jm-bg-color, #c0c0c0);
    border: 2px solid;
    border-color: #ffffff #808080 #808080 #ffffff;
    box-shadow:
        inset 1px 1px 0 #dfdfdf,
        inset -1px -1px 0 #000000,
        3px 3px 5px rgba(0, 0, 0, 0.3);
    z-index: 100002;
    pointer-events: auto;
}

.jellymenu-item.has-submenu.open > .jellymenu-submenu,
.jellymenu-item.has-submenu:hover > .jellymenu-submenu {
    display: block !important;
    visibility: visible !important;
}

.jellymenu-subitem {
    margin-bottom: 1px;
}

/* 잠긴 메뉴 */
.jellymenu-item.locked .jellymenu-folder,
.jellymenu-item.locked .jellymenu-link,
.jellymenu-subitem.locked .jellymenu-link {
    opacity: 0.5;
    cursor: not-allowed;
}

.jellymenu-item.locked .jellymenu-folder:hover,
.jellymenu-item.locked .jellymenu-link:hover,
.jellymenu-subitem.locked .jellymenu-link:hover {
    background: transparent;
    color: var(--jm-text-color, #000000);
}

/* 푸터 - 설정 버튼 */
.jellymenu-footer {
    border-top: 2px solid;
    border-color: #808080 #ffffff #ffffff #808080;
    padding: 4px;
    background: var(--jm-bg-color, #c0c0c0);
}

.jellymenu-settings-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    background: var(--jm-bg-color, #c0c0c0);
    border: 2px solid;
    border-color: #ffffff #000000 #000000 #ffffff;
    box-shadow:
        inset 1px 1px 0 #dfdfdf,
        inset -1px -1px 0 #808080;
    cursor: pointer;
    text-decoration: none;
    color: var(--jm-text-color, #000000);
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    gap: 4px;
}

.jellymenu-settings-btn:hover {
    background: #d4d0c8;
}

.jellymenu-settings-btn:active {
    border-color: #000000 #ffffff #ffffff #000000;
    box-shadow:
        inset -1px -1px 0 #dfdfdf,
        inset 1px 1px 0 #808080;
    padding-top: 5px;
    padding-left: 9px;
    padding-bottom: 3px;
    padding-right: 7px;
}

/* 반응형 - 모바일 */
@media (max-width: 768px) {
    .jellymenu-widget {
        left: 10px;
        width: calc(100% - 20px);
        max-width: 280px;
    }

    .jellymenu-submenu {
        left: auto;
        right: 100%;
    }
}

/* 드래그 중 선택 방지 */
.jellymenu-widget.dragging {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Windows 98 느낌의 픽셀 아트 효과 */
.jellymenu-widget,
.jellymenu-submenu {
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}
