/**
 * 智能体分析工作区样式
 * 以任务为中心的交互体验设计
 */

/* ==================== 工作区容器 ==================== */
.analysis-workspace {
    position: relative;
    margin: 3rem auto;
    max-width: 1200px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08),
                0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    animation: workspaceSlideIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes workspaceSlideIn {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==================== 工作区头部 ==================== */
.workspace-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 2.5rem;
    position: relative;
    overflow: hidden;
}

.workspace-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: headerGlow 8s ease-in-out infinite;
}

@keyframes headerGlow {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.1) rotate(180deg); }
}

.workspace-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    z-index: 1;
    margin-bottom: 0.5rem;
}

.workspace-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.workspace-title .emoji {
    font-size: 2rem;
    animation: titleEmoji 2s ease-in-out infinite;
}

@keyframes titleEmoji {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-5deg); }
    75% { transform: scale(1.1) rotate(5deg); }
}

.workspace-subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
    margin: 0;
    position: relative;
    z-index: 1;
}

.workspace-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.workspace-status.ready {
    background: rgba(34, 197, 94, 0.3);
}

.workspace-status.analyzing {
    background: rgba(251, 191, 36, 0.3);
    animation: statusPulse 2s ease-in-out infinite;
}

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

.workspace-status.completed {
    background: rgba(34, 197, 94, 0.3);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: dotPulse 2s ease-in-out infinite;
}

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

/* ==================== 任务向导 ==================== */
.task-wizard {
    padding: 2rem 2.5rem;
}

.wizard-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2.5rem;
    position: relative;
}

.wizard-steps::before {
    content: '';
    position: absolute;
    top: 24px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        #667eea 0%,
        #764ba2 50%,
        #667eea 100%);
    opacity: 0.2;
    z-index: 0;
}

.wizard-step {
    position: relative;
    z-index: 1;
    text-align: center;
    flex: 1;
    cursor: pointer;
    transition: all 0.3s ease;
}

.wizard-step-number {
    width: 50px;
    height: 50px;
    margin: 0 auto 0.75rem;
    background: white;
    border: 3px solid #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.125rem;
    color: #94a3b8;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.wizard-step.active .wizard-step-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: transparent;
    color: white;
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    animation: stepActive 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes stepActive {
    0% { transform: scale(0.8) rotate(-180deg); }
    100% { transform: scale(1.1) rotate(0deg); }
}

.wizard-step.completed .wizard-step-number {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-color: transparent;
    color: white;
}

.wizard-step.completed .wizard-step-number::after {
    content: '✓';
    font-size: 1.25rem;
}

.wizard-step-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    transition: all 0.3s ease;
}

.wizard-step.active .wizard-step-label {
    color: #667eea;
    font-weight: 600;
}

.wizard-step.completed .wizard-step-label {
    color: #22c55e;
}

/* ==================== 步骤内容区域 ==================== */
.step-content {
    display: none;
    animation: stepFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

.step-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.step-description {
    color: #64748b;
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* ==================== 表单元素 ==================== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-label.required::after {
    content: '*';
    color: #ef4444;
    margin-left: 0.25rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: white;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.form-control:hover {
    border-color: #cbd5e1;
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* ==================== 分析类型卡片 ==================== */
.analysis-types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.analysis-type-card {
    position: relative;
    padding: 1.5rem;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.analysis-type-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.analysis-type-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.analysis-type-card:hover::before {
    opacity: 1;
}

.analysis-type-card.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
}

.analysis-type-card.selected::after {
    content: '✓';
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
    animation: checkmarkPop 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes checkmarkPop {
    0% { transform: scale(0) rotate(-45deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.analysis-type-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.analysis-type-name {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.analysis-type-desc {
    font-size: 0.875rem;
    color: #64748b;
    line-height: 1.5;
    position: relative;
    z-index: 1;
}

/* ==================== 参数调整 ==================== */
.parameters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.parameter-item {
    background: white;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    transition: all 0.3s ease;
}

.parameter-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.parameter-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.parameter-value-display {
    font-size: 0.75rem;
    color: #667eea;
    font-weight: 600;
    background: rgba(102, 126, 234, 0.1);
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
}

input[type="range"].form-control {
    padding: 0;
    height: 6px;
    background: #e2e8f0;
    border: none;
    border-radius: 3px;
    appearance: none;
    cursor: pointer;
}

input[type="range"].form-control::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
    transition: transform 0.2s ease;
}

input[type="range"].form-control::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* ==================== 按钮组 ==================== */
.button-group {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e2e8f0;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

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

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-secondary {
    background: white;
    color: #475569;
    border: 2px solid #e2e8f0;
}

.btn-secondary:hover:not(:disabled) {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
}

/* ==================== 进度指示器 ==================== */
.progress-container {
    margin: 2rem 0;
}

.progress-bar-wrapper {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%);
    animation: progressShine 1.5s ease-in-out infinite;
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: #64748b;
}

/* ==================== 结果展示 ==================== */
.results-container {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    margin-top: 2rem;
    border: 1px solid #e2e8f0;
    animation: resultsFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f1f5f9;
}

.results-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.results-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 1rem;
    border-radius: 0.75rem;
    text-align: center;
    transition: all 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.metric-label {
    font-size: 0.875rem;
    color: #64748b;
    margin-top: 0.25rem;
}

.results-content {
    line-height: 1.6;
    color: #475569;
}

/* ==================== 提示消息 ==================== */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    padding: 1rem 1.5rem;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    animation: toastSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border-left: 4px solid;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-left-color: #22c55e;
}

.toast.error {
    border-left-color: #ef4444;
}

.toast.info {
    border-left-color: #3b82f6;
}

.toast.warning {
    border-left-color: #f59e0b;
}

.toast-icon {
    font-size: 1.5rem;
}

.toast-message {
    flex: 1;
    font-size: 0.9rem;
    color: #334155;
}

.toast-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.25rem;
    font-size: 1.25rem;
    line-height: 1;
    transition: color 0.2s ease;
}

.toast-close:hover {
    color: #64748b;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .analysis-workspace {
        margin: 1.5rem;
        border-radius: 1rem;
    }

    .workspace-header {
        padding: 1.5rem;
    }

    .workspace-title {
        font-size: 1.25rem;
    }

    .task-wizard {
        padding: 1.5rem;
    }

    .wizard-steps {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .wizard-step {
        min-width: 60px;
    }

    .wizard-step-number {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }

    .wizard-step-label {
        font-size: 0.75rem;
    }

    .analysis-types-grid {
        grid-template-columns: 1fr;
    }

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

    .btn {
        width: 100%;
        justify-content: center;
    }

    .toast-container {
        left: 1rem;
        right: 1rem;
        top: 1rem;
    }

    .toast {
        min-width: auto;
    }
}

/* ==================== 工具提示 ==================== */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: #1e293b;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1000;
}

.tooltip:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* ==================== 加载动画 ==================== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== 空状态 ==================== */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #94a3b8;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

/* ==================== 文件拖拽区域 ==================== */
.file-drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8fafc;
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.05);
}

.file-drop-zone-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.file-drop-zone-text {
    color: #64748b;
    margin-bottom: 0.5rem;
}

.file-drop-zone-hint {
    font-size: 0.8rem;
    color: #94a3b8;
}
