/* ================== GLOBAL ================== */
body {
  font-family: Arial, sans-serif;
  background: #f5f6fa;
  padding: 20px;
}

.container {
  max-width: 1500px;
  margin: auto;
  background: #fff;
  padding: 20px;
  border-radius: 10px;
}

h2 {
  text-align: center;
  margin-bottom: 20px;
}

h3 {
  margin: 0 0 10px;
}

/* ================== FORM ROOT ================== */
.root {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px,1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.field label {
  font-weight: bold;
}

input, select, button {
  width: 100%;
  padding: 8px;
  margin-top: 5px;
  box-sizing: border-box;
}

button {
  background: #273c75;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}
button:hover { background: #40739e; }

/* ================== DIAGRAM ================== */
.diagram-wrap {
  margin-top: 20px;
  background: #fafafa;
  border-radius: 8px;
  padding: 10px;
}

.diagram-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.diagram-toolbar .title {
  font-weight: bold;
}

.diagram-toolbar .tools button {
  width: auto;
  padding: 6px 12px;
  margin-left: 5px;
}

.diagram-toolbar select {
  padding: 6px 12px;
  border-radius: 5px;
  border: 1px solid #ccc;
  font-weight: bold;
  cursor: pointer;
}

.diagram-toolbar .tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* dropdown SVG kecil */
.tool-select {
  width: 90px;
  padding: 6px;
  border-radius: 5px;
  border: 1px solid #ccc;
  font-weight: bold;
  cursor: pointer;
}

/* tombol kecil toolbar */
.diagram-toolbar .tools button {
  padding: 6px 10px;
  width: auto;
}

/* viewport agar zoom & pan rapi */
.diagram-viewport {
  width: 100%;
  height: 600px;
  overflow: auto;          /* SCROLL */
  border: 1px solid #ddd;
  cursor: grab;
}

.diagram-viewport.dragging {
  cursor: grabbing;
}

svg {
  width: 100%;
  height: 100%;
}

/* ================== SVG NODE ================== */
.node {
  fill: #ffffff;
  stroke-width: 1.5;
}

.node-label {
  font-size: 12px;
  font-weight: bold;
  fill: #2f3640;
}

.node-power {
  font-size: 11px;
  fill: #353b48;
}

/* garis */
.line {
  stroke-width: 2;
  fill: none;
  stroke: #999;
}

/* ================== RASIO (2 OUTPUT SEJAJAR) ================== */
.rasio-group rect {
  rx: 6;
}

.rasio-small {
  stroke: #c23616;
  fill: #fdeaea;
}

.rasio-big {
  stroke: #0097e6;
  fill: #eaf4ff;
}

/* ================== TAP PANEL ================== */
.tap-panel {
  margin-top: 30px;
}

.tap-area {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.tap-box {
  background: #f1f2f6;
  padding: 12px;
  border-radius: 8px;
  border-left: 6px solid var(--color,#999);
  flex: 1 1 320px;
  max-width: 100%;
  align-self: flex-start; /* PENTING */
}

.tap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tap-header {
  cursor: pointer;
  user-select: none;
}

.tap-header .toggle {
  margin-right: 6px;
  font-weight: bold;
}

.tap-body {
  margin-top: 8px;
}

.tap-body {
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}

.tap-box.collapsed .tap-body {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.tap-box:not(.collapsed) .tap-body {
  max-height: 1000px;
}


.del {
  background: #e84118;
  color: #fff;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
}

/* output text */
.small { color: #c23616; font-weight: bold; }
.big   { color: #0097e6; font-weight: bold; }

/* ================== AUTO SCALE (SVG BANYAK TAP) ================== */
/* class ini akan dipakai JS untuk mengecilkan node otomatis */
.scale-small .node {
  transform: scale(0.9);
}
.scale-smaller .node {
  transform: scale(0.8);
}
.scale-mini .node {
  transform: scale(0.7);
}