body {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    display: flex;
    flex-direction: column;
    background: #181818;
    color: white;
    height: 100vh;
}

.topbar {
    height: 40px;
    display: flex;
    width: 100%;
    align-items: center;
    padding: 20px 0px 0px 20px;
}

.topbar_menu {
    font-size: 24px;
    font-family: "Jua", sans-serif;
    font-weight: 400;
    font-style: normal;
    margin-right: 30px;
    cursor: pointer;
    transition: color 0.3s;
}

.topbar_menu:hover {
    color: #1db954;
}

.sidebar {
    width: 180px;
    background: #202020;
    padding: 20px;
    transition: width 0.3s;
    overflow: visible;
    height: 100%;
    flex-grow: 1;
}

.sidebar.collapsed {
    width: 60px;
}

.sidebar .menu-link div {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar button {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
}

/* 추가됨: collapsed 상태에서 input-group 숨김 */
.sidebar.collapsed .input-group {
    display: none;
}

.mainview {
    flex: 1;
    display: flex;
}

.mainview > div:last-child {
    flex-grow: 1; /* 인라인 스타일을 CSS로 이동 */
}

.content {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.3s;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: #282828;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 1080px;
    animation: slideUp 0.3s;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
}

.close-button {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-button:hover {
    color: #1db954;
}

.intro-list {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    overflow-y: auto;
}

.intro-list-item {
    padding: 15px;
    background: #202020;
    margin-bottom: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.intro-list-item:hover {
    background: #333333;
}

.intro-list-item.selected {
    background: #1db954;
}

.intro-list-icon {
    font-size: 20px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-primary {
    background: #1db954;
    color: white;
}

.btn-primary:hover {
    background: #1ed760;
    transform: scale(1.05);
}

.btn-primary:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
}

.btn-delete:hover {
    background: #c0392b;
    transform: scale(1.05);
}

.footer {
    height: 80px;
    background: #202020;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    bottom: 0px;
}

.menu {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.menu-item {
    position: relative;
}

.menu-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    padding: 10px 10px 10px 5px;
    color: white;
    transition: background 0.2s;
    border-radius: 6px;
    position: relative; /* 추가됨: 툴팁 위치 기준 */
}

.menu-link:hover {
    background: #333;
}

.menu-icon {
    margin-right: 5px;
    font-size: 14px;
    transition: all 0.3s;
}

/* 추가됨: collapsed 상태에서 텍스트 숨김 */
.sidebar.collapsed .menu-link div {
    display: none;
}

/* 추가됨: collapsed 상태에서 아이콘 중앙 정렬 및 크기 증가 */
.sidebar.collapsed .menu-icon {
    margin: 0;
    font-size: 14px;
}

.sidebar.collapsed .menu-sub {
    padding-left: 0;
}

/* 추가됨: 툴팁 스타일 */
.sidebar.collapsed .menu-link::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px); /* 메뉴 오른쪽에서 10px 떨어진 위치 */
    top: 50%;
    transform: translateY(-50%);
    background: #282828;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 14px;
    pointer-events: none; /* 마우스 이벤트 무시 */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* 추가됨: 툴팁 화살표 */
.sidebar.collapsed .menu-link::before {
    content: '';
    position: absolute;
    left: calc(100% + 5px);
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 5px 5px 5px 0;
    border-color: transparent #282828 transparent transparent;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1001;
}

.sidebar:not(.collapsed) .menu-link:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 15px);
    top: 50%;
    transform: translateY(-50%);
    background: #282828;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    white-space: nowrap;
    font-size: 14px;
    pointer-events: none;
    opacity: 1;
    visibility: visible;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

/* 추가됨: collapsed 아닐 때 툴팁 화살표 */
.sidebar:not(.collapsed) .menu-link:hover::before {
    content: '';
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 6px 6px 0;
    border-color: transparent #282828 transparent transparent;
    pointer-events: none;
    opacity: 1;
    visibility: visible;
    z-index: 9999;
}


/* 추가됨: 호버 시 툴팁 표시 */
.sidebar.collapsed .menu-link:hover::after,
.sidebar.collapsed .menu-link:hover::before {
    opacity: 1;
    visibility: visible;
}

/* 추가됨: menu-toggle도 툴팁 적용 */
.sidebar.collapsed .menu-toggle::after {
    content: attr(data-tooltip);
}

.menu-sub {
    display: none;
    list-style-type: none;
    padding-left: 20px;
}

.menu-sub li{
    display: flex;
    align-items: center;
}

.menu-item.open .menu-sub {
    display: block;
}

.intro-list::-webkit-scrollbar {
    width: 8px;
}

.intro-list::-webkit-scrollbar-track {
    background: #181818;
    border-radius: 4px;
}

.intro-list::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.intro-list::-webkit-scrollbar-thumb:hover {
    background: #777;
}

.input-group {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.input-group .btn-add {
    padding: 5px 10px;
    font-size: 16px;
}

.btn-delete {
    padding: 5px 10px;
    font-size: 16px;
}

.input-group .input-tag { /* 기존 .input-group input 대신 더 구체적인 선택자 사용 */
    flex-grow: 1;
    margin-right: 8px;
    padding: 5px;
    width: 80%; /* HTML 인라인 스타일에서 이동 */

    /* 아래는 .input-group input의 원래 스타일. 필요에 따라 통합 */
    background: #282828;
    color: white;
    border: 1px solid #404040;
    border-radius: 4px;
}

.menu-link.active {
    background-color: #e0eafc;
    font-weight: bold;
    color: #0056b3;
}

.content-sector {
    display: none;
    width: 100%;
    height: 100%;
}

.content-sector.active {
    display: flex;
}

/* 변경됨: 스플리터 기능을 위해 grid 대신 flex 사용 */
.sector-grid-container {
    display: flex;
    height: 100vh;
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
}

/* 추가됨: 왼쪽 컨테이너 (Memo + Result) */
.left-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 200px;
}

/* 추가됨: 오른쪽 컨테이너 (Description) */
.right-container {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 변경됨: 각 영역 스타일 조정 */
.memo-area {
    flex: 1;
    overflow: hidden;
    min-height: 100px;
}

.description-area {
    flex: 1;
    overflow: hidden;
}

.result-area {
    flex: 2;
    overflow: auto;
    min-height: 100px;
    background: #202020;
    padding: 10px;
    border: 1px solid #404040;
    position: relative;
}

/* 기존 .result-area pre 스타일을 삭제하고 아래 스타일로 대체합니다. */
/* <iframe> 기본 스타일을 제거하고 결과 영역에 맞춥니다. */
.result-area iframe.result-iframe {
    width: 100%;
    height: 100%;
    border: none; /* iframe 기본 테두리 제거 */
    background-color: white; /* 렌더링 영역의 배경을 밝게 설정 */
}

.fullscreen-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 20;
    background: rgba(64, 64, 64, 0.8);
    border: none;
    color: #ddd;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 26px;
    transition: all 0.2s;
    display: flex;
    align-items: end;
}

.fullscreen-btn:hover {
    background: #1db954;
    color: white;
}

/* 전체화면 모드 */
.result-area.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    padding: 0;
    border: none;
    background: #000;
}

.result-area.fullscreen .result-iframe {
    width: 100%;
    height: 100%;
}

.result-area.fullscreen .fullscreen-btn {
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    font-size: 28px;
    background: rgba(0, 0, 0, 0.7);
}

.result-area.fullscreen .fullscreen-btn:hover {
    background: #e74c3c;
}

/* .memo-area textarea 와 .description-area textarea 의 공통 속성 통합 */
.content-sector textarea {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    resize: none;
    background: #282828;
    color: white;
    border: 1px solid #404040;
    padding: 10px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

.memo-area .ace-editor-input { /* Ace Editor가 삽입될 Div */
    width: 100%;
    height: 100%; /* Ace가 작동하기 위해 필수 */
    box-sizing: border-box;
    /* 기존 textarea의 폰트 및 배경 스타일은 Ace 테마로 대체 */
}

/* 추가됨: 스플리터 스타일 */
.splitter {
    background: #404040;
    position: relative;
    z-index: 10;
}
.splitter:hover {
    background: #1db954;
}
.splitter.active {
    background: #1ed760;
}
/* 가로 스플리터 */
.splitter-horizontal, .splitter-console {
    height: 4px;
    cursor: row-resize;
    width: 100%;
}
/* 세로 스플리터 (왼쪽과 오른쪽 사이) */
.splitter-vertical {
    width: 4px;
    cursor: col-resize;
    height: 100%;
}

/* 스플리터 때문에 result 영역에서 커서 비활성화*/
.result-iframe.dragging {
    pointer-events: none;
}

/* 콘솔 영역 */
.console-area {
    flex: 1;
    min-height: 80px;
    background: #1a1a1a;
    border: 1px solid #404040;
    display: flex;
    flex-direction: column;
}

.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 10px;
    background: #2d2d2d;
    border-bottom: 1px solid #404040;
    font-size: 12px;
    color: #aaa;
}

.console-clear-btn {
    background: #404040;
    border: none;
    color: #aaa;
    padding: 2px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
}

.console-clear-btn:hover {
    background: #555;
    color: white;
}

.console-output {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.console-log {
    padding: 2px 0;
    border-bottom: 1px solid #2a2a2a;
    color: #ddd;
}

.console-log.error {
    color: #ff6b6b;
}

.console-log.warn {
    color: #ffd93d;
}

.console-log.info {
    color: #6bcfff;
}


/* 템플릿 바 */
.template-bar, .format-btn {
    display: flex;
    gap: 5px;
    padding: 5px;
    background: #2d2d2d;
    border-bottom: 1px solid #404040;
    flex-wrap: wrap;
}

.template-btn, .format-btn {
    background: #404040;
    border: none;
    color: #ddd;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
}

.template-btn:hover {
    background: #1db954;
    color: white;
}

/* 라이브러리 선택 바 */
.library-bar {
    display: flex;
    gap: 10px;
    padding: 5px 10px;
    background: #252525;
    border-bottom: 1px solid #404040;
    flex-wrap: wrap;
}

.library-checkbox {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #aaa;
    font-size: 12px;
    cursor: pointer;
    transition: color 0.2s;
}

.library-checkbox:hover {
    color: #ddd;
}

.library-checkbox input[type="checkbox"] {
    accent-color: #1db954;
    cursor: pointer;
}

.edit-input {
    background: #282828;
    border: 1px solid #1db954;
    color: white;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
    outline: none;
}

/* 에디터 탭 */
.editor-tabs {
    display: flex;
    background: #1a1a1a;
    border-bottom: 1px solid #404040;
}

.editor-tab {
    padding: 5px 10px;
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.editor-tab:hover {
    color: #ddd;
    background: #252525;
}

.editor-tab.active {
    color: #1db954;
    border-bottom: 2px solid #1db954;
    background: #252525;
}

/* 탭 내용 */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* 언어 선택 바 */
.language-bar {
    display: flex;
    gap: 15px;
    padding: 8px 10px;
    background: #2d2d2d;
    border-bottom: 1px solid #404040;
    align-items: center;
}

.language-radio {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #aaa;
    font-size: 13px;
    cursor: pointer;
    transition: color 0.2s;
}

.language-radio:hover {
    color: #ddd;
}

.language-radio input[type="radio"] {
    accent-color: #1db954;
    cursor: pointer;
}

/* 실행 버튼 */
.run-btn {
    margin-left: auto;
    background: #1db954;
    border: none;
    color: white;
    padding: 6px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
}

.run-btn:hover {
    background: #1ed760;
}

.run-btn:disabled {
    background: #555;
    cursor: not-allowed;
}
