/* Scene render CSS for the lean OBS overlay (overlay.php).
 * Copied from the editor page's style blocks (editor/index.php: the main <style> and #overlay-mode-css),
 * so buttons, sticks, labels and animations render exactly as they did in the editor-based overlay.
 * If you change how scene elements are styled in the editor, change it here too. */
* { box-sizing: border-box; }
body { margin: 0; overflow: hidden; background: #0a0a0a; color: #fff; font-family: system-ui; }

.editor-layout { 
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  grid-template-rows: auto 1fr; /* toolbar may wrap to two rows on laptop-width screens */
  height: calc(100vh - 171px);
  overflow: hidden;
}

.editor-layout.fullscreen {
  height: calc(100vh - 40px);
}

.dropdown-toggle::after {
  display: none;
}

.toolbar { 
  grid-column: 1 / -1;
  background: #1a1a1a; 
  border-bottom: 1px solid #333; 
  padding: 12px 20px; 
  display: flex; 
  flex-wrap: wrap;
  justify-content: space-between; 
  align-items: center; 
  gap: 8px 10px; 
  min-height: 60px;
}
/* Let each toolbar group wrap instead of pushing Share/shortcuts off-screen */
.toolbar > div { flex-wrap: wrap; row-gap: 8px; }
@media (max-width: 1500px) {
  .toolbar { padding: 10px 14px; }
  .toolbar #sceneName { width: 160px !important; }
}

.left-panel { 
  background: #1a1a1a; 
  border-right: 1px solid #333; 
  overflow-y: auto; 
}

.center-area { 
  overflow: auto;
  position: relative; 
}

.right-panel-wrapper {
  display: flex;
  flex-direction: column;
  background: #1a1a1a;
  border-left: 1px solid #333;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.right-panel { 
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
}

.canvas-container { 
  padding: 40px;
  display: inline-block;
  min-width: 100%;
  min-height: 100%;
}

.canvas { 
  width: 1920px; 
  height: 1080px; 
  position: relative; 
  transform-origin: 0 0;
  background-size: cover;
  background-position: center;
  margin: auto;
}

.canvas.transparent {
  background: repeating-conic-gradient(#444 0% 25%, #333 0% 50%) 50% / 20px 20px;
}

.section { 
  padding: 20px; 
  border-bottom: 1px solid #333; 
  max-height: none;
  overflow: visible;
}
.section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #888; margin-bottom: 12px; }

.btn { padding: 8px 16px; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; transition: all 0.2s; }
.btn-primary { background: #c81e1e; color: #fff; } /* #ff2f2f was 3.7:1 contrast with white text */
.btn-secondary { background: #333; color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn:hover { opacity: 0.8; }
.btn:disabled { opacity: 0.3; cursor: not-allowed; }

.dropdown { position: relative; display: inline-block; }
.dropdown-toggle::after { content: ' ▼'; font-size: 10px; margin-left: 4px; }
.dropdown-menu { 
  position: absolute; 
  top: 100%; 
  right: 0;
  background: #1a1a1a; 
  border: 1px solid #333; 
  border-radius: 4px; 
  padding: 4px 0; 
  min-width: 200px; 
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  margin-top: 4px;
}
.dropdown-menu a { 
  display: block; 
  padding: 8px 16px; 
  color: #fff; 
  text-decoration: none; 
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
}
.dropdown-menu a:hover { background: #333; }
.dropdown-menu a i { width: 20px; margin-right: 8px; }
.dropdown-divider { height: 1px; background: #333; margin: 4px 0; }

/* Fix for links without href/class */
a:not([href]):not([class]) { color: #fff; cursor: pointer; }
a:not([href]):not([class]):hover { color: #fff; }

.form-group { margin-bottom: 15px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: #aaa; margin-bottom: 6px; }
.form-control { width: 100%; padding: 8px; background: #0a0a0a; border: 1px solid #333; border-radius: 4px; color: #fff; font-size: 13px; }
.form-control:focus { outline: none; border-color: #ff2f2f; }
.form-select { width: 100%; padding: 8px; background: #0a0a0a; border: 1px solid #333; border-radius: 4px; color: #fff; }

.item { 
  position: absolute; 
  border: 2px solid transparent; 
  cursor: move; 
  user-select: none;
  overflow: visible;
}
.item:hover { border-color: rgba(255,255,255,0.3); }
.item.selected { border-color: #ff2f2f !important; box-shadow: 0 0 0 2px #ff2f2f; }

.controller-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.controller-bg-layer { 
  z-index: 1;
  pointer-events: none;
}

.controller-bg-layer video,
.controller-bg-layer img {
  position: absolute;
  pointer-events: none;
}

.controller-outline-layer {
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 3;
  pointer-events: none;
}

.btn-controller { 
  position: absolute; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  font-weight: bold; 
  cursor: move;
  transition: all 0.1s;
  background-position: center;
  z-index: 5;
}

.btn-controller.circle { border-radius: 50%; }
.btn-controller.square { border-radius: 8px; }
.btn-controller:hover { transform: scale(1.05); }

.stick-controller {
  position: absolute;
  border-radius: 50%;
  background: #333;
  border: 3px solid #555;
  cursor: move;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  font-weight: bold;
  font-size: 10px;
  color: #fff;
}

.stick-controller::before {
  content: '';
  width: 40%;
  height: 40%;
  background: #888;
  border-radius: 50%;
  position: absolute;
  z-index: -1;
}

/* Hide the ::before dot when stick has a background image */
.stick-controller.has-image::before {
  display: none;
}

.stick-controller:hover { border-color: #ff2f2f; }

.resize-handle { position: absolute; width: 10px; height: 10px; background: #ff2f2f; border: 2px solid #fff; border-radius: 50%; z-index: 100; }
.resize-handle.nw { top: -5px; left: -5px; cursor: nw-resize; }
.resize-handle.ne { top: -5px; right: -5px; cursor: ne-resize; }
.resize-handle.sw { bottom: -5px; left: -5px; cursor: sw-resize; }
.resize-handle.se { bottom: -5px; right: -5px; cursor: se-resize; }

.layer-item { padding: 10px; margin-bottom: 4px; background: #0a0a0a; border: 1px solid #333; border-radius: 4px; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.layer-item:hover { background: #222; }
.layer-item.selected { border-color: #ff2f2f; background: #1a0a0a; }

.button-list-item {
  padding: 8px;
  margin-bottom: 4px;
  background: #0a0a0a;
  border: 1px solid #333;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.button-list-item:hover { background: #222; }
.button-list-item.selected { border-color: #ff2f2f; background: #1a0a0a; }

.tabs { 
  display: flex; 
  gap: 4px; 
  background: #1a1a1a;
  border-bottom: 1px solid #333; 
  padding: 0 10px; 
  flex-shrink: 0;
}
.tab { padding: 8px 12px; cursor: pointer; border-bottom: 2px solid transparent; color: #888; font-size: 12px; font-weight: 600; }
.tab:hover { color: #fff; }
.tab.active { color: #ff2f2f; border-bottom-color: #ff2f2f; }

.tab-content { display: none; }
.tab-content.active { display: block; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
input[type="color"] { height: 38px; border: 1px solid #333; border-radius: 4px; cursor: pointer; }
input[type="range"] { 
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: #333;
  border-radius: 3px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: #ff2f2f;
  border-radius: 50%;
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: #ff2f2f;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.collapsible { cursor: pointer; padding: 10px; background: #0a0a0a; border: 1px solid #333; border-radius: 4px; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; user-select: none; }
.collapsible:hover { background: #111; }
.collapsible.active .fa-chevron-down { transform: rotate(180deg); }
.collapsible-content { display: none; padding: 10px 0; }
.collapsible-content.active { display: block; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(calc(var(--shake-intensity, 5px) * -1)); }
  20%, 40%, 60%, 80% { transform: translateX(var(--shake-intensity, 5px)); }
}

@keyframes vibrate {
  0% { transform: translate(0, 0); }
  10% { transform: translate(calc(var(--shake-intensity, 3px) * -1), calc(var(--shake-intensity, 3px) * 0.5)); }
  20% { transform: translate(calc(var(--shake-intensity, 3px) * 1), calc(var(--shake-intensity, 3px) * -0.5)); }
  30% { transform: translate(calc(var(--shake-intensity, 3px) * 0.5), calc(var(--shake-intensity, 3px) * 1)); }
  40% { transform: translate(calc(var(--shake-intensity, 3px) * -0.5), calc(var(--shake-intensity, 3px) * -1)); }
  50% { transform: translate(calc(var(--shake-intensity, 3px) * 1), calc(var(--shake-intensity, 3px) * 0.5)); }
  60% { transform: translate(calc(var(--shake-intensity, 3px) * -1), calc(var(--shake-intensity, 3px) * -0.5)); }
  70% { transform: translate(calc(var(--shake-intensity, 3px) * 0.5), calc(var(--shake-intensity, 3px) * -1)); }
  80% { transform: translate(calc(var(--shake-intensity, 3px) * -0.5), calc(var(--shake-intensity, 3px) * 1)); }
  90% { transform: translate(calc(var(--shake-intensity, 3px) * 1), calc(var(--shake-intensity, 3px) * -0.5)); }
  100% { transform: translate(0, 0); }
}

@keyframes pedalPress {
  0% { 
    transform: perspective(600px) rotateX(0deg) translateY(0px);
  }
  100% { 
    transform: perspective(600px) rotateX(var(--pedal-angle, 25deg)) translateY(var(--pedal-depth, 10px));
  }
}

@keyframes idlePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: var(--idle-intensity, 0.5); }
}

@keyframes idleBreathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(var(--idle-intensity, 1.1)); }
}

@keyframes idleSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes idleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

@keyframes idleBounce {
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(-50px); }
  50% { transform: translateY(0); }
  75% { transform: translateY(-25px); }
}

@keyframes idleHueRotate {
  from { filter: hue-rotate(0deg); }
  to { filter: hue-rotate(360deg); }
}

/* Hide specific sections when editing trigger buttons - use class-based approach */
#buttonsPanel[data-button-type="trigger"] .hide-for-trigger {
  display: none !important;
}

/* Also hide Press Animation for triggers specifically using combined selector */
#buttonsPanel[data-button-type="trigger"] [onclick*="anim-"]:not([onclick*="Animation"]) {
  display: none !important;
}

/* ---- overlay mode (was #overlay-mode-css) ---- */
  body.overlay-mode .properties-panel,
  body.overlay-mode .layers-panel,
  body.overlay-mode .header,
  body.overlay-mode .sidebar,
  body.overlay-mode .controls,
  body.overlay-mode .menu,
  body.overlay-mode nav,
  body.overlay-mode header,
  body.overlay-mode .top-bar,
  body.overlay-mode .bottom-bar,
  body.overlay-mode .left-panel,
  body.overlay-mode .right-panel,
  body.overlay-mode .ui-panel,
  body.overlay-mode [class*="toolbar"],
  body.overlay-mode [class*="panel"],
  body.overlay-mode [class*="menu"],
  body.overlay-mode [class*="ui-"] {
    display: none !important;
  }
  
  body.overlay-mode {
    overflow: hidden;
    background: transparent;
  }
   body.overlay-mode .item{pointer-events: none!important;}
  body.overlay-mode #canvas-container,
  body.overlay-mode canvas {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 1920px !important;
    height: 1080px !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  body.overlay-mode #canvas,body.overlay-mode .canvas{transform: scale(1)!important;background-color:transparent!important; background-image:none!important;}
 body.overlay-mode .center-area {width: 100vw; height: 100vh;}
body.overlay-mode .canvas-container,body.overlay-mode .container,body.overlay-mode .main {padding: 0px;}
body.overlay-mode .app-content{margin-left:0px;}
body.overlay-mode .editor-layout{height: 100vh;}
    
