/**
 * 공통 스타일시트
 * 모든 SPA에서 이 파일을 로드하여 일관된 디자인을 적용합니다.
 */

/* 리셋 및 기본 설정 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #e8eaf6 0%, #f3e5f5 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* 타이틀 */
h1 {
    text-align: center;
    color: #4a5568;
    margin-bottom: 10px;
    font-size: 2rem;
}

.subtitle {
    text-align: center;
    color: #718096;
    margin-bottom: 30px;
    font-size: 0.95rem;
}

/* 그리드 레이아웃 */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

/* 패널 */
.panel {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
}

.panel-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.badge {
    padding: 3px 8px;
    font-size: 0.7rem;
    font-weight: 500;
    color: #667eea;
    background: #e8eaf6;
    border: 1px solid #c5cae9;
    border-radius: 10px;
}

.panel-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

/* 버튼 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn:disabled {
    background: #ccc;
    color: #888;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: #f0f0f0;
    color: #555;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(17, 153, 142, 0.4);
}

.btn-convert {
    padding: 16px 48px;
    font-size: 1.1rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(240, 147, 251, 0.4);
}

.btn-convert:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(240, 147, 251, 0.5);
}

.btn-convert:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 파일 업로드 */
.file-upload {
    display: none;
}

/* 텍스트 영역 */
.textarea-wrapper {
    position: relative;
}

textarea {
    width: 100%;
    height: 180px;
    padding: 16px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s;
}

/* 결과 텍스트 영역 */
textarea.result-textarea {
    height: 800px !important;
    background: #f8f9fa;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
}

textarea::placeholder {
    color: #aaa;
}

/* 변환 섹션 */
.convert-section {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

/* 결과 패널 */
.result-panel {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    margin-bottom: 100px;
}


/* 통계 */
.stats {
    display: flex;
    gap: 20px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.stat-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
}

.stat-item span {
    font-weight: 700;
    margin-left: 6px;
}

/* 토스트 메시지 */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 0.95rem;
    opacity: 0;
    transition: all 0.3s;
    z-index: 1000;
}

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

.toast.success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

/* 힌트 텍스트 */
.format-hint {
    font-size: 0.8rem;
    color: #888;
    margin-top: 8px;
}

/* 옵션 영역 */
.options {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.options-vertical {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 체크박스 */
.checkbox-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: #555;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 4px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.checkbox-label:hover .checkmark {
    border-color: #667eea;
}

/* 아이콘 */
.icon {
    width: 16px;
    height: 16px;
}

/* 색상 미리보기 */
.color-preview {
    width: 100%;
    height: 800px;
    padding: 16px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    background: #f8f9fa;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    resize: vertical;
}

.tag-highlight {
    padding: 2px 4px;
    border-radius: 4px;
    border: 1px solid;
    margin: 0 1px;
}

/* 태그 범례 */
.tag-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e8e8e8;
}

.legend-title {
    font-weight: 600;
    color: #4a5568;
    font-size: 0.85rem;
    margin-right: 8px;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.legend-item {
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.8rem;
}

.legend-hint {
    width: 100%;
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid #e8e8e8;
    font-size: 0.8rem;
    color: #888;
}

/* 태그 충돌 에러 */
.conflict-error {
    padding: 20px;
}

.conflict-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #c0392b;
    margin-bottom: 12px;
}

.conflict-desc {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 20px;
}

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

.conflict-group {
    background: #fdecea;
    border-left: 4px solid #c0392b;
    border-radius: 4px;
    padding: 12px;
}

.conflict-key {
    font-weight: 600;
    color: #c0392b;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.conflict-line {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    background: white;
    padding: 8px 12px;
    border-radius: 4px;
}

.conflict-line:last-child {
    margin-bottom: 0;
}

.conflict-line code {
    flex: 1;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    color: #333;
    white-space: pre;
}

.btn-copy-line {
    padding: 4px 10px;
    font-size: 0.75rem;
    background: #e0e0e0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: #555;
    transition: all 0.2s;
}

.btn-copy-line:hover {
    background: #d0d0d0;
}

/* 검증 에러 */
.validation-error {
    padding: 20px;
}

.validation-error-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #c0392b;
    margin-bottom: 12px;
}

.validation-error-desc {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 20px;
}

.validation-error-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 600px;
    overflow-y: auto;
}

.validation-error-item {
    background: #fdecea;
    border-left: 4px solid #c0392b;
    border-radius: 4px;
    padding: 12px;
}

.validation-error-message {
    font-size: 0.9rem;
    color: #c0392b;
    margin-bottom: 8px;
}

.validation-error-line {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 8px 12px;
    border-radius: 4px;
}

.validation-error-line code {
    flex: 1;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    color: #333;
    white-space: pre;
    overflow-x: auto;
}

.validation-error-summary {
    margin-top: 16px;
    padding: 12px 16px;
    background: #fff3cd;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #856404;
}

/* 공통 푸터 */
.footer {
    text-align: center;
    margin-top: 60px;
    padding: 20px;
    color: #718096;
    font-size: 0.9rem;
}

.footer a {
    color: #667eea;
    text-decoration: none;
    transition: color 0.2s;
}

.footer a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.footer-separator {
    margin: 0 10px;
    color: #cbd5e0;
}
