/* Static Launch Parameters — Hub Overlay / DataGrid / Fields, read-only. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  font-family: var(--rh-font);
  font-size: var(--rh-font-size);
  color: var(--rh-text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body {
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}

/* Overlay.svelte .container — fill iframe host */
.overlay {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: var(--rh-overlay-bg);
  box-shadow: var(--rh-overlay-shadow);
  overflow: hidden;
  user-select: none;
  pointer-events: none;
  color: var(--rh-text);
}

/* Overlay slot=header */
.overlay-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--rh-header-h);
  padding: 10px;
  background-color: var(--rh-overlay-header-bg);
  line-height: 20px;
}

/* Overlay.svelte .x-button — 10×10 hit/layout box; Material glyph paints at 24px */
.x-button {
  position: absolute;
  right: 20px;
  top: 7px;
  width: 10px;
  height: 10px;
  color: var(--rh-close);
  font-weight: bold;
  user-select: none;
  overflow: visible;
}

/* Overlay slot=body — top/bottom from doLayout() */
.overlay-body {
  position: absolute;
  top: var(--rh-header-h);
  bottom: var(--rh-footer-h);
  left: 0;
  width: 100%;
  padding: 6px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* RendererConfigOverlay .header */
.body-toolbar {
  flex: 0 0 auto;
  padding: 4px;
  display: flex;
  align-items: flex-end;
  flex-direction: column;
}

.add-btn {
  font-size: 18px;
  color: var(--rh-icon);
  line-height: 1;
}

/* DataGrid .grid-container fills remaining body */
.grid {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  position: relative;
}

/* DataGrid .body-wrapper — THIS plate is what makes cell lines readable */
.body-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
  background-color: var(--rh-grid-bg);
}

.body-grid {
  position: relative;
  width: 100%;
  height: 100%;
}

/* DataGrid .dgrow — absolute stacked rows */
.dgrow {
  position: absolute;
  left: 0;
  width: 100%;
  height: var(--rh-row-h);
  overflow: hidden;
}

.dgrow:nth-child(1) { top: 0; }
.dgrow:nth-child(2) { top: 30px; }
.dgrow:nth-child(3) { top: 60px; }
.dgrow:nth-child(4) { top: 90px; }
.dgrow:nth-child(5) { top: 120px; }
.dgrow:nth-child(6) { top: 150px; }
.dgrow:nth-child(7) { top: 180px; }

/* DataGrid .cell.with-border */
.cell {
  height: 100%;
  float: left;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  display: block;
  text-align: center;
  box-sizing: border-box;
  padding: 0 10px;
  border-right: 1px solid var(--rh-cell-border);
  border-bottom: 1px solid var(--rh-cell-border);
  line-height: var(--rh-row-h);
}

.cell-name {
  width: var(--rh-col-name);
}

.cell-value {
  /* remaining width after 200px name col */
  width: calc(100% - var(--rh-col-name));
}

/* DataGrid .cell-default — extra 10px pad (total 20px from cell edge) */
.cell-default {
  padding: 0 10px;
  height: var(--rh-row-h);
  line-height: var(--rh-row-h);
  text-align: left;
  color: var(--rh-text);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* SettingValueCR .value-container */
.value-container {
  width: 100%;
  height: 100%;
  position: relative;
  padding: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--rh-font);
}

/* BooleanField .cb */
.cb {
  display: flex;
  align-items: center;
  font-size: 14px;
  height: 30px;
  width: fit-content;
  margin: 2px -2px 0 0;
  outline: none;
  user-select: none;
  position: relative;
}

.cb .frame {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 2px;
  background: var(--rh-check-frame-bg);
  border: 1px solid var(--rh-check-frame-border);
}

.cb .check {
  display: inline-block;
  left: -12px;
  top: -2px;
  position: relative;
  width: 8px;
  height: 5px;
  background: transparent;
  border: 2px solid var(--rh-check-mark);
  border-top: none;
  border-right: none;
  transform: rotate(-45deg);
  pointer-events: none;
  opacity: 0;
}

.cb.checked .check {
  opacity: 1;
}

/* NumberField .input-container — idle gradient resolves to #191919 */
.number-field {
  --progress-color: #3e3e3e;
  --percentage: 0%;
  --border-color: #4c4c4c;
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  flex-direction: row;
  justify-content: flex-end;
  align-items: center;
  height: 22px;
  width: 100%;
  max-width: 100px;
  background: linear-gradient(90deg, var(--progress-color) var(--percentage), var(--rh-number-bg) 0%);
  font-family: var(--rh-font-mono-digits);
  font-size: 14px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  padding: 0 4px;
  box-sizing: border-box;
  overflow: hidden;
}

.number-field .digits {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  width: calc(100% - 12px);
  position: absolute;
  height: 100%;
  right: 4px;
  overflow: hidden;
}

.number-field .digit {
  color: var(--rh-number-digit);
  display: inline-block;
}

/* TextField .text-input idle (not focused) — must set text-align; .cell inherits center */
.string-field {
  width: 100%;
  display: block;
  height: 25px;
  background-color: var(--rh-string-bg);
  color: var(--rh-string-text);
  border: none;
  padding: 4px 20px 4px 4px;
  border-radius: 2px;
  outline: none;
  font-family: var(--rh-font);
  font-size: 14px;
  line-height: 1.1;
  text-align: left;
  overflow: hidden;
  white-space: nowrap;
  box-sizing: border-box;
}

/*
 * Overlay .buttons — Hub sets style height:50 (no unit → ignored),
 * so footer is padding + buttons ≈ 68px and overlaps body by ~18px.
 */
.overlay-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 10px;
  text-align: center;
}

/* Materialize .btn + Overlay button styles */
.overlay-footer .btn {
  display: inline-block;
  margin: 6px;
  padding: 0 16px;
  height: 36px;
  line-height: 36px;
  background-color: var(--rh-btn);
  color: var(--rh-btn-text);
  border: none;
  border-radius: 2px;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-family: var(--rh-font-btn);
  vertical-align: middle;
  box-shadow: var(--rh-btn-shadow);
}

/* Overlay .resize-handle */
.resize-handle {
  width: 14px;
  overflow: hidden;
  transform: rotate(222deg) translate(-3px, -4px);
  margin-right: 10px;
  position: absolute;
  right: -10px;
  bottom: 2px;
  color: var(--rh-resize);
  opacity: 0.45;
  font-size: 24px;
  line-height: 1;
  user-select: none;
}
