/* 模型数据包页面样式 */
.model-package-main {
    background: var(--bg-secondary);
    padding: 40px 0 80px;
    min-height: calc(100vh - 200px);
}

.page-header {
    text-align: center;
    margin-bottom: 40px;
}

.page-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.page-header p {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

/* 基础配置区 */
.config-section {
    display: flex;
    gap: 24px;
    margin-bottom: 40px;
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.config-item {
    flex: 1;
}

.config-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.config-item select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9375rem;
    transition: all 0.3s;
    outline: none;
    background: white;
    cursor: pointer;
}

.config-item select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* 卡片网格 */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

/* 功能卡片 */
.feature-card {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.feature-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.card-header {
    padding: 24px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(6, 182, 212, 0.05) 100%);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.card-icon svg {
    width: 24px;
    height: 24px;
}

.card-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* 上传卡片 */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--bg-secondary);
    margin-bottom: 16px;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
}

.upload-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    color: var(--text-secondary);
}

.upload-icon svg {
    width: 100%;
    height: 100%;
}

.upload-area p {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 0.9375rem;
}

.upload-hint {
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.upload-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.btn-upload,
.btn-select-db {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-primary);
}

.btn-upload:hover,
.btn-select-db:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--bg-secondary);
}

.btn-upload svg,
.btn-select-db svg {
    width: 18px;
    height: 18px;
}

.file-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.file-details {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.file-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.file-icon svg {
    width: 20px;
    height: 20px;
}

.file-text {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9375rem;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-meta {
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.btn-remove-file {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.btn-remove-file:hover {
    transform: scale(1.1);
}

/* 预览卡片 */
.preview-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

.empty-preview {
    text-align: center;
    color: var(--text-secondary);
}

.empty-preview svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-preview p {
    font-size: 0.9375rem;
}

.model-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.info-section h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.info-value {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
}

.structure-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.structure-block {
    background: var(--bg-secondary);
    padding: 12px;
    border-radius: 8px;
}

.structure-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: block;
}

.structure-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    padding: 4px 12px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 500;
}

.sample-data {
    overflow-x: auto;
}

.sample-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.sample-table th,
.sample-table td {
    padding: 10px 12px;
    text-align: left;
    border: 1px solid var(--border-color);
}

.sample-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-primary);
}

.sample-table td {
    color: var(--text-secondary);
}

.sample-table tr:hover {
    background: var(--bg-secondary);
}

/* 测试卡片 */
.test-input {
    margin-bottom: 16px;
}

.test-input label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.test-input textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.875rem;
    font-family: 'Courier New', monospace;
    resize: vertical;
    min-height: 120px;
    transition: all 0.3s;
    outline: none;
}

.test-input textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.input-hint svg {
    width: 14px;
    height: 14px;
}

.btn-test {
    width: 100%;
    padding: 14px 24px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow-md);
    margin-bottom: 16px;
}

.btn-test:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-test svg {
    width: 20px;
    height: 20px;
}

.test-result {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 16px;
}

.test-result h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.result-table th,
.result-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.result-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-primary);
}

.result-table td {
    color: var(--text-secondary);
}

.result-table tr:last-child td {
    border-bottom: none;
}

.result-value {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: var(--primary-color);
}

.test-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-align: center;
    padding: 40px 20px;
}

.test-empty svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.test-empty p {
    font-size: 0.9375rem;
}

/* 日志区 */
.log-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
}

.log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--bg-tertiary);
}

.log-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.btn-clear-log {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--text-secondary);
}

.btn-clear-log:hover {
    background: var(--danger-color);
    color: white;
}

.log-content {
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 16px;
}

.log-entry {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-time {
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    min-width: 80px;
}

.log-message {
    color: var(--text-primary);
    flex: 1;
}

.log-entry.info .log-message {
    color: var(--primary-color);
}

.log-entry.success .log-message {
    color: var(--success-color);
}

.log-entry.error .log-message {
    color: var(--danger-color);
}

.log-entry.warning .log-message {
    color: var(--warning-color);
}

/* 数据库选择模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-xl);
}

.modal-overlay.active .modal-container {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s;
    color: var(--text-secondary);
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-close svg {
    width: 24px;
    height: 24px;
}

.modal-body {
    padding: 24px 32px;
}

.db-model-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.db-model-item {
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.db-model-item:hover {
    border-color: var(--primary-color);
    background: var(--bg-secondary);
}

.db-model-item.selected {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.05);
}

.db-model-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.db-model-meta {
    display: flex;
    gap: 16px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.db-model-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .page-header h1 {
        font-size: 1.75rem;
    }

    .config-section {
        flex-direction: column;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .upload-buttons {
        flex-direction: column;
    }
}
