/* =============================================
 * PW EPO – 3D Preview  v1.2.1
 * ============================================= */

/* ── wrapper injected into each EPO value cell ── */
.epo-a3d-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 6px;
}

.epo-a3d-item {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

/* ── file row: button + download ── */
.epo-a3d-file-row {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px;
}

/* ── view button (shared) ── */
.epo-a3d-view-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #4a3f6b 0%, #5d4f86 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s;
    box-shadow: 0 2px 4px rgba(74,63,107,.2);
    flex: 1;
    text-align: left;
}
.epo-a3d-view-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74,63,107,.3);
    background: linear-gradient(135deg, #5d4f86 0%, #4a3f6b 100%);
}

/* image variant */
.epo-a3d-view-btn.epo-a3d-image-btn {
    background: linear-gradient(135deg, #6a5acd 0%, #836fff 100%);
}
.epo-a3d-view-btn.epo-a3d-image-btn:hover {
    background: linear-gradient(135deg, #836fff 0%, #6a5acd 100%);
    box-shadow: 0 4px 12px rgba(106,90,205,.4);
}

/* zip variant */
.epo-a3d-view-btn.epo-a3d-zip-btn {
    background: linear-gradient(135deg, #f58434 0%, #e6742d 100%);
}
.epo-a3d-view-btn.epo-a3d-zip-btn:hover {
    background: linear-gradient(135deg, #e6742d 0%, #f58434 100%);
    box-shadow: 0 4px 12px rgba(245,132,52,.3);
}

/* disabled / non-viewable */
.epo-a3d-view-btn.epo-a3d-disabled {
    background: #f5f4f8;
    color: #7c6f9d;
    border: 2px dashed #e9e7ef;
    cursor: default;
    box-shadow: none;
}
.epo-a3d-view-btn.epo-a3d-disabled:hover {
    transform: none;
    box-shadow: none;
    background: #f5f4f8;
}

/* ── inner parts ── */
.epo-a3d-btn-icon {
    font-size: 20px;
}
.epo-a3d-btn-label {
    padding: 4px 10px;
    background: rgba(255,255,255,.25);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
}
.epo-a3d-btn-filename {
    flex: 1;
    text-align: left;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.epo-a3d-btn-filename em {
    font-weight: 400;
    opacity: .8;
    font-size: 12px;
}
.epo-a3d-cannot-preview {
    font-size: 11px;
    font-weight: 400;
    opacity: .7;
    font-style: italic;
}

/* ── download icon ── */
.epo-a3d-download-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: #f5f4f8;
    border: 2px solid #e9e7ef;
    border-radius: 8px;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    flex-shrink: 0;
}
.epo-a3d-download-icon:hover {
    background: #4a3f6b;
    border-color: #4a3f6b;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(74,63,107,.2);
}
.epo-a3d-download-icon.epo-a3d-download-zip:hover {
    background: #f58434;
    border-color: #f58434;
    box-shadow: 0 4px 8px rgba(245,132,52,.2);
}
.epo-a3d-download-icon span {
    font-size: 20px;
    transition: transform .2s;
}
.epo-a3d-download-icon:hover span {
    transform: translateY(2px);
}

/* ── viewer container (hidden by default) ── */
.epo-a3d-viewer {
    width: 100%;
    height: 600px;
    background: #F0EDE8;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-top: 8px;
    border-radius: 0 0 8px 8px;
}

/* ── Frontend: full-width row for preview ── */
.epo-a3d-full-row > td {
    padding: 15px 20px !important;
    border-top: none !important;
    background: #fafafa;
}

.epo-a3d-full-row .epo-a3d-wrapper {
    max-width: 100%;
}

.epo-a3d-full-row .epo-a3d-item {
    margin-bottom: 10px;
}

.epo-a3d-full-row .epo-a3d-viewer {
    border-radius: 0 0 8px 8px;
    margin-top: 0;
}

/* Hide empty placeholder leftovers */
.epo-a3d-placeholder { display: none; }
.epo-a3d-viewer canvas {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
}
.epo-a3d-viewer img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* ── download progress bar ── */
.epo-a3d-progress-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 16px;
}
.epo-a3d-progress-label {
    font-size: 13px;
    font-weight: 600;
    color: #4a3f6b;
}
.epo-a3d-progress-track {
    width: 70%;
    background: #e9e7ef;
    border-radius: 4px;
    height: 8px;
    overflow: hidden;
}
.epo-a3d-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #f58434, #e6742d);
    border-radius: 4px;
    transition: width 0.2s;
}

/* ── loading spinner ── */
.epo-a3d-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.epo-a3d-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e9e7ef;
    border-top-color: #f58434;
    border-radius: 50%;
    animation: epo-a3d-spin .8s linear infinite;
}
@keyframes epo-a3d-spin {
    to { transform: rotate(360deg); }
}
.epo-a3d-loading-text {
    color: #4a3f6b;
    font-weight: 600;
    font-size: 14px;
}

/* ── responsive ── */
@media (max-width: 768px) {
    .epo-a3d-viewer {
        height: 400px;
    }
}
