/* 토론 추론 모드 전용 스타일 */

/* 로딩 스피너 (피드백 추론 모드와 동일) */
.discussion-loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* 에러 메시지 스타일 */
.error-message {
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 12px;
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.4;
}

/* 토론 설정 박스 */
.discussion-setup-box {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px var(--shadow-color);
    position: relative;
    transition: var(--transition-slow);
    max-width: 100%;
    overflow: hidden;
    word-wrap: break-word;
}

.discussion-setup-header {
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.discussion-setup-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #ff6b35;
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.discussion-setup-badge svg {
    flex-shrink: 0;
}

/* 토론 답변창 배지 (토론설정과 유사하지만 다른 색상) */
.discussion-response-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #10b981; /* 초록색 계열로 구분 */
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.discussion-response-badge svg {
    flex-shrink: 0;
}

.discussion-setup-title {
    color: var(--text-primary);
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.discussion-setup-header p {
    color: var(--text-secondary);
    font-size: 1rem;
    margin: 0;
}

.discussion-user-query {
    font-weight: bold;
    font-style: italic;
    color: #ff6b35;
    text-decoration: underline;
    text-decoration-color: rgba(255, 107, 53, 0.3);
    text-underline-offset: 2px;
}

/* 토론 설정 내용 */
.discussion-setup-content {
    margin-bottom: 2rem;
}

.discussion-agent-section {
    margin-bottom: 1.5rem;
}

.discussion-agent-section h4 {
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 0.6rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 토론 에이전트 아이콘 */
.discussion-agent-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.agent-a-icon {
    color: #3b82f6; /* 파란색 - 오른쪽을 보는 Agent-A */
}

.agent-b-icon {
    color: #10b981; /* 초록색 - 왼쪽을 보는 Agent-B */
}

.discussion-agent-prompt {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 0.8rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.5;
    white-space: pre-wrap;
    text-align: left;
    margin: 0;
    border: 1px solid var(--border-color);
}

.discussion-separator {
    text-align: center;
    color: var(--text-muted);
    margin: 1.5rem 0;
    font-weight: 300;
}

.discussion-turn-section h4 {
    color: var(--text-primary);
    font-size: 0.95rem;
    margin: 0.8rem 0 0.4rem 0;
    font-weight: 600;
}

/* 토론 버튼들 */
.discussion-setup-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

.discussion-btn {
    background: linear-gradient(45deg, #ff6b35, #f7931e);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none;
    letter-spacing: 0.3px;
    min-width: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.discussion-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 107, 53, 0.3);
    background: linear-gradient(45deg, #f7931e, #ff6b35);
}

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

.discussion-btn:disabled,
.discussion-btn.disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

/* 특정 버튼 스타일 */
.discussion-reconfig-btn {
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
}

.discussion-reconfig-btn:hover {
    background: linear-gradient(45deg, #8b5cf6, #6366f1);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.discussion-edit-btn {
    background: linear-gradient(45deg, #10b981, #059669);
}

.discussion-edit-btn:hover {
    background: linear-gradient(45deg, #059669, #10b981);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}

.discussion-execute-btn {
    background: linear-gradient(45deg, #ef4444, #dc2626);
}

.discussion-execute-btn:hover {
    background: linear-gradient(45deg, #dc2626, #ef4444);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.3);
}

/* 토론 수정 폼 */
.discussion-edit-form {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.discussion-edit-section {
    margin-bottom: 1.5rem;
}

.discussion-edit-section:last-child {
    margin-bottom: 0;
}

.discussion-edit-section label {
    display: block;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.discussion-edit-textarea {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.discussion-edit-textarea:focus {
    outline: none;
    border-color: #ff6b35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.discussion-edit-input {
    width: 100%;
    max-width: 150px;
    padding: 0.8rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.discussion-edit-input:focus {
    outline: none;
    border-color: #ff6b35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

/* 토론 로딩 상태 */
.discussion-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.discussion-loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top: 3px solid #ff6b35;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 토론 스트리밍 상태 */
.discussion-streaming {
    padding: 1rem 0;
}

.discussion-streaming-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-style: italic;
    font-size: 0.9rem;
}

.discussion-streaming-text {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    min-height: 100px;
    color: var(--text-primary);
    line-height: 1.6;
    font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 토론 에러 상태 */
.discussion-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-align: center;
}

.discussion-retry-btn {
    background: linear-gradient(45deg, #ef4444, #dc2626);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.discussion-retry-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

/* 모바일 반응형 */
@media (max-width: 768px) {
    .discussion-setup-box {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .discussion-setup-header h3 {
        font-size: 1.2rem;
    }

    .discussion-setup-buttons {
        flex-direction: column;
        gap: 0.8rem;
    }

    .discussion-btn {
        width: 100%;
        padding: 1rem;
        font-size: 0.95rem;
    }

    .discussion-agent-prompt {
        font-size: 0.75rem;
        padding: 0.7rem;
    }

    .discussion-edit-textarea {
        min-height: 100px;
        font-size: 0.85rem;
    }

    .discussion-edit-form {
        padding: 1rem;
    }

    .discussion-loading,
    .discussion-error {
        padding: 1.5rem;
        font-size: 0.9rem;
    }
}

/* 다크/라이트 모드 호환성 */
[data-theme="light"] .discussion-setup-box {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .discussion-setup-badge {
    background: rgba(255, 255, 255, 0.9);
    color: #1f2937;
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .discussion-agent-prompt {
    background: rgba(249, 250, 251, 0.8);
    color: #374151;
    border-color: rgba(0, 0, 0, 0.1);
}

/* ⭐️ 토론 설정 박스의 버튼 컨테이너 스타일 (피드백 플래너와 동일) */
.discussion-setup-buttons {
    display: flex !important;
    gap: 0.5rem !important;
    flex-wrap: wrap !important;
    justify-content: flex-end !important; /* 오른쪽 정렬 */
    padding-top: 1rem !important;
    border-top: 1px solid var(--border-color) !important;
}

/* ⭐️ 토론 설정 박스의 feedback-btn 스타일 강제 적용 */
.discussion-setup-buttons .feedback-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    padding: 0.6rem 1rem !important;
    background: transparent !important;
    border: 1px solid #6b7280 !important;
    border-radius: 8px !important;
    color: #d1d5db !important;
    cursor: pointer !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    transition: all 0.2s ease !important;
    text-decoration: none !important;
    box-shadow: none !important;
    width: auto !important;
    min-width: auto !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

.discussion-setup-buttons .feedback-btn:hover {
    background: rgba(107, 114, 128, 0.1) !important;
    border-color: #9ca3af !important;
    color: #f9fafb !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
}

.discussion-setup-buttons .feedback-btn.primary {
    background: #2563eb !important;
    color: white !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3) !important;
}

.discussion-setup-buttons .feedback-btn.primary:hover {
    background: #1d4ed8 !important;
    border-color: #2563eb !important;
    color: white !important;
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.4) !important;
}

.discussion-setup-buttons .feedback-btn:disabled,
.discussion-setup-buttons .feedback-btn.disabled {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
    transform: none !important;
    filter: grayscale(0.8) !important;
}

.discussion-setup-buttons .feedback-btn:disabled:hover,
.discussion-setup-buttons .feedback-btn.disabled:hover {
    background: transparent !important;
    border-color: #4b5563 !important;
    color: #6b7280 !important;
    transform: none !important;
    box-shadow: none !important;
}

.discussion-setup-buttons .feedback-btn svg {
    flex-shrink: 0 !important;
}

/* ⭐️ 토론 설정 박스의 각 버튼별 색상 (피드백 플래너와 동일) */
.discussion-setup-buttons .discussion-reconfig-btn {
    background: transparent !important;
    border-color: #dc2626 !important;
    color: #fca5a5 !important;
}

.discussion-setup-buttons .discussion-reconfig-btn:hover {
    background: #dc2626 !important;
    border-color: #ef4444 !important;
    color: white !important;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.4) !important;
}

.discussion-setup-buttons .discussion-edit-btn {
    background: transparent !important;
    border-color: #16a34a !important;
    color: #86efac !important;
}

.discussion-setup-buttons .discussion-edit-btn:hover {
    background: #16a34a !important;
    border-color: #22c55e !important;
    color: white !important;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.4) !important;
}

/* 라이트 모드에서의 토론 설정 버튼 스타일 */
[data-theme="light"] .discussion-setup-buttons .feedback-btn {
    background: #f8fafc !important;
    border-color: #d1d5db !important;
    color: #374151 !important;
}

[data-theme="light"] .discussion-setup-buttons .feedback-btn:hover {
    background: #e5e7eb !important;
    border-color: #9ca3af !important;
    color: #111827 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .discussion-setup-buttons .feedback-btn.primary {
    background: #2563eb !important;
    color: white !important;
    border-color: #3b82f6 !important;
}

[data-theme="light"] .discussion-setup-buttons .feedback-btn.primary:hover {
    background: #1d4ed8 !important;
    border-color: #2563eb !important;
    color: white !important;
}

/* ⭐️ 라이트 모드에서의 토론 설정 박스 각 버튼별 색상 (피드백 플래너와 동일) */
[data-theme="light"] .discussion-setup-buttons .discussion-reconfig-btn {
    background: #fef2f2 !important;
    border-color: #fecaca !important;
    color: #dc2626 !important;
}

[data-theme="light"] .discussion-setup-buttons .discussion-reconfig-btn:hover {
    background: #dc2626 !important;
    border-color: #ef4444 !important;
    color: white !important;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.3) !important;
}

[data-theme="light"] .discussion-setup-buttons .discussion-edit-btn {
    background: #f0fdf4 !important;
    border-color: #bbf7d0 !important;
    color: #15803d !important;
}

[data-theme="light"] .discussion-setup-buttons .discussion-edit-btn:hover {
    background: #16a34a !important;
    border-color: #22c55e !important;
    color: white !important;
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3) !important;
}

[data-theme="light"] .discussion-setup-buttons .feedback-btn:disabled:hover,
[data-theme="light"] .discussion-setup-buttons .feedback-btn.disabled:hover {
    background: #f8fafc !important;
    border-color: #d1d5db !important;
    color: #9ca3af !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

/* 애니메이션 효과 */
.discussion-setup-box {
    animation: fadeIn 0.6s ease-out;
}

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

.discussion-setup-content {
    animation: discussionFadeIn 0.8s ease-out 0.2s both;
}

.discussion-setup-buttons {
    animation: discussionFadeIn 0.8s ease-out 0.4s both;
} 

/* 토론 답변창은 피드백 추론 모드와 동일한 .ai-response 구조 사용 */

/* 턴 컨테이너 스타일 - 전문적이고 현대적인 디자인 */
.discussion-turn-container {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px var(--shadow-color);
    position: relative;
    transition: var(--transition-slow);
    max-width: 100%;
    overflow: hidden;
    word-wrap: break-word;
    border: 1px solid var(--border-color);
}

/* 턴 진행 중 상단 프로그레스 바 */
.discussion-turn-container.turn-in-progress::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        #3b82f6 25%, 
        #06b6d4 50%, 
        #3b82f6 75%, 
        transparent 100%);
    animation: progressSlide 2s linear infinite;
    border-radius: 15px 15px 0 0;
    z-index: 2;
}

/* 턴 진행 중 미묘한 그림자 효과 */
.discussion-turn-container.turn-in-progress {
    box-shadow: 
        0 4px 20px var(--shadow-color),
        0 0 0 1px rgba(59, 130, 246, 0.1),
        0 0 30px rgba(59, 130, 246, 0.05);
    animation: progressPulse 3s ease-in-out infinite alternate;
}

/* 다크모드용 진행 중 그림자 */
[data-theme="dark"] .discussion-turn-container.turn-in-progress {
    box-shadow: 
        0 4px 20px var(--shadow-color),
        0 0 0 1px rgba(59, 130, 246, 0.08),
        0 0 30px rgba(59, 130, 246, 0.04);
}

/* 라이트모드용 진행 중 그림자 */
[data-theme="light"] .discussion-turn-container.turn-in-progress {
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(59, 130, 246, 0.15),
        0 0 30px rgba(59, 130, 246, 0.08);
}

/* 다크/라이트 모드별 프로그레스 바 색상 조정 */
[data-theme="dark"] .discussion-turn-container.turn-in-progress::before {
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(59, 130, 246, 0.8) 25%, 
        rgba(6, 182, 212, 0.8) 50%, 
        rgba(59, 130, 246, 0.8) 75%, 
        transparent 100%);
}

[data-theme="light"] .discussion-turn-container.turn-in-progress::before {
    background: linear-gradient(90deg, 
        transparent 0%, 
        #3b82f6 25%, 
        #06b6d4 50%, 
        #3b82f6 75%, 
        transparent 100%);
}

/* 턴 진행 중 미묘한 펄스 효과 */
.discussion-turn-container.turn-in-progress {
    box-shadow: 
        0 4px 20px var(--shadow-color),
        0 0 0 1px rgba(34, 211, 238, 0.15),
        0 0 30px rgba(34, 211, 238, 0.08);
    animation: turnProgressPulse 3s ease-in-out infinite alternate;
}

[data-theme="dark"] .discussion-turn-container.turn-in-progress {
    box-shadow: 
        0 4px 20px var(--shadow-color),
        0 0 0 1px rgba(34, 211, 238, 0.12),
        0 0 30px rgba(34, 211, 238, 0.06);
}

[data-theme="light"] .discussion-turn-container.turn-in-progress {
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(34, 211, 238, 0.2),
        0 0 30px rgba(34, 211, 238, 0.1);
}

/* 턴 완료시 상단 초록색 완료 바 */
.discussion-turn-container.turn-completed::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: #10b981;
    border-radius: 15px 15px 0 0;
    z-index: 2;
}

/* 턴 완료시 미묘한 배경 그라데이션 */
.discussion-turn-container.turn-completed {
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(16, 185, 129, 0.03) 100%);
    animation: turnCompletedFlash 0.8s ease-out;
}

[data-theme="dark"] .discussion-turn-container.turn-completed {
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(16, 185, 129, 0.02) 100%);
}

[data-theme="light"] .discussion-turn-container.turn-completed {
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(16, 185, 129, 0.05) 100%);
}

/* 애니메이션 키프레임 */
@keyframes progressSlide {
    0% {
        background-position: -100% 0;
    }
    100% {
        background-position: 100% 0;
    }
}

@keyframes progressPulse {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.002);
    }
}

@keyframes badgePulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* ⭐️ 토론 참여자 박스 진행 중 애니메이션 키프레임들 */
@keyframes typingBorderGlow {
    0% { border-image-source: linear-gradient(45deg, #3b82f6, #06b6d4, #10b981, #3b82f6); }
    25% { border-image-source: linear-gradient(45deg, #06b6d4, #10b981, #3b82f6, #06b6d4); }
    50% { border-image-source: linear-gradient(45deg, #10b981, #3b82f6, #06b6d4, #10b981); }
    75% { border-image-source: linear-gradient(45deg, #3b82f6, #06b6d4, #10b981, #3b82f6); }
    100% { border-image-source: linear-gradient(45deg, #06b6d4, #10b981, #3b82f6, #06b6d4); }
}

@keyframes typingBackgroundPulse {
    0% { 
        transform: scale(1); 
        filter: brightness(1); 
    }
    100% { 
        transform: scale(1.002); 
        filter: brightness(1.03); 
    }
}

@keyframes lightBackgroundShift {
    0% { background-position: 0% 0%; }
    25% { background-position: 100% 0%; }
    50% { background-position: 100% 100%; }
    75% { background-position: 0% 100%; }
    100% { background-position: 0% 0%; }
}

@keyframes darkBackgroundShift {
    0% { background-position: 0% 0%; }
    25% { background-position: 100% 0%; }
    50% { background-position: 100% 100%; }
    75% { background-position: 0% 100%; }
    100% { background-position: 0% 0%; }
}

/* ⭐️ 참여자 에이전트 박스 전용 배경 애니메이션 (더 눈에 띄는 효과) */
@keyframes agentBackgroundShift {
    0% { 
        background-position: 0% 0%; 
        transform: scale(1);
    }
    25% { 
        background-position: 100% 0%; 
        transform: scale(1.001);
    }
    50% { 
        background-position: 100% 100%; 
        transform: scale(1.002);
    }
    75% { 
        background-position: 0% 100%; 
        transform: scale(1.001);
    }
    100% { 
        background-position: 0% 0%; 
        transform: scale(1);
    }
}

@keyframes turnCompletedFlash {
    0% {
        box-shadow: 
            0 4px 20px var(--shadow-color),
            0 0 0 1px rgba(16, 185, 129, 0.4),
            0 0 40px rgba(16, 185, 129, 0.2);
    }
    50% {
        box-shadow: 
            0 4px 20px var(--shadow-color),
            0 0 0 1px rgba(16, 185, 129, 0.6),
            0 0 60px rgba(16, 185, 129, 0.3);
    }
    100% {
        box-shadow: 0 4px 20px var(--shadow-color);
    }
}

/* 턴 컨테이너 내부 콘텐츠가 애니메이션 위에 표시되도록 */
.discussion-turn-container .discussion-turn-header,
.discussion-turn-container .discussion-turn-content {
    position: relative;
    z-index: 2;
}

.discussion-turn-header {
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 3;
}

.discussion-turn-header h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 턴 헤더 상태 배지 */
.discussion-turn-header.turn-in-progress::after {
    content: "진행 중";
    background: linear-gradient(45deg, #3b82f6, #06b6d4);
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 12px;
    animation: badgePulse 2s ease-in-out infinite;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.discussion-turn-header.turn-completed::after {
    content: "완료";
    background: #10b981;
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.discussion-turn-content {
    /* 패딩 제거 - 자연스러운 흐름 */
}

/* 에이전트 답변 박스 스타일 (피드백 추론 모드와 유사하게) */
.discussion-agent-response {
    background: var(--sub-card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: var(--transition-slow);
    position: relative;
}

/* ⭐️ 토론 참여자 답변 진행 중 애니메이션 (외곽선 + 배경색 강화) */
.discussion-agent-response.typing,
.discussion-agent-content.typing {
    /* 외곽선 애니메이션 (기존) */
    border: 2px solid;
    border-image: linear-gradient(45deg, #3b82f6, #06b6d4, #10b981, #3b82f6) 1;
    animation: 
        typingBorderGlow 2s linear infinite,
        typingBackgroundPulse 3s ease-in-out infinite alternate;
    
    /* 진행 중 그림자 강화 */
    box-shadow: 
        0 4px 20px var(--shadow-color),
        0 0 0 1px rgba(59, 130, 246, 0.2),
        0 0 30px rgba(59, 130, 246, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    
    /* 기본 배경 오버라이드 - 더 눈에 띄는 애니메이션 */
    background: linear-gradient(135deg, 
        rgba(59, 130, 246, 0.08) 0%, 
        rgba(6, 182, 212, 0.06) 25%, 
        rgba(16, 185, 129, 0.08) 50%, 
        rgba(6, 182, 212, 0.06) 75%, 
        rgba(59, 130, 246, 0.08) 100%) !important;
    background-size: 300% 300% !important;
    animation: 
        typingBorderGlow 2s linear infinite,
        typingBackgroundPulse 3s ease-in-out infinite alternate,
        agentBackgroundShift 4s ease-in-out infinite;
}

/* 라이트 모드용 진행 중 배경 애니메이션 - 참여자 박스 강화 */
[data-theme="light"] .discussion-agent-response.typing,
[data-theme="light"] .discussion-agent-content.typing {
    background: linear-gradient(135deg, 
        rgba(59, 130, 246, 0.12) 0%, 
        rgba(6, 182, 212, 0.08) 20%,
        rgba(255, 255, 255, 0.95) 40%, 
        rgba(16, 185, 129, 0.10) 60%,
        rgba(248, 250, 252, 0.98) 80%, 
        rgba(59, 130, 246, 0.12) 100%) !important;
    background-size: 300% 300% !important;
    animation: 
        typingBorderGlow 2s linear infinite,
        typingBackgroundPulse 3s ease-in-out infinite alternate,
        agentBackgroundShift 4s ease-in-out infinite;
    
    /* 추가 시각적 효과 */
    box-shadow: 
        0 4px 20px var(--shadow-color),
        0 0 0 1px rgba(59, 130, 246, 0.25),
        0 0 40px rgba(59, 130, 246, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}

/* 다크 모드용 진행 중 배경 애니메이션 - 참여자 박스 강화 */
[data-theme="dark"] .discussion-agent-response.typing,
[data-theme="dark"] .discussion-agent-content.typing {
    background: linear-gradient(135deg, 
        rgba(59, 130, 246, 0.15) 0%, 
        rgba(6, 182, 212, 0.10) 20%,
        rgba(30, 41, 59, 0.95) 40%, 
        rgba(16, 185, 129, 0.12) 60%,
        rgba(51, 65, 85, 0.98) 80%, 
        rgba(59, 130, 246, 0.15) 100%) !important;
    background-size: 300% 300% !important;
    animation: 
        typingBorderGlow 2s linear infinite,
        typingBackgroundPulse 3s ease-in-out infinite alternate,
        agentBackgroundShift 4s ease-in-out infinite;
    
    /* 추가 시각적 효과 */
    box-shadow: 
        0 4px 20px var(--shadow-color),
        0 0 0 1px rgba(59, 130, 246, 0.3),
        0 0 40px rgba(59, 130, 246, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
}

.discussion-agent-response:last-child {
    margin-bottom: 0;
}

.discussion-agent-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--accent-bg);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.discussion-agent-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.agent-a-icon {
    color: #10b981; /* 초록색 */
}

.agent-b-icon {
    color: #3b82f6; /* 파란색 */
}

.discussion-agent-header h5 {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
}

.discussion-agent-content {
    padding: 1.5rem;
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 0.95rem;
}

.streaming-indicator {
    color: var(--text-secondary);
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.streaming-indicator::before {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid var(--primary-color);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 토론 준비 중 애니메이션 스타일 (피드백 추론 모드와 동일) */
.discussion-preparation-animation {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1rem 0;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: fadeIn 0.3s ease-in;
}

.preparation-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
}

.preparation-icon {
    font-size: 1.2rem;
    animation: pulse 2s ease-in-out infinite;
}

.preparation-title {
    color: var(--text-primary);
}

.preparation-content {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.preparation-text {
    margin: 0;
}

.dots-animation {
    display: inline-block;
    width: 1.5rem;
    text-align: left;
    font-family: monospace;
    color: var(--primary-color);
    font-weight: bold;
}

/* 애니메이션 키프레임 */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

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

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

.error-message {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    padding: 0.75rem;
    border-radius: 6px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* 화이트페이퍼 박스 스타일링 */
.discussion-whitepaper {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin: 1.5rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.whitepaper-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.whitepaper-header .header-line {
    flex: 1;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
}

.whitepaper-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    white-space: nowrap;
}

.whitepaper-content {
    padding: 1.5rem;
    min-height: 100px;
}

.whitepaper-text {
    line-height: 1.6;
    color: var(--text-color);
}

.whitepaper-text.typing::after {
    content: '|';
    color: var(--primary-color);
    animation: blink 1s infinite;
}

/* ⭐️ 화이트페이퍼 박스 진행 중 애니메이션 (토론 참여자 박스와 동일) */
.discussion-whitepaper.typing {
    /* 외곽선 애니메이션 */
    border: 2px solid;
    border-image: linear-gradient(45deg, #3b82f6, #06b6d4, #10b981, #3b82f6) 1;
    animation: 
        typingBorderGlow 2s linear infinite,
        typingBackgroundPulse 3s ease-in-out infinite alternate;
    
    /* 진행 중 그림자 강화 */
    box-shadow: 
        0 4px 20px var(--shadow-color),
        0 0 0 1px rgba(59, 130, 246, 0.1),
        0 0 20px rgba(59, 130, 246, 0.05);
}

/* 라이트 모드용 화이트페이퍼 진행 중 배경 애니메이션 */
[data-theme="light"] .discussion-whitepaper.typing {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.95) 0%, 
        rgba(248, 250, 252, 0.98) 25%, 
        rgba(241, 245, 249, 0.95) 50%, 
        rgba(248, 250, 252, 0.98) 75%, 
        rgba(255, 255, 255, 0.95) 100%) !important;
    background-size: 200% 200% !important;
    animation: 
        typingBorderGlow 2s linear infinite,
        typingBackgroundPulse 3s ease-in-out infinite alternate,
        lightBackgroundShift 4s ease-in-out infinite;
}

/* 다크 모드용 화이트페이퍼 진행 중 배경 애니메이션 */
[data-theme="dark"] .discussion-whitepaper.typing {
    background: linear-gradient(135deg, 
        rgba(30, 41, 59, 0.95) 0%, 
        rgba(51, 65, 85, 0.98) 25%, 
        rgba(71, 85, 105, 0.95) 50%, 
        rgba(51, 65, 85, 0.98) 75%, 
        rgba(30, 41, 59, 0.95) 100%) !important;
    background-size: 200% 200% !important;
    animation: 
        typingBorderGlow 2s linear infinite,
        typingBackgroundPulse 3s ease-in-out infinite alternate,
        darkBackgroundShift 4s ease-in-out infinite;
}

/* 화이트페이퍼 준비 중 애니메이션 */
.whitepaper-preparation-animation {
    margin: 1rem 0;
}

/* 다크 테마 대응 */
[data-theme="dark"] .discussion-whitepaper {
    background: var(--dark-card-bg);
    border-color: var(--dark-border-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .whitepaper-text {
    color: var(--dark-text-color);
}

/* 토론 크리틱 박스 스타일링 (피드백 추론 모드와 동일한 헤더) */
.discussion-critic-box {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin: 1.5rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.discussion-critic-box .critic-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.discussion-critic-box .critic-header .header-line {
    flex: 1;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
}

.discussion-critic-box .critic-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    white-space: nowrap;
}

.discussion-critic-box .critic-content {
    padding: 1.5rem;
    min-height: 100px;
}

.discussion-critic-box .critic-text {
    line-height: 1.6;
    color: var(--text-color);
}

.discussion-critic-box .critic-text.typing::after {
    content: '|';
    color: var(--primary-color);
    animation: blink 1s infinite;
}

/* ⭐️ 크리틱 박스 진행 중 애니메이션 (화이트페이퍼 박스와 동일) */
.discussion-critic-box.typing {
    /* 외곽선 애니메이션 */
    border: 2px solid;
    border-image: linear-gradient(45deg, #3b82f6, #06b6d4, #10b981, #3b82f6) 1;
    animation: 
        typingBorderGlow 2s linear infinite,
        typingBackgroundPulse 3s ease-in-out infinite alternate;
    
    /* 진행 중 그림자 강화 */
    box-shadow: 
        0 4px 20px var(--shadow-color),
        0 0 0 1px rgba(59, 130, 246, 0.1),
        0 0 20px rgba(59, 130, 246, 0.05);
}

/* 라이트 모드용 크리틱 진행 중 배경 애니메이션 */
[data-theme="light"] .discussion-critic-box.typing {
    background: linear-gradient(135deg, 
        rgba(255, 255, 255, 0.95) 0%, 
        rgba(248, 250, 252, 0.98) 25%, 
        rgba(241, 245, 249, 0.95) 50%, 
        rgba(248, 250, 252, 0.98) 75%, 
        rgba(255, 255, 255, 0.95) 100%) !important;
    background-size: 200% 200% !important;
    animation: 
        typingBorderGlow 2s linear infinite,
        typingBackgroundPulse 3s ease-in-out infinite alternate,
        lightBackgroundShift 4s ease-in-out infinite;
}

/* 다크 모드용 크리틱 진행 중 배경 애니메이션 */
[data-theme="dark"] .discussion-critic-box.typing {
    background: linear-gradient(135deg, 
        rgba(30, 41, 59, 0.95) 0%, 
        rgba(51, 65, 85, 0.98) 25%, 
        rgba(71, 85, 105, 0.95) 50%, 
        rgba(51, 65, 85, 0.98) 75%, 
        rgba(30, 41, 59, 0.95) 100%) !important;
    background-size: 200% 200% !important;
    animation: 
        typingBorderGlow 2s linear infinite,
        typingBackgroundPulse 3s ease-in-out infinite alternate,
        darkBackgroundShift 4s ease-in-out infinite;
}

/* 다크 테마 대응 - 크리틱 박스 */
[data-theme="dark"] .discussion-critic-box {
    background: var(--dark-card-bg);
    border-color: var(--dark-border-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .discussion-critic-box .critic-text {
    color: var(--dark-text-color);
}

/* ⚡ Overload 재시도 애니메이션 */
.overload-retry-animation {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border: 1px solid #f59e0b;
    border-radius: 8px;
    color: white;
    text-align: center;
    gap: 0.8rem;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

.overload-loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: overloadSpin 1s linear infinite;
}

.overload-retry-message {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ⏭️ Overload 건너뛰기 메시지 */
.overload-skip-message {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 1.5rem;
    background: linear-gradient(135deg, #6b7280, #9ca3af);
    border: 1px solid #6b7280;
    border-radius: 8px;
    color: white;
    text-align: center;
    gap: 0.8rem;
    box-shadow: 0 4px 15px rgba(107, 114, 128, 0.3);
}

.skip-icon {
    font-size: 2rem;
    opacity: 0.9;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.skip-text {
    font-size: 0.95rem;
    line-height: 1.5;
    font-weight: 500;
}

.skip-text small {
    font-size: 0.85rem;
    opacity: 0.8;
    font-style: italic;
}

/* 다크 모드용 Overload 스타일 */
[data-theme="dark"] .overload-retry-animation {
    background: linear-gradient(135deg, #d97706, #92400e);
    border-color: #d97706;
    box-shadow: 0 4px 15px rgba(217, 119, 6, 0.4);
}

[data-theme="dark"] .overload-skip-message {
    background: linear-gradient(135deg, #4b5563, #6b7280);
    border-color: #4b5563;
    box-shadow: 0 4px 15px rgba(75, 85, 99, 0.4);
}

/* 라이트 모드용 Overload 스타일 */
[data-theme="light"] .overload-retry-animation {
    background: linear-gradient(135deg, #f59e0b, #eab308);
    color: #92400e;
    border-color: #f59e0b;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.2);
}

[data-theme="light"] .overload-loading-spinner {
    border: 3px solid rgba(146, 64, 14, 0.3);
    border-top: 3px solid #92400e;
}

[data-theme="light"] .overload-skip-message {
    background: linear-gradient(135deg, #9ca3af, #d1d5db);
    color: #374151;
    border-color: #9ca3af;
    box-shadow: 0 4px 15px rgba(156, 163, 175, 0.2);
}

/* Overload 스피너 애니메이션 */
@keyframes overloadSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ⚠️ Invalid Request 재시도 애니메이션 */
.invalid-request-retry-animation {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 1.5rem;
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    border: 1px solid #dc2626;
    border-radius: 8px;
    color: white;
    text-align: center;
    gap: 0.8rem;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
}

.invalid-request-loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid white;
    border-radius: 50%;
    animation: invalidRequestSpin 1s linear infinite;
}

.invalid-request-retry-message {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ⚠️ Invalid Request 건너뛰기 메시지 */
.invalid-request-skip-message {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 1.5rem;
    background: linear-gradient(135deg, #dc2626, #ef4444);
    border: 1px solid #dc2626;
    border-radius: 8px;
    color: white;
    text-align: center;
    gap: 0.8rem;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.3);
}

/* 다크 모드용 Invalid Request 스타일 */
[data-theme="dark"] .invalid-request-retry-animation {
    background: linear-gradient(135deg, #b91c1c, #991b1b);
    border-color: #b91c1c;
    box-shadow: 0 4px 15px rgba(185, 28, 28, 0.4);
}

[data-theme="dark"] .invalid-request-skip-message {
    background: linear-gradient(135deg, #b91c1c, #dc2626);
    border-color: #b91c1c;
    box-shadow: 0 4px 15px rgba(185, 28, 28, 0.4);
}

/* 라이트 모드용 Invalid Request 스타일 */
[data-theme="light"] .invalid-request-retry-animation {
    background: linear-gradient(135deg, #fecaca, #fca5a5);
    color: #991b1b;
    border-color: #fca5a5;
    box-shadow: 0 4px 15px rgba(252, 165, 165, 0.3);
}

[data-theme="light"] .invalid-request-loading-spinner {
    border: 3px solid rgba(153, 27, 27, 0.3);
    border-top: 3px solid #991b1b;
}

[data-theme="light"] .invalid-request-skip-message {
    background: linear-gradient(135deg, #fecaca, #f87171);
    color: #991b1b;
    border-color: #fca5a5;
    box-shadow: 0 4px 15px rgba(252, 165, 165, 0.3);
}

/* Invalid Request 스피너 애니메이션 */
@keyframes invalidRequestSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}