/* Container do editor */
.ctx-json-editor {
  background: #f5f7fb;
  border: 1px solid #e6eaf2;
  border-radius: 14px;
  padding: 14px;

  /* sombra do bloco inteiro */
  box-shadow:
    0 10px 30px rgba(18, 38, 63, 0.08),
    0 2px 8px rgba(18, 38, 63, 0.06);
}

/* Card de cada item */
.ctx-json-row {
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  border: 1px solid #e8ecf5;
  border-radius: 14px;
  padding: 12px 12px;
  margin-bottom: 12px;

  /* sombra mais “visível” */
  box-shadow:
    0 10px 24px rgba(18, 38, 63, 0.10),
    0 2px 6px rgba(18, 38, 63, 0.06);

  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

/* Hover subtil para ajudar a distinguir linhas */
.ctx-json-row:hover {
  border-color: #dfe6f4;
  box-shadow:
    0 14px 32px rgba(18, 38, 63, 0.14),
    0 4px 10px rgba(18, 38, 63, 0.08);
  transform: translateY(-1px);
}

/* “Objecto” vs “string” vs “list”
   - além da cor, adiciona um ligeiro glow à esquerda */
.ctx-json-row.is-object {
  border-left: 6px solid #5e72e4;
  box-shadow:
    inset 0 0 0 1px rgba(94, 114, 228, 0.08),
    0 10px 24px rgba(18, 38, 63, 0.10),
    0 2px 6px rgba(18, 38, 63, 0.06);
}

.ctx-json-row.is-string {
  border-left: 6px solid #2dce89;
  box-shadow:
    inset 0 0 0 1px rgba(45, 206, 137, 0.08),
    0 10px 24px rgba(18, 38, 63, 0.10),
    0 2px 6px rgba(18, 38, 63, 0.06);
}

.ctx-json-row.is-list {
  border-left: 6px solid #fb6340;
  box-shadow:
    inset 0 0 0 1px rgba(251, 99, 64, 0.08),
    0 10px 24px rgba(18, 38, 63, 0.10),
    0 2px 6px rgba(18, 38, 63, 0.06);
}

/* Título/chave */
.ctx-json-key {
  font-weight: 800;
  color: #1f2d3d;
  letter-spacing: 0.2px;
}

/* (opcional) mostrar a “type pill”/metas com contraste */
.ctx-json-meta {
  font-size: 12px;
  color: #6b7a90;
  background: #f1f4fb;
  border: 1px solid #e5eaf5;
  border-radius: 999px;
  padding: 3px 8px;
}

/* Inputs dentro do editor ficam mais “premium” */
.ctx-json-row textarea,
.ctx-json-row input,
.ctx-json-row select {
  border-radius: 12px;
  border: 1px solid #e3e8f3;
  box-shadow: 0 2px 6px rgba(18, 38, 63, 0.04);
}

.ctx-json-row textarea:focus,
.ctx-json-row input:focus,
.ctx-json-row select:focus {
  outline: none;
  border-color: rgba(94, 114, 228, 0.45);
  box-shadow:
    0 0 0 4px rgba(94, 114, 228, 0.12),
    0 6px 14px rgba(18, 38, 63, 0.08);
}

/* Botões Add/Remove mais “visíveis” */
.ctx-json-row .btn {
  border-radius: 10px;
  box-shadow: 0 6px 14px rgba(18, 38, 63, 0.10);
}

.ctx-json-row .btn:hover {
  box-shadow: 0 10px 20px rgba(18, 38, 63, 0.14);
}


/* Dar um fundo ao painel do grupo para os cards “saltarem” */
.ctx-group-pane.show.active {
  background: #f5f7fb;
  border: 1px solid #e6eaf2;
  border-radius: 16px;
  padding: 12px;
}

/* Cards do contexto com mais contraste */
.ctx-group-pane.show.active .card.mb-2 {
  background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%) !important;
  border: 1px solid #e6eaf2 !important;
  border-radius: 16px !important;
  box-shadow:
    0 10px 24px rgba(18, 38, 63, 0.10),
    0 2px 6px rgba(18, 38, 63, 0.06);
}

/* Alternância subtil para distinguir cards consecutivos */
.ctx-group-pane.show.active > [id^="ctx-item-"]:nth-of-type(even) .card.mb-2 {
  background: linear-gradient(180deg, #ffffff 0%, #f2f6ff 100%) !important;
}

/* Cabeçalho do card (a zona do título + badges) com “barra” leve */
.ctx-group-pane.show.active .card.mb-2 .card-body > .d-flex.justify-content-between:first-child {
  background: #f2f5ff;
  border: 1px solid #e5ebff;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

/* Fundo do conteúdo para os cards “saltarem” */
.ctx-group-pane.show.active {
  background: #f5f7fb !important;
  border: 1px solid #e6eaf2 !important;
  border-radius: 16px !important;
  padding: 12px !important;
}

/* Cards principais do contexto */
.ctx-group-pane.show.active .card.mb-2 {
  background: linear-gradient(180deg, #ffffff 0%, #f7f9ff 100%) !important;
  border: 1px solid #e3e8f3 !important;
  border-radius: 16px !important;
  box-shadow: 0 10px 24px rgba(18,38,63,.10), 0 2px 6px rgba(18,38,63,.06) !important;
  overflow: hidden;
}

/* Alternar ligeiramente para distinguir cards */
.ctx-group-pane.show.active > [id^="ctx-item-"]:nth-of-type(even) .card.mb-2 {
  background: linear-gradient(180deg, #ffffff 0%, #eef3ff 100%) !important;
}

/* Barra/cabeçalho interno (onde estão título + badges) */
.ctx-group-pane.show.active .card.mb-2 .card-body > .d-flex.justify-content-between:first-child {
  background: #eef3ff !important;
  border: 1px solid #e0e8ff !important;
  border-radius: 12px !important;
  padding: 10px 12px !important;
  margin-bottom: 12px !important;
}

/* Editor JSON/linhas geradas pelo JS (border rounded p-2 mb-2) */
.ctx-group-pane.show.active .border.rounded.p-2.mb-2 {
  background: #ffffff !important;
  border: 1px solid #dfe6f4 !important;
  border-radius: 14px !important;
  box-shadow: 0 8px 18px rgba(18,38,63,.08), 0 2px 6px rgba(18,38,63,.05) !important;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.ctx-group-pane.show.active .border.rounded.p-2.mb-2:hover {
  border-color: #cfd9f2 !important;
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(18,38,63,.12), 0 4px 10px rgba(18,38,63,.08) !important;
}


/* Container do editor */
.ctx-json-editor {
  background: #f5f7fb;
  border: 1px solid #e6eaf2;
  border-radius: 14px;
  padding: 14px;

  /* sombra do bloco inteiro */
  box-shadow:
    0 10px 30px rgba(18, 38, 63, 0.08),
    0 2px 8px rgba(18, 38, 63, 0.06);
}

/* Card de cada item */
.ctx-json-row {
  background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
  border: 1px solid #e8ecf5;
  border-radius: 14px;
  padding: 12px 12px;
  margin-bottom: 12px;

  /* sombra mais “visível” */
  box-shadow:
    0 10px 24px rgba(18, 38, 63, 0.10),
    0 2px 6px rgba(18, 38, 63, 0.06);

  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

/* Hover subtil para ajudar a distinguir linhas */
.ctx-json-row:hover {
  border-color: #dfe6f4;
  box-shadow:
    0 14px 32px rgba(18, 38, 63, 0.14),
    0 4px 10px rgba(18, 38, 63, 0.08);
  transform: translateY(-1px);
}

/* “Objecto” vs “string” vs “list”
   - além da cor, adiciona um ligeiro glow à esquerda */
.ctx-json-row.is-object {
  border-left: 6px solid #5e72e4;
  box-shadow:
    inset 0 0 0 1px rgba(94, 114, 228, 0.08),
    0 10px 24px rgba(18, 38, 63, 0.10),
    0 2px 6px rgba(18, 38, 63, 0.06);
}

.ctx-json-row.is-string {
  border-left: 6px solid #2dce89;
  box-shadow:
    inset 0 0 0 1px rgba(45, 206, 137, 0.08),
    0 10px 24px rgba(18, 38, 63, 0.10),
    0 2px 6px rgba(18, 38, 63, 0.06);
}

.ctx-json-row.is-list {
  border-left: 6px solid #fb6340;
  box-shadow:
    inset 0 0 0 1px rgba(251, 99, 64, 0.08),
    0 10px 24px rgba(18, 38, 63, 0.10),
    0 2px 6px rgba(18, 38, 63, 0.06);
}

/* Título/chave */
.ctx-json-key {
  font-weight: 800;
  color: #1f2d3d;
  letter-spacing: 0.2px;
}

/* (opcional) mostrar a “type pill”/metas com contraste */
.ctx-json-meta {
  font-size: 12px;
  color: #6b7a90;
  background: #f1f4fb;
  border: 1px solid #e5eaf5;
  border-radius: 999px;
  padding: 3px 8px;
}

/* Inputs dentro do editor ficam mais “premium” */
.ctx-json-row textarea,
.ctx-json-row input,
.ctx-json-row select {
  border-radius: 12px;
  border: 1px solid #e3e8f3;
  box-shadow: 0 2px 6px rgba(18, 38, 63, 0.04);
}

.ctx-json-row textarea:focus,
.ctx-json-row input:focus,
.ctx-json-row select:focus {
  outline: none;
  border-color: rgba(94, 114, 228, 0.45);
  box-shadow:
    0 0 0 4px rgba(94, 114, 228, 0.12),
    0 6px 14px rgba(18, 38, 63, 0.08);
}

/* Botões Add/Remove mais “visíveis” */
.ctx-json-row .btn {
  border-radius: 10px;
  box-shadow: 0 6px 14px rgba(18, 38, 63, 0.10);
}

.ctx-json-row .btn:hover {
  box-shadow: 0 10px 20px rgba(18, 38, 63, 0.14);
}


/* Dar um fundo ao painel do grupo para os cards “saltarem” */
.ctx-group-pane.show.active {
  background: #f5f7fb;
  border: 1px solid #e6eaf2;
  border-radius: 16px;
  padding: 12px;
}

/* Cards do contexto com mais contraste */
.ctx-group-pane.show.active .card.mb-2 {
  background: linear-gradient(180deg, #ffffff 0%, #f8faff 100%) !important;
  border: 1px solid #e6eaf2 !important;
  border-radius: 16px !important;
  box-shadow:
    0 10px 24px rgba(18, 38, 63, 0.10),
    0 2px 6px rgba(18, 38, 63, 0.06);
}

/* Alternância subtil para distinguir cards consecutivos */
.ctx-group-pane.show.active > [id^="ctx-item-"]:nth-of-type(even) .card.mb-2 {
  background: linear-gradient(180deg, #ffffff 0%, #f2f6ff 100%) !important;
}

/* Cabeçalho do card (a zona do título + badges) com “barra” leve */
.ctx-group-pane.show.active .card.mb-2 .card-body > .d-flex.justify-content-between:first-child {
  background: #f2f5ff;
  border: 1px solid #e5ebff;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

/* Fundo do conteúdo para os cards “saltarem” */
.ctx-group-pane.show.active {
  background: #f5f7fb !important;
  border: 1px solid #e6eaf2 !important;
  border-radius: 16px !important;
  padding: 12px !important;
}

/* Cards principais do contexto */
.ctx-group-pane.show.active .card.mb-2 {
  background: linear-gradient(180deg, #ffffff 0%, #f7f9ff 100%) !important;
  border: 1px solid #e3e8f3 !important;
  border-radius: 16px !important;
  box-shadow: 0 10px 24px rgba(18,38,63,.10), 0 2px 6px rgba(18,38,63,.06) !important;
  overflow: hidden;
}

/* Alternar ligeiramente para distinguir cards */
.ctx-group-pane.show.active > [id^="ctx-item-"]:nth-of-type(even) .card.mb-2 {
  background: linear-gradient(180deg, #ffffff 0%, #eef3ff 100%) !important;
}

/* Barra/cabeçalho interno (onde estão título + badges) */
.ctx-group-pane.show.active .card.mb-2 .card-body > .d-flex.justify-content-between:first-child {
  background: #eef3ff !important;
  border: 1px solid #e0e8ff !important;
  border-radius: 12px !important;
  padding: 10px 12px !important;
  margin-bottom: 12px !important;
}

/* Editor JSON/linhas geradas pelo JS (border rounded p-2 mb-2) */
.ctx-group-pane.show.active .border.rounded.p-2.mb-2 {
  background: #ffffff !important;
  border: 1px solid #dfe6f4 !important;
  border-radius: 14px !important;
  box-shadow: 0 8px 18px rgba(18,38,63,.08), 0 2px 6px rgba(18,38,63,.05) !important;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.ctx-group-pane.show.active .border.rounded.p-2.mb-2:hover {
  border-color: #cfd9f2 !important;
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(18,38,63,.12), 0 4px 10px rgba(18,38,63,.08) !important;
}


.ctx-group-pane.show.active textarea.form-control {
  line-height: 1.45;
  font-size: 13px;
  background: #fff !important;
}

.ctx-group-pane.show.active textarea.form-control::placeholder {
  color: #90a0b7;
}


.ctx-group-pane.show.active .badge.badge-light.border {
  background: #ffffff !important;
  border-color: #dfe6f4 !important;
  color: #516075;
}

.ctx-group-pane.show.active .badge.badge-success,
.ctx-group-pane.show.active .badge.badge-info {
  box-shadow: 0 6px 14px rgba(18,38,63,.10);
}


.ctx-group-pane.show.active .btn.btn-primary.btn-sm {
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(18,38,63,.12);
}

.ctx-group-pane.show.active .btn.btn-outline-secondary,
.ctx-group-pane.show.active .btn.btn-outline-primary,
.ctx-group-pane.show.active .btn.btn-outline-danger {
  border-radius: 10px;
}

.ctx-group-pane.show.active .btn:active {
  transform: translateY(0.5px);
}

/* =========================
   JSON editor: hierarquia (sem mexer no JS)
   ========================= */

/* O container do editor visual (onde estão lista/objeto/itens) */
.ctx-group-pane.show.active [data-json-editor] {
  background: #f6f8ff !important;
  border: 1px solid #e3e8f3 !important;
  border-radius: 14px !important;
  padding: 10px !important;
  position: relative;
}

/* Um “rail” vertical para ajudar o olho a seguir a estrutura */
.ctx-group-pane.show.active [data-json-editor]::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 12px;
  bottom: 12px;
  width: 2px;
  background: rgba(94,114,228,.15);
  border-radius: 999px;
}

/* Base: todos os blocos internos do editor (itens/chaves/objetos) */
.ctx-group-pane.show.active [data-json-editor] .border.rounded.p-2 {
  border: 1px solid #dfe6f4 !important;
  border-radius: 14px !important;
  background: #ffffff !important;
}

/* Nível 1: “cards” principais dentro do editor (Item 1/2/3, etc.) */
.ctx-group-pane.show.active [data-json-editor] > div > .border.rounded.p-2.mb-2 {
  margin-left: 10px !important;
  padding-left: 14px !important;
  position: relative;
}

/* Marcador do nível 1 */
.ctx-group-pane.show.active [data-json-editor] > div > .border.rounded.p-2.mb-2::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 18px;
  width: 10px;
  height: 10px;
  background: #5e72e4;
  border-radius: 999px;
  box-shadow: 0 6px 14px rgba(18,38,63,.12);
}

/* Nível 2: blocos dentro do item (objeto e chaves) */
.ctx-group-pane.show.active [data-json-editor] .border.rounded.p-2.mb-2 .border.rounded.p-2.mb-2 {
  margin-left: 18px !important;
  padding-left: 14px !important;
  background: #fbfcff !important;
  border-color: #d6def2 !important;
}

/* Nível 3: blocos dentro do nível 2 */
.ctx-group-pane.show.active [data-json-editor] .border.rounded.p-2.mb-2 .border.rounded.p-2.mb-2 .border.rounded.p-2.mb-2 {
  margin-left: 18px !important;
  padding-left: 14px !important;
  background: #f7f9ff !important;
  border-color: #ccd7f2 !important;
}

/* Botões e cabeçalhos do editor: dar “sticky feeling” visual */
.ctx-group-pane.show.active [data-json-editor] .text-muted.small {
  font-weight: 600;
  color: #62708a !important;
}

/* As badges das chaves (id, nome, morada...) mais visíveis */
.ctx-group-pane.show.active [data-json-editor] .badge.badge-light.border {
  background: #ffffff !important;
  border-color: #d6def2 !important;
  color: #3d4b63 !important;
  font-weight: 700;
}

/* Inputs dentro do editor: mais “caixa”, para separar do resto */
.ctx-group-pane.show.active [data-json-editor] textarea.form-control.form-control-sm,
.ctx-group-pane.show.active [data-json-editor] input.form-control.form-control-sm {
  background: #ffffff !important;
  border: 1px solid #dfe6f4 !important;
  border-radius: 12px !important;
}

/* Hover ajuda muito a perceber “onde está” */
.ctx-group-pane.show.active [data-json-editor] .border.rounded.p-2.mb-2:hover {
  border-color: #bfcdf2 !important;
  box-shadow: 0 12px 26px rgba(18,38,63,.10), 0 3px 8px rgba(18,38,63,.06) !important;
  transform: translateY(-1px);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}



/* ===========================
   JSON editor (Kira-Connect)
   =========================== */

:root{
  --je-bg: #f3f6fb;
  --je-surface: #ffffff;
  --je-border: rgba(15, 23, 42, .10);
  --je-muted: rgba(15, 23, 42, .62);
  --je-strong: rgba(15, 23, 42, .88);
  --je-shadow: 0 10px 24px rgba(15, 23, 42, .08);
  --je-radius: 14px;
}

.je-wrap{
  background: var(--je-bg);
  border: 1px solid var(--je-border);
  border-radius: var(--je-radius);
  padding: .85rem;
}

.je-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:.75rem;
  margin-bottom:.65rem;
}

.je-toolbar .je-hint{
  font-size:.82rem;
  color: var(--je-muted);
}

.je-search{
  max-width: 320px;
}

.je-card{
  background: var(--je-surface);
  border: 1px solid var(--je-border);
  border-radius: var(--je-radius);
  padding: .75rem;
  margin-bottom: .65rem;
  box-shadow: var(--je-shadow);
}

.je-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:.75rem;
  margin-bottom:.55rem;
}

.je-title{
  font-weight:800;
  color: var(--je-strong);
  line-height:1.15;
}

.je-sub{
  font-size:.80rem;
  color: var(--je-muted);
  margin-top:.15rem;
}

.je-mono{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.je-actions .btn{
  border-radius: 10px;
  font-weight: 700;
  padding: .28rem .55rem;
}

.je-divider{
  height:1px;
  background: rgba(15,23,42,.08);
  margin: .55rem 0 .65rem 0;
}

.je-collapse{
  background: rgba(15,23,42,.06);
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 999px;
  padding: .18rem .5rem;
  font-size:.78rem;
  color: rgba(15,23,42,.70);
}

.je-pill{
  display:inline-flex;
  align-items:center;
  gap:.35rem;
  border-radius: 999px;
  padding:.2rem .5rem;
  border:1px solid rgba(15,23,42,.12);
  background: rgba(255,255,255,.85);
  color: rgba(15,23,42,.75);
  font-size:.78rem;
  white-space: nowrap;
}

.je-muted{
  color: var(--je-muted);
}

.je-field textarea.form-control,
.je-field input.form-control{
  border-radius: 12px;
}

.je-empty{
  padding:.6rem .7rem;
  border-radius: 12px;
  border: 1px dashed rgba(15,23,42,.18);
  color: rgba(15,23,42,.65);
  background: rgba(255,255,255,.55);
  font-size: .9rem;
}
