/**
 * BuddyPackaging 3D Studio Add-Ons & Responsive Cockpit Layout Stylesheet
 * Modular styles for Single-Screen Cockpit (2D + 3D + Tabbed Tools), Prepress, 3D Enhancements & Sharing.
 * Keeps existing core studio.css intact without crossing 1000+ lines.
 * @package BuddyPackaging
 */

/* ==========================================================================
   1. SINGLE-SCREEN STUDIO COCKPIT & COMPACT TOP SHELL
   ========================================================================== */
.bp-studio-hero-banner {
  padding: 18px 0 16px !important;
}
.bp-studio-hero-banner .bp-studio-breadcrumb-nav {
  margin-bottom: 6px !important;
  font-size: 0.78rem !important;
}
.bp-studio-hero-banner .badge {
  margin-bottom: 6px !important;
}
.bp-studio-hero-banner h1 {
  font-size: clamp(1.4rem, 2.2vw, 2rem) !important;
  margin-bottom: 6px !important;
}
.bp-studio-hero-banner p {
  font-size: 0.9rem !important;
  line-height: 1.45 !important;
  max-width: 860px !important;
}

.bp-studio-cockpit.bp-studio-wrapper {
  padding: 16px 0 40px 0;
}

.bp-studio-cockpit .container {
  max-width: min(1540px, 97vw);
}

.bp-studio-cockpit .bp-studio-grid {
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 24px;
}

.bp-studio-cockpit .bp-studio-viewport-card {
  min-width: 0;
  overflow: visible;
}

.bp-studio-cockpit .bp-studio-panel-card {
  min-width: 0;
  padding: 16px 18px;
  max-height: clamp(560px, 72vh, 720px);
}

.bp-studio-cockpit .bp-studio-viewport-header {
  padding: 10px 14px;
  flex-wrap: wrap;
  gap: 8px;
}

.bp-studio-cockpit .bp-view-mode-btn {
  padding: 6px 11px;
  font-size: 0.78rem;
}

/* ==========================================================================
   2. SHARING, PRESETS & SAVED DESIGNS BAR
   ========================================================================== */
.bp-share-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 8px 14px;
  margin-bottom: 14px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.bp-share-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.bp-share-select {
  width: auto !important;
  min-width: 155px;
  padding: 5px 10px !important;
  font-size: 0.76rem !important;
  font-weight: 600;
}

/* ==========================================================================
   3. DOCKED NON-OVERLAPPING 2D CAD & 3D VIEWPORT PANES
   ========================================================================== */
.bp-studio-cockpit .bp-viewport-wrap {
  position: relative;
  height: clamp(460px, 58vh, 610px);
  min-height: 460px;
  display: flex;
  overflow: hidden;
  background: #ffffff;
}

.bp-cad-pane,
.bp-studio-cockpit .bp-three-canvas-box {
  position: static;
  inset: auto;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  min-height: 0;
  background: #ffffff;
}

.bp-studio-cockpit .bp-viewport-wrap.mode-cad .bp-cad-pane {
  display: flex;
  flex: 1 1 100%;
  width: 100%;
}
.bp-studio-cockpit .bp-viewport-wrap.mode-cad .bp-three-canvas-box {
  display: none;
}

.bp-studio-cockpit .bp-viewport-wrap.mode-3d .bp-cad-pane {
  display: none;
}
.bp-studio-cockpit .bp-viewport-wrap.mode-3d .bp-three-canvas-box {
  display: flex;
  flex: 1 1 100%;
  width: 100%;
}

.bp-studio-cockpit .bp-viewport-wrap.mode-split .bp-cad-pane {
  display: flex;
  flex: 0 0 50%;
  width: 50%;
  border-right: 1px solid #e2e8f0;
}
.bp-studio-cockpit .bp-viewport-wrap.mode-split .bp-three-canvas-box {
  display: flex;
  flex: 0 0 50%;
  width: 50%;
}

.bp-studio-cockpit .bp-cad-canvas-box {
  position: static;
  inset: auto;
  flex: 1 1 auto;
  min-height: 0;
  width: 100% !important;
  height: auto;
  border-right: none !important;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #ffffff;
}

.bp-studio-cockpit .bp-cad-canvas-box svg {
  width: 100%;
  height: 100%;
  max-height: 100%;
  display: block;
}

.bp-three-canvas-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}

.bp-three-canvas-stage canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
  cursor: grab;
}

.bp-three-canvas-stage canvas:active {
  cursor: grabbing;
}

/* Docked Viewport Toolbars (Static, Zero Overlap) */
.bp-vp-toolbar {
  position: static;
  flex: 0 0 auto;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 5px 8px;
  z-index: 5;
}

.bp-vp-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #334155;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
  white-space: nowrap;
}

.bp-vp-btn:hover {
  border-color: #a855f7;
  color: #4F016B;
  background: #faf5ff;
}

.bp-vp-btn.active {
  background: #4F016B;
  border-color: #4F016B;
  color: #ffffff;
}

.bp-vp-sep {
  width: 1px;
  height: 15px;
  background: #cbd5e1;
  margin: 0 1px;
}

.bp-vp-zoom-readout {
  font-size: 0.7rem;
  font-weight: 700;
  color: #475569;
  min-width: 34px;
  text-align: center;
}

/* Dark 3D background adaptation */
.bp-three-canvas-box.is-dark .bp-vp-toolbar-3d {
  background: #0f172a;
  border-bottom-color: #334155;
}
.bp-three-canvas-box.is-dark .bp-vp-sep {
  background: #334155;
}
.bp-three-canvas-box.is-dark .bp-vp-btn {
  background: #1e293b;
  border-color: #334155;
  color: #e2e8f0;
}
.bp-three-canvas-box.is-dark .bp-vp-btn.active {
  background: #9333ea;
  border-color: #9333ea;
  color: #ffffff;
}

/* Docked Fit-Test Bar (Below 3D Stage, Zero Model Overlap) */
.bp-fittest-bar {
  position: static;
  flex: 0 0 auto;
  width: 100%;
  display: none;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  padding: 5px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #334155;
}

.bp-fittest-bar.open {
  display: flex;
}

.bp-fittest-bar input,
.bp-fittest-bar select {
  width: 56px;
  padding: 2px 5px;
  font-size: 0.72rem;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  background: #ffffff;
  color: #0f172a;
}

.bp-fittest-bar select {
  width: auto;
}

.bp-three-canvas-box.is-dark .bp-fittest-bar {
  background: #0f172a;
  border-top-color: #334155;
  color: #e2e8f0;
}

.bp-three-canvas-box.is-dark .bp-fittest-bar input,
.bp-three-canvas-box.is-dark .bp-fittest-bar select {
  background: #1e293b;
  border-color: #475569;
  color: #f8fafc;
}

/* ==========================================================================
   4. PREPRESS STRIP & MULTI-FORMAT EXPORT DROPDOWN
   ========================================================================== */
.bp-prepress-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 0.75rem;
  color: #475569;
}

.bp-prepress-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.bp-prepress-metric strong {
  color: #0f172a;
  font-weight: 700;
}

.bp-prepress-badge {
  background: #ede9fe;
  color: #5b21b6;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.7rem;
}

.bp-export-menu-wrap {
  position: relative;
  display: inline-flex;
  align-items: stretch;
}

.bp-export-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
  padding: 6px;
  z-index: 60;
  display: none;
  flex-direction: column;
  gap: 2px;
}

.bp-export-dropdown.open {
  display: flex;
}

.bp-export-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: none;
  background: transparent;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  text-align: left;
}

.bp-export-opt:hover {
  background: #faf5ff;
  color: #4F016B;
}

.bp-export-ext {
  font-size: 0.68rem;
  font-weight: 800;
  color: #64748b;
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 4px;
}

/* ==========================================================================
   5. TABBED RIGHT INSPECTOR (ALL TOOLS WITHOUT OVERFLOW)
   ========================================================================== */
.bp-studio-cockpit .bp-panel-header {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

.bp-studio-cockpit .bp-panel-title {
  font-size: 1rem;
  margin-bottom: 2px;
}

.bp-studio-cockpit .bp-panel-desc {
  font-size: 0.76rem;
  margin: 0;
  line-height: 1.35;
}

.bp-inspector-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 12px;
  flex: 0 0 auto;
}

.bp-inspector-tab {
  border: none;
  background: transparent;
  color: #475569;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 7px 6px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  text-align: center;
}

.bp-inspector-tab:hover {
  color: #4F016B;
}

.bp-inspector-tab.active {
  background: #ffffff;
  color: #4F016B;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.bp-inspector-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.bp-inspector-pane {
  display: none;
}

.bp-inspector-pane.active {
  display: block;
}

/* Compact Vertical Rhythm Inside Inspector Tabs */
.bp-studio-cockpit .bp-form-section {
  margin-bottom: 12px;
}

.bp-studio-cockpit .bp-caliper-row {
  margin-top: 7px;
  padding: 6px 10px;
}

.bp-studio-cockpit .bp-fold-quick {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.bp-studio-cockpit .bp-fold-quick .bp-artwork-btn {
  flex: 1;
  text-align: center;
}

/* Design & Prepress Cards Inside Tabs */
.bp-addons-card {
  padding: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 10px;
}

.bp-addons-card:last-child {
  margin-bottom: 0;
}

.bp-addons-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}

.bp-addons-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: #1e293b;
  margin: 0;
}

.bp-swatch-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.bp-swatch-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #e2e8f0;
  cursor: pointer;
  padding: 0;
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.bp-swatch-btn:hover { transform: scale(1.1); }
.bp-swatch-btn.active {
  border-color: #4F016B;
  box-shadow: 0 0 0 2px #e9d5ff;
}

.bp-dpi-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9999px;
  margin-left: 6px;
}
.bp-dpi-ok { background: #dcfce7; color: #166534; }
.bp-dpi-warn { background: #fef3c7; color: #92400e; }
.bp-dpi-low { background: #fee2e2; color: #991b1b; }

.bp-design-mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.bp-design-mini-grid .form-input,
.bp-design-mini-grid .form-select {
  padding: 5px 8px;
  font-size: 0.76rem;
}

/* Prepress Tab Stats & Quick Export Grid */
.bp-prepress-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.bp-prepress-stat {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 7px 10px;
}

.bp-prepress-stat span {
  display: block;
  font-size: 0.68rem;
  color: #64748b;
  font-weight: 700;
  text-transform: uppercase;
}

.bp-prepress-stat strong {
  display: block;
  font-size: 0.82rem;
  color: #0f172a;
  font-weight: 800;
  margin-top: 2px;
}

.bp-quick-export-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.bp-quick-export-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.75rem;
  color: #1e293b;
  transition: all 0.15s ease;
}

.bp-quick-export-btn:hover {
  border-color: #4F016B;
  background: #faf5ff;
  color: #4F016B;
}

.bp-quick-export-btn span {
  font-size: 0.66rem;
  font-weight: 800;
  background: #f1f5f9;
  color: #475569;
  padding: 2px 6px;
  border-radius: 4px;
}

.bp-quick-export-btn.bp-quick-primary {
  grid-column: 1 / -1;
  background: #4F016B;
  border-color: #4F016B;
  color: #ffffff;
}

.bp-quick-export-btn.bp-quick-primary span {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.bp-shortcuts-list {
  margin: 0;
  padding-left: 16px;
  font-size: 0.72rem;
  color: #475569;
  line-height: 1.55;
  list-style: disc;
}

/* ==========================================================================
   6. FULLSCREEN VIEWPORT & TOAST
   ========================================================================== */
.bp-studio-viewport-card.is-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  border-radius: 0;
  margin: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.bp-studio-viewport-card.is-fullscreen .bp-viewport-wrap {
  flex: 1 1 auto;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
}

.bp-studio-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100000;
  background: #0f172a;
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.25);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.bp-studio-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   7. RESPONSIVE BREAKPOINTS (LAPTOP / TABLET / MOBILE)
   ========================================================================== */
@media (max-width: 1199px) {
  .bp-studio-cockpit .bp-studio-grid {
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 14px;
  }
  .bp-studio-cockpit .bp-viewport-wrap {
    height: 470px;
    min-height: 440px;
  }
}

@media (max-width: 991px) {
  .bp-studio-cockpit .bp-studio-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .bp-studio-cockpit .bp-studio-panel-card {
    max-height: none;
  }
  .bp-studio-cockpit .bp-inspector-body {
    overflow: visible;
  }
  .bp-studio-cockpit .bp-viewport-wrap {
    height: 400px;
    min-height: 360px;
  }
  .bp-studio-cockpit .bp-viewport-wrap.mode-split {
    flex-direction: column;
    height: auto;
    min-height: 0;
  }
  .bp-studio-cockpit .bp-viewport-wrap.mode-split .bp-cad-pane {
    width: 100%;
    flex: none;
    height: 310px;
    border-right: none;
    border-bottom: 1px solid #e2e8f0;
  }
  .bp-studio-cockpit .bp-viewport-wrap.mode-split .bp-three-canvas-box {
    width: 100%;
    flex: none;
    height: 320px;
  }
}

@media (max-width: 767px) {
  .bp-studio-hero-banner p {
    display: none;
  }
  .bp-studio-cockpit .container {
    max-width: 100%;
    padding-left: 12px;
    padding-right: 12px;
  }
  .bp-share-bar {
    padding: 8px 10px;
    gap: 6px;
  }
  .bp-share-group {
    width: 100%;
  }
  .bp-share-select {
    flex: 1 1 46%;
    min-width: 0;
  }
  .bp-studio-cockpit .bp-studio-viewport-header {
    padding: 10px 12px;
    flex-direction: column;
    align-items: stretch;
  }
  .bp-studio-cockpit .bp-view-mode-tabs {
    justify-content: center;
  }
  .bp-studio-cockpit .bp-viewport-actions {
    justify-content: center;
  }
  /* Single horizontal scrollable toolbar row on mobile — zero multi-row bloat */
  .bp-vp-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .bp-vp-toolbar::-webkit-scrollbar {
    display: none;
  }
  .bp-studio-cockpit .bp-viewport-wrap {
    height: 340px;
    min-height: 310px;
  }
  .bp-studio-cockpit .bp-viewport-wrap.mode-split .bp-cad-pane {
    height: 270px;
  }
  .bp-studio-cockpit .bp-viewport-wrap.mode-split .bp-three-canvas-box {
    height: 290px;
  }
  .bp-inspector-tab {
    font-size: 0.7rem;
    padding: 7px 4px;
  }
  .bp-design-mini-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   8. CATALOG GRID REAL 2D CAD + 3D BOX THUMBNAILS
   ========================================================================== */
.bp-template-card .bp-card-preview {
  padding: 12px 14px;
  gap: 8px;
  height: 158px;
}

.bp-template-card .bp-preview-dieline {
  width: 52%;
  padding-top: 6px;
}

.bp-template-card .bp-preview-3d {
  width: 46%;
  padding-top: 16px;
}

.bp-3d-thumb-img {
  width: 100%;
  height: 100%;
  max-height: 120px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 6px 10px rgba(15, 23, 42, 0.14));
  transition: transform 0.2s ease;
}

.bp-template-card:hover .bp-3d-thumb-img {
  transform: scale(1.06);
}

/* ==========================================================================
   9. FULL-SCREEN STUDIO LAYOUT
   The tool starts near the top of the screen, the viewer fills the window height on desktop,
   and on tablets/phones the viewer stays pinned under the site header while the settings scroll.
   --bp-header-h is measured by studio-layout.js.
   ========================================================================== */
.bp-studio-cockpit {
  overflow-x: clip;   /* safety net against sideways scrolling; clip keeps position: sticky working */
}

/* Hero: one compact band (breadcrumb, then badge + title on one line) */
.bp-studio-hero-banner {
  padding: 12px 0 12px !important;
}
.bp-studio-hero-banner .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  column-gap: 12px;
  row-gap: 4px;
}
.bp-studio-hero-banner .bp-studio-breadcrumb-nav {
  flex-basis: 100%;
  margin-bottom: 0 !important;
}
.bp-studio-hero-banner .badge {
  margin-bottom: 0 !important;
  font-size: 0.68rem;
}
.bp-studio-hero-banner h1 {
  margin: 0 !important;
  font-size: clamp(1.25rem, 1.9vw, 1.7rem) !important;
}

/* The intro text that used to sit in the hero, now under the tool */
.bp-studio-intro {
  max-width: 860px;
  margin: 6px auto 30px;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.65;
  color: #475569;
}

/* Viewer toolbars always stay on one row (extra buttons scroll sideways) */
.bp-vp-toolbar {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.bp-vp-toolbar::-webkit-scrollbar {
  display: none;
}
/* 3D PNG / GLB downloads live in the Prepress & Export tab; hidden here so the 3D toolbar fits one row.
   (The buttons stay in the page: the Prepress tab triggers them.) */
#bp-3d-snapshot-btn,
#bp-3d-glb-btn,
.bp-vp-toolbar-3d .bp-vp-sep:last-of-type {
  display: none;
}

/* "Studio" 3D background: soft gradient behind a transparent WebGL canvas */
.bp-three-canvas-stage {
  background: radial-gradient(ellipse at 50% 28%, #ffffff 0%, #f2f4f8 55%, #e2e7ee 100%);
}
.bp-three-canvas-box.is-dark .bp-three-canvas-stage {
  background: #0f172a;
}

@media (min-width: 992px) {
  .bp-studio-cockpit {
    --bp-vp-h: clamp(460px, calc(100vh - var(--bp-header-h, 80px) - 178px), 980px);
  }
  .bp-studio-cockpit .bp-studio-grid {
    scroll-margin-top: calc(var(--bp-header-h, 80px) + 10px);
  }
  .bp-studio-cockpit .bp-viewport-wrap {
    height: var(--bp-vp-h);
    min-height: 0;
  }
  /* settings panel matches the viewer card; its tab body scrolls inside */
  .bp-studio-cockpit .bp-studio-panel-card {
    max-height: calc(var(--bp-vp-h) + 132px);
  }
}

@media (max-width: 991px) {
  /* Viewer stays pinned under the header while the settings below scroll past */
  .bp-studio-cockpit .bp-studio-viewport-card {
    position: sticky;
    top: var(--bp-header-h, 64px);
    z-index: 30;
    box-shadow: 0 12px 24px -14px rgba(15, 23, 42, 0.45);
  }
  /* same figures are in the Prepress & Export tab */
  .bp-studio-cockpit .bp-prepress-strip {
    display: none;
  }
  .bp-studio-cockpit .bp-viewport-wrap,
  .bp-studio-cockpit .bp-viewport-wrap.mode-split {
    flex-direction: row;
    height: 40vh;
    min-height: 240px;
  }
  .bp-studio-cockpit .bp-viewport-wrap.mode-split .bp-cad-pane,
  .bp-studio-cockpit .bp-viewport-wrap.mode-split .bp-three-canvas-box {
    flex: 0 0 50%;
    width: 50%;
    height: 100%;
  }
  .bp-studio-cockpit .bp-viewport-wrap.mode-split .bp-cad-pane {
    border-right: 1px solid #e2e8f0;
    border-bottom: none;
  }
}

@media (max-width: 767px) {
  /* Download / Export stay in the settings panel and the Prepress tab; the pinned viewer stays small */
  .bp-studio-cockpit .bp-viewport-actions {
    display: none;
  }
  .bp-studio-cockpit .bp-studio-viewport-header {
    padding: 6px 8px;
  }
  .bp-studio-cockpit .bp-view-mode-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }
  .bp-studio-cockpit .bp-view-mode-btn {
    white-space: normal;
    text-align: center;
    padding: 6px 4px;
    font-size: 0.72rem;
    line-height: 1.2;
  }
  .bp-studio-cockpit .bp-viewport-wrap,
  .bp-studio-cockpit .bp-viewport-wrap.mode-split {
    height: 36vh;
    min-height: 220px;
  }
}

/* ==========================================================================
   10. VISUAL TEMPLATE PICKER (studio-picker.js)
   ========================================================================== */
.bp-tpl-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden;
  clip: rect(0 0 0 0);
  opacity: 0;
  pointer-events: none;
}

.bp-tpl-current {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 12px 8px 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.bp-tpl-current:hover {
  border-color: #4F016B;
  box-shadow: 0 0 0 3px rgba(79, 1, 107, 0.08);
}
.bp-tpl-current:focus-visible {
  outline: 2px solid #4F016B;
  outline-offset: 2px;
}
.bp-tpl-current-thumb {
  flex: 0 0 60px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border-radius: 8px;
  overflow: hidden;
}
.bp-tpl-current-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.bp-tpl-current-thumb svg {
  width: 100%;
  height: 100%;
}
.bp-tpl-current-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.bp-tpl-current-text strong {
  font-size: 0.78rem;
  font-weight: 800;
  color: #4F016B;
}
.bp-tpl-current-text span {
  font-size: 0.85rem;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bp-tpl-current-cta {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: #4F016B;
  background: #f5f3ff;
  padding: 5px 11px;
  border-radius: 999px;
}

.bp-tpl-picker {
  position: fixed;
  inset: 0;
  z-index: 100001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.bp-tpl-picker[hidden] {
  display: none;
}
.bp-tpl-picker-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
}
.bp-tpl-picker-panel {
  position: relative;
  width: min(1120px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 30px 60px -20px rgba(15, 23, 42, 0.45);
  padding: 20px 22px 16px;
}
.bp-tpl-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.bp-tpl-picker-head h2 {
  margin: 0;
  font-size: 1.15rem;
  color: #0f172a;
}
.bp-tpl-picker-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: #f1f5f9;
  color: #334155;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.bp-tpl-picker-close:hover {
  background: #e2e8f0;
}
.bp-tpl-picker-search {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 0.92rem;
}
.bp-tpl-picker-search:focus {
  outline: none;
  border-color: #4F016B;
  box-shadow: 0 0 0 3px rgba(79, 1, 107, 0.12);
}
.bp-tpl-picker-head,
.bp-tpl-picker-search,
.bp-tpl-picker-cats {
  flex: 0 0 auto;   /* only the grid shrinks and scrolls */
}
.bp-tpl-picker-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 0 12px;
}
.bp-tpl-cat {
  white-space: nowrap;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.76rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
}
.bp-tpl-cat:hover {
  border-color: #a855f7;
  color: #4F016B;
}
.bp-tpl-cat.active {
  background: #4F016B;
  border-color: #4F016B;
  color: #ffffff;
}
.bp-tpl-picker-grid {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  padding: 2px;
}
.bp-tpl-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  text-align: left;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #ffffff;
  padding: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.bp-tpl-item:hover,
.bp-tpl-item:focus-visible {
  border-color: #a855f7;
  box-shadow: 0 8px 18px -10px rgba(79, 1, 107, 0.45);
  outline: none;
}
.bp-tpl-item.is-current {
  border-color: #4F016B;
  box-shadow: inset 0 0 0 1px #4F016B;
}
.bp-tpl-item-thumb {
  height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 6px;
  overflow: hidden;
}
.bp-tpl-item-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.bp-tpl-item-thumb svg {
  width: 100%;
  height: 100%;
}
.bp-tpl-item-code {
  font-size: 0.74rem;
  font-weight: 800;
  color: #4F016B;
}
.bp-tpl-item-code em {
  font-style: normal;
  background: #4F016B;
  color: #ffffff;
  border-radius: 999px;
  padding: 1px 7px;
  margin-left: 4px;
  font-size: 0.64rem;
}
.bp-tpl-item-name {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
  color: #0f172a;
}
.bp-tpl-item-size {
  font-size: 0.7rem;
  color: #64748b;
}
.bp-tpl-thumb-empty {
  font-size: 1.8rem;
}
.bp-tpl-picker-empty {
  text-align: center;
  color: #64748b;
  padding: 24px 0;
  margin: 0;
}
html.bp-tpl-picker-open {
  overflow: hidden;
}

@media (max-width: 640px) {
  .bp-tpl-picker {
    padding: 0;
  }
  .bp-tpl-picker-panel {
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    padding: 14px 12px 10px;
  }
  .bp-tpl-picker-cats {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .bp-tpl-picker-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .bp-tpl-item-thumb {
    height: 90px;
  }
}

/* ==========================================================================
   11. "DIELINE GENERATOR AT A GLANCE" FACTS (inc/studio-seo.php)
   ========================================================================== */
.bp-studio-facts {
  max-width: 980px;
  margin: 0 auto 34px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 20px 24px 16px;
  box-shadow: 0 8px 24px -14px rgba(79, 1, 107, 0.18);
}
.bp-studio-facts h2 {
  font-size: 1.15rem;
  margin: 0 0 12px;
  color: #0f172a;
}
.bp-studio-facts-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 24px;
  margin: 0;
}
.bp-studio-fact {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid #f1f5f9;
}
.bp-studio-fact dt {
  font-size: 0.78rem;
  font-weight: 800;
  color: #4F016B;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.bp-studio-fact dd {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: #334155;
}
.bp-studio-updated {
  margin: 10px 0 0;
  font-size: 0.75rem;
  color: #64748b;
  text-align: right;
}
.bp-type-card-footer a {
  color: #4F016B;
  font-weight: 700;
  text-decoration: none;
}
.bp-type-card-footer a:hover {
  text-decoration: underline;
}
@media (max-width: 767px) {
  .bp-studio-facts {
    padding: 16px 14px 12px;
  }
  .bp-studio-facts-list {
    grid-template-columns: 1fr;
  }
  .bp-studio-fact {
    grid-template-columns: 82px minmax(0, 1fr);
  }
}

/* ==========================================================================
   12. OUTSIDE / INSIDE MULTI-DESIGN ARTWORK UI
   ========================================================================== */
.bp-vp-side-switch {
  display: inline-flex;
  align-items: center;
  background: #e2e8f0;
  padding: 2px;
  border-radius: 6px;
  gap: 2px;
}
.bp-vp-side-switch .bp-side-btn {
  border: 0;
  background: transparent;
  padding: 3px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  border-radius: 4px;
}
.bp-vp-side-switch .bp-side-btn.active {
  background: #4F016B;
  color: #ffffff;
}
.bp-cad-pane {
  position: relative;
}
.bp-cad-pane.is-inside-view::after {
  content: 'Inside Dieline View (Mirrored)';
  position: absolute;
  bottom: 8px;
  left: 10px;
  background: rgba(79, 1, 107, 0.9);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 9999px;
  pointer-events: none;
  z-index: 4;
  letter-spacing: 0.01em;
}
.bp-art-side-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: #e2e8f0;
  padding: 3px;
  border-radius: 8px;
  margin-bottom: 10px;
}
.bp-art-side-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: #475569;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.14s ease;
}
.bp-art-side-tab:hover {
  color: #0f172a;
}
.bp-art-side-tab.active {
  background: #ffffff;
  color: #4F016B;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}
.bp-art-side-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 9999px;
  background: #4F016B;
  color: #ffffff;
  font-size: 0.66rem;
  font-weight: 800;
}
.bp-file-upload-wrap.is-dragover {
  outline: 2px dashed #4F016B;
  outline-offset: 2px;
  background: #faf5ff;
  border-radius: 8px;
}
.bp-artwork-both-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding: 6px 10px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #065f46;
}
.bp-artwork-peek-link {
  border: 0;
  background: #059669;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
  flex-shrink: 0;
}
.bp-artwork-peek-link:hover {
  background: #047857;
}
.bp-artwork-layers {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 8px;
}
.bp-art-layer-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.bp-art-layer-row:hover {
  border-color: #cbd5e1;
}
.bp-art-layer-row.active {
  border-color: #4F016B;
  background: #faf5ff;
}
.bp-art-layer-thumb {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  font-size: 0.85rem;
}
.bp-art-layer-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.bp-art-layer-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.bp-art-layer-name {
  font-size: 0.74rem;
  font-weight: 700;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bp-art-layer-dims {
  font-size: 0.66rem;
  color: #64748b;
  font-variant-numeric: tabular-nums;
}
.bp-art-layer-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.bp-layer-mini-btn {
  width: 22px;
  height: 22px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.bp-layer-mini-btn:hover:not(:disabled) {
  border-color: #4F016B;
  color: #4F016B;
}
.bp-layer-mini-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.bp-layer-mini-btn.is-del:hover {
  border-color: #dc2626;
  color: #dc2626;
  background: #fef2f2;
}
.bp-layer-vis {
  display: inline-flex;
  align-items: center;
  margin: 0 2px;
  cursor: pointer;
}
.bp-layer-vis input {
  width: 14px;
  height: 14px;
  accent-color: #4F016B;
  cursor: pointer;
}

/* ==========================================================================
   12. TEMPLATE INFO & VALIDATION NOTES (paramsPanel.info, cadData.warnings)
   ========================================================================== */
.bp-template-notes {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bp-template-note {
  margin: 0;
  padding: 7px 10px;
  border-radius: 8px;
  background: #f5f3ff;
  color: #3b0764;
  font-size: 0.76rem;
  line-height: 1.45;
}
.bp-template-note-warn {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
