/* =============================================
   2열 레이아웃 에디터 스타일
   ============================================= */

.two-column-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    padding: 24px;
    min-height: 100vh;
    background: var(--bg-body);
}

/* 왼쪽 열 - 글 편집 */
.left-column {
    position: relative;
}

.left-column-sticky {
    position: sticky;
    top: 24px;
    background: white;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.editor-header-section h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-main);
}

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

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-main);
}

.form-group input[type="text"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-soft);
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.2s;
}

.form-group input[type="text"]:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

/* 에디터 툴바 */
.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.editor-mode-switcher {
    display: flex;
    gap: 4px;
    background: var(--bg-sidebar);
    padding: 4px;
    border-radius: 8px;
}

.mode-btn {
    padding: 6px 14px;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}

.mode-btn.active {
    background: white;
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.mode-btn:hover:not(.active) {
    color: var(--text-main);
}

/* 에디터 컨테이너 */
.editor-container {
    border: 2px solid var(--border-soft);
    border-radius: 12px;
    overflow: hidden;
    background: white;
    display: none;
}

.editor-container.active {
    display: block;
}

#quill-editor {
    min-height: 400px;
    font-size: 15px;
}

#code-editor {
    width: 100%;
    min-height: 400px;
    padding: 16px;
    border: none;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
}

.help-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* 2열 폼 */
.form-row-two {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.form-row-two .form-group {
    margin-bottom: 0;
}

.form-group label input[type="checkbox"] {
    margin-right: 8px;
}

/* 액션 버튼 */
.action-buttons-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-soft);
}

.btn-primary-large {
    width: 100%;
    padding: 16px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary-large:hover {
    background: #00b0c4;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 198, 220, 0.3);
}

.btn-secondary {
    width: 100%;
    padding: 12px 20px;
    background: var(--bg-sidebar);
    color: var(--text-main);
    border: 2px solid var(--border-soft);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: white;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* 오른쪽 열 - 파트 워크플로우 */
.right-column {
    /* 높이 제한 제거 - 전체 스크롤로 변경 */
}

.parts-header {
    background: white;
    padding: 24px;
    border-radius: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.parts-header h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
}

.workflow-desc {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
}

/* 파트 리스트 */
.parts-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 파트 카드 */
.part-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border-left: 4px solid rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.part-card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    transform: translateX(4px);
}

.part-card.status-completed {
    border-left-color: #10b981;
}

.part-card.status-selecting {
    border-left-color: #f59e0b;
}

.part-card.status-ready {
    border-left-color: var(--primary-color);
}

.part-card.status-pending {
    border-left-color: #d1d5db;
}

/* 파트 헤더 */
.part-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-soft);
}

.part-number-badge {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: var(--primary-soft);
    color: var(--primary-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.part-title-section {
    flex: 1;
}

.part-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 6px 0;
    color: var(--text-main);
}

.part-preview {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.5;
}

.part-status {
    flex-shrink: 0;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge.success {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.info {
    background: var(--primary-soft);
    color: #0e7490;
}

.status-badge.default {
    background: var(--bg-sidebar);
    color: var(--text-muted);
}

/* 파트 섹션 */
.part-section {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-sidebar);
    border-radius: 12px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-main);
}

.section-icon {
    font-size: 18px;
}

/* 프롬프트 표시 */
.prompt-display-box {
    background: white;
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
    margin-bottom: 8px;
}

.prompt-display-box p {
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-main);
}

/* 버튼들 */
.btn-action {
    width: 100%;
    padding: 12px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-action:hover {
    background: #00b0c4;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 198, 220, 0.3);
}

.btn-mini {
    padding: 6px 14px;
    background: white;
    color: var(--text-main);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-mini:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* 이미지 그리드 */
.image-grid-3,
.part-images-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.image-label {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.image-thumb-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s;
}

.image-thumb-item:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.image-thumb-item.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-soft);
}

.image-thumb-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.selected-check {
    position: absolute;
    inset: 0;
    background: rgba(0, 198, 220, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    font-weight: 700;
}

/* Empty 상태 */
.empty-parts {
    background: white;
    border-radius: 20px;
    padding: 60px 40px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-parts h4 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-main);
}

.empty-parts p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.6;
}

.btn-primary {
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #00b0c4;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 198, 220, 0.3);
}

/* =============================================
   전체 화면 진행 애니메이션
   ============================================= */

.fullscreen-progress-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: fadeIn 0.3s ease-out;
}

.progress-content {
    text-align: center;
    color: white;
}

.progress-icon {
    font-size: 80px;
    margin-bottom: 24px;
    animation: pulse 2s infinite;
}

.progress-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 12px;
}

.progress-message {
    font-size: 16px;
    opacity: 0.8;
    margin-bottom: 32px;
}

.progress-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.progress-bar-container {
    width: 400px;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 24px;
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    animation: progressMove 2s ease-in-out infinite;
}

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

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

@keyframes progressMove {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(400%);
    }
}

/* ===================================================== */
/* 아코디언 스타일 */
/* ===================================================== */

.accordion-card {
    transition: all 0.3s ease;
}

.accordion-card .part-card-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: white;
    border-radius: 12px;
    transition: all 0.2s;
}

.accordion-card .part-card-header:hover {
    background: var(--bg-sidebar);
}

.part-actions-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.btn-action-inline {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-action-inline:hover {
    background: #00b0c4;
    transform: translateY(-1px);
}

.accordion-toggle-icon {
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.3s;
}

.accordion-card.collapsed .accordion-toggle-icon {
    transform: rotate(-90deg);
}

.accordion-content {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
    opacity: 1;
    padding: 16px;
}

.accordion-card.collapsed .accordion-content {
    max-height: 0;
    opacity: 0;
    padding: 0 16px;
}

/* 반응형 */
@media (max-width: 1200px) {
    .two-column-layout {
        grid-template-columns: 1fr;
    }
    
    .left-column-sticky {
        position: relative;
        top: 0;
    }
    
    .image-grid-3 {
        grid-template-columns: 1fr;
    }
    
    .progress-bar-container {
        width: 80vw;
    }
    
    .part-actions-inline {
        flex-wrap: wrap;
    }
}


/* =============================================
   이미지 원본 보기 모달
   ============================================= */

.image-zoom-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    backdrop-filter: blur(4px);
    padding: 20px;
}

.image-zoom-modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    max-width: 1200px;
    max-height: 90vh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: modalFadeIn 0.3s ease-out;
}

/* 이미지 편집 모달 */
.image-edit-modal {
    max-width: 1400px;
}

.modal-body-two-columns {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 32px;
    padding: 32px;
    overflow-y: auto;
}

.modal-left-column,
.modal-right-column {
    min-height: 0;
}

.original-image-section h4,
.edited-images-section h4,
.edit-request-section h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-main);
}

.image-actions {
    margin-top: 16px;
    display: flex;
    gap: 12px;
}

/* 수정된 이미지 영역 */
.edited-images-section {
    border-top: 1px solid var(--border-soft);
    padding-top: 24px;
}

.edited-images-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.edited-image-item {
    background: var(--bg-body);
    border-radius: 12px;
    padding: 16px;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.edited-image-item:hover {
    border-color: var(--primary-color);
}

.edited-image {
    width: 100%;
    height: auto;
    border-radius: 8px;
    margin-bottom: 12px;
}

.edited-image-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn-replace-image {
    flex: 1;
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-replace-image:hover {
    background: #00a8c6;
    transform: translateY(-1px);
}

.btn-download-small {
    padding: 10px 16px;
    background: var(--text-muted);
    color: white;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-download-small:hover {
    background: var(--text-main);
}

/* 수정 요청 섹션 */
.edit-request-section {
    background: var(--bg-body);
    padding: 24px;
    border-radius: 12px;
    position: sticky;
    top: 0;
}

.edit-description {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.5;
}

.edit-request-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-soft);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
}

.edit-request-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-edit-image {
    width: 100%;
    margin-top: 16px;
}

.edit-status {
    text-align: center;
    padding: 16px;
    background: var(--primary-soft);
    border-radius: 8px;
}

.edit-status .loading {
    margin: 0 auto 12px;
}

.edit-status p {
    font-size: 14px;
    color: var(--text-main);
    margin: 0;
}

/* 이미지 업데이트 애니메이션 */
@keyframes flash {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 16px 16px 0 0;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s;
}

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

.modal-body {
    flex: 1;
    overflow: auto;
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    min-height: 400px;
}

.modal-image {
    max-width: 100%;
    max-height: calc(90vh - 160px);
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 16px 16px;
}

.btn-download {
    padding: 10px 20px;
    background: #3b82f6;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
}

.btn-download:hover {
    background: #2563eb;
}

.btn-close-modal {
    padding: 10px 20px;
    background: #f3f4f6;
    color: #374151;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
}

.btn-close-modal:hover {
    background: #e5e7eb;
}

/* 이미지 썸네일 래퍼 (원본 버튼 포함) */
.image-thumb-wrapper {
    position: relative;
}

.btn-view-original {
    width: 100%;
    margin-top: 8px;
    padding: 6px 12px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 500;
    font-size: 13px;
}

.btn-view-original:hover {
    background: #2563eb;
}
