/* ==========================================================================
   FOLIO — forms feature styles
   Dense, quiet panel for detected fields, plus page outlines.
   ========================================================================== */

.ff-panel { padding-top: 6px; }

/* ---------- empty / loading states ---------- */
.ff-empty {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center; padding: 30px 12px 18px; color: var(--muted);
}
.ff-empty p { margin: 0; font-size: 12px; line-height: 1.5; }
.ff-empty p.small { font-size: 11px; }
.ff-empty-ic {
  width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(124, 147, 255, .2);
  margin-bottom: 2px;
}
.ff-empty .btn { margin-top: 6px; }
.ff-empty-fields { padding-top: 24px; }

/* ---------- header ---------- */
.ff-head { display: flex; flex-direction: column; gap: 7px; padding: 2px 4px 8px; }
.ff-toolbar { position: relative; display: flex; align-items: center; }
.ff-search-icon {
  position: absolute; left: 9px; color: var(--faint);
  display: flex; pointer-events: none;
}
.ff-search-input {
  height: 28px; padding-left: 28px; font-size: 11.5px; border-radius: 6px;
}
.ff-search-input::-webkit-search-cancel-button { filter: grayscale(1); opacity: .6; }

.ff-toggle {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  font-size: 10.5px; color: var(--muted); cursor: pointer; user-select: none;
}
.ff-toggle input { accent-color: var(--accent); margin: 0; }

.ff-summary {
  font-size: 9.5px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--faint); font-weight: 600;
}

.ff-actions { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.ff-actions .mini-btn { display: inline-flex; align-items: center; gap: 4px; }
.ff-actions .spacer { flex: 1; }
.ff-apply { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 11px; font-size: 11.5px; }
.ff-apply.has-changes { box-shadow: 0 0 0 3px rgba(124, 147, 255, .16); }

/* ---------- field list ---------- */
.ff-list { display: flex; flex-direction: column; gap: 2px; }
.ff-group { margin-bottom: 6px; }
.ff-group-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 9px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--faint); font-weight: 700; padding: 8px 6px 5px;
  border-bottom: 1px solid var(--line); margin-bottom: 5px;
}
.ff-group-count {
  font-family: var(--mono); font-size: 9px; letter-spacing: 0;
  padding: 0 5px; border-radius: 4px; background: rgba(255, 255, 255, .06);
}

.ff-row {
  padding: 6px 7px 8px; border-radius: 7px; border: 1px solid transparent;
  transition: background .12s, border-color .12s;
  position: relative;
}
.ff-row:hover { background: rgba(255, 255, 255, .03); }
.ff-row.sel { background: var(--accent-soft); border-color: rgba(124, 147, 255, .28); }
.ff-row.dirty::after {
  content: ''; position: absolute; right: 5px; top: 5px;
  width: 4px; height: 4px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 5px var(--accent-glow);
}
.ff-row.flash { animation: ffFlash 1.1s ease; }
@keyframes ffFlash {
  0% { background: rgba(124, 147, 255, .3); }
  100% { background: transparent; }
}

.ff-row-head { display: flex; align-items: center; gap: 6px; min-height: 20px; }
.ff-row-head .spacer { flex: 1; }
.ff-badge {
  flex: none; padding: 1px 5px; border-radius: 4px; font-size: 8.5px;
  letter-spacing: .06em; text-transform: uppercase; font-weight: 700;
  background: rgba(255, 255, 255, .06); color: var(--muted);
  border: 1px solid var(--line);
}
.ff-badge-text { color: var(--accent); background: var(--accent-soft); border-color: rgba(124, 147, 255, .25); }
.ff-badge-checkbox { color: var(--ok); background: rgba(75, 214, 162, .08); border-color: rgba(75, 214, 162, .25); }
.ff-badge-dropdown { color: var(--warn); background: rgba(240, 180, 94, .08); border-color: rgba(240, 180, 94, .25); }
.ff-badge-list { color: var(--warn); background: rgba(240, 180, 94, .08); border-color: rgba(240, 180, 94, .25); }
.ff-badge-radio { color: var(--accent-2); background: rgba(167, 139, 250, .1); border-color: rgba(167, 139, 250, .25); }
.ff-badge-signature, .ff-badge-button { color: var(--faint); }

.ff-name {
  flex: 0 1 auto; min-width: 0; max-width: 100%;
  border: 0; background: none; padding: 0; text-align: left;
  font-size: 11.5px; font-weight: 600; color: var(--text-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ff-name:hover { color: var(--accent); }
.ff-req { color: var(--err); font-size: 12px; font-weight: 700; line-height: 1; }
.ff-flags { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.ff-flags .tag { font-size: 8.5px; padding: 1px 4px; }
.ff-prop-btn { width: 20px; height: 20px; }
.ff-row-body { margin-top: 6px; }
.ff-input { height: 29px; font-size: 11.5px; border-radius: 5px; }
textarea.ff-input { min-height: 52px; height: auto; padding: 6px 8px; }

.ff-check { display: inline-flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); cursor: pointer; }
.ff-check input { accent-color: var(--accent); margin: 0; }

.ff-note { font-size: 10px; color: var(--faint); line-height: 1.45; margin-top: 4px; }
.ff-none { padding: 22px 10px; text-align: center; font-size: 11px; color: var(--faint); }

/* ---------- footer ---------- */
.ff-foot { padding: 4px 2px 10px; }
.ff-foot-actions { display: flex; gap: 5px; flex-wrap: wrap; }
.ff-foot-actions .mini-btn { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- create buttons ---------- */
.ff-create-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin: 2px 0 4px;
}
.ff-create-btn {
  display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px;
  border-radius: 6px; border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, .015); color: var(--text-soft);
  font-size: 10.5px; font-weight: 600; text-align: left;
}
.ff-create-btn:hover { border-color: rgba(124, 147, 255, .5); background: var(--accent-soft); color: var(--accent); }
.ff-create-btn svg { color: var(--muted); flex: none; }
.ff-create-btn:hover svg { color: var(--accent); }
.ff-empty .ff-create-grid { width: 100%; margin-top: 8px; }
.ff-create-grid.compact { grid-template-columns: 1fr 1fr; }

/* ---------- page overlays ---------- */
.ff-outline {
  position: absolute; pointer-events: auto; cursor: pointer;
  border: 1px solid rgba(124, 147, 255, .0);
  box-shadow: inset 0 0 0 1px rgba(124, 147, 255, .55);
  background: rgba(124, 147, 255, .045);
  border-radius: 1px;
  transition: background .12s, box-shadow .12s;
  z-index: 2;
}
.ff-outline:hover { background: rgba(124, 147, 255, .16); box-shadow: inset 0 0 0 1.5px var(--accent); }
.ff-outline.sel { box-shadow: inset 0 0 0 2px var(--accent); background: rgba(124, 147, 255, .12); }
.ff-outline.flash { animation: ffOutlineFlash 1.3s ease; }
@keyframes ffOutlineFlash {
  0% { background: rgba(124, 147, 255, .45); box-shadow: inset 0 0 0 2px var(--accent); }
  100% { background: rgba(124, 147, 255, .045); }
}
.ff-outline-label {
  position: absolute; left: -1px; bottom: calc(100% + 2px);
  padding: 1px 4px; border-radius: 3px;
  font-family: var(--mono); font-size: 8.5px; line-height: 1.4;
  color: #fff; background: rgba(70, 86, 160, .94);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none; opacity: 0; transition: opacity .1s;
}
.ff-outline:hover .ff-outline-label,
.ff-outline.sel .ff-outline-label { opacity: 1; }
.ff-outline-label:empty { display: none; }

/* ---------- drag draft ---------- */
.draft-box.ff-draft {
  border-color: var(--accent);
  background: rgba(124, 147, 255, .12);
}
.draft-box.ff-draft .ff-draft-label {
  top: -21px;
}
.ff-draft-label {
  position: absolute; padding: 2px 6px; border-radius: 4px;
  background: rgba(20, 24, 33, .94); border: 1px solid rgba(124, 147, 255, .4);
  font-family: var(--mono); font-size: 9px; color: var(--text);
  pointer-events: none; white-space: nowrap; z-index: 3;
}

/* ---------- inspector ---------- */
.ff-insp .panel-note { margin-top: 0; }
.ff-insp-body .field { margin-bottom: 9px; }
.ff-insp-body .check-row { margin: 5px 0; }
.ff-insp-body .field .input { height: 30px; font-size: 11.5px; }
.ff-insp-body .color-row .input { height: 30px; }

/* ---------- field-properties danger zone ---------- */
.ff-prop-danger {
  grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px; border-radius: 7px; margin-top: 2px;
  background: rgba(255, 111, 111, .05); border: 1px solid rgba(255, 111, 111, .18);
}
.ff-prop-danger .btn { flex: none; display: inline-flex; align-items: center; gap: 5px; }

/* ---------- light theme touches ---------- */
:root[data-theme="light"] .ff-create-btn { background: rgba(15, 23, 42, .015); }
:root[data-theme="light"] .ff-outline-label { background: rgba(52, 66, 130, .92); }
:root[data-theme="light"] .ff-row:hover { background: rgba(15, 23, 42, .035); }
:root[data-theme="light"] .ff-group-count { background: rgba(15, 23, 42, .06); }
:root[data-theme="light"] .ff-badge { background: rgba(15, 23, 42, .05); }
:root[data-theme="light"] .ff-draft-label { background: #1a1f2a; color: #eef1f7; }
