/* =========================================================================
   360° product viewer — floating button + fullscreen modal with drag-to-rotate
   ========================================================================= */

/* --- Floating "360° View" trigger button on the product gallery --- */
.bm-360-btn {
    position: absolute;
    bottom: 18px;
    right: 18px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 14px;
    background: #0a1230;
    color: #ffffff;
    border: none;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -0.005em;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
    transition: background 0.2s ease, transform 0.18s ease, box-shadow 0.2s ease;
}
.bm-360-btn:hover,
.bm-360-btn:focus {
    background: #1a1f3a;
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.22);
    color: #ffffff;
    outline: none;
}
.bm-360-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.bm-360-btn-icon svg { display: block; }
@media (max-width: 575px) {
    .bm-360-btn {
        bottom: 12px;
        right: 12px;
        padding: 8px 12px;
        font-size: 12px;
    }
}

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

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

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

/* --- Head --- */
.bm-360-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #eef0f4;
}
.bm-360-modal-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #0a1230;
}
.bm-360-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-360-modal-close:hover {
    background: #f3f4f6;
    color: #0a1230;
}

/* --- Stage (where the rotating frame lives) --- */
.bm-360-stage {
    position: relative;
    background: linear-gradient(180deg, #fafbfc 0%, #f1f3f7 100%);
    min-height: 420px;
    height: 65vh;
    max-height: 620px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    user-select: none;
    overflow: hidden;
    outline: none;
}
.bm-360-stage.is-dragging { cursor: grabbing; }
.bm-360-stage:focus-visible { box-shadow: inset 0 0 0 3px #d8f55a; }

.bm-360-frame {
    max-width: 92%;
    max-height: 92%;
    width: auto;
    height: auto;
    object-fit: contain;
    pointer-events: none;
    -webkit-user-drag: none;
    user-drag: none;
    transition: opacity 0.08s linear;
}

/* --- Drag hint (fades out on first drag) --- */
.bm-360-hint {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(10, 18, 48, 0.8);
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.bm-360-hint.is-hidden { opacity: 0; }
.bm-360-hint i { font-size: 14px; }

/* --- Frame counter top-right --- */
.bm-360-counter {
    position: absolute;
    top: 12px;
    right: 14px;
    padding: 4px 10px;
    background: rgba(10, 18, 48, 0.78);
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 700;
    border-radius: 999px;
    letter-spacing: 0.02em;
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}

/* --- Controls --- */
.bm-360-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 14px 18px;
    background: #ffffff;
    border-top: 1px solid #eef0f4;
}
.bm-360-ctrl {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #f3f4f6;
    color: #0a1230;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.12s ease, color 0.18s ease;
}
.bm-360-ctrl:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}
.bm-360-ctrl.bm-360-play {
    width: 50px;
    height: 50px;
    background: #0a1230;
    color: #ffffff;
    font-size: 20px;
}
.bm-360-ctrl.bm-360-play:hover {
    background: #1a1f3a;
    color: #ffffff;
}
.bm-360-ctrl.bm-360-play.is-playing i::before { content: "\f04c"; }  /* swap icon if FA is loaded */

@media (max-width: 575px) {
    .bm-360-modal { padding: 10px; }
    .bm-360-modal-dialog { border-radius: 14px; }
    .bm-360-stage { min-height: 320px; height: 60vh; }
    .bm-360-modal-head { padding: 12px 14px; }
    .bm-360-controls { padding: 12px 14px; gap: 10px; }
}

/* Lock background scroll while modal is open */
body.bm-360-open {
    overflow: hidden;
}
