/* 智聊模型模块样式（独立作用域，避免影响其它布局） */

.zl-model-popover {
    position: fixed;
    z-index: 10020;
    width: fit-content;
    max-width: calc(100vw / 3);
    min-width: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    padding: 8px;
}

.zl-model-option-list {
    max-height: 280px;
    overflow-y: auto;
}

.zl-model-option-loading-wrap {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zl-model-option-loading {
    color: #6b7280;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
}

.zl-model-option {
    width: 100%;
    border: none;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
}

.zl-model-option:hover {
    background: #f3f7ff;
}

.zl-model-option.active {
    background: #eaf2ff;
}

.zl-model-option-name {
    color: #111827;
    font-size: 13px;
    line-height: 1.3;
    font-weight: 600;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.zl-model-option-sub {
    color: #6b7280;
    font-size: 12px;
    line-height: 1.3;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.zl-model-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 10030;
}

.zl-model-modal.show {
    display: block;
}

.zl-model-modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.32);
}

.zl-model-modal-panel {
    position: relative;
    margin: 5vh auto;
    width: 90vw;
    height: 90vh;
    max-width: 480px;
    max-height: 932px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.zl-model-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.zl-model-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: #111827;
    min-width: 0;
}

.zl-model-modal-close {
    border: none;
    background: transparent;
    font-size: 20px;
    color: #6b7280;
    cursor: pointer;
    line-height: 1;
}

.zl-model-modal-body {
    flex: 1 1 auto;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    overflow: hidden;
}

.zl-model-modal-footer {
    flex-shrink: 0;
    padding: 10px 16px 10px;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}

.zl-model-loading-mask {
    position: absolute;
    inset: 0;
    z-index: 30;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.55);
    pointer-events: auto;
}

.zl-model-loading-mask.show {
    display: flex;
}

.zl-model-loading-mask span {
    color: #374151;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.4px;
}

.zl-model-modal-panel.is-editing .zl-model-modal-body {
    padding: 10px 16px 10px;
}

.zl-model-list-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.zl-model-list-scroll::-webkit-scrollbar {
    width: 6px;
}

.zl-model-list-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.zl-model-list-scroll::-webkit-scrollbar-thumb {
    background: rgba(107, 114, 128, 0.35);
    border-radius: 999px;
}

.zl-model-list-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(107, 114, 128, 0.55);
}

.zl-model-empty {
    color: #6b7280;
    font-size: 13px;
    padding: 12px 8px;
}

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

.zl-model-card {
    position: relative;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    background: #ffffff;
    width: 100%;
    min-width: 0;
}

.zl-model-card[draggable="true"] {
    cursor: grab;
}

.zl-model-card.is-dragging {
    opacity: 0.6;
    cursor: grabbing;
}

.zl-model-card.drag-insert-top::before {
    content: '';
    position: absolute;
    left: 10px;
    right: 10px;
    top: -7px;
    height: 2px;
    border-radius: 999px;
    background: #3d6dff;
    pointer-events: none;
}

.zl-model-row1 {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.zl-model-name {
    flex: 1 1 auto;
    min-width: 0;
    color: #111827;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.zl-model-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.zl-model-actions button {
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #374151;
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 12px;
    cursor: pointer;
}

.zl-model-row2 {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
    white-space: nowrap;
    margin-bottom: 8px;
    overflow: hidden;
}

.zl-model-tag,
.zl-model-tag-empty {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 1px 7px;
    font-size: 11px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

.zl-model-tag {
    background: #edf2ff;
    color: #3458a2;
}

.zl-model-tag-empty {
    background: #f3f4f6;
    color: #9ca3af;
}

.zl-model-row3 {
    min-width: 0;
    color: #4b5563;
    font-size: 12px;
    line-height: 1.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.zl-model-add-card-btn {
    width: 100%;
    border: 1px dashed #9ca3af;
    border-radius: 10px;
    background: #ffffff;
    color: #374151;
    padding: 10px 0;
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
}

.zl-model-editor-page {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.zl-model-editor {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.zl-model-editor-grid {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: max-content max-content max-content max-content max-content minmax(0, 1fr);
    align-content: stretch;
    gap: 10px;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.zl-model-editor-grid label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    color: #374151;
    font-size: 12px;
}

.zl-model-editor-label {
    display: block;
    margin-bottom: 4px;
}

.zl-model-editor-grid input,
.zl-model-editor-grid select,
.zl-model-editor-grid textarea {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 7px 8px;
    font-size: 13px;
    color: #111827;
    outline: none;
    background: #ffffff;
}

.zl-model-editor-grid textarea {
    resize: none;
}

.zl-model-editor-models {
    grid-column: span 1;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.zl-model-editor-models textarea {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow-y: auto;
}

.zl-model-editor-actions {
    margin-top: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    flex-shrink: 0;
}

.zl-model-editor-actions button {
    width: 100%;
    border: 1px solid #d1d5db;
    background: #ffffff;
    color: #374151;
    border-radius: 8px;
    padding: 10px 0;
    font-size: 12px;
    cursor: pointer;
}

.zl-model-editor-actions button:disabled {
    opacity: 0.72;
    cursor: not-allowed;
}

.zl-model-editor-actions button[data-action="save-editor"] {
    background: #3d6dff;
    color: #ffffff;
    border-color: #3d6dff;
}

@media (max-width: 768px) {
    .zl-model-modal-panel {
        margin: 5vh auto;
        width: 90vw;
        height: 90vh;
    }

    .zl-model-editor-grid {
        grid-template-columns: 1fr;
        grid-template-rows: max-content max-content max-content max-content max-content minmax(0, 1fr);
        align-content: stretch;
    }

    .zl-model-editor-models {
        grid-column: span 1;
    }
}
