/* 卡片组件样式 */

/* 基础卡片 */
.card {
    margin: 16px 0;
    padding: 16px;
    border-radius: 12px;
    border-left: 4px solid;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 卡片类型 */
.card-info {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
}

.card-success {
    border-color: #10b981;
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 100%);
}

.card-warning {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #ffffff 100%);
}

.card-error {
    border-color: #ef4444;
    background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%);
}

.card-code {
    border-color: #8b5cf6;
    background: linear-gradient(135deg, #f5f3ff 0%, #ffffff 100%);
}

.card-tip {
    border-color: #06b6d4;
    background: linear-gradient(135deg, #ecfeff 0%, #ffffff 100%);
}

.card-quote {
    border-color: #64748b;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
}

/* 卡片头部 */
.card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    color: #1e293b;
}

.card-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.card-title {
    flex: 1;
    font-size: 16px;
}

.card-collapse-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.card-collapse-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.card-collapse-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s;
}

.card.collapsed .card-collapse-btn svg {
    transform: rotate(-90deg);
}

/* 卡片内容 */
.card-content {
    color: #475569;
    line-height: 1.6;
    transition: all 0.3s;
}

.card.collapsed .card-content {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin: 0;
}

/* 卡片操作按钮 */
.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.card-action-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    background: white;
    color: #475569;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.card-action-btn:hover {
    background: #f8fafc;
    border-color: #3b82f6;
    color: #3b82f6;
}

.card-action-btn svg {
    width: 14px;
    height: 14px;
}

/* 步骤卡片 */
.step-card {
    margin: 16px 0;
    padding: 16px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.step-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    position: relative;
}

.step-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 19px;
    top: 48px;
    bottom: -16px;
    width: 2px;
    background: #e2e8f0;
}

.step-marker {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f1f5f9;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s;
}

.step-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    opacity: 0;
    transition: all 0.3s;
}

/* 步骤状态 */
.step-pending .step-number {
    background: #f1f5f9;
    color: #94a3b8;
}

.step-active .step-number {
    background: #3b82f6;
    color: white;
    animation: pulse 2s infinite;
}

.step-completed .step-number {
    background: #10b981;
    color: white;
}

.step-completed .step-icon {
    opacity: 1;
    color: white;
}

.step-completed .step-number {
    font-size: 0;
}

.step-error .step-number {
    background: #ef4444;
    color: white;
}

.step-error .step-icon {
    opacity: 1;
    color: white;
}

.step-error .step-number {
    font-size: 0;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }
}

.step-content {
    flex: 1;
    padding-top: 8px;
}

.step-title {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 4px;
}

.step-description {
    color: #64748b;
    font-size: 14px;
    line-height: 1.6;
}

/* 代码块 */
.code-block {
    margin: 16px 0;
    border-radius: 8px;
    overflow: hidden;
    background: #1e293b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.code-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: #0f172a;
    color: #94a3b8;
    font-size: 13px;
}

.code-language {
    font-weight: 600;
    text-transform: uppercase;
    color: #60a5fa;
}

.code-filename {
    flex: 1;
    color: #cbd5e1;
}

.code-copy-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border: none;
    border-radius: 4px;
    background: #334155;
    color: white;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.code-copy-btn:hover {
    background: #475569;
}

.code-copy-btn.copied {
    background: #10b981;
}

.code-copy-btn svg {
    width: 14px;
    height: 14px;
}

.code-block pre {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
    background: #1e293b;
}

.code-block code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.6;
    color: #e2e8f0;
}

/* 行号 */
.line-numbers {
    counter-reset: linenumber;
}

.line-numbers code {
    counter-increment: linenumber;
}

.line-numbers code::before {
    content: counter(linenumber);
    display: inline-block;
    width: 2em;
    margin-right: 1em;
    text-align: right;
    color: #64748b;
    user-select: none;
}

/* 引用块 */
.quote-block {
    margin: 16px 0;
    padding: 16px 16px 16px 56px;
    background: #f8fafc;
    border-left: 4px solid #64748b;
    border-radius: 8px;
    position: relative;
}

.quote-icon {
    position: absolute;
    left: 16px;
    top: 16px;
    width: 24px;
    height: 24px;
    color: #94a3b8;
}

.quote-content {
    color: #475569;
    font-style: italic;
    line-height: 1.6;
}

.quote-author {
    margin-top: 8px;
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
}

/* 提示框 */
.tip-box {
    display: flex;
    gap: 12px;
    margin: 16px 0;
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 4px solid;
}

.tip-info {
    background: #eff6ff;
    border-color: #3b82f6;
}

.tip-success {
    background: #f0fdf4;
    border-color: #10b981;
}

.tip-warning {
    background: #fffbeb;
    border-color: #f59e0b;
}

.tip-error {
    background: #fef2f2;
    border-color: #ef4444;
}

.tip-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

.tip-info .tip-icon {
    color: #3b82f6;
}

.tip-success .tip-icon {
    color: #10b981;
}

.tip-warning .tip-icon {
    color: #f59e0b;
}

.tip-error .tip-icon {
    color: #ef4444;
}

.tip-content {
    flex: 1;
    color: #1e293b;
    line-height: 1.6;
}

/* 列表项样式 */
.list-item-success,
.list-item-error,
.list-item-warning,
.list-item-tip,
.list-item-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 8px 0;
}

.list-item-success svg {
    color: #10b981;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex-shrink: 0;
}

.list-item-error svg {
    color: #ef4444;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex-shrink: 0;
}

.list-item-warning svg {
    color: #f59e0b;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex-shrink: 0;
}

.list-item-tip svg {
    color: #06b6d4;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex-shrink: 0;
}

.list-item-note svg {
    color: #8b5cf6;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex-shrink: 0;
}

/* 表格样式 */
.table-wrapper {
    margin: 16px 0;
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.markdown-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.markdown-table thead {
    background: #f8fafc;
}

.markdown-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #1e293b;
    border-bottom: 2px solid #e2e8f0;
}

.markdown-table td {
    padding: 12px 16px;
    color: #475569;
    border-bottom: 1px solid #f1f5f9;
}

.markdown-table tr:last-child td {
    border-bottom: none;
}

.markdown-table tr:hover {
    background: #f8fafc;
}

/* 响应式 */
@media (max-width: 768px) {
    .card {
        padding: 12px;
        margin: 12px 0;
    }
    
    .step-item {
        gap: 12px;
    }
    
    .step-marker {
        width: 32px;
        height: 32px;
    }
    
    .step-number {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .code-block pre {
        padding: 12px;
    }
    
    .code-block code {
        font-size: 13px;
    }
}

/* AI响应内容增强样式 */
.ai-response-content {
    line-height: 1.6;
}

.ai-response-content p {
    margin: 0.8em 0;
}

.ai-response-content strong {
    color: var(--primary-color, #3b82f6);
    font-weight: 600;
}

.ai-response-content h1,
.ai-response-content h2,
.ai-response-content h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.ai-response-content h1 {
    font-size: 1.5em;
    border-bottom: 2px solid var(--border-color, #e5e7eb);
    padding-bottom: 0.3em;
}

.ai-response-content h2 {
    font-size: 1.3em;
}

.ai-response-content h3 {
    font-size: 1.1em;
}

.ai-response-content ul,
.ai-response-content ol {
    margin: 1em 0;
    padding-left: 2em;
}

.ai-response-content li {
    margin: 0.5em 0;
}

.ai-response-content code {
    background: var(--code-bg, #f3f4f6);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

.ai-response-content pre {
    background: var(--code-block-bg, #1e293b);
    color: var(--code-block-text, #e2e8f0);
    padding: 1em;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1em 0;
    position: relative;
}

.ai-response-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.code-copy-btn {
    position: absolute;
    top: 0.5em;
    right: 0.5em;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.3em 0.8em;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
    transition: all 0.2s;
}

.code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.table-wrapper {
    overflow-x: auto;
    margin: 1em 0;
}

.ai-response-content table {
    border-collapse: collapse;
    width: 100%;
    min-width: 400px;
}

.ai-response-content th,
.ai-response-content td {
    border: 1px solid var(--border-color, #e5e7eb);
    padding: 0.6em 1em;
    text-align: left;
}

.ai-response-content th {
    background: var(--table-header-bg, #f9fafb);
    font-weight: 600;
}

.ai-response-content blockquote {
    border-left: 4px solid var(--primary-color, #3b82f6);
    padding-left: 1em;
    margin: 1em 0;
    color: var(--text-secondary, #6b7280);
    font-style: italic;
}
