/* 기본 레이아웃 스타일 */
.stream-editor-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
    background: #f8f9fa;
    min-height: 100vh;
}

.editor-header {
    text-align: center;
    margin-bottom: 24px;
    background: white;
    padding: 24px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
}

.editor-header h1 {
    color: #212529;
    margin-bottom: 8px;
    font-size: 1.8em;
    font-weight: 600;
}

.subtitle {
    color: #6c757d;
    font-size: 1em;
    margin: 0;
    font-weight: 400;
}

/* 입력 섹션 */
.input-section {
    background: white;
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
}

.keyword-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.keyword-input-wrapper input {
    flex: 1;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #495057;
    font-size: 0.9em;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    background: #fff;
}

.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.1);
}

.form-help {
    display: block;
    margin-top: 4px;
    color: #6c757d;
    font-size: 0.85em;
}

.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.generation-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 24px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.btn-large {
    padding: 12px 24px;
    font-size: 1em;
    font-weight: 600;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,123,255,0.2);
    transition: all 0.2s ease;
}

.btn-large:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,123,255,0.3);
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.checkbox-label:hover {
    background: rgba(0,123,255,0.05);
}

.checkbox-label input[type="checkbox"] {
    width: auto !important;
    margin-right: 8px;
    transform: scale(1.1);
}

.checkbox-text {
    font-weight: 400;
    color: #495057;
    font-size: 0.9em;
}

/* 콤보박스 스타일 */
.combobox-wrapper {
    position: relative;
    display: block;
}

.combobox-input {
    width: 100%;
    padding: 8px 40px 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9em;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.combobox-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
}

.combobox-toggle {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 30px;
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6c757d;
    transition: color 0.2s;
}

.combobox-toggle:hover {
    color: #495057;
}

.combobox-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ced4da;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.combobox-dropdown.open {
    display: block;
}

.combobox-option {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.2s;
    outline: none;
}

.combobox-option:hover,
.combobox-option:focus {
    background: #f8f9fa;
    outline: none;
}

.combobox-option:last-child {
    border-bottom: none;
}

.combobox-option[data-value="자동분류"] {
    background: #e8f5e8;
    font-weight: 500;
    color: #28a745;
}

.combobox-option[data-value="자동분류"]:hover,
.combobox-option[data-value="자동분류"]:focus {
    background: #d4edda;
}

/* 진행상황 섹션 */
.progress-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
}

.progress-header h3 {
    margin: 0 0 12px 0;
    color: #495057;
    font-size: 1.1em;
    font-weight: 600;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin: 12px 0 20px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #20c997);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px 12px;
    border-radius: 8px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
    min-height: 100px;
    justify-content: center;
}

.step.active {
    background: #e3f2fd;
    border-color: #2196F3;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.15);
}

.step.completed {
    background: #e8f5e8;
    border-color: #4CAF50;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.15);
}

.step.error {
    background: #fff5f5 !important;
    border-color: #dc3545 !important;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.15) !important;
}

.step.error .step-icon {
    background: #dc3545 !important;
    color: white !important;
}

.step-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.step.active .step-icon {
    background: #2196F3;
    color: white;
    animation: pulse 1.5s infinite;
}

.step.completed .step-icon {
    background: #4CAF50;
    color: white;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.step-text {
    font-weight: 500;
    margin-bottom: 4px;
    color: #495057;
    font-size: 0.9em;
}

.step-status {
    font-size: 0.8em;
    color: #6c757d;
    font-weight: 400;
}

.step.active .step-status {
    color: #2196F3;
    font-weight: 500;
}

.step.completed .step-status {
    color: #4CAF50;
    font-weight: 500;
}

/* 컨텐츠 섹션들 */
.think-section, .document-section, .keywords-section {
    background: white;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
    overflow: hidden;
}

.think-header, .document-header, .keywords-header {
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.think-header h3, .document-header h3, .keywords-header h3 {
    margin: 0;
    color: #495057;
    font-size: 1.1em;
    font-weight: 600;
}

.think-content {
    padding: 20px;
    background: #f8f9fa;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
    line-height: 1.5;
    color: #495057;
    border-radius: 0;
    font-size: 0.9em;
    scroll-behavior: smooth;
}

.document-tabs {
    display: flex;
    gap: 0;
}

.tab-button {
    padding: 10px 16px;
    border: none;
    background: #e9ecef;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    border-radius: 0;
    font-size: 0.9em;
}

.tab-button:first-child {
    border-radius: 4px 0 0 0;
}

.tab-button:last-child {
    border-radius: 0 4px 0 0;
}

.tab-button.active {
    background: #007bff;
    color: white;
}

.tab-button:hover:not(.active) {
    background: #dee2e6;
}

.document-content {
    padding: 0;
}

.tab-content {
    display: none;
    min-height: 400px;
}

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

#documentContent {
    width: 100%;
    min-height: 400px;
    border: none;
    padding: 20px;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    background: #fff;
    color: #495057;
}

.markdown-preview {
    padding: 20px;
    min-height: 400px;
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.6;
    color: #495057;
    scroll-behavior: smooth;
}

.keywords-content {
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.keyword-link {
    display: inline-block;
    padding: 6px 12px;
    background: #e3f2fd;
    color: #1976d2;
    text-decoration: none;
    border-radius: 16px;
    border: 1px solid #bbdefb;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.85em;
}

.keyword-link:hover {
    background: #bbdefb;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(25, 118, 210, 0.2);
}

/* 액션 버튼들 */
.editor-actions {
    text-align: center;
    padding: 20px;
    gap: 12px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
}

.required {
    color: #dc3545;
    font-weight: bold;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.9em;
    min-width: 100px;
}

.btn-primary {
    background: #007bff;
    color: white;
    box-shadow: 0 2px 4px rgba(0,123,255,0.2);
}

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,123,255,0.3);
}

.btn-success {
    background: #28a745;
    color: white;
    box-shadow: 0 2px 4px rgba(40,167,69,0.2);
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(40,167,69,0.3);
}

.btn-outline {
    background: white;
    color: #6c757d;
    border: 1px solid #6c757d;
}

.btn-outline:hover {
    background: #6c757d;
    color: white;
    transform: translateY(-1px);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85em;
    min-width: auto;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-auto-classify {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
    box-shadow: 0 2px 4px rgba(23,162,184,0.2);
}

.btn-auto-classify:hover {
    background: #138496;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(23,162,184,0.3);
}

.btn-auto-classify:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* 분류 추천 섹션 */
.classification-section {
    background: white;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
    overflow: hidden;
}

.classification-header {
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.classification-header h3 {
    margin: 0;
    color: #495057;
    font-size: 1.1em;
    font-weight: 600;
}

.classification-help {
    color: #6c757d;
    font-size: 0.85em;
}

.classification-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.classification-option {
    padding: 16px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.classification-option:hover {
    border-color: #007bff;
    background: #f8f9fa;
}

.classification-option.selected {
    border-color: #007bff;
    background: #e3f2fd;
    box-shadow: 0 2px 8px rgba(0,123,255,0.15);
}

.classification-option .category-path {
    font-weight: 600;
    color: #007bff;
    margin-bottom: 4px;
    font-size: 0.95em;
}

.classification-option .category-description {
    color: #6c757d;
    font-size: 0.85em;
    line-height: 1.4;
}

.classification-actions {
    padding: 16px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .stream-editor-page {
        padding: 12px;
    }
    
    .editor-header {
        padding: 16px;
    }
    
    .editor-header h1 {
        font-size: 1.6em;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .progress-steps {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
    
    .generation-controls {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .editor-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 280px;
    }
    
    .input-section {
        padding: 16px;
    }
    
    .think-content, #documentContent, .markdown-preview {
        padding: 12px;
    }
    
    .think-header, .document-header, .keywords-header {
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    .progress-steps {
        grid-template-columns: 1fr;
    }
    
    .step {
        min-height: 80px;
        padding: 12px 8px;
    }
    
    .step-icon {
        width: 28px;
        height: 28px;
        font-size: 0.8em;
    }
    
    .step-text {
        font-size: 0.8em;
    }
    
    .step-status {
        font-size: 0.75em;
    }
}