/* 전역 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a90e2;
    --secondary-color: #357abd;
    --success-color: #5cb85c;
    --danger-color: #d9534f;
    --warning-color: #f0ad4e;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --border-color: #e1e8ed;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

body {
    font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* 헤더 */
header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 40px 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

header h1 i {
    font-size: 2.2rem;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 300;
}

/* 메인 콘텐츠 */
main {
    padding: 40px 30px;
}

section {
    margin-bottom: 40px;
}

section h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 업로드 영역 */
.upload-section {
    margin-bottom: 30px;
}

.upload-area {
    border: 3px dashed var(--border-color);
    border-radius: 12px;
    padding: 60px 30px;
    text-align: center;
    background: var(--bg-color);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #f0f5ff;
    transform: translateY(-2px);
}

.upload-area.drag-over {
    border-color: var(--primary-color);
    background: #e3f2fd;
    transform: scale(1.02);
}

.upload-area i {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    display: block;
}

.upload-area p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

#fileInput {
    display: none;
}

.btn-upload {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.btn-upload:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* 옵션 섹션 */
.options-section {
    background: var(--bg-color);
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 12px;
    background: white;
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.option-item:hover {
    background: #f8f9fa;
    border-color: var(--primary-color);
}

.option-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.option-item span {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* 결과 섹션 */
.result-section {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.result-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-action {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-action:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.btn-clear {
    background: var(--danger-color);
}

.btn-clear:hover {
    background: #c9302c;
}

.result-stats {
    background: var(--bg-color);
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    font-size: 0.9rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 5px;
}

.stat-value {
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
}

.result-content {
    background: var(--bg-color);
    border-radius: 8px;
    overflow: hidden;
}

#resultText {
    width: 100%;
    min-height: 400px;
    max-height: 600px;
    padding: 20px;
    border: none;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    background: white;
    color: var(--text-primary);
}

#resultText:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

/* 다중 파일 결과 */
.multi-result-section {
    animation: fadeIn 0.4s ease;
}

#multiResultContainer {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.multi-result-item {
    background: var(--bg-color);
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid var(--primary-color);
}

.multi-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.multi-result-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.multi-result-text {
    background: white;
    padding: 15px;
    border-radius: 6px;
    max-height: 300px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 푸터 */
footer {
    background: var(--bg-color);
    padding: 20px 30px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
}

/* 토스트 알림 */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--text-primary);
    color: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 1000;
    pointer-events: none;
    max-width: 400px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.toast.success {
    background: var(--success-color);
}

.toast.error {
    background: var(--danger-color);
}

.toast.warning {
    background: var(--warning-color);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header h1 {
        font-size: 1.8rem;
        flex-direction: column;
        gap: 10px;
    }

    .subtitle {
        font-size: 1rem;
    }

    main {
        padding: 25px 20px;
    }

    .upload-area {
        padding: 40px 20px;
    }

    .upload-area i {
        font-size: 3rem;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .result-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .result-actions {
        width: 100%;
    }

    .btn-action {
        flex: 1;
        justify-content: center;
    }

    .result-stats {
        grid-template-columns: 1fr;
    }

    .toast {
        left: 10px;
        right: 10px;
        bottom: 10px;
    }
}

/* 스크롤바 스타일 */
#resultText::-webkit-scrollbar,
.multi-result-text::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#resultText::-webkit-scrollbar-track,
.multi-result-text::-webkit-scrollbar-track {
    background: var(--bg-color);
}

#resultText::-webkit-scrollbar-thumb,
.multi-result-text::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

#resultText::-webkit-scrollbar-thumb:hover,
.multi-result-text::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}
