/* Enhanced Spell Check Styles */

/* Beta Version Notice */
.beta-notice {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 1px solid #ffeaa7;
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.beta-notice i {
    color: #856404;
    font-size: 1.5rem;
    margin-top: 2px;
    flex-shrink: 0;
}

.beta-notice .notice-content {
    flex: 1;
}

.beta-notice .notice-content strong {
    color: #856404;
    font-size: 1.1rem;
    display: block;
    margin-bottom: 5px;
}

.beta-notice .notice-content p {
    color: #856404;
    margin: 0;
    line-height: 1.4;
}

/* 검사 성공 결과 */
.spell-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 1px solid #c3e6cb;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    color: #155724;
}

.spell-success i {
    font-size: 3rem;
    color: #28a745;
    margin-bottom: 15px;
    display: block;
}

.spell-success h4 {
    color: #155724;
    margin: 0 0 10px 0;
    font-size: 1.3rem;
}

.spell-success p {
    color: #155724;
    margin: 0;
    opacity: 0.8;
}

/* 오류 목록 스타일 - 심플 디자인 */
.spell-errors {
    margin-top: 20px;
}

.errors-summary {
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.summary-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #495057;
    font-size: 1.1rem;
    font-weight: 600;
}

.summary-title i {
    color: #dc3545;
    font-size: 1.3rem;
}

.apply-all-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.apply-all-btn:hover {
    background: #218838;
    transform: translateY(-1px);
}

.apply-all-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
}

/* 개별 오류 아이템 - 심플 디자인 */
.error-item {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.error-item:hover {
    border-color: #adb5bd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.error-item.applied {
    opacity: 0.6;
    background: #f8f9fa;
    border-color: #28a745;
}

.error-header {
    padding: 12px 15px 8px 15px;
    border-bottom: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.error-type {
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    color: white;
}

.error-type.spelling {
    background: #dc3545;
}

.error-type.spacing {
    background: #ffc107;
    color: #212529;
}

.error-type.grammar {
    background: #6f42c1;
}

.error-position {
    color: #6c757d;
    font-size: 0.8rem;
}

.error-content {
    padding: 8px 15px 12px 15px;
}

.error-text-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 8px;
}

.error-before, .error-after {
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-label {
    font-size: 0.85rem;
    color: #6c757d;
    min-width: 30px;
}

.error-text {
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.error-original-text {
    background: #fff2f2;
    color: #dc3545;
    text-decoration: line-through;
    border: 1px solid #f5c6cb;
}

.error-suggestion-text {
    background: #f0f9f0;
    color: #28a745;
    font-weight: 600;
    border: 1px solid #c3e6cb;
}

.error-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
}

.btn-apply {
    background: #007bff;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-apply:hover {
    background: #0056b3;
}

.btn-apply:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.error-description {
    color: #6c757d;
    font-size: 0.9rem;
    font-style: italic;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f8f9fa;
}

/* 교정된 텍스트 섹션 */
.corrected-text-section {
    margin-top: 30px;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
}

.corrected-text-section h5 {
    color: #495057;
    margin: 0 0 15px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.corrected-text-section h5 i {
    color: #6f42c1;
}

.corrected-text {
    position: relative;
}

.corrected-text textarea {
    width: 100%;
    min-height: 120px;
    padding: 15px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    background: white;
    resize: vertical;
}

.corrected-text button {
    margin-top: 10px;
    padding: 8px 16px;
    font-size: 0.9rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.corrected-text button.btn-success {
    background: #28a745 !important;
    border-color: #28a745 !important;
    transform: scale(1.05);
}

/* 로딩 상태 스타일 */
.spell-loading {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.spell-loading i {
    font-size: 2rem;
    color: #007bff;
    margin-bottom: 15px;
    display: block;
}

.spell-loading p {
    margin: 0;
    font-size: 1.1rem;
}

/* 오류 상태 스타일 */
.spell-error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border: 1px solid #f5c6cb;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    color: #721c24;
}

.spell-error i {
    font-size: 2.5rem;
    color: #dc3545;
    margin-bottom: 15px;
    display: block;
}

.spell-error p {
    margin: 0;
    font-size: 1rem;
}

/* 결과 없음 상태 */
.spell-no-result {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.spell-no-result i {
    font-size: 3rem;
    color: #dee2e6;
    margin-bottom: 15px;
    display: block;
}

.spell-no-result p {
    margin: 0;
    font-size: 1rem;
}

/* 통계 정보 스타일 */
.spell-stats {
    background: #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #495057;
    display: block;
}

.stat-label {
    font-size: 0.8rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 검사 소스 표시 */
.summary-source {
    margin: 10px 0;
    padding: 8px 12px;
    background: #e9ecef;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #495057;
}

.source-info {
    display: flex;
    align-items: center;
    gap: 5px;
}

.summary-stats {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.stat-item {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
}

.stat-item.spelling {
    background: #dc3545;
}

.stat-item.spacing {
    background: #ffc107;
    color: #212529;
}

.stat-item.grammar {
    background: #6f42c1;
}

.stat-item.style {
    background: #17a2b8;
}

/* 오류 소스 표시 */
.error-source {
    font-size: 1.1rem;
    margin-left: auto;
}

/* 신뢰도 표시 */
.error-confidence {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
}

.confidence-label {
    color: #6c757d;
    font-weight: bold;
    min-width: 50px;
}

.confidence-bar {
    flex: 1;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #dc3545 0%, #ffc107 50%, #28a745 100%);
    transition: width 0.3s ease;
}

.confidence-value {
    font-weight: bold;
    color: #495057;
    min-width: 40px;
    text-align: right;
}

/* API 정보 */
.api-info {
    margin-top: 20px;
    padding: 12px;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: 8px;
    border-left: 4px solid #2196f3;
}

.api-info small {
    color: #1565c0;
    line-height: 1.4;
}

/* 스타일 오류 전용 색상 */
.error-type.style {
    background: #17a2b8;
    color: white;
}

/* 향상된 검사 결과 헤더 */
.summary-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 5px;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .error-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .error-original, .error-suggestion {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .summary-stats {
        flex-direction: column;
        gap: 5px;
    }
    
    .stat-item {
        align-self: flex-start;
    }
    
    .error-confidence {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .confidence-bar {
        width: 100%;
    }
    
    .corrected-text textarea {
        font-size: 16px; /* 모바일에서 줌 방지 */
    }
    
    .api-info {
        margin-top: 15px;
        padding: 10px;
    }
}

.spell-check-result.success p {
    color: #155724;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.text-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.7);
    padding: 8px 12px;
    border-radius: 15px;
    font-size: 0.9rem;
    color: #155724;
}

.spell-check-result.error {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    overflow: hidden;
}

.spell-check-result.error h4 {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    padding: 15px 20px;
    margin: 0;
    border-bottom: 1px solid #f5c6cb;
}

.error-summary {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
}

.error-type-counts {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.error-count {
    background: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.error-count.spacing {
    border-left: 4px solid #2196F3;
}

.error-count.spelling {
    border-left: 4px solid #FF9800;
}

.error-count.grammar {
    border-left: 4px solid #9C27B0;
}

.errors-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 0 20px;
}

.error-item {
    border-bottom: 1px solid #eee;
    padding: 15px 0;
}

.error-item:last-child {
    border-bottom: none;
}

.error-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.error-type {
    font-weight: 600;
    font-size: 0.9rem;
}

.error-position {
    background: #e9ecef;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    color: #6c757d;
    margin-left: auto;
}

.error-content {
    padding-left: 25px;
}

.error-text {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.original-text {
    background: #ffebee;
    color: #c62828;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
}

.suggested-text {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
}

.error-message {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 10px;
    line-height: 1.4;
}

.apply-suggestion {
    font-size: 0.8rem;
    padding: 4px 12px;
}

.corrected-text-section {
    background: #f8f9fa;
    padding: 20px;
    border-top: 1px solid #ddd;
}

.corrected-text-section h5 {
    color: #495057;
    margin-bottom: 15px;
}

.corrected-text {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    font-family: inherit;
    line-height: 1.6;
    margin-bottom: 15px;
    max-height: 200px;
    overflow-y: auto;
}

.corrected-text-section .action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .error-type-counts {
        flex-direction: column;
        align-items: center;
    }
    
    .error-text {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .text-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .corrected-text-section .action-buttons {
        flex-direction: column;
    }
    
    .corrected-text-section .action-buttons .btn {
        width: 100%;
    }
}

/* Server-based Spell Check Styles */
.spell-check-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 30px;
}

.spell-input-section, .spell-result-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 25px;
}

.spell-input-section h4, .spell-result-section h4 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.spell-input-section .input-area textarea {
    width: 100%;
    min-height: 200px;
    border: 2px solid #e8f4f8;
    border-radius: 8px;
    padding: 15px;
    font-size: 1rem;
    line-height: 1.5;
    resize: vertical;
    font-family: 'Noto Sans KR', sans-serif;
}

.spell-input-section .input-area textarea:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.spell-actions {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.spell-options {
    display: flex;
    gap: 20px;
}

.spell-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #555;
}

.spell-buttons {
    display: flex;
    gap: 10px;
}

.spell-result-area {
    min-height: 250px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
}

.spell-loading {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.spell-loading i {
    font-size: 2rem;
    margin-bottom: 15px;
    color: #3498db;
}

.spell-no-result {
    text-align: center;
    padding: 40px 20px;
    color: #6c757d;
}

.spell-no-result i {
    font-size: 2rem;
    margin-bottom: 15px;
    color: #17a2b8;
}

.spell-success {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border-radius: 8px;
}

.spell-success i {
    font-size: 3rem;
    color: #28a745;
    margin-bottom: 15px;
}

.spell-success h4 {
    color: #155724;
    margin-bottom: 10px;
}

.spell-success p {
    color: #155724;
}

.spell-error {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border-radius: 8px;
}

.spell-error i {
    font-size: 2.5rem;
    color: #dc3545;
    margin-bottom: 15px;
}

.spell-error p {
    color: #721c24;
}

.spell-errors {
    max-height: 400px;
    overflow-y: auto;
}

.errors-summary {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.errors-summary i {
    color: #856404;
    font-size: 1.5rem;
}

.errors-summary h4 {
    color: #856404;
    margin: 0;
}

.errors-list {
    margin-bottom: 25px;
}

.error-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
}

.error-header {
    background: #f8f9fa;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
}

.error-type {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.error-type.spelling {
    background: #e3f2fd;
    color: #1565c0;
}

.error-type.spacing {
    background: #f3e5f5;
    color: #7b1fa2;
}

.error-type.grammar {
    background: #e8f5e8;
    color: #2e7d32;
}

.error-position {
    font-size: 0.8rem;
    color: #6c757d;
}

.error-content {
    padding: 15px;
}

.error-original, .error-suggestion {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.error-original .label, .error-suggestion .label {
    font-weight: 600;
    color: #495057;
    min-width: 40px;
}

.error-original .text {
    background: #ffebee;
    color: #c62828;
    padding: 4px 8px;
    border-radius: 4px;
    text-decoration: line-through;
}

.error-suggestion .text {
    background: #e8f5e8;
    color: #2e7d32;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 500;
}

.btn-apply {
    background: #28a745;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-apply:hover {
    background: #218838;
}

.error-description {
    font-size: 0.9rem;
    color: #6c757d;
    font-style: italic;
    margin-top: 5px;
}

.corrected-text-section {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
}

.corrected-text-section h5 {
    color: #495057;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.corrected-text {
    position: relative;
}

.corrected-text textarea {
    width: 100%;
    min-height: 120px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    padding: 12px;
    font-family: 'Noto Sans KR', sans-serif;
    line-height: 1.5;
    resize: vertical;
    margin-bottom: 10px;
}

.corrected-text button {
    align-self: flex-start;
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .spell-check-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .spell-actions {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .spell-buttons {
        width: 100%;
        justify-content: center;
    }
    
    .spell-options {
        justify-content: center;
    }
}