/* GEOMETOR • elementarium — Interactive 3D Device Component & Optical Activity Studio
 * Modeled on GEOMETOR phyllotaxis studio layout with F-key Theater Mode popout.
 */

.elementarium-3d-studio {
  margin: 1.25rem 0 2rem 0;
  padding: 0;
  background: transparent;
  outline: none;
}

.elem3d-preset-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
  align-items: center;
  margin-bottom: 0.65rem;
  padding: 0.5rem 0.72rem;
  background: #141821;
  border: 1px solid rgba(212, 175, 55, 0.28);
  border-radius: 6px;
}

.elem3d-preset-bar .preset-label {
  font-family: "Fira Sans Condensed", system-ui, sans-serif;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #d4af37;
  margin-right: 0.3rem;
  font-weight: 600;
}

.elem3d-preset-btn {
  margin: 0;
  background: #222834;
  color: #e5e7eb;
  border: 1px solid #394150;
  border-radius: 4px;
  padding: 0.26rem 0.6rem;
  font-family: "Fira Sans Condensed", system-ui, sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.elem3d-preset-btn:hover,
.elem3d-preset-btn.active {
  background: #00adb5;
  color: #0b0e14;
  border-color: #00d2dc;
  font-weight: 600;
}

/* Compact inline RST card bar (hidden in full studio unless .is-compact, transforms in theater mode) */
.elementarium-3d-studio.is-compact .elem3d-preset-bar {
  justify-content: space-between;
  padding: 0.42rem 0.7rem;
}

.elem3d-compact-title {
  font-family: "Fira Sans Condensed", system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 0.03em;
}

.elem3d-compact-actions {
  display: flex;
  gap: 0.38rem;
  align-items: center;
  flex-wrap: wrap;
}

.elem3d-stage-wrapper {
  position: relative;
  width: 100%;
  height: 640px;
  min-height: 380px;
  background-color: #05070b;
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
  display: flex;
  font-family: "Fira Sans Condensed", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #e0e0e0;
}

.elementarium-3d-studio.is-active-viewer .elem3d-stage-wrapper {
  border-color: rgba(0, 173, 181, 0.65);
}

/* Fullscreen Theater Mode (F shortcut, matching phyllotaxis) */
.elem3d-stage-wrapper.theater-mode {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  max-height: none !important;
  border-radius: 0 !important;
  border: none !important;
  z-index: 9999 !important;
}

.elem3d-preset-bar.theater-mode {
  position: fixed !important;
  top: 12px;
  left: 314px;
  right: 235px;
  width: fit-content;
  max-width: calc(100vw - 555px);
  margin: 0 auto;
  z-index: 10005 !important;
  background: rgba(15, 19, 28, 0.9);
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.65);
  justify-content: center;
}

.elem3d-preset-bar.theater-mode.controls-collapsed {
  left: 36px;
  max-width: calc(100vw - 275px);
}

.elem3d-viewport {
  width: 100%;
  height: 100%;
  flex-grow: 1;
  display: block;
  background: radial-gradient(circle at 55% 48%, #0d1320 0%, #04060a 100%);
  cursor: grab;
  touch-action: none;
}

.elem3d-viewport:active {
  cursor: grabbing;
}

/* Collapsible Left Controls Drawer */
.elem3d-controls-panel {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 296px;
  background: rgba(18, 23, 33, 0.94);
  backdrop-filter: blur(8px);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 13px;
  box-shadow: 4px 0 16px rgba(0, 0, 0, 0.5);
  transform: translateX(0);
  transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 30;
  overflow-y: auto;
  box-sizing: border-box;
}

.elem3d-controls-panel.collapsed {
  transform: translateX(-296px);
}

.elem3d-controls-toggle {
  position: absolute;
  left: 296px;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  padding: 0;
  width: 25px;
  height: 54px;
  background: rgba(42, 49, 62, 0.95);
  color: #00adb5;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-left: none;
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
  cursor: pointer;
  font-family: "Fira Sans Condensed", sans-serif;
  font-size: 15px;
  font-weight: bold;
  line-height: 52px;
  text-align: center;
  z-index: 31;
  transition: left 0.26s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.15s;
}

.elem3d-controls-panel.collapsed + .elem3d-controls-toggle {
  left: 0;
}

.elem3d-controls-toggle:hover {
  background: #00adb5;
  color: #090c10;
}

.elem3d-section-title {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #d4af37;
  margin: 11px 0 6px 0;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.28);
  font-weight: 600;
}

.elem3d-control-group {
  margin-bottom: 7px;
}

.elem3d-input-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.045);
  border-left: 2px solid rgba(212, 175, 55, 0.55);
  padding: 2px 7px;
  border-radius: 3px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 3px 0;
}

.elem3d-val-badge {
  color: #38e1eb;
  font-family: "Fira Code", monospace;
  font-size: 0.74rem;
  font-weight: 600;
}

.elem3d-select {
  width: 100%;
  padding: 4px 7px;
  border-radius: 4px;
  background-color: #242b38;
  color: #f8fafc;
  border: 1px solid #3f495e;
  font-family: "Fira Sans Condensed", sans-serif;
  font-size: 0.79rem;
  box-sizing: border-box;
}

.elem3d-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  background: #3b4454;
  border-radius: 3px;
  outline: none;
  margin: 4px 0 2px 0;
}

.elem3d-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  background: #00adb5;
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid #0f172a;
}

.elem3d-slider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  background: #00adb5;
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid #0f172a;
}

.elem3d-btn-row {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.elem3d-btn {
  flex: 1;
  margin: 0;
  padding: 5px 6px;
  border-radius: 4px;
  font-family: "Fira Sans Condensed", sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.15;
  cursor: pointer;
  border: 1px solid transparent;
  text-align: center;
  text-decoration: none;
  transition: all 0.15s ease;
}

.elem3d-btn-primary {
  background-color: #00adb5;
  color: #080b11;
  border-color: #00c4ce;
}

.elem3d-btn-primary:hover {
  background-color: #18cad3;
}

.elem3d-btn-secondary {
  background-color: #2d3546;
  color: #f1f5f9;
  border-color: #455068;
}

.elem3d-btn-secondary:hover {
  background-color: #3d485e;
  border-color: #00adb5;
}

.elem3d-checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 8px;
  margin-top: 6px;
}

.elem3d-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 2px 3px;
  font-size: 0.76rem;
  color: #e2e8f0;
  cursor: pointer;
}

.elem3d-checkbox-label input {
  width: 13px;
  height: 13px;
  accent-color: #00adb5;
  margin: 0;
  cursor: pointer;
}

/* STL / Component Part List inside Drawer */
.elem3d-stl-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 165px;
  overflow-y: auto;
  margin-top: 4px;
}

.elem3d-stl-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  background: rgba(34, 41, 56, 0.72);
  border: 1px solid rgba(71, 85, 105, 0.45);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 0.72rem;
}

.elem3d-stl-row a {
  color: #38e1eb;
  font-family: monospace;
  font-size: 0.68rem;
  text-decoration: none;
  border: 1px solid rgba(56, 225, 235, 0.4);
  border-radius: 3px;
  padding: 1px 5px;
}

.elem3d-stl-row a:hover {
  background: #00adb5;
  color: #06090f;
}

/* Floating Top-Right Telemetry HUD */
.elem3d-hud {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(13, 17, 26, 0.86);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(212, 175, 55, 0.34);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.76rem;
  color: #cbd5e1;
  z-index: 25;
  min-width: 215px;
  pointer-events: none;
}

.elem3d-hud .hud-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #d4af37;
  margin-bottom: 4px;
  font-weight: 700;
}

.elem3d-hud .hud-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 2px 0;
}

.elem3d-hud .hud-val {
  color: #00adb5;
  font-family: "Fira Code", monospace;
  font-weight: 600;
}

/* Bottom Hint Ribbon */
.elem3d-footer-hint {
  position: absolute;
  right: 12px;
  bottom: 10px;
  background: rgba(10, 14, 22, 0.76);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 4px;
  padding: 3px 8px;
  font-family: monospace;
  font-size: 0.69rem;
  color: #94a3b8;
  pointer-events: none;
  z-index: 22;
}

/* Keymap Footer inside Drawer */
.elem3d-keymap {
  margin-top: 9px;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.elem3d-keymap h4 {
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #00adb5;
  margin: 0 0 5px 0;
}

.elem3d-keymap ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 6px;
}

.elem3d-keymap li {
  font-size: 0.69rem;
  color: #94a3b8;
}

.elem3d-keymap kbd {
  background-color: #2b3240;
  color: #e2e8f0;
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid #475569;
  font-family: monospace;
  font-size: 0.66rem;
}

@media (max-width: 780px) {
  .elem3d-hud {
    display: none;
  }
  .elem3d-preset-bar.theater-mode {
    left: 12px;
    right: 12px;
    max-width: calc(100vw - 24px);
  }
}
