/* ============================================================
   editor.css — Entry 에디터 화면 스타일
   Entry 디자인 토큰(#4f80ff, #d6e9f4, #2c313d 등)을 따릅니다.
   ============================================================ */

/* ---------- Base ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    overflow: hidden;
    font-family: NanumGothic, 'Nanum Gothic', 'Malgun Gothic', sans-serif;
    color: #2c313d;
    letter-spacing: -0.3px;
}

/* ---------- Header ---------- */
#header {
    height: 42px;
    background: #2c313d;
    display: flex;
    align-items: center;
    padding: 0 16px;
    color: #fff;
    position: relative;
    z-index: 100;
}
#header h1 { font-size: 16px; font-weight: 600; flex: 1; }
#header .beta-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 6px;
    background: #fa5536;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    border-radius: 3px;
    letter-spacing: 1px;
    vertical-align: middle;
}
#header button {
    border: none; border-radius: 4px;
    padding: 6px 16px; margin-left: 8px;
    font-size: 13px; cursor: pointer; font-weight: 600;
}
.mode-btn { background: #555; color: #fff; }
.mode-btn:hover { background: #666; }
.history-btn { background: #444; color: #ccc; }
.history-btn:hover:not(:disabled) { background: #666; color: #fff; }
.history-btn:disabled { opacity: 0.35; cursor: default; }
#test-btn { background: #03a9f4; color: #fff; }
#test-btn:hover { background: #0288d1; }
#test-btn:disabled { background: #aaa; cursor: wait; }
#submit-btn { background: #ff9800; color: #fff; }
#submit-btn:hover { background: #fb8c00; }
#submit-btn:disabled { background: #aaa; cursor: wait; }
#reset-btn { background: #e53935; color: #fff; }
#reset-btn:hover { background: #c62828; }

/* ---------- Main layout ---------- */
#main { display: flex; height: calc(100vh - 42px); }

/* ---------- Problem description panel (left) ---------- */
#problem-panel {
    width: 360px;
    min-width: 0;
    background: #fff;
    border-right: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#problem-panel.hidden { display: none; }
#problem-panel-header {
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}
#problem-panel-title {
    font-size: 15px;
    font-weight: 700;
    color: #333;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#problem-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    font-size: 14px;
    line-height: 1.7;
    color: #333;
}
#problem-panel-body h1, #problem-panel-body h2, #problem-panel-body h3 {
    color: #2c313d;
    margin-top: 18px;
    margin-bottom: 10px;
    font-weight: 700;
}
#problem-panel-body h2 { font-size: 17px; }
#problem-panel-body h3 { font-size: 15px; }
#problem-panel-body h2:first-child, #problem-panel-body h3:first-child { margin-top: 0; }
#problem-panel-body p { margin-bottom: 10px; }
#problem-panel-body ul, #problem-panel-body ol { margin-left: 20px; margin-bottom: 10px; }
#problem-panel-body li { margin-bottom: 4px; }
#problem-panel-body code {
    background: #f1f3f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    color: #e03131;
    font-family: 'Consolas', 'Monaco', monospace;
}
#problem-panel-body pre {
    background: #f1f3f5;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 10px 0;
}
#problem-panel-body pre code {
    background: none;
    color: #333;
    padding: 0;
}

/* ---------- Splitter ---------- */
#splitter {
    width: 8px;
    cursor: col-resize;
    background: #e2e2e2;
    flex-shrink: 0;
    position: relative;
    transition: background 0.15s;
}
#splitter:hover, #splitter.dragging { background: #4f80ff; }
#splitter::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 36px;
    background: #8ba4b3;
    border-radius: 1px;
}
#splitter:hover::after, #splitter.dragging::after { background: #fff; }
#splitter.hidden { display: none; }

/* ---------- Workspace (Entry block editor) ---------- */
#workspace-wrapper {
    flex: 1;
    min-width: 0;
    position: relative;
    overflow: hidden;
}
#workspace { height: 100%; }

/* ---------- Grading result modal — Entry design language ---------- */
#grade-overlay {
    display: none;
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}
#grade-overlay.active { display: flex; }
#grade-modal {
    background: #fff;
    border: 1px solid #d6e9f4;
    border-radius: 6px;
    width: 90vw;
    max-width: 560px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
}
#grade-header {
    padding: 14px 20px;
    border-bottom: 1px solid #d6e9f4;
    display: flex;
    align-items: center;
    background: #fff;
}
#grade-title {
    flex: 1;
    font-size: 15px;
    font-weight: bold;
    color: #2c313d;
    letter-spacing: -0.3px;
}
#grade-body {
    padding: 18px 20px;
    overflow-y: auto;
    flex: 1;
    background: #f9f8f7;
}
#grade-footer {
    padding: 12px 20px;
    border-top: 1px solid #d6e9f4;
    background: #fff;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
#grade-footer button {
    border: none;
    border-radius: 4px;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: -0.3px;
    transition: background 0.15s, border-color 0.15s;
}
#grade-footer button:disabled { opacity: 0.5; cursor: not-allowed; }
#grade-stop { background: #fa5536; color: #fff; }
#grade-stop:hover:not(:disabled) { background: #e0452a; }
#grade-close-btn {
    background: #fff;
    color: #555;
    border: 1px solid #e2e2e2;
}
#grade-close-btn:hover { background: #f1f1f1; border-color: #d6e9f4; }
#grade-home { background: #4f80ff; color: #fff; }
#grade-home:hover { background: #3064ec; }

/* Toggle visibility based on grading state */
#grade-footer.running #grade-close-btn,
#grade-footer.running #grade-home { display: none; }
#grade-footer:not(.running) #grade-stop { display: none; }
/* Home button: shown only on submit + all pass (via .show-home on footer) */
#grade-footer:not(.show-home) #grade-home { display: none; }

/* ---------- Grade summary & test case blocks ---------- */
.grade-summary {
    padding: 14px 16px;
    border-radius: 6px;
    margin-bottom: 14px;
    text-align: center;
    font-size: 15px;
    font-weight: bold;
    letter-spacing: -0.3px;
}
.grade-summary.pass    { background: #e8fbf0; color: #1a7d45; border: 1px solid #32d27d; }
.grade-summary.fail    { background: #ffedeb; color: #a02d1c; border: 1px solid #fa5536; }
.grade-summary.running { background: #fffbed; color: #7a5a00; border: 1px solid #ffcf5f; }

.test-case {
    border: 1px solid #e2e2e2;
    border-radius: 6px;
    padding: 11px 12px;
    margin-bottom: 7px;
    display: flex;
    align-items: flex-start;
    background: #fff;
}
.test-case.pass    { border-color: #32d27d; background: #f3fbf7; }
.test-case.fail    { border-color: #fa5536; background: #fff6f4; }
.test-case.running { border-color: #ffcf5f; background: #fffbed; }
.test-case.error   { border-color: #8ba4b3; background: #f9f8f7; }

.test-status {
    font-weight: bold; font-size: 13px; margin-right: 10px;
    min-width: 56px;
    letter-spacing: -0.3px;
}
.test-case.pass    .test-status { color: #1a7d45; }
.test-case.fail    .test-status { color: #c33923; }
.test-case.running .test-status { color: #b8870a; }
.test-case.error   .test-status { color: #555; }
.test-detail { flex: 1; font-size: 13px; color: #2c313d; }
.test-name { font-weight: bold; margin-bottom: 3px; letter-spacing: -0.2px; }
.test-diff {
    background: #f9f8f7;
    padding: 8px 10px;
    border-radius: 4px;
    border: 1px solid #e2e2e2;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    margin-top: 6px;
    line-height: 1.6;
    color: #555;
}
.test-diff .expected { color: #1a7d45; font-weight: bold; }
.test-diff .actual   { color: #c33923; font-weight: bold; }

/* ---------- Confirm dialog (reset 등) — Entry design language ---------- */
#confirm-overlay {
    display: none;
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 10001;
    justify-content: center;
    align-items: center;
}
#confirm-overlay.active { display: flex; }
#confirm-dialog {
    background: #fff;
    border: 1px solid #d6e9f4;
    border-radius: 6px;
    padding: 24px 28px 18px;
    max-width: 340px;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}
#confirm-dialog p {
    font-size: 14px;
    color: #2c313d;
    margin-bottom: 20px;
    line-height: 1.6;
    letter-spacing: -0.3px;
}
#confirm-dialog .confirm-btns {
    display: flex;
    gap: 8px;
    justify-content: center;
}
#confirm-dialog .confirm-btns button {
    border: none;
    border-radius: 4px;
    padding: 9px 24px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: -0.3px;
    transition: background 0.15s, border-color 0.15s;
}
#confirm-yes { background: #fa5536; color: #fff; }
#confirm-yes:hover { background: #e0452a; }
#confirm-no {
    background: #fff;
    color: #555;
    border: 1px solid #e2e2e2;
}
#confirm-no:hover { background: #f1f1f1; border-color: #d6e9f4; }

/* ---------- Entry sprite popup (local catalog) ---------- */
#popup-container {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 9999; display: none;
}
/* Hide default category sidebar (엔트리봇 친구들 / 사람 / 동물 / 식물 / ...)
   and the sub-tab (전체/…) since we only serve a small curated set. */
#popup-container [class^="menu_list__"],
#popup-container [class*=" menu_list__"],
#popup-container [class^="sub_tab__"],
#popup-container [class*=" sub_tab__"] {
    display: none !important;
}
/* Hide broken tabs (파일 올리기 / 새로 그리기 / 글상자) — keep only first tab
   (오브젝트 선택 or 모양 선택). Also hide the search bar (not useful for 13 items). */
#popup-container [class^="section_navi__"],
#popup-container [class*=" section_navi__"] {
    display: none !important;
}
#popup-container [class^="srch_box__"],
#popup-container [class*=" srch_box__"] {
    display: none !important;
}

/* ---------- Entry internal workspace overrides ---------- */
/* Keep block workspace visible in ALL tabs.
   Entry hides it via entryRemove (display:none) + visibility:hidden
   when 모양/소리 tabs are active. Override both. */
.entryPlaygroundCodeWorkspace {
    display: block !important;
    visibility: visible !important;
}
/* Show 모양/소리 tab content as a narrow side panel (not full overlay)
   so the block workspace remains visible behind it. */
.entryPlaygroundPictureWorkspace,
.entryPlaygroundSoundWorkspace {
    width: 250px !important;
    background: #fff;
    z-index: 10;
    border-right: 1px solid #e5e5e5;
    overflow-y: auto;
}
/* When 모양/소리 panel is active, hide block menu and resize handle
   (matching 속성 tab behavior) so the board gets full width. */
.entryPlaygroundPictureWorkspace:not(.entryRemove) ~ .entryPlaygroundCodeWorkspace .entryWorkspaceBlockMenu,
.entryPlaygroundPictureWorkspace:not(.entryRemove) ~ .entryPlaygroundCodeWorkspace .entryPlaygroundResizeWorkspace,
.entryPlaygroundSoundWorkspace:not(.entryRemove) ~ .entryPlaygroundCodeWorkspace .entryWorkspaceBlockMenu,
.entryPlaygroundSoundWorkspace:not(.entryRemove) ~ .entryPlaygroundCodeWorkspace .entryPlaygroundResizeWorkspace {
    display: none !important;
}
/* Expand board to fill space (like 속성 tab's wideView) when side panel is active */
.entryPlaygroundPictureWorkspace:not(.entryRemove) ~ .entryPlaygroundCodeWorkspace .entryWorkspaceBoard,
.entryPlaygroundSoundWorkspace:not(.entryRemove) ~ .entryPlaygroundCodeWorkspace .entryWorkspaceBoard {
    left: 250px !important;
    width: calc(100% - 250px) !important;
}
/* Hide paint editor and related buttons — editing unsupported offline.
   Shape thumbnail list (.entryPlaygroundPictureView) is kept for reference. */
.entryPlaygroundPainter {
    display: none !important;
}
.entryPlaygroundNewPictureInner {
    display: none !important;
}
/* Match "모양 추가하기" button style to "소리 추가하기" for consistency */
.entryPlaygroundAddPictureInner {
    display: block !important;
    font-size: 14px !important;
    width: calc(100% - 24px) !important;
}
/* Hide sound editor — same reason as paint editor (offline unsupported). */
.entryPlaygroundSoundEdit {
    display: none !important;
}
