* {
    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, #f5f7fa 0%, #c3cfe2 100%);
    color: #333;
    overflow: hidden;
    height: 100vh;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    padding: 15px;
    gap: 15px;
}

/* 상단 컨트롤 */
.top-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 15px 25px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

/* 헤더 버튼 통일 스타일 */
.header-btn {
    padding: 10px 20px;
    font-size: 0.95em;
    font-weight: 600;
    color: white;
    background: #667eea;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.25);
    min-width: 100px;
    text-align: center;
}

.header-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
    background: #5568d3;
}

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

/* 녹음시작 버튼 - 파란색 */
.header-btn#recordBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.header-btn#recordBtn:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8a 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.header-btn#recordBtn.recording {
    background: linear-gradient(135deg, #f5576c 0%, #e63946 100%);
    animation: pulse 1.5s infinite;
    box-shadow: 0 2px 8px rgba(245, 87, 108, 0.4);
}

.header-btn#recordBtn.recording:hover {
    background: linear-gradient(135deg, #e63946 0%, #d32f2f 100%);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.5);
}

/* 녹음저장 버튼 - 초록색 */
.header-btn#saveBtn {
    background: linear-gradient(135deg, #4caf50 0%, #66bb6a 100%);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.header-btn#saveBtn:hover {
    background: linear-gradient(135deg, #45a049 0%, #4caf50 100%);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

/* 초기화 버튼 - 주황색 */
.header-btn#clearBtn {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
}

.header-btn#clearBtn:hover {
    background: linear-gradient(135deg, #f57c00 0%, #ef6c00 100%);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.85;
    }
}

.status-small {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 500;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1976d2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.status-small.recording {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    color: #c62828;
}

.status-small.connected {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    color: #2e7d32;
}

.status-small.error {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    color: #e65100;
}

/* 메인 콘텐츠 영역 */
.main-content {
    display: flex;
    flex: 1;
    gap: 20px;
    overflow: hidden;
    min-height: 0;
}

/* 텍스트 패널 */
.text-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: box-shadow 0.3s ease;
    gap: 0;
}

/* 섹션 구분 */
.current-section {
    flex: 0 0 200px; /* 진행 중 영역: 고정 높이 200px (기존 150px에서 증가) */
    display: flex;
    flex-direction: column;
    border-bottom: 2px solid #e0e0e0;
    min-height: 0;
}

.completed-section {
    flex: 1; /* 완료된 영역: 나머지 공간 모두 사용 */
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.section-label {
    padding: 8px 15px;
    font-size: 0.85em;
    font-weight: 600;
    color: #666;
    background: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.current-text {
    font-size: 0.95em;
    padding: 15px;
    line-height: 1.6;
    min-height: 120px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
}

.completed-text {
    font-size: 1.05em;
    padding: 15px;
    line-height: 1.7;
}

.completed-sentence {
    margin-bottom: 10px;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.95em;
    line-height: 1.6;
}

.completed-sentence.source-microphone {
    background: rgba(102, 126, 234, 0.15);
    border-left: 4px solid #667eea;
    color: #333;
}

.completed-sentence.source-system {
    background: rgba(255, 255, 255, 0.9);
    border-left: 4px solid #999;
    color: #333;
    border: 1px solid #e0e0e0;
}

.sentence-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 0.8em;
}

.source-label {
    font-weight: 600;
    color: #555;
}

.source-microphone .source-label {
    color: #667eea;
}

.source-system .source-label {
    color: #666;
    font-weight: 700;
}

.timestamp {
    color: #999;
    font-size: 0.85em;
}

.sentence-text {
    color: #333;
}

.completed-translation-item {
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(118, 75, 162, 0.05);
    border-radius: 8px;
    border-left: 3px solid #764ba2;
}

.completed-translation-item .source {
    color: #666;
    font-size: 0.85em;
    margin-bottom: 6px;
    font-style: italic;
    line-height: 1.5;
}

.completed-translation-item .translation {
    color: #764ba2;
    font-weight: 600;
    font-size: 0.95em;
    line-height: 1.6;
}

.text-panel:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.left-panel {
    border-left: 4px solid #667eea;
}

.right-panel {
    border-left: 4px solid #764ba2;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 2px solid #f0f0f0;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);
    flex-shrink: 0;
}

.lang-info {
    font-size: 0.85em;
    color: #333;
    padding: 8px 12px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 6px;
    white-space: nowrap;
    font-weight: 500;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-header h2 {
    font-size: 1.3em;
    color: #555;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.lang-select {
    padding: 10px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95em;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 150px;
    font-weight: 500;
    color: #555;
}

.lang-select:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.lang-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
}

/* 텍스트 표시 영역 */
.text-display {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    font-size: 1.1em;
    line-height: 1.7;
    word-wrap: break-word;
    background: white;
    min-height: 0;
}

.text-display.source-text {
    background: linear-gradient(to bottom, #ffffff 0%, #fafbff 100%);
}

.text-display.translated-text {
    background: linear-gradient(to bottom, #ffffff 0%, #fefaff 100%);
}

.text-display .placeholder {
    color: #bbb;
    font-style: italic;
    font-size: 0.85em;
    display: block;
    text-align: center;
    margin-top: 50px;
}

.text-display .interim {
    color: #999;
    font-style: italic;
    opacity: 0.7;
    font-size: 0.9em;
}

.text-display .final {
    color: #333;
    font-weight: 500;
    font-size: 0.95em;
}

.text-display .translation {
    color: #764ba2;
    font-weight: 600;
    line-height: 1.7;
    font-size: 0.95em;
}

.text-display .translation-item {
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(118, 75, 162, 0.05);
    border-radius: 8px;
    border-left: 3px solid #764ba2;
}

.text-display .translation-item .source {
    color: #666;
    font-size: 0.85em;
    margin-bottom: 6px;
    font-style: italic;
    line-height: 1.5;
}

.text-display .translation-item .translation {
    color: #764ba2;
    font-weight: 600;
    font-size: 0.95em;
    line-height: 1.6;
}

.text-display .error {
    color: #e74c3c;
    font-weight: 600;
    padding: 15px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 8px;
    border-left: 3px solid #e74c3c;
}

/* 스크롤바 스타일링 */
.text-display::-webkit-scrollbar {
    width: 10px;
}

.text-display::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 5px;
}

.text-display::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 5px;
}

.text-display::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8a 100%);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .app-container {
        padding: 15px;
        gap: 15px;
    }

    .main-content {
        flex-direction: column;
        gap: 15px;
    }

    .panel-header {
        padding: 15px 20px;
    }

    .panel-header h2 {
        font-size: 1.1em;
    }

    .lang-select {
        min-width: 120px;
        font-size: 0.9em;
        padding: 8px 12px;
    }

    .text-display {
        font-size: 1.0em;
        padding: 15px;
        line-height: 1.6;
    }
    
    .current-text {
        font-size: 0.9em;
        padding: 10px;
    }
    
    .completed-text {
        font-size: 1.0em;
        padding: 12px;
    }

    .top-controls {
        padding: 12px 20px;
    }
}
