* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(45deg, #f5f5f5 25%, transparent 25%), 
                linear-gradient(-45deg, #f5f5f5 25%, transparent 25%), 
                linear-gradient(45deg, transparent 75%, #f5f5f5 75%), 
                linear-gradient(-45deg, transparent 75%, #f5f5f5 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    min-height: 100vh;
}

/* 상단 네비게이션 바 */
.header {
    background: white;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #1976d2;
}

.version-info {
    display: flex;
    align-items: center;
}

.version-text {
    background: #f5f5f5;
    color: #666;
    font-size: 12px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.version-text:hover {
    background: #e3f2fd;
    color: #1976d2;
    border-color: #1976d2;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(25, 118, 210, 0.2);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-email {
    color: #666;
    font-size: 14px;
}

.logout-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

/* 메인 컨테이너 - 5단계 구성 */
.main-container {
    display: flex;
    height: calc(100vh - 60px);
}

/* 1단계: 책 관리 패널 */
.panel-1 {
    flex: 1;
    background: white;
    border-right: 1px solid #e0e0e0;
    padding: 15px;
    overflow-y: auto;
}

.panel-title {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    border-bottom: 2px solid #1976d2;
    padding-bottom: 6px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-1 .panel-title,
.panel-2 .panel-title {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.panel-1 .panel-title:hover,
.panel-2 .panel-title:hover {
    color: #1976d2;
}

.panel-toggle-btn {
    background: transparent;
    border: none;
    color: #666;
    padding: 2px 6px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    flex-shrink: 0;
}

.panel-toggle-btn:hover {
    background: rgba(25, 118, 210, 0.1);
    color: #1976d2;
}

.panel-toggle-btn.collapsed {
    transform: rotate(-90deg);
}

.panel-1,
.panel-2 {
    transition: width 0.3s ease;
    overflow: hidden;
}

.panel-1.collapsed,
.panel-2.collapsed {
    flex: 0 0 50px !important;
    width: 50px !important;
    min-width: 50px !important;
    max-width: 50px !important;
}

.panel-1.collapsed .panel-content,
.panel-2.collapsed .panel-content {
    display: none;
}

.panel-1.collapsed .panel-header,
.panel-2.collapsed .panel-header {
    padding: 8px 4px;
    margin-bottom: 0;
    border-radius: 6px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.panel-1.collapsed .panel-title,
.panel-2.collapsed .panel-title {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    white-space: nowrap;
    font-size: 13px;
    margin: 10px auto;
    letter-spacing: 2px;
    border-bottom: none;
    border-right: 2px solid #1976d2;
    padding-right: 6px;
    padding-bottom: 0;
    display: block;
}

.panel-1.collapsed .panel-toggle-btn,
.panel-2.collapsed .panel-toggle-btn {
    writing-mode: vertical-rl;
    margin: 10px auto;
    padding: 4px 8px;
    font-size: 12px;
}

.book-item {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.book-item:hover {
    background: #e3f2fd;
    border-color: #1976d2;
}

.book-item.active {
    background: #1976d2;
    color: white;
}

.book-title {
    font-weight: bold;
    margin-bottom: 3px;
    font-size: 13px;
}

.book-meta {
    font-size: 10px;
    color: #666;
}

.book-item.active .book-meta {
    color: #e3f2fd;
}

.book-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
}

.book-action-btn {
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.book-action-btn.edit {
    background: #4caf50;
    color: white;
}

.book-action-btn.export {
    background: #ff9800;
    color: white;
}

.book-action-btn.delete {
    background: #f44336;
    color: white;
}

.book-action-btn:hover {
    transform: scale(1.1);
}

.add-btn {
    width: 100%;
    padding: 8px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 8px;
    transition: background 0.3s;
}

.add-btn:hover {
    background: #45a049;
}

/* 버튼 그룹 (페이지/문제 추가) */
.add-buttons-group {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.add-buttons-group .add-btn {
    flex: 1;
    margin-top: 0;
    font-size: 11px;
}

.add-page-btn {
    background: #2196F3;
}

.add-page-btn:hover {
    background: #1976D2;
}

.add-problem-btn {
    background: #4caf50;
}

.add-problem-btn:hover {
    background: #45a049;
}

/* 2단계: 챕터 관리 패널 */
.panel-2 {
    flex: 1;
    background: white;
    border-right: 1px solid #e0e0e0;
    padding: 15px;
    overflow-y: auto;
}

.chapter-item {
    padding: 8px 10px;
    margin-bottom: 4px;
    background: #f5f5f5;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
    border-left: 3px solid #4caf50;
    position: relative;
}

.chapter-item:hover {
    background: #e0e0e0;
}

.chapter-item.active {
    background: #4caf50;
    color: white;
}

.chapter-title {
    font-weight: bold;
    margin-bottom: 2px;
}

.chapter-info {
    font-size: 10px;
    color: #666;
}

.chapter-item.active .chapter-info {
    color: #e8f5e8;
}

.chapter-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 3px;
}

.chapter-action-btn {
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.chapter-action-btn.edit {
    background: #4caf50;
    color: white;
}

.chapter-action-btn.delete {
    background: #f44336;
    color: white;
}

/* 3단계: 문제 목록 패널 */
.panel-3 {
    flex: 1;
    background: white;
    border-right: 1px solid #e0e0e0;
    padding: 15px;
    overflow-y: auto;
}

.problem-item {
    padding: 6px 8px;
    margin-bottom: 3px;
    background: #fff3e0;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    border-left: 2px solid #ff9800;
    transition: all 0.3s;
    position: relative;
}

.problem-item:hover {
    background: #ffe0b2;
}

.problem-item.active {
    background: #ff9800;
    color: white;
}

/* 페이지 아이템 스타일 (파란색 계열) */
.problem-item.page-item {
    background: #e3f2fd;
    border-left-color: #2196F3;
}

.problem-item.page-item:hover {
    background: #bbdefb;
}

.problem-item.page-item.active {
    background: #2196F3;
    color: white;
}

.problem-item.page-item .problem-type {
    color: #1976D2;
}

.problem-item.page-item.active .problem-type {
    color: #e3f2fd;
}

.problem-number {
    font-weight: bold;
    margin-bottom: 2px;
}

.problem-type {
    font-size: 9px;
    color: #666;
}

.problem-item.active .problem-type {
    color: #fff3e0;
}

.problem-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    gap: 2px;
}

.problem-action-btn {
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 2px;
    cursor: pointer;
    font-size: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.problem-action-btn.edit {
    background: #4caf50;
    color: white;
}

.problem-action-btn.delete {
    background: #f44336;
    color: white;
}

.problem-difficulty {
    display: inline-block;
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 8px;
    margin-top: 2px;
}

.difficulty-easy {
    background: #c8e6c9;
    color: #2e7d32;
}

.difficulty-medium {
    background: #fff3e0;
    color: #f57c00;
}

.difficulty-hard {
    background: #ffcdd2;
    color: #c62828;
}

/* 4단계: 문제 상세 편집 패널 */
.panel-4 {
    flex: 1.5;
    background: white;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    padding: 15px;
    padding-bottom: 0;
    overflow-y: auto;
}

.editor-header {
    padding: 0 0 12px 0;
    margin: 0 -15px;
    padding-left: 15px;
    padding-right: 15px;
    border-bottom: 1px solid #e0e0e0;
    background: #f8f9fa;
}

.editor-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.tab-item {
    padding: 5px 10px;
    background: #e9ecef;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.3s;
}

.tab-item.active {
    background: #1976d2;
    color: white;
}

.problem-info {
    background: #e3f2fd;
    border: 1px solid #1976d2;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 10px;
}

.problem-title {
    font-weight: bold;
    margin-bottom: 6px;
    color: #1976d2;
    font-size: 13px;
}

.problem-content {
    line-height: 1.4;
    font-size: 12px;
}


.editor-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px 0;
}

.editor-toolbar {
    display: flex;
    gap: 4px;
    padding: 8px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    flex-wrap: wrap;
    align-items: center;
}

.toolbar-btn {
    padding: 6px 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.toolbar-btn:hover {
    background: #e3f2fd;
    border-color: #1976d2;
}

.toolbar-btn:active {
    background: #bbdefb;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: #ddd;
    margin: 0 4px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 13px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: #1976d2;
}

.editor-textarea,
.editor-explanation {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 0 0 4px 4px;
    font-size: 14px;
    font-family: 'Noto Sans KR', sans-serif;
    line-height: 1.6;
    transition: border-color 0.2s;
    box-sizing: border-box;
    overflow-y: auto;
    background: white;
}

.editor-explanation {
    min-height: 100px;
}

.editor-textarea:focus,
.editor-explanation:focus {
    outline: none;
    border-color: #1976d2;
}

.editor-textarea:empty:before,
.editor-explanation:empty:before {
    content: attr(data-placeholder);
    color: #999;
}

.editor-textarea img,
.editor-explanation img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 10px 0;
    display: block;
}

.editor-textarea strong,
.editor-explanation strong {
    font-weight: 700;
}

.editor-textarea em,
.editor-explanation em {
    font-style: italic;
}

.editor-textarea u,
.editor-explanation u {
    text-decoration: underline;
}

.editor-textarea ul,
.editor-textarea ol,
.editor-explanation ul,
.editor-explanation ol {
    margin: 10px 0;
    padding-left: 30px;
}

.editor-textarea li,
.editor-explanation li {
    margin: 5px 0;
}

.editor-metadata {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.answer-input-wrapper {
    position: relative;
}

.answer-text,
.answer-ox {
    width: 100%;
}

.answer-ox {
    display: flex;
    gap: 20px;
    padding: 12px 0;
}

.ox-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 10px 20px;
    border: 2px solid #ddd;
    border-radius: 8px;
    transition: all 0.2s;
    background: white;
}

.ox-option:hover {
    border-color: #1976d2;
    background: #f0f7ff;
}

.ox-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.ox-option input[type="radio"]:checked + .ox-label {
    font-weight: 600;
    color: #1976d2;
}

.ox-label {
    font-size: 15px;
    cursor: pointer;
    user-select: none;
}

/* 객관식 보기 입력 */
.multiple-choice-options {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    background: #fafafa;
}

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

.btn-add-option {
    padding: 6px 12px;
    background: #1976d2;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.btn-add-option:hover {
    background: #1565c0;
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.option-item {
    display: flex;
    gap: 10px;
    align-items: center;
    background: white;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ddd;
}

.option-number {
    min-width: 30px;
    font-weight: 600;
    color: #666;
    font-size: 14px;
}

.option-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: 'Noto Sans KR', sans-serif;
}

.option-input:focus {
    outline: none;
    border-color: #1976d2;
}

.option-correct {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background 0.2s;
}

.option-correct:hover {
    background: #f0f7ff;
}

.option-correct input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.option-correct.is-correct {
    background: #e8f5e9;
}

.option-correct.is-correct label {
    color: #2e7d32;
    font-weight: 600;
}

.option-correct label {
    cursor: pointer;
    user-select: none;
    font-size: 13px;
}

.btn-remove-option {
    padding: 6px 10px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.2s;
    white-space: nowrap;
}

.btn-remove-option:hover {
    background: #d32f2f;
}

.answer-summary {
    background: #f5f5f5;
    cursor: not-allowed;
}

/* 미리보기 개선 */
.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.preview-title {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.preview-controls .btn-toggle-preview-mode {
    padding: 6px 14px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.preview-controls .btn-toggle-preview-mode:hover {
    background: #1976D2;
}

.preview-controls .btn-toggle-preview-mode[data-mode="static"] {
    background: #9E9E9E;
}

.preview-controls .btn-toggle-preview-mode[data-mode="static"]:hover {
    background: #757575;
}

.btn-reset-preview {
    padding: 8px 16px;
    background: #ff9800;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-reset-preview:hover {
    background: #f57c00;
}

/* 정적 모드일 때 답안 입력 영역 숨기고 정답/해설 표시 */
.preview-content.static-mode .preview-answer-input {
    display: none !important;
}

.preview-content.static-mode .preview-result {
    display: block !important;
}

.preview-content.static-mode .btn-reset-preview {
    display: none;
}

.preview-question-content {
    line-height: 1.8;
    margin: 20px 0;
    font-size: 16px;
    padding: 0;
    background: transparent;
}

.preview-question-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 10px 0;
}

.preview-answer-section {
    margin-top: 20px;
}

.preview-answer-input {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
}

.preview-options-area {
    margin-bottom: 20px;
}

.preview-option-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    margin-bottom: 10px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.preview-option-item:hover {
    border-color: #1976d2;
    background: #f0f7ff;
}

.preview-option-item.selected {
    border-color: #1976d2;
    background: #e3f2fd;
}

.preview-option-item input[type="checkbox"],
.preview-option-item input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    cursor: pointer;
}

.preview-option-label {
    flex: 1;
    cursor: pointer;
    line-height: 1.6;
}

.preview-text-input {
    margin-bottom: 20px;
}

.preview-text-input label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.preview-answer-text {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Noto Sans KR', sans-serif;
    resize: vertical;
}

.preview-answer-text:focus {
    outline: none;
    border-color: #1976d2;
}

.preview-ox-input {
    margin-bottom: 20px;
}

.preview-ox-input label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #333;
}

.preview-ox-buttons {
    display: flex;
    gap: 15px;
}

.preview-ox-btn {
    flex: 1;
    padding: 15px 30px;
    background: white;
    border: 3px solid #ddd;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.preview-ox-btn:hover {
    border-color: #1976d2;
    background: #f0f7ff;
}

.preview-ox-btn.selected {
    border-color: #1976d2;
    background: #1976d2;
    color: white;
}

.btn-check-answer {
    width: 100%;
    padding: 15px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-check-answer:hover {
    background: #45a049;
}

.preview-result {
    margin-top: 30px;
    padding: 20px;
    background: #fff9e6;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
}

.result-status {
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 10px;
}

.result-status.correct {
    color: #2e7d32;
}

.result-status.incorrect {
    color: #c62828;
}

.result-correct-answer {
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.5);
    padding: 10px;
    border-radius: 4px;
}

.result-correct-answer strong {
    font-weight: bold;
    color: #d32f2f;
    font-size: 18px;
    margin-bottom: 10px;
    display: block;
}

.correct-answer-text {
    display: block;
    color: #333;
    line-height: 1.6;
    min-height: 20px;
    padding: 5px 0;
}

.result-explanation {
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.5);
    padding: 10px;
    border-radius: 4px;
}

.result-explanation strong {
    font-weight: bold;
    color: #1976d2;
    font-size: 18px;
    margin-bottom: 10px;
    display: block;
}

.explanation-content {
    line-height: 1.6;
    color: #333;
    min-height: 20px;
    padding: 5px 0;
}

.explanation-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 10px 0;
}

.metadata-row {
    display: flex;
    gap: 15px;
}


.editor-textarea {
    width: 100%;
    min-height: 150px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    font-size: 12px;
    line-height: 1.4;
    resize: vertical;
    font-family: inherit;
}

.editor-options {
    margin-top: 12px;
}

.option-group {
    margin-bottom: 10px;
}

.option-label {
    font-weight: bold;
    margin-bottom: 4px;
    color: #333;
    font-size: 11px;
}

.option-select {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 11px;
}

.option-input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 11px;
}

.option-checkbox {
    margin-right: 4px;
}

/* 5단계: 미리보기 패널 */
.panel-5 {
    flex: 2;
    background: white;
    padding: 15px;
    overflow-y: auto;
    min-width: 500px;
}

.preview-controls {
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
    flex-wrap: nowrap;
}

.preview-width {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.preview-width label {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
}

.width-input {
    width: 45px;
    padding: 2px 4px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 12px;
    text-align: center;
}

.preview-width span {
    font-size: 12px;
    color: #666;
}

.preview-container {
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    min-height: 400px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    margin-bottom: 15px;
}

.preview-content {
    line-height: 1.6;
}

.preview-question {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #1976d2;
}

.preview-question h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #1976d2;
}

.preview-question p {
    font-size: 14px;
    margin-bottom: 15px;
}

.preview-options {
    margin-top: 15px;
}

.preview-option {
    padding: 8px 12px;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
}

.preview-option:hover {
    background: #f0f0f0;
}

.preview-option.selected {
    background: #e3f2fd;
    border-color: #1976d2;
}

.preview-submit {
    margin-top: 20px;
    padding: 12px 24px;
    background: #4caf50;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    width: 100%;
}

.preview-submit:hover {
    background: #45a049;
}

.preview-stats {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
}

.stats-title {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

.stats-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 11px;
}

.stats-label {
    color: #666;
}

.stats-value {
    font-weight: bold;
    color: #1976d2;
}

/* 팝업 모달 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: white;
    border-radius: 8px;
    padding: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 10px;
}

.modal-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

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

.modal-close:hover {
    color: #333;
}

.modal-content {
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-textarea {
    width: 100%;
    height: 80px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    resize: vertical;
}

.form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-primary {
    background: #1976d2;
    color: white;
}

.btn-primary:hover {
    background: #1565c0;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #4caf50;
    color: white;
}

.btn-success:hover {
    background: #45a049;
}

.btn-warning {
    background: #ff9800;
    color: white;
}

.btn-warning:hover {
    background: #f57c00;
}

.export-section {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    margin-top: 20px;
}

.export-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #1976d2;
}

.export-options {
    margin-bottom: 15px;
}

.export-option {
    margin-bottom: 8px;
}

.export-option label {
    font-size: 14px;
    cursor: pointer;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    margin-top: 10px;
    overflow: hidden;
    display: none;
}

.progress-fill {
    height: 100%;
    background: #4caf50;
    width: 0%;
    transition: width 0.3s;
}


/* 스크롤바 스타일링 */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 애니메이션 */
.panel-1, .panel-2, .panel-3, .panel-4, .panel-5 {
    transition: width 0.3s ease;
}

.book-item, .chapter-item, .problem-item {
    transform: translateX(0);
    transition: all 0.3s ease;
}

.book-item:hover, .chapter-item:hover, .problem-item:hover {
    transform: translateX(2px);
}

/* 토스트 메시지 스타일 */
#toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    animation: slideIn 0.3s ease-out;
    position: relative;
    overflow: hidden;
}

.toast.removing {
    animation: slideOut 0.3s ease-out forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toast-title {
    font-weight: bold;
    font-size: 14px;
    color: #333;
}

.toast-message {
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: #999;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    flex-shrink: 0;
    transition: background 0.2s;
}

.toast-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #333;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    animation: progress linear;
}

@keyframes progress {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* 토스트 타입별 스타일 */
.toast.success {
    border-left: 4px solid #4caf50;
    color: #4caf50;
}

.toast.error {
    border-left: 4px solid #f44336;
    color: #f44336;
}

.toast.warning {
    border-left: 4px solid #ff9800;
    color: #ff9800;
}

.toast.info {
    border-left: 4px solid #2196f3;
    color: #2196f3;
}

/* EPUB 출력 유형 선택 스타일 */
.export-type-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.export-type-option:hover {
    border-color: #1976d2;
    background: #f5f9ff;
}

.export-type-option input[type="radio"] {
    margin-top: 3px;
    cursor: pointer;
}

.export-type-option input[type="radio"]:checked + .export-type-content {
    color: #1976d2;
}

.export-type-option:has(input[type="radio"]:checked) {
    border-color: #1976d2;
    background: #f5f9ff;
}

.export-type-content {
    flex: 1;
}

.export-type-content strong {
    font-size: 14px;
}

/* ===== 드래그 앤 드롭 스타일 ===== */

/* 드래그 가능한 아이템에 커서 표시 */
.book-item,
.chapter-item,
.problem-item {
    cursor: move;
    cursor: grab;
}

.book-item:active,
.chapter-item:active,
.problem-item:active {
    cursor: grabbing;
}

/* 드래그 중인 아이템 스타일 */
.sortable-ghost {
    opacity: 0.4;
    background: #e3f2fd;
    border: 2px dashed #1976d2;
}

/* 드래그 시 부드러운 전환 효과 */
.book-item,
.chapter-item,
.problem-item {
    transition: transform 0.2s ease;
}

/* 버전 히스토리 모달 */
.version-history-modal {
    max-width: 600px;
    max-height: 80vh;
}

.version-history-content {
    max-height: 60vh;
    overflow-y: auto;
}

.version-timeline {
    position: relative;
    padding: 20px 0;
}

.version-timeline::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #1976d2, #e0e0e0);
}

.version-item {
    position: relative;
    margin-bottom: 30px;
    padding-left: 50px;
}

.version-item::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 8px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #1976d2;
    border: 3px solid white;
    box-shadow: 0 0 0 2px #1976d2;
}

.version-item.latest::before {
    background: #4caf50;
    box-shadow: 0 0 0 2px #4caf50;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 2px #4caf50; }
    50% { box-shadow: 0 0 0 6px rgba(76, 175, 80, 0.3); }
    100% { box-shadow: 0 0 0 2px #4caf50; }
}

.version-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.version-number {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 14px;
    color: #1976d2;
    background: #e3f2fd;
    padding: 4px 8px;
    border-radius: 4px;
}

.version-item.latest .version-number {
    background: #e8f5e8;
    color: #4caf50;
}

.version-date {
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.version-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.version-changes {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px;
    border-left: 4px solid #1976d2;
}

.version-item.latest .version-changes {
    border-left-color: #4caf50;
}

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

.change-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 14px;
    line-height: 1.5;
}

.change-item:last-child {
    margin-bottom: 0;
}

.change-type {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: white;
}

.change-type.new {
    background: #4caf50;
}

.change-type.fix {
    background: #ff9800;
}

.change-type.improve {
    background: #2196f3;
}

.change-type.feature {
    background: #9c27b0;
}

.change-text {
    flex: 1;
    color: #555;
}

/* 미리보기 모드 선택 버튼 스타일 */
.preview-mode-selector {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.preview-mode-selector label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    white-space: nowrap;
    flex-shrink: 0;
}

.mode-buttons {
    display: flex;
    gap: 4px;
    background: #f5f5f5;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.mode-btn {
    flex: 1;
    padding: 6px 10px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    white-space: nowrap;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.8);
    color: #333;
    transform: translateY(-1px);
}

.mode-btn.active {
    background: #4A90E2;
    color: white;
    box-shadow: 0 2px 4px rgba(74, 144, 226, 0.3);
    font-weight: 600;
}

.mode-btn.active:hover {
    background: #3A7BC8;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(74, 144, 226, 0.4);
}

.mode-btn:active {
    transform: translateY(0);
}

