/* ==============================
   RESET & BASE
================================ */
:root {
  --editor-font-size: 14px;
  --editor-line-height: 20px;
  --bg-main: #0f1115;
  --bg-panel: #161a22;
  --bg-hover: #1f2430;

  --border-soft: #2b3240;

  --text-main: #e9ecef;
  --text-muted: #dce0e6;

  --accent-green: #51cf66;
  --accent-red: #ff6b6b;
}

html, body {
  height: 100%;
  margin: 0;
}

.app-body {
  height: 100%;
  background-color: #f4f6f8;
  font-family: "Segoe UI", sans-serif;
  overflow: hidden;
}

/* ==============================
   ROOT EDITOR LAYOUT
================================ */
.editor-root {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
  justify-content:flex-start;
}

/* ==============================
   BLOCK PANEL (LEFT)
================================ */

.block-panel {
  position: relative;
  overflow: visible; /* WAJIB */
}

.block-action-panel {
  position: fixed;
  z-index: 1999;
}

.block-panel {
  position: relative;
  width: 68px;
  flex: 0 0 68px;
  background: #1f2937;
  padding: 8px 4px;

  overflow-x: visible; /* penting */
  overflow-y: auto;
}


.block-group {
  margin-bottom: 15px;
  z-index:10;
}

.block-btn {
  width: 100%;
  min-height: 40px;
  padding: 6px 8px;

  border: none;
  border-radius: 8px;
  background: #374151;
  color: #fff;

  font-size: 12px;
  text-align: left;
  cursor: pointer;

  white-space: normal;
  word-break: break-word;
}

.block-panel:not(.expanded) .block-category {
  justify-content: center;
}

.block-btn[title] {
  position: relative;
}
.block-btn:hover {
  background: #4b5563;
}

/* ==============================
   CODE EDITOR PANEL
================================ */
.panel-header {
  padding: 8px 12px;
  background: #1f2937;
  font-weight: 600;
  flex: 0 0 auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.btn-toggle-panel{
    width:28px;
    height:28px;
    border:none;
    border-radius:6px;
    background:transparent;
    cursor:pointer;
    transition:.2s;
}

.btn-toggle-panel:hover{
    background:#ececec;
}

.code-editor-panel{
    transition:
        width .25s ease,
        flex-basis .25s ease;
}

/* ==============================
   STAGE COLUMN (RIGHT)
================================ */
.stage-column {
  flex: 1 1 auto;
  min-width: 0; /* KRITIS */
  display: flex;
}

/* ==============================
   STAGE PANEL
================================ */
.stage-panel {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #e5e7eb;
}

/* ==============================
   STAGE TOOLBAR
================================ */
.stage-toolbar {
  flex: 0 0 auto;
  padding: 8px;
  background: #ffffff;
  border-bottom: 1px solid #ccc;
}

/* ==============================
   STAGE CANVAS WRAPPER (SCROLL)
================================ 
*/

.stage-canvas-wrapper {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  background: #d1d5db;
  position: relative;
  overscroll-behavior: none;
}

/* WORLD SPACE */
.canvas-world {
  position: relative;
  width: 5000px;
  height: 5000px;
  display: flex;
  align-items: center;
  justify-content: center;
}


/* CANVAS */
#stageCanvas {
  background: #d1d5db;
  border: none;
}


/* ==============================
   SCENE PANEL
================================ */
.scene-panel {
  flex: 0 0 auto;
  height: 110px;
  background: #111827;
  padding: 8px;
  display: flex;
  gap: 10px;
  border-top: 1px solid #374151;
}

.scene-item {
  width: 120px;
  background: #374151;
  color: #ffffff;
  border-radius: 6px;
  padding: 5px;
  cursor: pointer;

  display: flex;
  flex-direction: column;
}

.scene-item.active {
  outline: 2px solid #3b82f6;
}

.scene-thumb{
  height:60px;

  display:flex;
  align-items:center;
  justify-content:center;

  overflow:hidden;
}

.scene-thumb img{
  max-width:100%;
  max-height:100%;

  width:auto;
  height:auto;

  display:block;
}

.scene-name {
  text-align: center;
  font-size: 12px;
  margin-top: 4px;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.add-scene {
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 24px;
}

/* ==============================
   OBJECT PROPERTIES
================================ */
.object-properties {
  flex: 0 0 auto;
  background: #ffffff;
  padding: 8px;
  border-top: 1px solid #ccc;
}

.property-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}

.opacity-range-wrapper {
  width: 90px;      /* kontrol panjang slider */
  padding: 4px 6px;
}

.opacity-range-wrapper .form-range {
  margin: 0;
}
.input-group-text{
  width:30px;
}

/* ==============================
   TRANSITIONS
================================ */
.scene-panel,
.object-properties {
  transition: all 0.2s ease;
}

/* =====================
   PANEL RESIZER
===================== */
.panel-resizer {
  width: 6px;
  cursor: col-resize;
  background: transparent;
  flex: 0 0 6px;
  position: relative;
}

.panel-resizer:hover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(59, 130, 246, 0.35);
}

body.resizing {
  cursor: col-resize;
  user-select: none;
}
/* =========================
   ASSET MANAGER PANEL
========================= */

.asset-manager {
  position: absolute;
  top: 60px;               
  right: 0;                  
  height: calc(100% - 180px);
  width: 240px;
  background: #1e1e1e;
  color: #fff;
  border-left: 1px solid #333;
  z-index: 30;
  display: flex;
  flex-direction: column;
}


/* COLLAPSED */
.asset-manager.collapsed {
  transform: translateX(-180px);
}

/* HEADER */
.asset-header {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px;
  background: #2a2a2a;
  border-bottom: 1px solid #333;
}

.asset-title {
  font-size: 13px;
  white-space: nowrap;
}

/* BODY */
.asset-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}

/* ASSET LIST */
.asset-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.asset-item {
  background: #fff;
  border: none;
  padding: 4px;
  cursor: pointer;
  text-align: center;
  height:120px;
}

.asset-item img {
  max-width: 100%;
  max-height: 64px;
  object-fit: contain;
}

.asset-name {
  font-size: 11px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* tab */
.asset-manager-tabs{
    display:flex;
    height:32px;
    border-bottom:1px solid #333;
}

.asset-manager-tab{
    flex:1;
    border:none;
    background:#252525;
    color:#ccc;
    cursor:pointer;
    font-size:12px;
}

.asset-manager-tab:hover{
    background:#333;
}

.asset-manager-tab.active{
    background:#444;
    color:white;
    font-weight:bold;
}
/* object tab */
.object-list{
    display:flex;
    flex-direction:column;
}

.object-item{
    display:flex;
    align-items:center;
    justify-content:space-between;

    padding:6px 8px;
    border-bottom:1px solid #333;

    cursor:pointer;
    color:white;
}

.object-item:hover{
    background:#333;
}

.object-item.active{
    background:#0d6efd;
}

.object-name{
    flex:1;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.object-visible{
    width:24px;
    text-align:center;
    color:#ccc;
}

.object-visible.off{
    opacity:.3;
}
/* BLOCK CODE */
/* BLOCK PANEL */
.block-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px;
  background: #1e1e1e;
  border-right: 1px solid #2c2c2c;
}

/* BLOCK PALETTE (GROUP BUTTONS) */
.block-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* CATEGORY BUTTON */
.block-category {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  border: none;
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  color: #fff;
  font-size: 16px;
  transition: transform 0.1s ease, filter 0.1s ease;
}

.block-category {
  position: relative;
  z-index: 5;
}


.block-category:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.block-category:active {
  transform: translateY(0);
}

/* ===== BLOCK CATEGORY COLORS ===== */

/* Event */
.block-category.event {
  background: #ff9f1c;
}

/* Motion */
.block-category.motion {
  background: #4dabf7;
}

/* Look */
.block-category.look {
  background: #845ef7;
}

/* Control / Flow */
.block-category.control {
  background: #51cf66;
}

/* Sensing */
.block-category.sensing {
  background: #20c997;
}

/* Variable */
.block-category.variable {
  background: #fd7e14;
}

/* scene */
.block-category.scene {
  background: #20237a;
}

/* condition */
.block-category.condition {
  background: #e64980;
}

.block-category.text {
  background: #504d57;
}

.block-category.media {
  background: #940707;
}

.block-category.module {
  background: #cbd113;
}

/* utility */
.block-category.utility {
  background: #06571e;
}


/* ACTION PANEL */
.block-action-panel {
  position: absolute;
  top: 0;

  left: 80px; /* keluar dari panel */
  width: 180px;

  background: #111827;
  border: 1px solid #374151;
  border-radius: 8px;

  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;

  z-index: 110;
  max-height: calc(100vh - 16px);
  overflow-y: auto;
}


/* ACTION BUTTON */
.block-action-btn {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: none;

  background: #374151;
  color: #fff;

  font-size: 12px;
  text-align: left;
  cursor: pointer;

  transition: background 0.15s ease;
}

.block-action-btn:hover {
  background: #4b5563;
}

.block-action-btn:hover {
  background: var(--bg-hover);
}

.code-editor-panel .panel-header {
  padding: 6px 10px;
  font-size: var(--editor-font-size);
  line-height: var(--editor-line-height);
  color: #ccc;
  background: #252526;
  border-bottom: 1px solid #2c2c2c;
}

/* TEXTAREA EDITOR */

/* parameter code */

/* ================= PARAM MODAL OVERLAY ================= */
.param-modal {
  position: fixed;
  inset: 0;
  z-index: 5999;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}

.param-modal.hidden {
  display: none;
}

/* ================= DIALOG ================= */
.param-dialog {
  width: auto;
  min-width:500px;
  max-width: 92%;
  max-height:80%;
  background: #1e1e1e;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  color: #e5e7eb;
  display: flex;
  flex-direction: column;
  animation: paramFade 0.18s ease-out;
}

#paramBody{
	overflow-y:auto;
}

@keyframes paramFade {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ================= HEADER ================= */
.param-header {
  padding: 14px 18px;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.param-header span {
  color: #f8fafc;
}

.param-header button {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 18px;
  cursor: pointer;
}

.param-header button:hover {
  color: #f87171;
}

/* ================= BODY ================= */
.param-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ================= PARAM ROW ================= */
.param-body .param-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.param-body .param-row label {
  font-size: 12px;
  color: #9ca3af;
}

.param-body .param-row input,
.param-body .param-row select {
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 8px 10px;
  color: #f9fafb;
  font-size: 13px;
}

.param-body .param-row input:focus,
.param-body .param-row select:focus {
  outline: none;
  border-color: #4dabf7;
  box-shadow: 0 0 0 2px rgba(77, 171, 247, 0.25);
}

/* ================= FOOTER ================= */
.param-footer {
  padding: 14px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* cancel */
.param-footer #paramCancel {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #9ca3af;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
}

.param-footer #paramCancel:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* apply */
.param-footer #paramApply {
  background: #4dabf7;
  border: none;
  color: #0f172a;
  padding: 6px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.param-footer #paramApply:hover {
  background: #339af0;
}

.expression-chain {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.expression-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.expression-row select,
.expression-row input {
  height: 30px;
  padding: 2px 6px;
  font-size: 13px;
  border-radius: 4px;
  border: 1px solid #ccc;
}

.expression-row button {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: #f03e3e;
  color: white;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.expression-row button:hover {
  background: #e03131;
}

.expression-row button:active {
  transform: scale(0.92);
}

.expression-chain > button {
  margin-top: 6px;
  align-self: flex-start;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 4px;
  border: 1px dashed #adb5bd;
  background: transparent;
  color: #495057;
  cursor: pointer;
}

.expression-chain > button:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* ==== SYNTAX COLORS ==== */
/* ===== COMMON TOKENS ===== */
.token-comment {
  color: #6a9955;
  font-style: italic;
}

.token-string {
  color: #ce9178;
}

.token-number {
  color: #b5cea8;
}

/* ===== CATEGORY BASED (match block colors) ===== */

/* Event — from #ff9f1c */
.token-event {
  color: #ffb454;
  font-weight: 600;
}

/* Motion — from #4dabf7 */
.token-motion {
  color: #74c0fc;
}

/* Look — from #845ef7 */
.token-look {
  color: #b197fc;
}

/* Control / Flow — from #51cf66 */
.token-control {
  color: #69db7c;
  font-weight: 500;
}

/* Sensing — from #20c997 */
.token-sensing {
  color: #63e6be;
}

/* Variable — from #fd7e14 */
.token-variable {
  color: #ffa94d;
}

.token-scene {
  color: #20237a;
}

/* Condition — from #e64980 */
.token-condition {
  color: #f783ac;
  font-weight: 500;
}

/* ===== SYMBOLS ===== */
.token-brace {
  color: #d4d4d4;
}

.token-operator {
  color: #c586c0;
}

.block-action-btn.var-create {
  background: rgba(81, 207, 102, 0.15);
  color: var(--accent-green);
  font-weight: 600;
}

.block-action-btn.var-create:hover {
  background: rgba(81, 207, 102, 0.25);
}
.block-action-btn.var-list {
  color: var(--text-muted);
}

.block-action-btn.var-list:hover {
  color: var(--text-main);
}
.block-action-panel hr {
  border: none;
  height: 1px;
  background: var(--border-soft);
  margin: 6px 0;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-box {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  width: 340px;
  padding: 16px;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
}
.modal-box h3 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  color:var(--text-main);
}

.modal-box label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
  display: block;
}
.modal-box input,
.modal-box select {
  width: 100%;
  margin-top: 4px;
  padding: 7px 8px;
  background: #0f1115;
  border: 1px solid var(--border-soft);
  color: var(--text-main);
  border-radius: 6px;
  font-size: 13px;
}

.modal-box input:focus,
.modal-box select:focus {
  outline: none;
  border-color: var(--accent-green);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.modal-actions button {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}
.modal-actions button:first-child {
  background: transparent;
  color: var(--text-muted);
}

.modal-actions button:first-child:hover {
  color: var(--text-main);
}
.modal-actions button:last-child {
  background: var(--accent-green);
  color: #081c15;
  font-weight: 600;
}
.var-list {
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 12px;
}
.var-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 6px 4px;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.var-row span:nth-child(2) {
  font-size: 11px;
  color: var(--text-muted);
}

.var-row button {
  background: transparent;
  border: none;
  color: var(--accent-red);
  cursor: pointer;
  font-size: 14px;
}

.var-row button:hover {
  opacity: .8;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

.field input,
.field select {
  background: #111827;
  color: #e5e7eb;
  border: 1px solid #374151;
  border-radius: 6px;
  padding: 6px 8px;
}

.field input.error,
.field select.error {
  border-color: #ef4444;
}

.field .error-tooltip {
  font-size: 11px;
  color: #fecaca;
  background: #7f1d1d;
  padding: 4px 6px;
  border-radius: 4px;
}

/* ===== ALERT OVERLAY ===== */
.custom-alert-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

/* ===== ALERT PANEL ===== */
.custom-alert {
  background: #111827;
  border: 1px solid #374151;
  border-radius: 14px;
  padding: 18px 20px;
  width: 320px;
  color: #e5e7eb;

  display: flex;
  gap: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
}

/* ICON */
.custom-alert-icon {
  font-size: 26px;
  color: #facc15; /* warning yellow */
  margin-top: 2px;
}

/* CONTENT */
.custom-alert-content {
  flex: 1;
}

.custom-alert-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.custom-alert-message {
  font-size: 13px;
  color: #d1d5db;
  line-height: 1.4;
}

/* ACTION */
.custom-alert-actions {
  margin-top: 12px;
  text-align: right;
}

.custom-alert-actions button {
  background: #374151;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
}

.custom-alert-actions button:hover {
  background: #4b5563;
}

.radio-item.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.radio-group {
  display: flex;
  align-items: center;
  gap: 18px;
}

.radio-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;              /* 🔥 penting */
  white-space: nowrap;      /* 🔥 cegah turun baris */

  cursor: pointer;
  font-size: 13px;
  color: #e5e7eb;
}

.radio-item input[type="radio"] {
  margin: 0;
  accent-color: #3b82f6;
}

.radio-item input[type="radio"] {
  accent-color: #3b82f6; /* biru modern */
  cursor: pointer;
}

.radio-item.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.radio-item.disabled input {
  cursor: not-allowed;
}

.context-menu {
  background: #1f2937;
  border-radius: 6px;
  padding: 4px 0;
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  z-index: 1000;
}

.menu-item {
  padding: 8px 12px;
  color: white;
  cursor: pointer;
  font-size: 14px;
}

.menu-item:hover {
  background: #374151;
}

.menu-divider {
  height: 1px;
  background: #374151;
  margin: 4px 0;
}


.running-label {
  margin: 10px;
  padding: 6px 12px;

  background: linear-gradient(135deg, #00c853, #00e676);  
  color: #00ff66;
  font-weight: bold;
  font-size: 12px;
  border-radius: 6px;
  letter-spacing: 1px;

  backdrop-filter: blur(4px);
}
.running-indicator {
  display: none;
  margin-top: 2px;
  padding: 2px 8px;

  font-size: 11px;
  font-weight: bold;
  letter-spacing: 1px;

  color: #fff;
  background: linear-gradient(135deg, #00c853, #00e676);  
  border-radius: 4px;

  width: fit-content;
}
/* code editor monaco support */
.code-editor-panel {
  flex: 0 0 580px;
  background: #1e1e1e;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #2c2c2c;
}

.panel-header {
  padding: 6px 10px;
  font-size: 14px;
  color: #ccc;
  background: #252526;
  border-bottom: 1px solid #2c2c2c;
}

.code-editor-wrapper {
  flex: 1;
  position: relative;
}

#editorContainer {
  width: 100%;
  height: 100%;
}

.popup-modal {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}

.popup-modal.hidden {
  display: none;
}

/* ================= DIALOG ================= */
.popup-dialog {
  width: auto;
  min-width:500px;
  max-width: 92%;
  background: #1e1e1e;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  color: #e5e7eb;
  display: flex;
  flex-direction: column;
  animation: popupFade 0.18s ease-out;
}

@keyframes popupFade {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ================= HEADER ================= */
.popup-header {
  padding: 14px 18px;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.popup-header span {
  color: #f8fafc;
}

.popup-header button {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 18px;
  cursor: pointer;
}

.popup-header button:hover {
  color: #f87171;
}

/* ================= BODY ================= */
.popup-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ================= popup ROW ================= */
.popup-body .popup-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.popup-body .popup-row label {
  font-size: 12px;
  color: #9ca3af;
}

.popup-body input,
.popup-body select {
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 8px 10px;
  color: #f9fafb;
  font-size: 13px;
}

.popup-body input:focus,
.popup-body select:focus {
  outline: none;
  border-color: #4dabf7;
  box-shadow: 0 0 0 2px rgba(77, 171, 247, 0.25);
}

/* ================= FOOTER ================= */
.popup-footer {
  padding: 14px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* cancel */
.popup-footer #popupCancel {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #9ca3af;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
}

.popup-footer #popupCancel:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* apply */
.popup-footer #popupApply {
  background: #4dabf7;
  border: none;
  color: #0f172a;
  padding: 6px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
}

.popup-footer #popupApply:hover {
  background: #339af0;
}
/* Save Load Project */
.project-browser-overlay{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(0,0,0,.55);
  backdrop-filter:blur(10px);
  z-index:1997;
}

.project-browser-window{
  width:min(1100px,75vw);
  height:min(580px,75vh);
  background:#18181b;
  border-radius:32px;
  border:1px solid rgba(255,255,255,.06);
  box-shadow:0 30px 80px rgba(0,0,0,.45);
  padding:28px;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

.project-browser-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
}

.project-browser-title{
  color:#fff;
  font-size:30px;
  font-weight:700;
}

.project-browser-subtitle{
  margin-top:4px;
  color:rgba(255,255,255,.45);
  font-size:14px;
}

.project-browser-close{
  width:42px;
  height:42px;
  border:none;
  border-radius:50%;
  background:#27272a;
  color:#fff;
  cursor:pointer;
  transition:.15s;
}

.project-browser-close:hover{
  background:#34343a;
}

.project-browser-menu{
  display:flex;
  gap:12px;
  margin-top:24px;
  margin-bottom:24px;
}

.browser-btn{
  border:none;
  border-radius:999px;
  padding:12px 22px;
  font-size:14px;
  font-weight:600;
  cursor:pointer;
  transition:.15s;
}

.browser-btn:hover{
  transform:translateY(-1px);
}

.browser-btn-primary{
  background:#6366f1;
  color:#fff;
}

.browser-btn-primary:hover{
  background:#7477ff;
}

.browser-btn-dark{
  background:#27272a;
  color:#fff;
}

.browser-btn-dark:hover{
  background:#34343a;
}

.project-browser-list{
  flex:1;
  overflow-x:auto;
  overflow-y:hidden;
  display:flex;
  gap:18px;
  padding-bottom:8px;
}

.project-card{
  min-width:280px;
  background:#202024;
  border-radius:16px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.05);
  transition:.15s;
  flex-shrink:0;
}

.project-card:hover{
  transform:translateY(-2px);
  border-color:rgba(255,255,255,.12);
}

.project-thumb{
  width:100%;
  height:150px;
  object-fit:cover;
  background:#2c2c31;
}

.project-card-body{
  padding:18px;
}

.project-card-title{
  color:#fff;
  font-size:16px;
  font-weight:600;
}

.project-card-date{
  margin-top:6px;
  color:rgba(255,255,255,.45);
  font-size:12px;
}

.project-card-actions{
  display:flex;
  gap:8px;
  margin-top:18px;
}

.project-card-actions .browser-btn{
  padding:10px 16px;
  font-size:12px;
}
.project-thumb{
  width:100%;
  height:150px;
  object-fit:cover;
  background:#2c2c31;
}

.new-project-overlay{
  position:fixed;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  background:rgba(0,0,0,.45);
  z-index:2000;
}

.new-project-window{
  width:min(420px,92vw);
  background:#1b1b1f;
  border-radius:20px;
  border:1px solid rgba(255,255,255,.06);
  box-shadow:0 20px 60px rgba(0,0,0,.45);
  padding:24px;
  box-sizing:border-box;
}

.new-project-title{
  color:#fff;
  font-size:24px;
  font-weight:700;
  margin-bottom:24px;
}

.new-project-form{
  margin-bottom:18px;
}

.new-project-form label{
  display:block;
  margin-bottom:8px;
  color:rgba(255,255,255,.65);
  font-size:13px;
}

.new-project-input{
  width:100%;
  background:#27272a;
  border:1px solid rgba(255,255,255,.06);
  border-radius:14px;
  padding:12px 14px;
  box-sizing:border-box;
  color:#fff;
  outline:none;
}

.new-project-input:focus{
  border-color:#6366f1;
}

.new-project-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}

.new-project-actions{
  display:flex;
  justify-content:flex-end;
  gap:12px;
  margin-top:24px;
}

.project-browser-list::-webkit-scrollbar{
  height:12px;
}

.project-browser-list::-webkit-scrollbar-track{
  background:transparent;
}

.project-browser-list::-webkit-scrollbar-thumb{
  background:#34343a;
  border-radius:999px;
}

.project-browser-list::-webkit-scrollbar-thumb:hover{
  background:#44444d;
}

.object-select-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(110px,1fr));
  gap:10px;
}

.object-select-item{
  position:relative;
  border:2px solid transparent;
  border-radius:12px;
  overflow:hidden;
  cursor:pointer;
  transition:0.2s;
  background:#f1f5f9;
}

.object-select-item:hover{
  transform:translateY(-2px);
}

.object-select-item img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.object-select-item.active{
  border-color:#0d6efd;
  box-shadow:
    0 0 0 3px rgba(13,110,253,.2);
}

.object-modal-body{
  max-height:60vh;
  overflow-y:auto;
}

.dropdown-menu .dropend:hover > .dropdown-menu {
  display: block;
  top: 0;
  left: 100%;
  margin-top: -1px;
}
.sound-item{
	display:flex;
	align-items:center;
	justify-content:space-between;
	gap:8px;
}

.sound-main{
	display:flex;
	align-items:center;
	gap:20px;
	min-width:0;
	flex:1;
}

.sound-name{
	overflow:hidden;
	text-overflow:ellipsis;
	white-space:nowrap;
}

.sound-actions{
	display:flex;
	align-items:center;
	gap:4px;
	margin-top:20px;
}

.sound-actions button{
	width:24px;
	height:24px;
	padding:0;
	border:none;
	cursor:pointer;
	border-radius:4px;
}

#videoLayer{
	position:absolute;
	inset:0;
	pointer-events:none;
	overflow:hidden;	
}

.video-frame{
	position:fixed;
	z-index:999;
	border:none;
	pointer-events:auto;
}

.module-browser-overlay{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(0,0,0,.55);
  backdrop-filter:blur(10px);
  z-index:2399;
}

.publish-overlay{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(0,0,0,.55);
  backdrop-filter:blur(10px);
  z-index:2499;
}

.module-browser-window{
  width:min(1100px,75vw);
  height:min(580px,75vh);
  background:#18181b;
  border-radius:32px;
  border:1px solid rgba(255,255,255,.06);
  box-shadow:0 30px 80px rgba(0,0,0,.45);
  padding:28px;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

.module-browser-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
}

.module-browser-title{
  color:#fff;
  font-size:30px;
  font-weight:700;
}

.module-browser-subtitle{
  margin-top:4px;
  color:rgba(255,255,255,.45);
  font-size:14px;
}

.module-browser-close{
  width:42px;
  height:42px;
  border:none;
  border-radius:50%;
  background:#27272a;
  color:#fff;
  cursor:pointer;
  transition:.15s;
}

.module-browser-close:hover{
  background:#34343a;
}

.publish-close{
  width:42px;
  height:42px;
  border:none;
  border-radius:50%;
  background:#27272a;
  color:#fff;
  cursor:pointer;
  transition:.15s;
}

.publish-close:hover{
  background:#34343a;
}

.module-browser-menu{
  display:flex;
  gap:12px;
  margin-top:24px;
  margin-bottom:24px;
}

.module-browser-list{
  flex:1;
  overflow-x:auto;
  overflow-y:hidden;
  display:flex;
  gap:18px;
  padding-bottom:8px;
}

.publish-list{
  flex:1;
  overflow-x:auto;
  overflow-y:hidden;
  display:flex;
  gap:18px;
  padding-bottom:8px;
}

.module-card{
  min-width:280px;
  max-width:300px;
  background:#202024;
  border-radius:16px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.05);
  transition:.15s;
  flex-shrink:0;
}

.module-card:hover{
  transform:translateY(-2px);
  border-color:rgba(255,255,255,.12);
}

.module-thumb{
  width:100%;
  height:150px;
  object-fit:cover;
  background:#2c2c31;
}

.module-card-body{
  padding:18px;
}

.module-card-title{
  color:#fff;
  font-size:16px;
  font-weight:600;
}

.module-card-desc{
  margin-top:6px;
  color:rgba(255,255,255,.45);
  font-size:12px;
}

.module-card-actions{
  display:flex;
  gap:8px;
  margin-top:18px;
}

.module-card-actions .browser-btn{
  padding:10px 16px;
  font-size:12px;
}
.module-thumb{
  width:100%;
  height:150px;
  object-fit:cover;
  background:#2c2c31;
}

/* Search Box */
.module-search-box{
  display:flex;
  align-items:center;
  gap:10px;

  width:250px;

  padding:0 14px;
  height:42px;

  border:1px solid rgba(255,255,255,0.08);
  border-radius:14px;

  background:#1e1e1e;

  transition:0.2s ease;
}

.module-search-box:focus-within{
  border-color:#4d8dff;
  box-shadow:0 0 0 3px rgba(77,141,255,0.15);
}

.module-search-box i{
  font-size:14px;
  color:#8a8a8a;
}

.module-search-box input{
  flex:1;

  border:none;
  outline:none;
  background:transparent;

  color:#fff;
  font-size:14px;
}

/* Search Button */
#search-module{
  width:42px;
  height:42px;

  display:flex;
  align-items:center;
  justify-content:center;

  border-radius:14px;
  padding:0;
}

#search-module i{
  font-size:14px;
}

.module-not-found{
  width:100%;
  padding:40px;
  text-align:center;
  opacity:0.6;
  font-size:16px;
  color:rgba(255,255,255,.45);
}
#runtimeOverlay{
    position: fixed;
    inset: 0;

    background: rgba(0,0,0,0.85);

    z-index: 12000;

    display: flex;
    flex-direction: column;
}

#runtimeOverlay.hidden{
    display:none;
}

#runtimeHeader{
    height: 50px;
    background: #222;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 15px;
    color:white;
    flex-shrink:0;
}

#runtimeViewport{
    flex:1;
    display:flex;
    justify-content:center;
    align-items:center;
    overflow:hidden;
}

#runtimeCanvas{
    background:#fff;
}


.asset-browser{
  padding:0 15px;
}

.search-box{
  position:relative;
}

.search-box i{
  position:absolute;
  left:12px;
  top:50%;
  transform:translateY(-50%);
  opacity:.6;
}

.search-box input{
  padding-left:35px;
  width:300px;
  background:#e3e3e3;
  border:none;
  color:white;
}

.asset-tabs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.asset-tab{
  border:none;
  background:#b8b8b8;
  color:#e3e3e3;
  padding:6px 14px;
  border-radius:999px;
  font-size:13px;
  transition:.2s;
}

.asset-tab.active{
  background:#0d6efd;
  color:white;
}

.asset-grid{
  height:480px;
  overflow-y:auto;
  display:grid;
  grid-template-columns:
  repeat(auto-fill,minmax(140px,202px));
  gap:12px;
  padding-right:10px;
}

/* scrollbar modern */
.asset-grid::-webkit-scrollbar{
  width:8px;
}

.asset-grid::-webkit-scrollbar-thumb{
  background:#444;
  border-radius:999px;
}

.asset-item2{
  background:#e3e3e3;
  border-radius:10px;
  overflow:hidden;
  cursor:pointer;
  height:150px;
  border:2px solid transparent;

  transition:.2s;
}

.asset-item2:hover{
  transform:translateY(-2px);
}

.asset-item2.selected{
  border-color:#0d6efd;
}

.asset-thumb{
  width:95%;
  height:100px;
  background:#e3e3e3;
  margin:5px;
}

.asset-thumb img{
  width:100%;
  height:100%;
  object-fit:contain;
}

.asset-name{
  padding:8px;
  font-size:12px;
  text-align:center;
}

.asset-pagination{
  display:flex;
  justify-content:center;
  gap:8px;
}

.asset-page{
  width:32px;
  height:32px;
  border:none;
  border-radius:8px;

  background:#b8b8b8;
  color:white;
}

.asset-page.active{
  background:#0d6efd;
}
.modal-title{
	font-size: 20px;
	font-weight: bold;
}

.card-frame-list{
  display:flex;
  gap:10px;
  overflow-x:auto;
  padding:10px;
  border:1px solid #ddd;
  min-height:160px;
}

.card-frame-item{
  flex:0 0 auto;
  width:140px;
  border:1px solid #ddd;
  border-radius:6px;
  padding:5px;
}

.card-frame-thumb{
  width:100%;
  height:90px;
  object-fit:contain;
  background:#f8f8f8;
}

.card-frame-toolbar{
  display:flex;
  justify-content:center;
  gap:5px;
  margin-top:5px;
}
.asset-manager-item {
  background: #2b2b2b;
  border: 1px solid #333;
  padding: 4px;
  cursor: pointer;
  text-align: center;
}

.asset-manager-item img {
  max-width: 100%;
  max-height: 64px;
  object-fit: contain;
}

.asset-manager-name {
  font-size: 11px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sprite-preview-wrapper{
    height:500px;
    overflow:auto;
    background:#fff;
    border:1px solid #e3e3e3;
	border-radius:10px;
    display:flex;
    justify-content:center;
    align-items:flex-start;
    padding:20px;
}

#spriteGridCanvas{
    max-width:100%;
    image-rendering:pixelated;
}

.external-script-disabled{
  opacity:.5;
  filter:grayscale(1);
}

/* Loading Spinner */
.loading-container {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 40px 0;
    width: 100%;
    grid-column: 1 / -1;
}

.loading-container.active {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Sembunyikan grid saat loading */
.asset-grid.loading .asset-item2 {
    opacity: 0.3;
    pointer-events: none;
}

/* Pesan tidak ada asset */
.no-assets {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 0;
    color: #666;
    font-size: 16px;
}

/* Pesan error */
.error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 0;
    color: #d32f2f;
    background: #fde8e8;
    border-radius: 8px;
    margin: 20px 0;
}

.error-message p {
    margin-bottom: 15px;
}

.retry-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.retry-btn:hover {
    background: #2980b9;
}

/* Search Info */
.search-info {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.search-info i {
    color: #6c757d;
}

.search-info .result-count {
    color: #6c757d;
    font-size: 14px;
    margin-left: auto;
}

.clear-search-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.3s;
}

.clear-search-btn:hover {
    background: #c0392b;
}

/* Highlight text */
.highlight {
    background-color: #fff3cd;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}

/* Asset Tags */
.asset-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px 8px;
    margin-top: 4px;
}

.tag {
    font-size: 10px;
    background: #e9ecef;
    color: #495057;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
}

.tag-more {
    font-size: 10px;
    color: #6c757d;
    padding: 2px 4px;
}

/* Category Badge */
.asset-category-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    pointer-events: none;
}

.asset-thumb {
    position: relative;
}

.color-preview{
    width:28px;
    height:28px;

    border:1px solid #999;
    border-radius:4px;
	cursor:pointer;
}

#gradient-prop{
    display: flex;
    align-items: center;
    gap: 10px;
}

#gradient-prop > .col{
    flex: 0 0 auto;
    width: auto;
    padding: 0;
}

.project-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 4000;

  display: flex;
  align-items: center;
  justify-content: center;

  background: rgba(15, 15, 18, 0.96);

  opacity: 1;
}

.project-loading-box {
  width: min(420px, calc(100% - 40px));

  padding: 30px;

  text-align: center;

  background: #232323;
  border: 1px solid #3a3a3a;
  border-radius: 14px;

  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}

.project-loading-icon {
  width: 52px;
  height: 52px;

  margin: 0 auto 16px;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 12px;

  background: #2d2d2d;

  color: #fff;
  font-size: 22px;
}

.project-loading-title {
  font-size: 20px;
  font-weight: 600;
  color: #fff;
}

.project-loading-name {
  margin-top: 6px;

  font-size: 13px;
  color: #999;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-loading-progress {
  margin-top: 25px;
}

.project-loading-bar {
  width: 100%;
  height: 8px;

  overflow: hidden;

  background: #151515;
  border-radius: 20px;
}

.project-loading-fill {
  width: 0%;
  height: 100%;

  border-radius: inherit;

  background: #4dabf7;

  transition: width .15s ease-out;
}

.project-loading-percent {
  margin-top: 9px;

  font-size: 13px;
  font-weight: 600;

  color: #bbb;
}

.project-loading-status {
  margin-top: 12px;

  font-size: 12px;
  color: #777;
}

.asset-import-progress {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  z-index: 999;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transition: opacity 0.2s ease,
              transform 0.2s ease;
}

.asset-import-progress.active {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%);
}

.asset-import-label {
  display: flex;
  justify-content: space-between;
  align-items: center;

  font-size: 12px;
  font-weight: 600;
  color: #374151;

  margin-bottom: 8px;
}

#assetImportPercent {
  color: #2563eb;
  font-size: 11px;
}

.asset-progress-track {
  width: 100%;
  height: 4px;

  background: #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
}

.asset-progress-bar {
  width: 0%;
  height: 100%;

  background: #2563eb;
  border-radius: 10px;

  transition: width 0.2s ease;
}