/* ============ type=2 嵌套模块(PRODUCT / QUICK_QUOTE / CARTEDIT 共享) start ============ */
/* 与 custom.css L2048-2476 逐字一致;custom.html 继续用 custom.css,此文件供编辑型页面引入 */
.step .step-content.nested-cards {
    --columns: 3;
    display: grid;
    grid-template-columns: repeat(var(--columns), 1fr);
    gap: clamp(1em, 1.5vw, 2em);
}

.nested-card {
    padding: 0 10px;
    cursor: pointer;
}

.nested-card .nested-card-img {
    aspect-ratio: 1/1;
    margin-bottom: 1em;
    border: .1em solid var(--border-color, var(--color-grayer));
    border-radius: .5em;
    overflow: hidden;
    position: relative;
    background: #fff;
}

.nested-card.none-img .nested-card-img {
    display: none;
}

.nested-card .nested-card-img > .nested-card-tag {
    position: absolute;
    top: 0;
    left: 0;
    background-color: #ff5252;
    padding: 5px 10px;
    color: #fff;
    font-weight: 600;
    border-bottom-right-radius: 10px;
    z-index: 2;
}

.nested-card .nested-card-img img {
    object-fit: contain;
    width: 100%;
    height: 100%;
}

.nested-card.is-active .nested-card-img {
    border-width: .2em;
    border-color: var(--color-bg-light);
}

.nested-card-label {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-align: center;
}

.nested-radio {
    width: 14px;
    height: 14px;
    border: var(--radio-input-border);
    border-radius: 50%;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: .5em;
    flex-shrink: 0;
}

.nested-radio-inner {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--color-white);
    display: none;
}

.nested-card.is-active .nested-radio {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.nested-card.is-active .nested-radio-inner {
    display: block;
}

.nested-card-name {
    font-size: 1em;
    line-height: 1.3;
    word-break: break-word;
}

.nested-card.is-active .nested-card-name {
    color: var(--color-primary);
}

.nested-card-price {
    margin-top: .5em;
    text-align: center;
    font-size: .83em;
    line-height: 1.4;
}

.nested-card-price .prominent {
    color: var(--color-fail);
    font-weight: 600;
}

.nested-card-price .nested-card-free {
    color: var(--color-success);
    font-weight: 600;
}

.nested-card-mold {
    margin-top: .3em;
    color: var(--color-gray);
}

/* 子面板 */
.nested-sub-panel {
    display: none;
    margin-top: 1.2em;
    border: 1px solid var(--border-color);
    border-radius: .8em;
    background: #fafafa;
    padding: clamp(1em, 2vw, 1.6em);
}

.nested-sub-panel.is-active {
    display: block;
}

.nested-section-title {
    font-weight: 600;
    margin-bottom: .8em;
    font-size: 1em;
    color: var(--color-darker);
}

.nested-size-options {
    display: flex;
    flex-wrap: wrap;
    gap: .8em;
    margin-bottom: 1em;
}

.nested-size-btn {
    border: 1px solid var(--border-color);
    border-radius: .5em;
    padding: .7em 1em;
    cursor: pointer;
    background: #fff;
    text-align: center;
    font-size: .9em;
    display: inline-flex;
    align-items: center;
    gap: .5em;
    font-family: inherit;
    transition: border-color .2s, box-shadow .2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.nested-size-btn:hover {
    border-color: var(--color-primary);
}

.nested-size-btn.is-active {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(93, 132, 179, .2);
}

.nested-size-btn img {
    width: 1.5em;
    height: 1.5em;
    object-fit: contain;
    border-radius: .3em;
    flex-shrink: 0;
}

.nested-size-content {
    display: none;
    margin-top: .5em;
    padding-top: 1em;
    border-top: 1px dashed #e0e0e0;
}

.nested-size-content.is-active {
    display: block;
}

/* 色点行: 左侧预览框 + 右侧色点 */
.nested-color-row {
    display: flex;
    align-items: flex-start;
    gap: .9em;
}

.nested-color-dots {
    display: flex;
    flex-wrap: wrap;
    gap: .7em;
    flex: 1;
    min-width: 0;
}

/* 选中图片预览框(第三层为图片时, 位于色点左侧) */
.nested-color-preview {
    flex: 0 0 110px;
    width: 110px;
}

.nested-color-preview-img {
    display: block;
    width: 110px;
    height: 110px;
    object-fit: contain;
    border: .1em solid var(--border-color, var(--color-grayer));
    border-radius: .5em;
    background: #fff;
    padding: .3em;
    box-sizing: border-box;
}

.nested-color-preview-name {
    display: block;
    margin-top: .4em;
    text-align: center;
    font-size: .85em;
    color: #666;
    line-height: 1.3;
    word-break: break-all;
}

.nested-color-dot {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid transparent;
    box-shadow: 0 0 0 1px #ddd;
    cursor: pointer;
    overflow: hidden;
    background: #f0f0f0;
    flex-shrink: 0;
    padding: 0;
    transition: border-color .2s, transform .1s;
    -webkit-tap-highlight-color: transparent;
}

.nested-color-dot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.nested-color-dot.is-active {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(93, 132, 179, .25);
}

.nested-color-dot-text {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 11px;
    color: #666;
}

/* sections 原子控件 */
.nested-custom-grid {
    display: flex;
    gap: 1.5em;
    align-items: stretch;
    flex-wrap: wrap;
}

.nested-custom-col {
    flex: 1;
    min-width: 220px;
}

.nested-upload-row {
    display: flex;
    gap: .8em;
    align-items: center;
    flex-wrap: wrap;
}

.nested-upload-btn {
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    background: #fff;
    padding: .5em 1.2em;
    border-radius: .4em;
    cursor: pointer;
    font-weight: 600;
    font-size: .9em;
    font-family: inherit;
}

.nested-upload-btn:hover {
    background: #f0f6fd;
}

.nested-upload-btn.is-disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* 嵌套上传文件列表(与 custom 页 .upload-file-list 列表样式一致, 可删除) */
.nested-upload-file-list .file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    margin-top: .5em;
    font-size: 13px;
    border-radius: 5px;
    background: #f7f7f7;
}

.nested-upload-file-list .file-item span {
    flex: 1;
    padding-left: 5px;
    word-break: break-all;
}

.nested-upload-file-list .file-item .remove-btn {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    color: #ff5252;
    cursor: pointer;
}

.nested-helper-text {
    display: flex;
    align-items: center;
    gap: .5em;
    margin-top: .8em;
    font-size: .85em;
    color: var(--color-gray);
    cursor: pointer;
    user-select: none;
}

.nested-helper-text input {
    cursor: pointer;
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

.nested-textarea {
    width: 100%;
    min-height: 82px;
    border: 1px solid var(--border-color);
    border-radius: .4em;
    padding: .5em .6em;
    resize: vertical;
    font-family: inherit;
    font-size: .9em;
    box-sizing: border-box;
    background-color: #fff;
    color: var(--color-darker);
}

.nested-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(93, 132, 179, .15);
}

.nested-text-input {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: .4em;
    padding: .5em .6em;
    font-size: .9em;
    box-sizing: border-box;
    background-color: #fff;
    color: var(--color-darker);
}

.nested-text-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.nested-select {
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: .4em;
    padding: .5em .6em;
    font-size: .9em;
    background: #fff;
    color: var(--color-darker);
}

@media screen and (max-width: 768px) {
    .step .step-content.nested-cards {
        --columns: 3;
        gap: .6em;
    }

    .nested-card {
        padding: 0;
    }

    .nested-card .nested-card-img {
        margin-bottom: .6em;
    }

    .nested-card-price {
        font-size: .75em;
    }

    .nested-card-mold {
        font-size: .9em;
    }

    .nested-radio {
        width: 12px;
        height: 12px;
        margin-right: .4em;
    }

    .nested-card-name {
        font-size: .9em;
    }

    .nested-sub-panel {
        padding: 1em .8em;
        margin-top: 1em;
        margin-bottom: 1em;
    }

    .nested-size-options {
        gap: .5em;
        margin-bottom: .8em;
    }

    .nested-size-btn {
        flex: 1;
        padding: .6em .4em;
        font-size: .8em;
    }

    .nested-custom-grid {
        flex-direction: column;
        gap: 1em;
    }

    .nested-custom-col {
        flex: none;
        width: 100%;
        min-width: 0;
    }

    .nested-color-dot {
        width: 38px;
        height: 38px;
    }

    .nested-color-preview {
        flex-basis: 76px;
        width: 76px;
    }

    .nested-color-preview-img {
        width: 76px;
        height: 76px;
    }

    .nested-upload-btn {
        width: 100%;
        padding: .8em;
        text-align: center;
    }

    .nested-helper-text {
        font-size: .8em;
    }

    .nested-textarea,
    .nested-text-input {
        font-size: 16px;
    }
}
/* ============ type=2 嵌套模块 end ============ */
