/* 음성 파일 업로드 페이지 스타일 */

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 2rem;
    color: var(--text-color);
}

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

header {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

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

.upload-section {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

.field-label {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 1rem;
}

/* 성별 선택 스타일 */
.gender-selection {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.radio-group {
    display: flex;
    gap: 1.5rem;
}

.radio-label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    font-weight: 500;
}

.radio-label:hover {
    border-color: var(--primary-color);
    background: #f0f4ff;
    transform: translateY(-2px);
}

.radio-label input[type="radio"] {
    margin-right: 0.5rem;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.radio-label input[type="radio"]:checked {
    accent-color: var(--primary-color);
}

.radio-label:has(input:checked) {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* 파일 섹션 */
.file-section {
    margin-top: 1.5rem;
}

#fileInputsContainer {
    margin-bottom: 1.5rem;
}

.file-input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 1.25rem;
    background: var(--bg-color);
    border-radius: 0.75rem;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.file-input-wrapper:hover {
    border-color: var(--primary-color);
    background: #f0f4ff;
}

.file-input-wrapper input[type="file"] {
    padding: 0.5rem;
    font-size: 0.95rem;
    width: 100%;
}

/* 인라인 성별 선택 */
.inline-gender-selection {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.gender-field-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
}

.inline-radio-label {
    display: flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.inline-radio-label:hover {
    border-color: var(--primary-color);
    background: #f0f4ff;
}

.inline-radio-label input[type="radio"] {
    margin-right: 0.5rem;
    cursor: pointer;
}

.inline-radio-label:has(input:checked) {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.remove-file-btn {
    background: var(--error-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.remove-file-btn:hover {
    background: #dc2626;
    transform: scale(1.05);
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.btn {
    flex: 1;
    padding: 1rem 2rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-primary:disabled {
    background: var(--secondary-color);
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

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

.file-info {
    background: #f0f9ff;
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    border-radius: 0.5rem;
}

.file-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0.3rem 0;
}

/* 프로그레스 섹션 */
.progress-section {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

.progress-section.hidden,
.results-section.hidden {
    display: none;
}

.progress-section h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--text-color);
}

.progress-container {
    margin-bottom: 2rem;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: var(--bg-color);
    border-radius: 1rem;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    border-radius: 1rem;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
    margin-top: 0.5rem;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.step-item {
    flex: 1;
    text-align: center;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 0.75rem;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.step-item.active {
    opacity: 1;
    background: #f0f4ff;
    border: 2px solid var(--primary-color);
    transform: scale(1.05);
}

.step-item.completed {
    opacity: 1;
    background: #ecfdf5;
    border: 2px solid var(--success-color);
}

.step-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.step-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-color);
}

/* 결과 섹션 */
.results-section {
    background: var(--card-bg);
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.results-section h2 {
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

.result-item {
    background: var(--bg-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--success-color);
}

.result-item.error {
    border-left-color: var(--error-color);
}

.result-item h3 {
    color: var(--text-color);
    /* margin-bottom: 1rem; */
    font-size: 1.2rem;
}

.result-section {
    margin-bottom: 1rem;
}

.result-section h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.result-section .script {
    background: white;
    padding: 1rem;
    border-radius: 0.5rem;
    /* font-family: 'Courier New', monospace; */
    line-height: 1.6;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.result-section .metadata {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.error-message {
    color: var(--error-color);
    font-weight: 500;
    padding: 1rem;
    background: #fef2f2;
    border-radius: 0.5rem;
    margin-top: 0.5rem;
}

.summary {
    background: #f0f9ff;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.summary .success {
    color: var(--success-color);
}

.summary .error {
    color: var(--error-color);
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .upload-section,
    .progress-section,
    .results-section {
        padding: 1.5rem;
    }

    .button-group,
    .radio-group {
        flex-direction: column;
    }

    .file-input-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .progress-steps {
        flex-wrap: wrap;
    }

    .step-item {
        min-width: calc(50% - 0.5rem);
    }
}

/* 그래프 관련 스타일 */
.chart-container {
    position: relative;
    width: 100%;
    background: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
    overflow-x: auto;
}

.chart-container canvas {
    max-width: 100%;
    height: auto !important;
    cursor: grab;
}

.chart-container canvas:active {
    cursor: grabbing;
}

.chart-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    background: #f0f9ff;
    border-radius: 0.5rem;
    flex-wrap: wrap;
}

.chart-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chart-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15);
}

.chart-btn:active {
    transform: translateY(0);
}

.chart-info {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: right;
}

@media (max-width: 768px) {
    .chart-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .chart-info {
        text-align: center;
    }

    .chart-btn {
        width: 100%;
    }
}

/* 단어별 강세 정보 테이블 */
.word-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.word-table thead {
    background: var(--primary-color);
    color: white;
}

.word-table th,
.word-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.word-table th {
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.word-table td {
    font-size: 0.95rem;
}

.word-table tbody tr:hover {
    background: #f8fafc;
}

.word-table tbody tr:last-child td {
    border-bottom: none;
}

/* 강세 표시 문장 */
.accent-sentence {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.accent-high {
    color: var(--error-color);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: var(--error-color);
    text-decoration-thickness: 2px;
}

.accent-low {
    color: var(--primary-color);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-color: var(--primary-color);
    text-decoration-thickness: 2px;
}

.pause {
    color: var(--text-muted);
    font-style: italic;
    margin: 0 0.25rem;
}

@media (max-width: 768px) {
    .word-table {
        font-size: 0.85rem;
    }

    .word-table th,
    .word-table td {
        padding: 0.5rem 0.75rem;
    }

    .accent-sentence {
        font-size: 1rem;
        padding: 1rem;
    }
}

/* 점수별 색상 구분 문장 */
.score-sentence {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.score-low {
    color: #dc2626;
    font-weight: 700;
}

.score-medium {
    color: #f59e0b;
    font-weight: 600;
}

.score-high {
    color: #10b981;
    font-weight: 600;
}

@media (max-width: 768px) {
    .score-sentence {
        font-size: 1rem;
        padding: 1rem;
    }
}

/* 점수 기준표 (범례) */
.score-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.legend-dot.score-high {
    background-color: #10b981;
}

.legend-dot.score-medium {
    background-color: #f59e0b;
}

.legend-dot.score-low {
    background-color: #dc2626;
}

.legend-label {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 500;
}

@media (max-width: 768px) {
    .score-legend {
        gap: 1rem;
    }
    
    .legend-label {
        font-size: 0.85rem;
    }
}

/* 음소별 발음 점수 */
.phoneme-sentence {
    background: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    font-size: 1.3rem;
    line-height: 1.8;
    /* font-family: 'Courier New', monospace; */
    letter-spacing: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.phoneme-error {
    color: #dc2626;
    font-weight: 900;
}

.phoneme-normal {
    color: #1e293b;
}

@media (max-width: 768px) {
    .phoneme-sentence {
        font-size: 1.1rem;
        padding: 1rem;
        letter-spacing: 1px;
    }
}

/* 처리 방식 선택 UI */
.processing-mode-section {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #f1f5f9;
    border-radius: 12px;
}

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

.mode-option {
    cursor: pointer;
    display: block;
}

.mode-option input[type="radio"] {
    display: none;
}

.mode-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    height: 100%;
}

.mode-option input[type="radio"]:checked + .mode-card {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(99, 102, 241, 0.1) 100%);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.mode-option:hover .mode-card {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.mode-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.mode-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.mode-note {
    font-size: 0.85rem;
    color: #6366f1;
    font-weight: 500;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #e2e8f0;
}

/* 이메일 입력 섹션 */
.email-section {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    border: 2px dashed #cbd5e1;
    transition: all 0.3s ease;
}

.email-section.hidden {
    display: none;
}

.email-input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    margin-top: 0.5rem;
    transition: all 0.3s ease;
}

.email-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.email-note {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    font-style: italic;
}

/* 반응형 처리 */
@media (max-width: 768px) {
    .mode-options {
        grid-template-columns: 1fr;
    }
    
    .processing-mode-section {
        padding: 1rem;
    }
}