/* 전체 레이아웃 */
body {
    font-family: 'Noto Sans KR', sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden; /* Prevent body scroll */
    background-color: #f0f0f0;
}

.main-layout-container {
    display: flex;
    flex-grow: 1;
    overflow: hidden;
}

/* 왼쪽 사이드바 */
.left-sidebar {
    width: 250px;
    background-color: #fff;
    padding: 15px;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto; /* Enable scrolling for sidebar content */
}

.io-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.io-buttons button {
    flex-grow: 1;
    padding: 10px;
    border: none;
    border-radius: 5px;
    background-color: #4CAF50;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
}

.io-buttons button:hover {
    background-color: #45a049;
}

.palette-container h3,
.examples-container h3,
.buttons-section h3 {
    margin-top: 0;
    margin-bottom: 10px;
    color: #333;
    font-size: 16px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

/* 팔레트 컨테이너 - 3열 그리드 */
.palette-container #myPaletteDiv {
    border: 1px solid #ddd;
    background-color: #f9f9f9;
    min-height: 150px; /* 최소 높이 */
    height: 200px; /* 내용에 따라 높이 조절 */
    overflow-y: auto; /* 스크롤 가능 */
    border-radius: 5px;
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3열로 설정 */
    gap: 5px; /* 아이템 간격 */
    padding: 5px;
}

.control-buttons,
.example-buttons {
    display: flex;
    flex-wrap: wrap; /* 버튼들이 다음 줄로 넘어가도록 */
    gap: 8px;
    margin-bottom: 10px;
}

.control-buttons button,
.example-buttons button {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f0f0f0;
    cursor: pointer;
    font-size: 11px;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.control-buttons button:hover,
.example-buttons button:hover {
    background-color: #e0e0e0;
    border-color: #999;
}

/* 다이어그램 컨테이너 */
.diagram-container {
    flex-grow: 1;
    background-color: #ffffff;
    border: 1px solid #ddd;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.1);
    margin: 15px;
}

/* 오른쪽 코드 섹션 */
.right-code-section {
    width: 400px;
    background-color: #fff;
    padding: 15px;
    box-shadow: -2px 0 5px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto; /* Enable scrolling for code section */
}

.code-container {
    border: 1px solid #333;
    border-radius: 5px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background-color: #222;
    border-bottom: 1px solid #444;
}

.code-header h3 {
    margin: 0;
    font-size: 15px;
    color: #eee;
}

.code-header button {
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    background-color: #007BFF;
    color: white;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.3s ease;
}

.code-header button:hover {
    background-color: #0056b3;
}

#pythonCodeInput {
    width: 100%;
    height: 200px; /* 고정 높이 */
    padding: 10px;
    border: none;
    background-color: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical; /* 수직 크기 조절 가능 */
    box-sizing: border-box;
}

.code-input-info {
    padding: 10px;
    background-color: #333;
    border-top: 1px solid #444;
    font-size: 12px;
    color: #bbb;
}

.code-input-info p {
    margin: 5px 0;
}

#myCodeEditor {
    white-space: pre-wrap; /* Preserve whitespace and wrap text */
    word-wrap: break-word; /* Break long words */
    height: 300px; /* 고정 높이 */
    padding: 10px;
    background-color: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.5;
    overflow: auto; /* Enable scrolling for generated code */
}

/* 콘솔 컨테이너 */
.console-container {
    border: 1px solid #333;
    border-radius: 5px;
    overflow: hidden;
    flex-grow: 1; /* 남은 공간을 채우도록 */
    display: flex;
    flex-direction: column;
}

.console-container h3 {
    margin: 0;
    padding: 8px 12px;
    background-color: #222;
    border-bottom: 1px solid #444;
    font-size: 15px;
    color: #eee;
}

#myConsoleOutput {
    white-space: pre-wrap;
    word-wrap: break-word;
    flex-grow: 1; /* 남은 공간을 채우도록 */
    padding: 10px;
    background-color: #000; /* 검은색 배경 */
    color: #0f0; /* 초록색 글씨 */
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    line-height: 1.5;
    overflow: auto;
}


/* 모달 스타일 */
#modalBackdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#modalContent {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 80%;
    max-width: 600px;
    position: relative;
    margin: 100px auto;
}

#modalCloseBtn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #888;
}

#modalTitle {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    text-align: center;
}

#modalSlotsContainer {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.slot {
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    background-color: #f9f9f9;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.slot:hover {
    background-color: #e9e9e9;
    border-color: #bbb;
}

.slot.filled {
    background-color: #d4edda;
    border-color: #28a745;
}

.slot.filled:hover {
    background-color: #c3e6cb;
}

.slot-number {
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

.slot-status {
    font-size: 0.9em;
    color: #666;
}