/* Query Section */
.query-section {
    background: #f9fafb;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.query-section h2 {
    color: #1f2937;
    margin-bottom: 20px;
    font-size: 1.5em;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #374151;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
    font-family: inherit;
}

/* Checkbox Group */
.checkbox-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Buttons */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #6b7280;
    color: white;
    margin-left: 10px;
}

.btn-secondary:hover {
    background: #4b5563;
}

/* Upload Section */
.upload-section {
    background: #f9fafb;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
}

.upload-area {
    border: 3px dashed #d1d5db;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover {
    border-color: #667eea;
    background: #f3f4f6;
}

.upload-area.drag-over {
    border-color: #667eea;
    background: #eef2ff;
}

.upload-icon {
    font-size: 3em;
    margin-bottom: 15px;
}

.upload-text {
    color: #6b7280;
    margin-bottom: 10px;
}

.file-input {
    display: none;
}

/* File List */
.file-list {
    margin-top: 20px;
}

.file-item {
    background: white;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-name {
    font-weight: 500;
    color: #374151;
}

.file-remove {
    color: #ef4444;
    cursor: pointer;
    font-weight: 600;
}

.file-remove:hover {
    color: #dc2626;
}

/* Response Section */
.response-section {
    margin-top: 30px;
}

.response-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
}

.response-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
}

.response-agent {
    font-weight: 700;
    font-size: 1.2em;
    color: #667eea;
}

.response-time {
    color: #6b7280;
    font-size: 0.9em;
}

.response-body {
    color: #374151;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #6b7280;
}

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

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

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
}

.tab {
    padding: 12px 24px;
    cursor: pointer;
    border: none;
    background: transparent;
    color: #6b7280;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Collaboration Timeline */
.collaboration-timeline {
    padding: 20px 0;
}

.collaboration-step {
    background: white;
    border-left: 4px solid #667eea;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
}

.step-icon {
    font-size: 1.5em;
}

.step-agent {
    font-weight: 700;
    font-size: 1.1em;
    color: #1f2937;
    flex-grow: 1;
}

.step-time {
    color: #6b7280;
    font-size: 0.9em;
    background: #f3f4f6;
    padding: 4px 12px;
    border-radius: 12px;
}

.step-content {
    color: #374151;
    line-height: 1.6;
}

.step-action {
    font-size: 1em;
    margin-bottom: 10px;
    color: #4b5563;
}

.step-result {
    background: #f9fafb;
    padding: 15px;
    border-radius: 8px;
    margin-top: 10px;
    border-left: 3px solid #9ca3af;
}

.step-result p {
    margin-bottom: 8px;
}

.step-result pre {
    background: #1f2937;
    color: #f3f4f6;
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
}

/* Meta Info */
.meta-info {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid #e5e7eb;
    background: #f9fafb;
    padding: 20px;
    border-radius: 8px;
}

.meta-info p {
    margin-bottom: 10px;
    color: #4b5563;
}

.meta-info strong {
    color: #1f2937;
}

/* Streaming Indicator */
.streaming-indicator {
    text-align: center;
    padding: 20px;
    font-size: 1.1em;
    color: #667eea;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Streaming Step */
.collaboration-step.streaming {
    border-left-color: #f59e0b;
    animation: borderPulse 2s ease-in-out infinite;
}

@keyframes borderPulse {
    0%, 100% {
        border-left-width: 4px;
    }
    50% {
        border-left-width: 8px;
    }
}

/* Error Message */
.error-message {
    background: #fee2e2;
    border: 2px solid #ef4444;
    color: #991b1b;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    font-weight: 600;
}

/* SSE Streaming Status */
.streaming-status {
    background: white;
    border: 3px solid #667eea;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
}

.status-header h3 {
    margin: 0;
    color: #667eea;
    font-size: 1.3em;
}

.btn-close {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.3s;
}

.btn-close:hover {
    background: #dc2626;
    transform: rotate(90deg);
}

/* Status Phases */
.status-phases {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.phase-item {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s;
}

.phase-item.active {
    background: #eef2ff;
    border-color: #667eea;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.3);
    transform: scale(1.05);
}

.phase-item.completed {
    background: #dcfce7;
    border-color: #10b981;
}

.phase-icon {
    display: block;
    font-size: 2em;
    margin-bottom: 8px;
}

.phase-name {
    display: block;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
}

.phase-status {
    display: block;
    font-size: 1.2em;
}

/* SSE Events Log */
.status-events {
    background: #1f2937;
    border-radius: 8px;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.events-header {
    color: #9ca3af;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.events-log {
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    color: #f3f4f6;
}

.event-item {
    padding: 5px 0;
    border-bottom: 1px solid #374151;
    animation: fadeIn 0.3s ease-in;
}

.event-item:last-child {
    border-bottom: none;
}

.event-time {
    color: #9ca3af;
    margin-right: 10px;
}

.event-type {
    color: #60a5fa;
    font-weight: 600;
    margin-right: 10px;
}

.event-data {
    color: #d1d5db;
}

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

/* Scrollbar styling for events log */
.events-log::-webkit-scrollbar {
    width: 8px;
}

.events-log::-webkit-scrollbar-track {
    background: #374151;
    border-radius: 4px;
}

.events-log::-webkit-scrollbar-thumb {
    background: #6b7280;
    border-radius: 4px;
}

.events-log::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Thinking Timeline */
.thinking-timeline {
    padding: 20px 0;
}

.thinking-step {
    background: white;
    border-left: 4px solid #8b5cf6;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.1);
    animation: slideIn 0.3s ease-out;
}

.thinking-step .step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e5e7eb;
}

.thinking-step .step-thought {
    color: #374151;
    margin-bottom: 10px;
    line-height: 1.6;
}

.thinking-step .step-reasoning {
    color: #6b7280;
    font-style: italic;
    background: #f9fafb;
    padding: 10px;
    border-radius: 6px;
    border-left: 3px solid #8b5cf6;
}

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

/* Task Plan */
.task-plan-container {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.task-plan-header {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 3px solid #e5e7eb;
}

.task-plan-header h3 {
    margin: 0 0 15px 0;
    color: #1f2937;
    font-size: 1.5em;
}

.plan-meta {
    display: flex;
    gap: 15px;
    align-items: center;
}

.complexity-badge {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    color: white;
}

.complexity-simple {
    background: #10b981;
}

.complexity-medium {
    background: #f59e0b;
}

.complexity-complex {
    background: #ef4444;
}

.subtask-count {
    color: #6b7280;
    font-weight: 600;
}

.plan-query {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9fafb;
    border-radius: 8px;
    color: #374151;
}

.subtasks-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.subtask-item {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s;
    position: relative;
}

.subtask-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.subtask-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.subtask-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.9em;
}

.subtask-name {
    flex: 1;
    font-weight: 700;
    font-size: 1.1em;
    color: #1f2937;
}

.priority-badge {
    padding: 4px 12px;
    border-radius: 12px;
    color: white;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.estimated-time {
    color: #6b7280;
    font-size: 0.9em;
    font-weight: 600;
}

.subtask-body {
    color: #374151;
    line-height: 1.6;
}

.subtask-body p {
    margin-bottom: 10px;
}

.dependencies {
    margin-top: 12px;
    padding: 10px;
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    border-radius: 6px;
    color: #92400e;
    font-size: 0.9em;
}

.dependencies strong {
    color: #78350f;
}

/* Animation for subtasks */
.subtask-item {
    animation: fadeInUp 0.4s ease-out;
}

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

/* 자동 도구 선택 관련 스타일 */
.tools-info {
    margin: 15px 0;
    padding: 15px;
    background: #e7f3ff;
    border-left: 4px solid #0066cc;
    border-radius: 4px;
    animation: fadeIn 0.3s ease-in;
}

.info-badge {
    display: inline-block;
    padding: 6px 12px;
    background: #0066cc;
    color: white;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: 500;
    margin-bottom: 10px;
}

.work-plan-summary {
    margin-top: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
}

.work-plan-summary p {
    margin: 5px 0;
    font-size: 0.9em;
    color: #333;
}

.work-plan-summary strong {
    color: #0066cc;
}

/* 수동 도구 그룹 들여쓰기 */
#manualToolsGroup {
    margin-left: 25px;
    padding: 10px;
    border-left: 2px solid #ddd;
    background: #f9fafb;
    border-radius: 4px;
}

/* 비동기 태스크 상태 */
.async-task-status {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    color: white;
}

.async-task-status .status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.async-task-status .status-header h3 {
    margin: 0;
    font-size: 1.3em;
    color: white;
}

.async-task-status .btn-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 50%;
    transition: background 0.3s;
}

.async-task-status .btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.async-task-status .task-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.async-task-status .info-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.async-task-status .info-item:last-child {
    border-bottom: none;
}

.async-task-status .info-label {
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.async-task-status .info-value {
    color: white;
    font-family: monospace;
}

.async-task-status .task-status {
    padding: 3px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9em;
}

.async-task-status .status-pending {
    background: #fbbf24;
    color: #92400e;
}

.async-task-status .status-progress {
    background: #3b82f6;
    color: white;
    animation: pulse 1.5s infinite;
}

.async-task-status .status-success {
    background: #10b981;
    color: white;
}

.async-task-status .status-failure {
    background: #ef4444;
    color: white;
}

.async-task-status .task-progress {
    margin-top: 15px;
}

.async-task-status .progress-bar {
    width: 100%;
    height: 25px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 10px;
}

.async-task-status .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #3b82f6 100%);
    border-radius: 12px;
    transition: width 0.5s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.async-task-status .progress-text {
    text-align: center;
    color: white;
    font-size: 0.95em;
}

.async-task-status .task-actions {
    margin-top: 15px;
    text-align: center;
}

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

