﻿/* PCB 计价页仿真图 / 2D 图预览（L1） */

.pcb-preview {
    display: none;
    margin: 0 0 16px;
    padding: 14px 16px 12px;
    border: 1px solid #e6e8eb;
    border-radius: 6px;
    background: #fff;
}

.pcb-preview.is-visible {
    display: block !important;
}

/* 预览展示时隐藏原上传框，但保留内部的 #pcbQuoteUpFile 锚点供加购读取 */
.boxPcbUpFile.pcb-preview-hidden {
    display: none !important;
}

.pcb-preview__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.pcb-preview__title {
    color: #222;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
}

.pcb-preview__actions {
    display: flex;
    align-items: center;
}

.pcb-preview__actions .pcb-preview__btn + .pcb-preview__btn {
    margin-left: 8px;
}

.pcb-preview__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    padding: 0 12px;
    border: 1px solid #d9dde3;
    border-radius: 3px;
    background: #fff;
    color: #333;
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color .2s, color .2s, background-color .2s;
}

.pcb-preview__btn:hover {
    border-color: #0060FF;
    color: #0060FF;
}

.pcb-preview__btn--primary {
    border-color: #0060FF;
    background: #eff5ff;
    color: #0060FF;
}

.pcb-preview__btn--primary:hover {
    background: #0060FF;
    color: #fff;
}

.pcb-preview__btn svg {
    margin-right: 5px;
}

.pcb-preview__btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.pcb-preview__body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    padding: 16px 20px;
    border-radius: 6px;
    background: #F2F6FA;
    overflow: hidden;
}

/* 无仿真图但有 2D 预览时：隐藏仿真图图片模块，并紧凑化展示卡片 */
.pcb-preview.no-sim-images .pcb-preview__body {
    display: none !important;
}

.pcb-preview.no-sim-images .pcb-preview__head {
    margin-bottom: 8px;
}

.pcb-preview.no-sim-images .pcb-preview__foot {
    margin-top: 0;
    padding-top: 10px;
    border-top: 1px dashed #e6e8eb;
}

.pcb-preview__item {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    height: 180px;
    margin: 0 10px;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    overflow: hidden;
    cursor: zoom-in;
}

.pcb-preview__item:hover {
    border-color: transparent;
    box-shadow: none;
}

.pcb-preview__item.is-empty {
    display: none;
}

.pcb-preview__item.is-error {
    cursor: default;
}

.pcb-preview__item.is-error:hover {
    border-color: transparent;
    box-shadow: none;
}

.pcb-preview__img {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
    pointer-events: none;
    user-select: none;
    transition: opacity .2s;
}

.pcb-preview__item.is-loaded .pcb-preview__img {
    opacity: 1;
}

.pcb-preview__badge {
    display: none !important;
}

.pcb-preview__skeleton {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(100deg, #f1f3f5 20%, #e7ebef 40%, #f1f3f5 60%);
    background-size: 200% 100%;
    animation: pcbPreviewShimmer 1.4s infinite linear;
}

.pcb-preview__item.is-loaded .pcb-preview__skeleton,
.pcb-preview__item.is-error .pcb-preview__skeleton {
    display: none;
}

.pcb-preview__error {
    position: absolute;
    top: 50%;
    left: 50%;
    display: none;
    color: #999;
    font-size: 12px;
    white-space: nowrap;
    transform: translate(-50%, -50%);
}

.pcb-preview__item.is-error .pcb-preview__error {
    display: block;
}

@keyframes pcbPreviewShimmer {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

.pcb-preview__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    color: #777;
    font-size: 12px;
    line-height: 18px;
}

.pcb-preview__detected {
    overflow: hidden;
    color: #555;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pcb-preview__meta {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    max-width: 50%;
    margin-left: 16px;
}

.pcb-preview__file {
    display: inline-flex;
    align-items: center;
    max-width: 280px;
    color: #333;
    text-decoration: underline;
    cursor: pointer;
}

.pcb-preview__file:hover {
    color: #f90;
    text-decoration: underline;
}

.pcb-preview__file-icon {
    flex-shrink: 0;
    margin-right: 5px;
    color: #008549;
}

.pcb-preview__file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pcb-preview__delete {
    margin-left: 12px;
    padding: 0;
    border: 0;
    background: none;
    color: #999;
    font-size: 12px;
    cursor: pointer;
}

.pcb-preview__delete:hover {
    color: #e54d42;
}


/* ---------------------------------------------------------------- 2D 弹窗 */

.pcb-preview-lock {
    overflow: hidden;
}

.pcb-preview-modal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
}

.pcb-preview-modal.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.pcb-preview-modal__mask {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, .55);
}

.pcb-preview-modal__dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: 92vw;
    max-width: 1180px;
    height: 88vh;
    max-height: 820px;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, .28);
    overflow: hidden;
}

.pcb-preview-modal__dialog:focus {
    outline: none;
}

.pcb-preview-modal__head {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    padding: 0 12px;
    border-bottom: 1px solid #eceff2;
}

.pcb-preview-modal__tabs {
    display: flex;
    align-items: stretch;
    height: 100%;
}

.pcb-preview-modal__tab {
    height: 100%;
    padding: 0 16px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    color: #666;
    font-size: 14px;
    cursor: pointer;
}

.pcb-preview-modal__tab:hover {
    color: #0060FF;
}

.pcb-preview-modal__tab.is-active {
    border-bottom-color: #0060FF;
    color: #0060FF;
    font-weight: 600;
}

.pcb-preview-modal__tab:disabled {
    color: #c4c8cc;
    cursor: not-allowed;
}

.pcb-preview-modal__tools {
    display: flex;
    align-items: center;
}

.pcb-preview-modal__tool {
    height: 28px;
    min-width: 30px;
    margin-left: 6px;
    padding: 0 9px;
    border: 1px solid #dde1e6;
    border-radius: 3px;
    background: #fff;
    color: #333;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
}

.pcb-preview-modal__tool:hover {
    border-color: #0060FF;
    color: #0060FF;
}

.pcb-preview-modal__zoom {
    min-width: 48px;
    margin-left: 6px;
    color: #666;
    font-size: 12px;
    text-align: center;
}

.pcb-preview-modal__reset {
    font-size: 12px;
}

.pcb-preview-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin-left: 10px;
    padding: 0;
    border: 0;
    background: none;
    color: #999;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.pcb-preview-modal__close:hover {
    color: #333;
}

.pcb-preview-modal__stage {
    position: relative;
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f3f4f6;
    cursor: default;
    touch-action: none;
    user-select: none;
}

.pcb-preview-modal__stage.is-zoomed {
    cursor: grab;
}

.pcb-preview-modal__stage.is-dragging {
    cursor: grabbing;
}

.pcb-preview-modal__img {
    max-width: 100%;
    max-height: 100%;
    opacity: 0;
    pointer-events: none;
    user-select: none;
    will-change: transform;
    transform-origin: center center;
    transition: opacity .2s;
}

.pcb-preview-modal__img.is-loaded {
    opacity: 1;
}

.pcb-preview-modal__loading,
.pcb-preview-modal__error {
    position: absolute;
    top: 50%;
    left: 50%;
    color: #888;
    font-size: 13px;
    transform: translate(-50%, -50%);
}

.pcb-preview-modal__error {
    display: none;
    color: #e54d42;
}

.pcb-preview-modal__iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #121212;
    z-index: 5;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease;
}

.pcb-preview-modal.is-prewarming {
    display: block !important;
    position: fixed !important;
    top: -9999px !important;
    left: -9999px !important;
    width: 1180px !important;
    height: 800px !important;
    opacity: 0.01 !important;
    visibility: visible !important;
    pointer-events: none !important;
    z-index: -999 !important;
}

.pcb-preview-modal.is-prewarming .pcb-preview-modal__dialog {
    width: 1180px !important;
    height: 800px !important;
    display: flex !important;
}

.pcb-preview-modal.is-prewarming .pcb-preview-modal__stage {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
}

.pcb-preview-modal.is-prewarming .pcb-preview-modal__iframe {
    width: 100% !important;
    height: 100% !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: none !important;
}

.pcb-preview-modal.is-2d-mode .pcb-preview-modal__iframe {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.pcb-preview-modal.is-2d-mode.is-loading .pcb-preview-modal__loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #18191c;
    color: #e0e0e0;
    z-index: 6;
    padding: 24px 32px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    font-size: 14px;
    letter-spacing: 0.3px;
}

.pcb-preview-modal.is-2d-mode.is-loading .pcb-preview-modal__loading::before {
    content: '';
    width: 32px;
    height: 32px;
    margin-bottom: 12px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: #0060FF;
    border-radius: 50%;
    animation: pcb2dSpin 0.8s linear infinite;
}

@keyframes pcb2dSpin {
    to {
        transform: rotate(360deg);
    }
}

.pcb-preview-modal.is-2d-mode .pcb-preview-modal__tools [data-act="zoom-in"],
.pcb-preview-modal.is-2d-mode .pcb-preview-modal__tools [data-act="zoom-out"],
.pcb-preview-modal.is-2d-mode .pcb-preview-modal__tools [data-act="reset"],
.pcb-preview-modal.is-2d-mode .pcb-preview-modal__zoom,
.pcb-preview-modal.is-2d-mode .pcb-preview-modal__tabs,
.pcb-preview-modal.is-2d-mode .pcb-preview-modal__img {
    display: none !important;
}

.pcb-preview-modal.is-2d-mode .pcb-preview-modal__title-2d {
    display: block;
    color: #333;
    font-size: 15px;
    font-weight: 600;
}

.pcb-preview-modal:not(.is-2d-mode) .pcb-preview-modal__title-2d {
    display: none;
}

@media (max-width: 768px) {
    .pcb-preview__body {
        display: block;
        margin: 0;
    }

    .pcb-preview__item {
        display: block;
        margin: 0 0 10px;
    }

    .pcb-preview__foot {
        display: block;
    }

    .pcb-preview__meta {
        max-width: 100%;
        margin: 4px 0 0;
    }

    .pcb-preview-modal {
        padding: 0;
    }

    .pcb-preview-modal__dialog {
        width: 100vw;
        height: 100vh;
        max-height: none;
        border-radius: 0;
    }
}
