/* ========================================
   工具选择器模态框 - 精美样式
   ======================================== */

/* 工具选择触发按钮 */
.tool-selector-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 2px dashed #cbd5e1;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tool-selector-trigger:hover {
    border-color: #6366f1;
    border-style: solid;
    background: linear-gradient(135deg, #fefefe 0%, #f8fafc 100%);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.tool-selector-trigger-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tool-selector-trigger-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.tool-selector-trigger-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.tool-selector-trigger-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #0f172a;
}

.tool-selector-trigger-subtitle {
    font-size: 0.75rem;
    color: #64748b;
}

.tool-selector-trigger-arrow {
    width: 1.25rem;
    height: 1.25rem;
    color: #94a3b8;
    transition: transform 0.3s;
}

.tool-selector-trigger:hover .tool-selector-trigger-arrow {
    transform: translateX(4px);
    color: #6366f1;
}

/* 已选工具展示 */
.selected-tools-display {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: white;
    border-radius: 0.625rem;
    min-height: 3rem;
}

.selected-tool-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: white;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
    animation: badgeAppear 0.3s ease-out;
}

@keyframes badgeAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.selected-tool-remove {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.selected-tool-remove:hover {
    transform: scale(1.2);
}

.selected-tools-empty {
    width: 100%;
    text-align: center;
    color: #94a3b8;
    font-size: 0.8125rem;
    padding: 0.5rem;
}

/* 工具选择模态框 */
.tool-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.3s ease-out;
}

.tool-modal-container {
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    background: white;
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalSlideUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 模态框头部 */
.tool-modal-header {
    padding: 2rem 2rem 1.5rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(168, 85, 247, 0.05) 100%);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    position: relative;
}

.tool-modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899);
}

.tool-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.tool-modal-title-icon {
    width: 2rem;
    height: 2rem;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.tool-modal-subtitle {
    font-size: 0.875rem;
    color: #64748b;
}

.tool-modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(248, 250, 252, 0.8);
    border: 1px solid rgba(226, 232, 240, 0.8);
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}

.tool-modal-close:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
    transform: rotate(90deg);
}

/* 搜索栏 */
.tool-search-container {
    padding: 1rem 2rem;
    background: white;
    border-bottom: 1px solid #f1f5f9;
}

.tool-search-wrapper {
    position: relative;
}

.tool-search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.25rem;
    height: 1.25rem;
    color: #94a3b8;
}

.tool-search-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 0.75rem;
    font-size: 0.9375rem;
    color: #0f172a;
    transition: all 0.2s;
}

.tool-search-input:focus {
    outline: none;
    background: white;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.tool-search-input::placeholder {
    color: #cbd5e1;
}

/* 工具列表 */
.tool-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 2rem;
}

.tool-list-container::-webkit-scrollbar {
    width: 8px;
}

.tool-list-container::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.tool-list-container::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #cbd5e1, #94a3b8);
    border-radius: 4px;
}

.tool-list-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #94a3b8, #64748b);
}

.tool-list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

/* 工具卡片 */
.tool-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 1rem;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    opacity: 0;
    transition: opacity 0.3s;
}

.tool-card:hover {
    border-color: #6366f1;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.tool-card:hover::before {
    opacity: 1;
}

.tool-card.selected {
    border-color: #6366f1;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(168, 85, 247, 0.05));
}

.tool-card.selected::before {
    opacity: 1;
}

.tool-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.tool-card-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.tool-card.selected .tool-card-icon {
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: white;
}

.tool-card-checkbox {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid #cbd5e1;
    border-radius: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.tool-card.selected .tool-card-checkbox {
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    border-color: #6366f1;
}

.tool-card-checkbox svg {
    width: 1rem;
    height: 1rem;
    color: white;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s;
}

.tool-card.selected .tool-card-checkbox svg {
    opacity: 1;
    transform: scale(1);
}

.tool-card-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.25rem;
    font-family: 'Monaco', 'Menlo', monospace;
}

.tool-card-display-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.5rem;
}

.tool-card-description {
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tool-card-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tool-card-tag {
    padding: 0.25rem 0.625rem;
    background: #f1f5f9;
    border-radius: 0.375rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #64748b;
}

/* 模态框底部 */
.tool-modal-footer {
    padding: 1.25rem 2rem;
    background: rgba(248, 250, 252, 0.8);
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tool-modal-footer-info {
    font-size: 0.875rem;
    color: #64748b;
}

.tool-modal-footer-info strong {
    color: #6366f1;
    font-weight: 700;
}

.tool-modal-footer-actions {
    display: flex;
    gap: 0.75rem;
}

.tool-modal-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.tool-modal-btn-secondary:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.tool-modal-btn-primary {
    background: linear-gradient(135deg, #6366f1, #7c3aed);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.tool-modal-btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5, #6d28d9);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

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

.tool-list-empty-icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    opacity: 0.5;
}

.tool-list-empty-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.5rem;
}

.tool-list-empty-text {
    font-size: 0.875rem;
}

/* 响应式 */
@media (max-width: 768px) {
    .tool-modal-container {
        width: 95%;
        max-height: 90vh;
    }
    
    .tool-list-grid {
        grid-template-columns: 1fr;
    }
    
    .tool-modal-header,
    .tool-search-container,
    .tool-list-container,
    .tool-modal-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

