/**
 * Style Guide Management Modal CSS
 * 스타일 가이드 관리 모달 스타일
 *
 * @version 1.0.0
 * @since 2026-01-21
 */

/* ===== 모달 오버레이 ===== */
.style-manage-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1050;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* ===== 모달 콘텐츠 ===== */
.style-manage-modal-content {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 900px;
    max-height: 63vh; /* 90vh에서 30% 감소 */
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* ===== 헤더 ===== */
.style-manage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.style-manage-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #212529;
}

.style-manage-title i {
    color: #6c757d;
}

/* ===== 가이드 선택 ===== */
.style-manage-selector {
    padding: 12px 20px;
    border-bottom: 1px solid #e9ecef;
    background: #fff;
}

.selector-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.selector-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #495057;
    white-space: nowrap;
}

.selector-row .form-select {
    flex: 1;
}

/* ===== 설정 바 ===== */
.style-manage-settings-bar {
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
    padding: 12px 20px 16px;
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 12px;
}

.settings-row:last-child {
    margin-bottom: 0;
}

.settings-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #495057;
    white-space: nowrap;
}

.settings-value {
    font-size: 0.8rem;
    color: #212529;
    font-weight: 500;
}

.settings-input {
    font-size: 0.85rem;
    padding: 4px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    width: 200px;
}

.settings-input-wide {
    flex: 1;
    width: auto;
    min-width: 300px;
}

.settings-group-fullwidth {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-input:focus {
    border-color: #86b7fe;
    outline: none;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.15);
}

.settings-input-small {
    font-size: 0.85rem;
    padding: 4px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    width: 60px;
    text-align: center;
}

.settings-unit {
    font-size: 0.8rem;
    color: #6c757d;
}

/* ===== 가중치 3-State Chip ===== */
.weight-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.weight-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

/* OFF 상태 (비활성) */
.weight-chip[data-state="off"] {
    background: #e9ecef;
    color: #6c757d;
    border-color: #dee2e6;
}

.weight-chip[data-state="off"]:hover {
    background: #dee2e6;
    border-color: #ced4da;
}

/* LOW 상태 (기본 검사/요약) */
.weight-chip[data-state="low"] {
    background: #e7f1ff;
    color: #0d6efd;
    border-color: #b6d4fe;
}

.weight-chip[data-state="low"]:hover {
    background: #d0e5ff;
    border-color: #9ec5fe;
}

/* HIGH 상태 (상세 검사/요약) */
.weight-chip[data-state="high"] {
    background: #0d6efd;
    color: #fff;
    border-color: #0a58ca;
}

.weight-chip[data-state="high"]:hover {
    background: #0b5ed7;
    border-color: #0a53be;
}

/* 상태 인디케이터 */
.weight-chip .chip-state {
    font-size: 0.65rem;
    text-transform: uppercase;
    opacity: 0.85;
}

.weight-chip[data-state="off"] .chip-state {
    display: none;
}

/* 레거시 호환 (드롭다운 스타일 - 추후 제거 예정) */
.weight-sliders {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.weight-item {
    display: flex;
    align-items: center;
    gap: 0;
}

.weight-label {
    font-size: 0.77rem;
    color: #6c757d;
    min-width: 32px;
}

.weight-select {
    font-size: 0.75rem;
    padding: 4px 4px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    width: 66px;
    background: #fff;
}

.weight-select:focus {
    border-color: #86b7fe;
    outline: none;
}

/* ===== 미리보기 패널 ===== */
.style-manage-preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.preview-tabs {
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid #e9ecef;
    background: #fff;
}

.preview-tab {
    background: none;
    border: none;
    padding: 10px 16px;
    font-size: 0.85rem;
    color: #6c757d;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.preview-tab:hover {
    color: #212529;
}

.preview-tab.active {
    color: #0d6efd;
    border-bottom-color: #0d6efd;
    font-weight: 500;
}

.preview-tabs-spacer {
    flex: 1;
}

.preview-language-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.language-label {
    font-size: 0.8rem;
    color: #6c757d;
}

.preview-language-toggle .form-select {
    width: auto;
    font-size: 0.8rem;
    padding: 4px 8px;
}

.preview-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    margin: 0 8px 8px 8px; /* 좌우 4px 여백 */
    background: #f4f3f3;
    border-radius: 6px;
}

.preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #6c757d;
    font-size: 0.9rem;
}

/* ===== 마크다운 렌더링 ===== */
.preview-markdown {
    font-size: 0.9rem;
    line-height: 1.6;
}

.preview-markdown h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0 0 16px;
    color: #212529;
}

.preview-markdown h4,
.preview-markdown h4.section-header {
    font-size: 1rem;
    font-weight: 600;
    margin: 20px 0 12px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #0d6efd;
}

.preview-markdown h5 {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 16px 0 8px;
    color: #495057;
}

.preview-markdown h6 {
    font-size: 0.9rem;
    font-weight: 500;
    margin: 12px 0 6px;
    color: #6c757d;
}

.preview-markdown p {
    margin: 0 0 12px;
}

.preview-markdown li {
    margin: 4px 0;
    padding-left: 8px;
}

.preview-markdown li.do-item {
    color: #198754;
}

.preview-markdown li.dont-item {
    color: #dc3545;
}

.preview-markdown code {
    background: #f1f3f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.85em;
}

.preview-markdown strong {
    font-weight: 600;
}

/* ===== 섹션 컨트롤 ===== */
.section-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.section-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.section-delete-btn {
    background: none;
    border: none;
    padding: 2px 6px;
    color: #dc3545;
    cursor: pointer;
    opacity: 0.6;
}

.section-delete-btn:hover {
    opacity: 1;
}

/* ===== 편집 모드 ===== */
.edit-sections {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.edit-component {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    background: #fafafa;
}

.edit-component-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.edit-component-header h5 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

.component-controls {
    display: flex;
    gap: 4px;
}

.component-controls .btn {
    padding: 2px 8px;
    font-size: 0.75rem;
}

.edit-section,
.edit-subsection {
    margin-bottom: 12px;
    padding: 12px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.edit-subsection {
    margin-left: 20px;
    border-color: #dee2e6;
}

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

.edit-section-header .section-controls {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.edit-section-header .section-controls .btn {
    padding: 2px 6px;
    font-size: 0.7rem;
}

.section-id {
    font-weight: 600;
    color: #6c757d;
    font-size: 0.85rem;
    min-width: 24px;
}

.section-title-input {
    flex: 1;
    font-size: 0.9rem;
    padding: 4px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
}

.section-title-input:focus,
.section-content-input:focus {
    border-color: #86b7fe;
    outline: none;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.15);
}

.section-content-input {
    width: 100%;
    font-size: 0.85rem;
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
}

.add-section {
    margin-top: 8px;
}

/* ===== 구조 뷰 ===== */
.structure-view {
    background: #1e1e1e;
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
}

.structure-view pre {
    margin: 0;
}

.structure-view code {
    color: #d4d4d4;
    font-size: 0.8rem;
    font-family: 'Monaco', 'Menlo', monospace;
}

/* ===== 액션 버튼 ===== */
.style-manage-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    flex-wrap: wrap;
}

.actions-spacer {
    flex: 1;
    min-width: 20px;
}

.style-manage-actions .btn {
    font-size: 0.8rem;
    padding: 6px 12px;
}

.style-manage-actions .btn i {
    margin-right: 4px;
}

/* ===== 토스트 ===== */
.style-manage-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    background: #212529;
    color: #fff;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.85rem;
    z-index: 1100;
    opacity: 0;
    transition: all 0.3s ease;
}

.style-manage-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ===== 요약 모달 (Phase 3.7.4) ===== */
.summarize-modal-content {
    font-size: 0.9rem;
}

.summarize-modal-content .tm-form-field {
    margin-bottom: 0;
}

.summarize-modal-content .tm-form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 6px;
}

.summarize-modal-content .tm-form-input {
    display: block;
    width: 100%;
    padding: 8px 12px;
    font-size: 0.9rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #f8f9fa;
}

.summarize-level-options,
.summarize-save-options {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #fff;
}

.summarize-level-options .form-check,
.summarize-save-options .form-check {
    padding: 4px 0;
}

.summarize-level-options .form-check-label {
    font-size: 0.85rem;
    color: #212529;
}

.summarize-level-options .form-check-label strong {
    color: #0d6efd;
}

.summarize-components .form-check {
    padding: 3px 0;
}

.summarize-components .form-check-label {
    font-size: 0.85rem;
}

/* 레거시 스타일 제거됨 - 3-State Chip 시스템 사용 */

.summarize-modal-content #summarize-new-name {
    font-size: 0.85rem;
}

.summarize-modal-content #summarize-new-name:disabled {
    background: #e9ecef;
    cursor: not-allowed;
}

/* ===== 반응형 ===== */
@media (max-width: 768px) {
    .style-manage-modal-content {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .settings-row {
        flex-wrap: wrap;
        gap: 12px;
    }

    .weight-sliders {
        flex-wrap: wrap;
        width: 100%;
    }

    .style-manage-actions {
        justify-content: center;
    }

    .actions-spacer {
        display: none;
    }
}
