/* Custom css for 3D Viewer */

.b3dviewer_front_shortcode input {
  cursor: pointer;
  text-align: center;
  border: none;
  outline: none;
  background-color: #1e8cbe;
  color: #fff;
  padding: 4px 10px;
  border-radius: 3px;
}

.b3dviewer_front_shortcode {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  /* margin: 0 auto;
  width: 100%; */
}

.b3dviewer_front_shortcode svg {
  cursor: pointer;
}

.b3dviewer_front_shortcode .htooltip {
  visibility: hidden;
  width: 140px;
  background-color: #555;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px;
  position: absolute;
  z-index: 1;
  bottom: 150%;
  left: 50%;
  margin-left: -75px;
  opacity: 0;
  transition: opacity 0.3s;
}

.b3dviewer_front_shortcode .htooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #555 transparent transparent transparent;
}

.b3dviewer_front_shortcode:hover .htooltip {
  visibility: visible;
  opacity: 1;
}

/* Woocommerce Css */
/* #woocommerce-product-images {
  display: none;
} */

.button.button-bplugins {
  background: #146ef5;
  color: #fff;
}

.components-button.button.button-bplugins:hover,
.button.button-bplugins:hover {
  background: #0957ca;
  color: #fff;
}

.bp3d_shortcode_area_after_title {
  display: flex;
  background: #fff;
  padding: 5px 15px;
  align-items: center;
  /* justify-content: center; */
  gap: 15px;
  margin-top: 10px;
  border: 1px solid #ccc;

  label {
    font-weight: 500;
    font-size: 1rem;
  }

  .shortcode_area {
    display: flex;
    align-items: center;
    gap: 10px;

    svg {
      cursor: pointer;
    }
  }
}

/* ========================================
   Live model preview (metabox) — redesign
   ======================================== */

/* Live preview container styling inside CSF field */
#bp3d-model-preview-root {
  width: 100%;
}

/* --- Preview panel card --- */
.bp3d-model-preview {
  position: relative;
  border-radius: 0px !important;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  transition: box-shadow 0.25s ease;
}

.bp3d-model-preview:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08), 0 8px 24px rgba(0, 0, 0, 0.06);
}

/* --- Header bar --- */
.bp3d-model-preview__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
  border-bottom: 1px solid #e2e8f0;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}

.bp3d-model-preview__header:hover {
  background: linear-gradient(135deg, #f1f5f9 0%, #e8ecff 100%);
}

.bp3d-model-preview__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 0px !important;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  flex-shrink: 0;
}

.bp3d-model-preview__icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.bp3d-model-preview__title {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  letter-spacing: 0.01em;
}

.bp3d-model-preview__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 0px !important;
  background: #dcfce7;
  color: #16a34a;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bp3d-model-preview__badge::before {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #16a34a;
  animation: bp3d-pulse 2s ease-in-out infinite;
}

/* --- Header action buttons --- */
.bp3d-model-preview__actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.bp3d-model-preview__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}

.bp3d-model-preview__btn:hover {
  background: rgba(99, 102, 241, 0.1);
  color: #4f46e5;
}

.bp3d-model-preview__btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.bp3d-model-preview__btn--refresh svg {
  transition: transform 0.3s ease;
}

.bp3d-model-preview__btn--refresh:hover svg {
  transform: rotate(90deg);
}

.bp3d-model-preview__btn--toggle svg {
  transition: transform 0.25s ease;
}

.bp3d-model-preview--collapsed .bp3d-model-preview__btn--toggle svg {
  transform: rotate(-90deg);
}

/* --- Stage (preview viewport) --- */
.bp3d-model-preview__body {
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease;
  max-height: 800px;
  opacity: 1;
}

.bp3d-model-preview--collapsed .bp3d-model-preview__body {
  max-height: 0;
  opacity: 0;
}

.bp3d-model-preview__stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  padding: 12px;
  margin: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 0px !important;
  background: #f9fafb;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.bp3d-model-preview__stage:hover {
  border-color: #c7d2fe;
}

/* Let the viewer fill the sidebar preview box and the modal stage — without
   this the block keeps its intrinsic width and sits in the left half. */
.bp3d-model-preview__stage .modelViewerBlock,
.bp3d-model-preview__stage .b3dviewer-wrapper,
.bp3d-modal-body .modelViewerBlock,
.bp3d-modal-body .b3dviewer-wrapper {
  width: 100%;
}

/* --- Empty state --- */
/* Live Preview: a model the Lite viewer can't open (src/admin/preview). */
p.bp3d-lite-notice {
  margin: 12px 12px 0;
  padding: 6px 10px;
  border-left: 3px solid #f59e0b;
  border-radius: 4px;
  background: var(--bfields-warn-bg, #fffbeb);
  color: var(--bfields-warn-fg, #92400e);
  font-size: 12px;
  line-height: 1.5;
}

.bp3d-side-preview > p.bp3d-lite-notice {
  margin: 12px 15px 0;
}

.bp3d-model-preview__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 30px 20px;
  margin: 0;
  text-align: center;
}

.bp3d-model-preview__empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 0px !important;
  background: linear-gradient(135deg, #eef2ff, #e0e7ff);
  animation: bp3d-float 3s ease-in-out infinite;
}

.bp3d-model-preview__empty-icon svg {
  width: 28px;
  height: 28px;
  fill: #818cf8;
}

.bp3d-model-preview__empty-text {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
  max-width: 260px;
}

.bp3d-model-preview__empty-text strong {
  color: #64748b;
  font-weight: 600;
}

/* --- Animations --- */
@keyframes bp3d-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@keyframes bp3d-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* --- Preview Popup Modal Redesign --- */
.bp3d-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999999;
  animation: bp3d-fade-in 0.25s ease-out;
}

.bp3d-modal-container {
  width: 90%;
  max-width: 850px;
  background: #ffffff;
  border-radius: 0px !important;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  animation: bp3d-scale-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
}

.bp3d-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
  border-bottom: 1px solid #e2e8f0;
}

.bp3d-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
}

.bp3d-modal-close {
  background: transparent;
  border: none;
  font-size: 28px;
  font-weight: 300;
  color: #64748b;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.15s ease;
}

.bp3d-modal-close:hover {
  color: #ef4444;
}

.bp3d-modal-body {
  padding: 20px;
  background: #ffffff;
  min-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* The body hugs the viewer, so its buttons sit the same distance from every edge. */
.bp3d-modal-body--viewer {
  min-height: 0;
}

.bp3d-modal-frame {
  width: 100%;
  margin: 0 auto;
}

.bp3d-modal-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.bp3d-modal-devices {
  display: flex;
  gap: 7px;
}

.bp3d-modal-device {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 29px;
  padding: 0 14px 0 13px;
  border: 1px solid #e5ecf5;
  border-radius: 5px;
  background: #fff;
  font-size: 11px;
  line-height: 1;
  color: #1f3861;
  cursor: pointer;
}

.bp3d-modal-device:hover {
  border-color: #c7d6ec;
}

.bp3d-modal-device[aria-pressed="true"] {
  border-color: #5892ff;
  color: #1b6cff;
}

@media (max-width: 600px) {
  .bp3d-modal-device {
    padding: 0 9px;
  }

  .bp3d-modal-device__label {
    display: none;
  }
}

/* Loading indicator. It is slotted into <model-viewer slot="progress-bar">, so
   its containing block is model-viewer's own slot wrapper (and, before the
   custom element upgrades, the wrapper itself). Centre it against whichever of
   those it lands in rather than relying on a percentage height that collapses
   to the icon, which pins it to the top-left corner. */
.bp3d-modal-body .bp3d_loader,
.bp3d-model-preview__stage .bp3d_loader {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: auto;
  height: auto;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Modal animation keyframes */
@keyframes bp3d-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes bp3d-scale-up {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* --- Remove radius from Shortcode row & preview trigger button --- */
.bp3d_shortcode_area_after_title,
.bp3d_shortcode_area_after_title * {
  border-radius: 0px !important;
}

.bp3d-preview-popup-trigger {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  border-color: #146ef5 !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  background: #146ef5 !important;
  border-radius: 0px !important;
  width: 100% !important;
  justify-content: center !important;
  height: 40px !important;
  line-height: 38px !important;
  padding: 0 18px !important;
  transition: all 0.2s ease !important;
}

.bp3d-preview-popup-trigger:hover,
.bp3d-preview-popup-trigger:focus,
.bp3d-preview-popup-trigger:active {
  background: #0957ca !important;
  color: #ffffff !important;
  border-color: #0957ca !important;
  box-shadow: none !important;
}

.bp3d-preview-popup-trigger .dashicons {
  font-size: 18px !important;
  width: 18px !important;
  height: 18px !important;
  line-height: 18px !important;
  display: flex !important;
  align-items: center !important;
  color: #ffffff !important;
}

.bp3d-preview-popup-trigger .dashicons::before {
  color: #ffffff !important;
}

/* --- Live Preview meta box (sidebar, directly under the Publish box) --- */
/* Hide the meta box title so the box reads as a clean button card — the
   button itself is labelled "Live Preview", so a title would be redundant. */
#bp3d_live_preview .postbox-header {
  display: none;
}

#bp3d_live_preview .inside {
  margin-top: 0;
  padding: 12px;
}

#bp3d-preview-btn-root {
  width: 100%;
}

/* Pinned state: the entire meta box is fixed to the top of the viewport (its
   top/left/width are applied inline via JS from the measured column) once it
   scrolls out of view. A same-size placeholder holds its slot in the sidebar.
   z-index keeps it below the preview modal overlay (999999) so it hides itself
   while the modal is open. */
#bp3d_live_preview.is-stuck {
  z-index: 99990;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
