/* Self-Hosted Inter Font (Local WOFF2) */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
body, * { font-family: 'Inter', sans-serif; }
/* Range Slider Touch-Scroll Protection & Tactile Thumbs */
input[type="range"] {
  accent-color: #10b981;
  touch-action: pan-y !important;
  -webkit-tap-highlight-color: transparent !important;
  flex: 1 1 auto;
  min-width: 60px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  cursor: grab;
  transition: transform 0.12s ease;
}
input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(1.2);
  cursor: grabbing;
}
input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  cursor: grab;
}

/* Stepper Buttons for Mobile Precision & Scroll Safety */
.slider-stepper-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin-top: 2px;
  margin-bottom: 2px;
}
.slider-step-btn {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background-color: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
  line-height: 1;
}
.slider-step-btn:hover {
  background-color: #334155;
  color: #ffffff;
  border-color: #475569;
}
.slider-step-btn:active {
  background-color: #10b981;
  color: #020617;
  border-color: #10b981;
  transform: scale(0.92);
}

.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: #0f172a; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #475569; }

/* Override global header from style.css so studio header flows naturally in flex column without overlapping sidebar tabs */
header.studio-header,
header {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  width: 100% !important;
  height: 3.5rem !important; /* 56px / h-14 */
  padding: 0 1rem !important; /* overrides style.css padding: 0 8% */
  z-index: 30 !important;
}

/* Clean Overlay for Toast */
.studio-toast {
  position: fixed;
  bottom: 85px;
  left: 50%;
  right: auto;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  border: 1px solid #10b981;
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translate(-50%, 80px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  max-width: 90vw;
}
.studio-toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 1024px) {
  /* On desktop, center the toast over the 3D viewport (leaving the right sidebar completely free) */
  .studio-toast {
    left: calc((100vw - 420px) / 2);
    bottom: 32px;
    transform: translate(-50%, 80px);
  }
  .studio-toast.show {
    transform: translate(-50%, 0);
  }
}

/* Keep shop cart drawer styles consistent */
.cart-drawer {
  z-index: 9999;
}
.cart-overlay {
  z-index: 9998;
}

/* Step-by-step Studio Navigation Tabs */
.tab-btn {
  position: relative;
  transition: all 0.2s ease-in-out;
}
.tab-btn .step-num {
  background-color: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  transition: all 0.2s ease-in-out;
}
.tab-btn:hover .step-num {
  border-color: #475569;
  color: #f1f5f9;
  background-color: #334155;
}
.tab-btn.active .step-num {
  background-color: #10b981;
  color: #020617;
  border-color: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.45);
}
.tab-btn .step-lbl {
  color: #64748b;
  transition: color 0.2s ease-in-out;
}
.tab-btn.active .step-lbl {
  color: #34d399;
}
.tab-btn .tab-title {
  color: #94a3b8;
  transition: color 0.2s ease-in-out;
}
.tab-btn:hover .tab-title {
  color: #e2e8f0;
}
.tab-btn.active .tab-title {
  color: #ffffff;
  font-weight: 700;
}

/* Fullscreen Mode (Whole Studio fills screen) */
:fullscreen,
:-webkit-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  overflow: hidden !important;
}

/* Mobile & Tablet Responsive Layout (Split View) */
@media (max-width: 1024px) {
  /* Prevent horizontal overflow on mobile body and ensure 100dvh fit */
  html, body {
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
    position: relative !important;
  }

  /* Root Studio App Container */
  .studio-root-container {
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
  }

  /* Main Workspace: Vertical Split View (3D Canvas top, Controls bottom) */
  .flex-1.flex.overflow-hidden.relative {
    flex-direction: column !important;
    height: calc(100vh - 56px) !important;
    height: calc(100dvh - 56px) !important;
    max-height: calc(100dvh - 56px) !important;
    overflow: hidden !important;
  }

  /* 3D Canvas Viewport: dedicated top area */
  #canvasContainer {
    height: 42vh !important;
    min-height: 240px !important;
    max-height: 48vh !important;
    flex: none !important;
    width: 100% !important;
    position: relative !important;
  }

  /* Sticky Footer: Add to Cart Action must stay fully visible with safe-area support */
  .studio-sidebar-footer {
    flex-shrink: 0 !important;
    position: sticky !important;
    bottom: 0 !important;
    z-index: 25 !important;
    padding-bottom: max(10px, env(safe-area-inset-bottom)) !important;
  }

  /* Smooth finger rotation without scroll conflict */
  #canvasContainer canvas,
  #threeCanvas {
    touch-action: none !important;
    width: 100% !important;
    height: 100% !important;
  }

  /* Settings Sidebar: full-width bottom scrollable panel */
  aside {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 0% !important;
    border-left: none !important;
    border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
    height: auto !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    z-index: 20 !important;
    box-sizing: border-box !important;
  }

  #sidebarScrollArea {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    overscroll-behavior-y: contain !important;
    padding: 12px 14px 24px 14px !important;
  }

  /* Header compact styling */
  header.studio-header {
    height: 52px !important;
    padding: 0 10px !important;
    gap: 6px !important;
  }

  /* Hide secondary desktop-only items from header on mobile */
  #headerTypeIcon,
  #headerStudioTitle,
  #headerWeightBadge,
  #headerTimeBadge,
  #quickFilamentBtn,
  #photoRenderBtn,
  #shareLinkBtn,
  #randomizeBtn,
  #topAddToCartBtn,
  #quickGuideBtn,
  #seoFaqBtn {
    display: none !important;
  }

  /* Price badge compact & single-line */
  #headerPriceBadge {
    padding: 4px 8px !important;
    font-size: 0.78rem !important;
    margin-left: auto !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
  }
  #headerPriceBadge span#headerPriceText {
    white-space: nowrap !important;
    font-size: 0.8rem !important;
  }

  /* Header icon buttons compact square on mobile */
  #headerFullscreenBtn,
  #btn-open-cart {
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }

  /* Camera toolbar on canvas */
  #canvasContainer .absolute.top-4.left-4 {
    top: 8px !important;
    left: 8px !important;
    gap: 4px !important;
  }
  #canvasContainer .absolute.top-4.left-4 button {
    width: 34px !important;
    height: 34px !important;
    font-size: 0.85rem !important;
  }

  /* Mobile floating action icons on canvas top-right */
  .mobile-canvas-actions {
    top: 8px !important;
    right: 8px !important;
    gap: 4px !important;
  }
  .mobile-canvas-actions button {
    width: 34px !important;
    height: 34px !important;
    font-size: 0.85rem !important;
  }

  /* HUD status bar on canvas bottom */
  #canvasContainer .absolute.bottom-4.left-4 {
    bottom: 6px !important;
    left: 6px !important;
    right: 6px !important;
    gap: 4px !important;
  }
  #hudOverhangCard,
  #canvasContainer .absolute.bottom-4.left-4 > div {
    padding: 3px 8px !important;
    font-size: 10px !important;
  }

  /* Step navigation tabs */
  .tab-btn {
    padding: 10px 4px !important;
  }
  .tab-btn .tab-title {
    font-size: 11.5px !important;
    white-space: nowrap !important;
  }
  #filamentCountBadge {
    font-size: 9.5px !important;
    padding: 1.5px 5px !important;
    line-height: 1 !important;
  }

  /* Swatches palette grid on mobile: 3 columns */
  #swatchesContainer {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    max-height: 220px !important;
  }

  /* Mobile stepper buttons: larger touch targets for fingers */
  .slider-stepper-wrap {
    gap: 10px !important;
    margin-top: 4px !important;
    margin-bottom: 4px !important;
  }
  .slider-step-btn {
    width: 36px !important;
    height: 36px !important;
    border-radius: 9px !important;
    font-size: 17px !important;
    color: #cbd5e1 !important;
  }

  /* Sticky sidebar bottom add to cart bar */
  aside > div:last-child {
    padding: 10px 12px !important;
  }
}


