/* ============ ARTES · bitgital — editor theme ============ */
:root {
  --bg0: #0b0e16;
  --bg1: #11151f;
  --bg2: #181d2b;
  --bg3: #20263a;
  --line: #2a3147;
  --txt: #e8ecf6;
  --txt2: #98a2bd;
  --accent: #0fe0c8;
  --accent2: #1e5854;
  --danger: #ff5470;
  --warn: #ffd84d;
  --radius: 10px;
  font-size: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg0);
  color: var(--txt);
  display: flex;
  flex-direction: column;
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ============ top bar ============ */
#topbar {
  height: 52px;
  flex: 0 0 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  background: var(--bg1);
  border-bottom: 1px solid var(--line);
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 8px; user-select: none; }
.brand-icon { color: var(--accent); font-size: 20px; }
.brand-name { font-weight: 600; letter-spacing: .5px; font-size: 15px; }
.brand-name b { color: var(--accent); font-weight: 800; }

#project-name {
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--txt);
  border-radius: 8px;
  padding: 6px 10px;
  width: 160px;
  outline: none;
}
#project-name:focus { border-color: var(--accent); }

.top-group { display: flex; align-items: center; gap: 6px; }
.top-label { color: var(--txt2); font-size: 12px; }
.spacer { flex: 1; }

#canvas-size {
  background: var(--bg2);
  color: var(--txt);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  outline: none;
}

.tbtn {
  background: var(--bg2);
  border: 1px solid var(--line);
  color: var(--txt);
  border-radius: 8px;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background .15s, border-color .15s;
}
.tbtn:hover { background: var(--bg3); border-color: var(--accent2); }
.tbtn.text { font-size: 13px; }
.tbtn.wide { padding: 0 10px; font-size: 13px; }
.tbtn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #04221e;
  font-weight: 700;
  font-size: 13px;
}
.tbtn.primary:hover { filter: brightness(1.1); }
.tbtn:disabled { opacity: .35; cursor: default; }

/* dropdown */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  min-width: 190px;
  box-shadow: 0 12px 30px rgba(0,0,0,.5);
  z-index: 50;
}
.dropdown.up .dropdown-menu { top: auto; bottom: 0; left: calc(100% + 6px); right: auto; }
.dropdown-menu.open { display: flex; }
.dropdown-menu button {
  background: none;
  border: 0;
  color: var(--txt);
  text-align: left;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 13px;
}
.dropdown-menu button:hover { background: var(--bg3); color: var(--accent); }

/* ============ workspace ============ */
#workspace { flex: 1; display: flex; min-height: 0; }

/* rail izquierdo */
#rail {
  flex: 0 0 86px;
  background: var(--bg1);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 8px 6px;
  gap: 4px;
  overflow-y: auto;
  z-index: 20;
}
.rail-btn {
  background: none;
  border: 1px solid transparent;
  color: var(--txt2);
  border-radius: 10px;
  padding: 7px 2px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  transition: all .15s;
  width: 100%;
}
.rail-btn:hover { background: var(--bg2); color: var(--txt); border-color: var(--line); }
.rail-btn.accent { color: var(--accent); border-color: var(--accent2); background: rgba(15,224,200,.06); }
.rail-btn.accent:hover { background: rgba(15,224,200,.14); }
.rail-ico { font-size: 19px; line-height: 1; font-weight: 700; }
.rail-sep { height: 1px; background: var(--line); margin: 5px 8px; flex: 0 0 1px; }

/* centro */
#canvas-wrap {
  flex: 1;
  overflow: auto;
  display: flex;
  background:
    radial-gradient(1200px 500px at 70% -10%, rgba(15,224,200,.05), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(150,40,255,.06), transparent 60%),
    var(--bg0);
  position: relative;
}
#canvas-holder {
  margin: auto;
  padding: 28px;
  display: inline-block;
}
.canvas-container {
  box-shadow: 0 0 0 1px var(--line), 0 24px 60px rgba(0,0,0,.55);
  border-radius: 2px;
}

/* ============ panel derecho ============ */
#panel {
  flex: 0 0 308px;
  background: var(--bg1);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  z-index: 20;
}
#panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.ptab {
  flex: 1;
  background: none;
  border: 0;
  color: var(--txt2);
  padding: 11px 0;
  font-size: 13px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
}
.ptab.active { color: var(--accent); border-bottom-color: var(--accent); }
.pane { display: none; flex: 1; overflow-y: auto; padding: 12px; min-height: 0; }
.pane.active { display: block; }

/* ---- props ---- */
.prop-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 10px;
  background: var(--bg2);
}
.prop-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.prop-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}
.prop-row:last-child { margin-bottom: 0; }
.prop-row label {
  flex: 0 0 76px;
  font-size: 12px;
  color: var(--txt2);
}
.prop-row .grow { flex: 1; display: flex; gap: 6px; align-items: center; }

.pin, .psel, .ptxt {
  background: var(--bg1);
  border: 1px solid var(--line);
  color: var(--txt);
  border-radius: 7px;
  padding: 6px 8px;
  width: 100%;
  outline: none;
  font-size: 13px;
  min-width: 0;
}
.pin:focus, .psel:focus, .ptxt:focus { border-color: var(--accent); }
.pin.num { width: 64px; flex: 0 0 64px; text-align: center; }
textarea.ptxt { resize: vertical; min-height: 56px; }

input[type="range"].prange {
  flex: 1;
  appearance: none;
  height: 4px;
  background: var(--bg3);
  border-radius: 4px;
  outline: none;
}
input[type="range"].prange::-webkit-slider-thumb {
  appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid #04221e;
}

input[type="color"].pcolor {
  width: 34px; height: 28px;
  flex: 0 0 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg1);
  padding: 2px;
  cursor: pointer;
}

.btn-row { display: flex; gap: 5px; flex-wrap: wrap; }
.mini {
  background: var(--bg1);
  border: 1px solid var(--line);
  color: var(--txt);
  border-radius: 7px;
  height: 28px;
  min-width: 30px;
  padding: 0 8px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mini:hover { border-color: var(--accent); color: var(--accent); }
.mini.on { background: var(--accent2); border-color: var(--accent); color: var(--accent); }
.mini.danger:hover { border-color: var(--danger); color: var(--danger); }
.mini.full { flex: 1; }

.empty-hint {
  color: var(--txt2);
  font-size: 13px;
  line-height: 1.6;
  padding: 8px 4px;
}
.empty-hint b { color: var(--accent); }
.empty-hint kbd {
  background: var(--bg3);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 11px;
}

/* ---- layers ---- */
#layers-list { display: flex; flex-direction: column; gap: 4px; }
.layer-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: grab;
  user-select: none;
}
.layer-row:hover { border-color: var(--accent2); }
.layer-row.active { border-color: var(--accent); background: rgba(15,224,200,.08); }
.layer-row.dragover { border-top: 2px solid var(--accent); }
.layer-row .lname {
  flex: 1;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.layer-row .lkind { font-size: 13px; flex: 0 0 18px; text-align: center; }
.layer-row .lbtn {
  background: none;
  border: 0;
  color: var(--txt2);
  font-size: 13px;
  padding: 2px;
  border-radius: 5px;
}
.layer-row .lbtn:hover { color: var(--accent); }
.layer-row .lbtn.off { opacity: .35; }
.layers-hint { color: var(--txt2); font-size: 11px; margin-top: 10px; text-align: center; }

/* ============ toast ============ */
#toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg3);
  border: 1px solid var(--accent2);
  color: var(--txt);
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all .25s;
  z-index: 99;
  max-width: 80vw;
  text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: var(--danger); }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 6px; border: 2px solid var(--bg0); }
::-webkit-scrollbar-thumb:hover { background: var(--line); }
::-webkit-scrollbar-track { background: transparent; }

/* responsive mínimo */
@media (max-width: 980px) {
  #panel { flex-basis: 260px; }
  #rail { flex-basis: 72px; }
}
