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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    scroll-behavior: smooth;
    overflow-x: hidden;
    position: relative;
}

/* 스크롤 동작 최적화 */
* {
    scroll-behavior: smooth;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* 헤더 스타일 */
.header {
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 40px 20px;
    border-radius: 20px;
    margin-bottom: 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 10;
    transform: none;
    will-change: auto;
}

.header h1 {
    font-size: 2.5rem;
    color: #4a5568;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2rem;
    color: #718096;
    font-style: italic;
    margin-bottom: 15px;
}

.description {
    font-size: 1rem;
    color: #a0aec0;
    max-width: 600px;
    margin: 0 auto;
}

/* 메인 콘텐츠 */
.main-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px 40px 40px 40px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 5;
    margin-top: 0;
    overflow: visible;
}

/* 입력 섹션 */
.input-section {
    margin-bottom: 40px;
    margin-top: 0;
    padding-top: 0;
    position: relative;
    z-index: 1;
}

.input-section h2 {
    color: #4a5568;
    margin-bottom: 30px;
    margin-top: 0;
    font-size: 1.8rem;
    position: relative;
    z-index: 1;
}

.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
}

.input-group select,
.input-group input,
.input-group textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.input-group select:focus,
.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.input-group textarea {
    height: 120px;
    resize: vertical;
}

.analyze-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
}

.analyze-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

/* 분석 과정 시각화 */
.analysis-section {
    margin-bottom: 40px;
}

.analysis-section h2 {
    color: #4a5568;
    margin-bottom: 30px;
    font-size: 1.8rem;
}

.analysis-progress {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.progress-step {
    display: flex;
    align-items: center;
    padding: 20px;
    background: #f7fafc;
    border-radius: 15px;
    border-left: 5px solid #e2e8f0;
    transition: all 0.5s ease;
}

.progress-step.active {
    border-left-color: #667eea;
    background: #edf2f7;
    transform: translateX(10px);
}

.progress-step.completed {
    border-left-color: #48bb78;
    background: #f0fff4;
}

.step-icon {
    font-size: 2rem;
    margin-right: 20px;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.progress-step.active .step-icon {
    opacity: 1;
    animation: pulse 2s infinite;
}

.step-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: #4a5568;
    flex: 1;
}

.step-detail {
    font-size: 0.9rem;
    color: #718096;
    margin-top: 5px;
    font-style: italic;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* 결과 섹션 */
.results-section {
    margin-bottom: 40px;
}

.results-section h2 {
    color: #4a5568;
    margin-bottom: 30px;
    font-size: 1.8rem;
}

.timeline-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-left: 5px solid #e2e8f0;
    transition: transform 0.3s ease;
    min-height: auto;
    height: auto;
    position: relative;
}

.timeline-card:hover {
    transform: translateY(-5px);
}

.past-analysis {
    border-left-color: #6b7280;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
}

.present-analysis {
    border-left-color: #10b981;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

.future-analysis {
    border-left-color: #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.timeline-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.timeline-icon {
    font-size: 2rem;
    margin-right: 15px;
}

.timeline-header h3 {
    font-size: 1.5rem;
    color: #4a5568;
    margin-right: 15px;
}

.timeline-role {
    background: #e2e8f0;
    color: #718096;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.timeline-content {
    color: #4a5568;
    line-height: 1.8;
    min-height: auto;
    overflow: visible;
    padding: 25px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    margin: 15px 0;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    font-size: 1.05rem;
    letter-spacing: 0.02em;
}

/* 샘플 시나리오 */
.sample-scenarios h2 {
    color: #4a5568;
    margin-bottom: 30px;
    font-size: 1.8rem;
}

.scenario-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.scenario-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.scenario-card:hover {
    transform: translateY(-5px);
}

.scenario-card h4 {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.scenario-card p {
    color: #718096;
    margin-bottom: 20px;
    line-height: 1.6;
}

.scenario-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.scenario-btn:hover {
    background: #5a67d8;
}

/* 푸터 */
.footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: rgba(255, 255, 255, 0.8);
}

.footer p {
    margin-bottom: 5px;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .coach-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .coach-icon {
        margin-bottom: 10px;
    }
    
    .scenario-cards {
        grid-template-columns: 1fr;
    }
}

/* 로딩 애니메이션 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 타이핑 효과 */
.typing-effect {
    overflow: hidden;
    border-right: 2px solid #667eea;
    white-space: nowrap;
    animation: typing 2s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: #667eea; }
}

/* 마크다운 스타일링 */
.coach-content h1,
.coach-content h2,
.coach-content h3 {
    margin: 15px 0 10px 0;
    color: #4a5568;
}

.coach-content h1 {
    font-size: 1.5rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 5px;
}

.coach-content h2 {
    font-size: 1.3rem;
    color: #667eea;
}

.coach-content h3 {
    font-size: 1.1rem;
    color: #718096;
}

.coach-content strong {
    font-weight: 700;
    color: #2d3748;
}

.coach-content em {
    font-style: italic;
    color: #4a5568;
}

.coach-content code {
    background: #f7fafc;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #e53e3e;
}

.coach-content pre {
    background: #2d3748;
    color: #e2e8f0;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}

.coach-content pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.coach-content li {
    margin: 5px 0;
    padding-left: 10px;
}

.coach-content .emoji {
    font-size: 1.2em;
    margin-right: 5px;
}

.coach-content .bullet {
    color: #667eea;
    font-weight: bold;
    margin-right: 8px;
}

/* 타임머신 스트리밍 효과 */
.streaming-text {
    animation: timeFadeIn 0.3s ease-in;
}

@keyframes timeFadeIn {
    from { 
        opacity: 0;
        transform: translateX(-10px);
    }
    to { 
        opacity: 1;
        transform: translateX(0);
    }
}

/* 타임머신 스크롤 애니메이션 */
.smooth-scroll {
    scroll-behavior: smooth;
}

/* 결과 섹션 스크롤 최적화 */
.results-section {
    scroll-behavior: smooth;
}

/* 타임머신 스트리밍 인디케이터 */
.streaming-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(102, 126, 234, 0.95);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
}

.streaming-indicator.active {
    transform: translateX(0);
}

.streaming-indicator::before {
    content: '⏳';
    font-size: 1.2em;
    animation: timePulse 1.5s infinite;
}

@keyframes timePulse {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.7;
        transform: scale(0.9);
    }
}

/* 오류 메시지 스타일 */
.error-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #fee;
    border: 2px solid #f56565;
    border-radius: 10px;
    padding: 20px;
    z-index: 2000;
    box-shadow: 0 10px 30px rgba(245, 101, 101, 0.3);
    animation: slideDown 0.3s ease-out;
}

.error-content h3 {
    color: #c53030;
    margin-bottom: 10px;
}

.error-content p {
    color: #4a5568;
    margin-bottom: 15px;
}

.error-content button {
    background: #f56565;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
}

.error-content button:hover {
    background: #e53e3e;
}

.error-message {
    background: #fef5e7;
    border: 1px solid #f6ad55;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.error-message h4 {
    color: #c05621;
    margin-bottom: 10px;
}

.error-message p {
    color: #744210;
    margin-bottom: 5px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* 로딩 상태 스타일 */
.loading-state {
    text-align: center;
    padding: 40px 20px;
    color: #718096;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loading-state p {
    font-size: 1.1rem;
    font-weight: 600;
}

/* 타이핑 커서 효과 */
.typing-cursor {
    animation: blink 1s infinite;
    color: #667eea;
    font-weight: bold;
    font-size: 1.2em;
    background: rgba(102, 126, 234, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
    margin-left: 2px;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* 타임머신 스트리밍 텍스트 강조 */
.timeline-content {
    position: relative;
}

.timeline-content.streaming {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(240, 240, 240, 0.9) 100%);
    border: 2px solid #667eea;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
    transform: scale(1.02);
    transition: all 0.3s ease;
}


/* 스트리밍 인디케이터 */
.streaming-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(102, 126, 234, 0.95);
    color: white;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
}

.streaming-indicator.active {
    transform: translateX(0);
}

.streaming-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.5;
        transform: scale(0.8);
    }
}


/* 실시간 스트리밍 효과 */
.coach-content.streaming .emoji {
    /* 애니메이션 제거 */
}

/* 타임머신 스트리밍 중 강조 효과 */
.timeline-content.streaming h3,
.timeline-content.streaming h4 {
    color: #667eea;
    transition: color 0.3s ease;
}

.timeline-content.streaming .bullet {
    color: #667eea;
    font-weight: bold;
}

/* 타임머신 마크다운 스타일링 */
.timeline-content h1 {
    font-size: 1.8rem;
    font-weight: bold;
    color: #2d3748;
    margin: 1.5rem 0 1rem 0;
    border-bottom: 3px solid #667eea;
    padding-bottom: 0.8rem;
    position: relative;
}

.timeline-content h1::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: -3px;
    width: 50px;
    height: 3px;
    background: #667eea;
}

.timeline-content h2 {
    font-size: 1.5rem;
    font-weight: bold;
    color: #4a5568;
    margin: 1.3rem 0 0.8rem 0;
    padding-left: 15px;
    border-left: 4px solid #667eea;
    background: rgba(102, 126, 234, 0.05);
    padding: 0.8rem 0 0.8rem 15px;
    border-radius: 0 8px 8px 0;
}

.timeline-content h3 {
    font-size: 1.3rem;
    font-weight: bold;
    color: #667eea;
    margin: 1rem 0 0.6rem 0;
    padding: 0.5rem 0;
    border-bottom: 2px solid #e2e8f0;
}

.timeline-content strong {
    font-weight: bold;
    color: #2d3748;
    background: rgba(102, 126, 234, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
}

.timeline-content em {
    font-style: italic;
    color: #4a5568;
    background: rgba(72, 187, 120, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
}

.timeline-content code {
    background-color: #2d3748;
    color: #e2e8f0;
    border: 1px solid #4a5568;
    border-radius: 6px;
    padding: 4px 8px;
    font-family: 'Courier New', 'Monaco', monospace;
    font-size: 0.9em;
    font-weight: 500;
}

.timeline-content pre {
    background-color: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    overflow-x: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.timeline-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: #e2e8f0;
    font-size: 0.9em;
}

.timeline-content li {
    margin: 0.5rem 0;
    padding-left: 0.8rem;
    position: relative;
}

.timeline-content li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.7rem;
    width: 6px;
    height: 6px;
    background: #667eea;
    border-radius: 50%;
}

.timeline-content ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.timeline-content ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.timeline-content ul li {
    list-style: none;
}

.timeline-content ol li {
    list-style: decimal;
    padding-left: 0.5rem;
}

.timeline-content ol li::before {
    display: none;
}

.timeline-content .emoji {
    font-size: 1.3em;
    margin-right: 0.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    display: inline-block;
    animation: emojiFloat 2s ease-in-out infinite;
}

@keyframes emojiFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-2px); }
}

.timeline-content .bullet {
    color: #667eea;
    font-weight: bold;
    margin-right: 0.8rem;
    font-size: 1.2em;
}

/* 전체 페이지 스크롤 통합 - 내부 스크롤 완전 제거 */
* {
    overflow-x: hidden;
}

section, .coach-card, .coach-content, .main-content, .input-section, .results-section {
    overflow: visible !important;
    max-height: none !important;
}

/* 코드 블록만 가로 스크롤 허용 */
pre {
    overflow-x: auto !important;
}

/* 스크롤 겹침 문제 해결 */
.header {
    position: relative;
    z-index: 100;
    transform: none;
    will-change: auto;
    isolation: isolate;
}

.main-content {
    position: relative;
    z-index: 50;
    transform: translateZ(0);
    will-change: transform;
    isolation: isolate;
}

.input-section {
    isolation: isolate;
    contain: layout;
}

/* 스크롤 시 부드러운 전환 */
html {
    scroll-padding-top: 0;
}

body {
    scroll-padding-top: 0;
}

/* 겹침 방지를 위한 추가 규칙 */
.container > * {
    position: relative;
    z-index: auto;
}

.container .header {
    z-index: 100;
}

.container .main-content {
    z-index: 50;
}