/* =========================================================================
   Premium 3D product viewer — floating "View in 3D" button + fullscreen modal
   wrapping a Google <model-viewer> for free-orbit + zoom + AR.
   ========================================================================= */

/* --- Floating button --- */
.bm-3d-btn {
    position: absolute;
    bottom: 70px;             /* sit above 360 button if both exist */
    right: 18px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    background: linear-gradient(135deg, #6d28d9 0%, #db2777 100%);
    color: #ffffff;
    border: none;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -0.005em;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(109, 40, 217, 0.32);
    transition: background 0.2s ease, transform 0.18s ease, box-shadow 0.2s ease;
}
.bm-3d-btn:hover,
.bm-3d-btn:focus {
    background: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%);
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(109, 40, 217, 0.36);
    color: #ffffff;
    outline: none;
}
.bm-3d-btn-icon { display: inline-flex; align-items: center; justify-content: center; }
.bm-3d-btn-icon svg { display: block; }
@media (max-width: 575px) {
    .bm-3d-btn { bottom: 56px; right: 12px; padding: 8px 12px; font-size: 12px; }
}

/* If 360 button isn't present, drop the 3D button to the corner */
body:not(:has(.bm-360-btn)) .bm-3d-btn { bottom: 18px; }
@media (max-width: 575px) {
    body:not(:has(.bm-360-btn)) .bm-3d-btn { bottom: 12px; }
}

/* --- Modal --- */
.bm-3d-modal {
    position: fixed;
    inset: 0;
    z-index: 10060;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.bm-3d-modal[hidden] { display: none !important; }

.bm-3d-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 18, 48, 0.84);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    cursor: pointer;
}

.bm-3d-modal-dialog {
    position: relative;
    background: #ffffff;
    border-radius: 18px;
    width: min(960px, 100%);
    max-height: 95vh;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: bm3d-pop 0.22s ease-out;
}
@keyframes bm3d-pop {
    from { transform: translateY(8px) scale(0.985); opacity: 0; }
    to   { transform: translateY(0)   scale(1);     opacity: 1; }
}

.bm-3d-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #eef0f4;
    background: linear-gradient(135deg, #faf7ff 0%, #fdf2f8 100%);
}
.bm-3d-modal-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #4c1d95;
}
.bm-3d-modal-title i { color: #db2777; }
.bm-3d-modal-close {
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #6b7280;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}
.bm-3d-modal-close:hover {
    background: #f3f4f6;
    color: #0a1230;
}

/* --- Stage (where model-viewer lives) --- */
.bm-3d-stage {
    position: relative;
    height: 70vh;
    max-height: 720px;
    min-height: 420px;
    background: #ffffff;
}

/* --- model-viewer overrides --- */
model-viewer {
    --poster-color: transparent;
    outline: none;
}

/* AR button */
.bm-3d-ar-btn {
    position: absolute;
    bottom: 18px;
    left: 18px;
    background: #0a1230;
    color: #ffffff;
    border: none;
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
    transition: background 0.2s ease, transform 0.18s ease;
}
.bm-3d-ar-btn:hover {
    background: #1a1f3a;
    transform: translateY(-1px);
}
.bm-3d-ar-btn i { font-size: 16px; }

/* Loading progress bar */
.bm-3d-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(15, 23, 42, 0.08);
}
.bm-3d-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #6d28d9, #db2777);
    width: 0%;
    transition: width 0.2s ease;
}

/* Hint pill */
.bm-3d-hint {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: rgba(10, 18, 48, 0.8);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
    pointer-events: none;
    white-space: nowrap;
}
.bm-3d-hint i { font-size: 13px; }

@media (max-width: 575px) {
    .bm-3d-modal { padding: 10px; }
    .bm-3d-modal-dialog { border-radius: 14px; }
    .bm-3d-stage { min-height: 320px; height: 65vh; }
    .bm-3d-ar-btn { bottom: 12px; left: 12px; padding: 9px 13px; font-size: 12px; }
    .bm-3d-hint { font-size: 11px; padding: 5px 10px; }
}

body.bm-3d-open { overflow: hidden; }
