/* ===========================
   공문 톤 체크 & 금지어 검사기
   Style Sheet
   =========================== */

/* CSS 변수 정의 */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #06b6d4;
    
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    --transition: all 0.3s ease;
}

/* 리셋 및 기본 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Malgun Gothic', '맑은 고딕', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

/* 컨테이너 레이아웃 */
.container {
    display: grid;
    grid-template-columns: 1fr 300px;
    grid-template-rows: auto 1fr;
    gap: 20px;
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    min-height: calc(100vh - 250px);
}

/* 페이지 컨테이너 (네비게이션 고정 고려) */
.page-container {
    padding-top: 90px;
}

/* 헤더 */
.header {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 30px 40px;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo i {
    font-size: 2.5rem;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

.subtitle {
    margin-top: 10px;
    opacity: 0.9;
    font-size: 1rem;
}

/* 메인 콘텐츠 */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 섹션 공통 스타일 */
.input-section,
.result-section,
.sidebar-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow-md);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.section-header h2 {
    font-size: 1.3rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header h2 i {
    color: var(--primary-color);
}

/* 버튼 스타일 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.template-buttons {
    display: flex;
    gap: 10px;
}

/* 텍스트 입력 영역 */
.textarea-wrapper {
    position: relative;
    margin-bottom: 20px;
}

#inputText {
    width: 100%;
    min-height: 250px;
    padding: 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    line-height: 1.8;
    resize: vertical;
    transition: var(--transition);
    font-family: inherit;
}

#inputText:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.char-count {
    position: absolute;
    bottom: 10px;
    right: 15px;
    font-size: 0.875rem;
    color: var(--text-muted);
    background: var(--card-bg);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

/* 점수 패널 */
.score-panel {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: var(--radius-lg);
    padding: 25px;
    text-align: center;
    margin-bottom: 20px;
}

.score-panel h3 {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.gauge-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 15px;
}

.gauge {
    width: 200px;
    height: 20px;
    background: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.gauge-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--danger-color), var(--warning-color), var(--success-color));
    border-radius: 10px;
    transition: width 0.8s ease;
}

.score-display {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.score-unit {
    font-size: 1.2rem;
    color: var(--text-muted);
}

.score-comment {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* 통계 패널 */
.stats-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-color);
}

/* 문제 문장 패널 */
.issues-panel {
    margin-bottom: 20px;
}

.issues-panel h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    color: var(--text-color);
}

.issues-panel h3 i {
    color: var(--warning-color);
}

.issues-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    background: var(--bg-color);
    color: var(--text-muted);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.tab-btn:hover {
    background: var(--border-color);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
}

.issues-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px;
}

.no-issues {
    color: var(--text-muted);
    text-align: center;
    padding: 30px;
}

.issue-item {
    padding: 12px 15px;
    margin-bottom: 8px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--warning-color);
    cursor: pointer;
    transition: var(--transition);
}

.issue-item:hover {
    background: var(--border-color);
    transform: translateX(5px);
}

.issue-item.forbidden {
    border-left-color: var(--danger-color);
}

.issue-item.emotional {
    border-left-color: var(--warning-color);
}

.issue-item.speculative {
    border-left-color: var(--info-color);
}

.issue-item.informal {
    border-left-color: var(--secondary-color);
}

.issue-type {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    margin-bottom: 5px;
}

.issue-type.forbidden {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.issue-type.emotional {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.issue-type.speculative {
    background: rgba(6, 182, 212, 0.1);
    color: var(--info-color);
}

.issue-type.informal {
    background: rgba(100, 116, 139, 0.1);
    color: var(--secondary-color);
}

.issue-text {
    font-size: 0.95rem;
    color: var(--text-color);
}

.issue-highlight {
    background: rgba(239, 68, 68, 0.2);
    padding: 1px 4px;
    border-radius: 2px;
    font-weight: 600;
}

/* 수정 제안 박스 */
.suggestion-box {
    margin-top: 10px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
    border-radius: 6px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.suggestion-label {
    font-weight: 600;
    color: #166534;
}

.suggestion-original {
    background: #fecaca;
    color: #991b1b;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
    text-decoration: line-through;
}

.suggestion-arrow {
    color: #166534;
    font-weight: bold;
}

.suggestion-text {
    background: #bbf7d0;
    color: #166534;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
}

/* 미리보기 패널 */
.preview-panel {
    margin-bottom: 20px;
}

.preview-panel h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    color: var(--text-color);
}

.preview-panel h3 i {
    color: var(--primary-color);
}

.preview-content {
    padding: 20px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
    min-height: 150px;
    max-height: 400px;
    overflow-y: auto;
    line-height: 2;
    white-space: pre-wrap;
    word-break: break-word;
}

.no-preview {
    color: var(--text-muted);
    text-align: center;
}

/* 하이라이트 스타일 */
.highlight-forbidden {
    background: rgba(239, 68, 68, 0.3);
    border-bottom: 2px solid var(--danger-color);
    padding: 1px 2px;
    border-radius: 2px;
    cursor: pointer;
}

.highlight-emotional {
    background: rgba(245, 158, 11, 0.3);
    border-bottom: 2px solid var(--warning-color);
    padding: 1px 2px;
    border-radius: 2px;
    cursor: pointer;
}

.highlight-speculative {
    background: rgba(6, 182, 212, 0.3);
    border-bottom: 2px solid var(--info-color);
    padding: 1px 2px;
    border-radius: 2px;
    cursor: pointer;
}

.highlight-informal {
    background: rgba(100, 116, 139, 0.3);
    border-bottom: 2px solid var(--secondary-color);
    padding: 1px 2px;
    border-radius: 2px;
    cursor: pointer;
}

.highlight-passive {
    background: rgba(139, 92, 246, 0.3);
    border-bottom: 2px solid #8b5cf6;
    padding: 1px 2px;
    border-radius: 2px;
    cursor: pointer;
}

.highlight-difficult-word {
    background: rgba(236, 72, 153, 0.3);
    border-bottom: 2px solid #ec4899;
    padding: 1px 2px;
    border-radius: 2px;
    cursor: pointer;
}

.highlight-long-sentence {
    background: rgba(249, 115, 22, 0.2);
    border-left: 3px solid #f97316;
    padding-left: 5px;
}

/* 사이드바 */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-md);
}

.sidebar-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--text-color);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-section h3 i {
    color: var(--primary-color);
}

/* 설정 그룹 */
.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
}

.setting-group textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    resize: vertical;
    font-family: inherit;
    margin-bottom: 10px;
}

.setting-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* 체크박스 그룹 */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

/* 기본 금지어 목록 */
.default-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding: 5px;
}

.default-list .tag {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
}

/* 팁 목록 */
.tips-list {
    list-style: none;
}

.tips-list li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.tips-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
}

/* 푸터 */
.footer {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* 스크롤바 스타일 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* 반응형 디자인 */
@media (max-width: 1200px) {
    .container {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        order: 3;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header {
        padding: 20px;
    }
    
    .logo h1 {
        font-size: 1.3rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .template-buttons {
        width: 100%;
        flex-direction: column;
    }
    
    .template-buttons .btn {
        width: 100%;
        justify-content: center;
    }
    
    .gauge-container {
        flex-direction: column;
    }
    
    .stats-panel {
        grid-template-columns: 1fr;
    }
    
    .issues-tabs {
        justify-content: center;
    }
}

/* 애니메이션 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.issue-item {
    animation: fadeIn 0.3s ease;
}

/* 로딩 상태 */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 툴팁 */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: var(--text-color);
    color: white;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}
