/* Form page layout and manual-form density helpers (split from form-controls.css). */

.form-page-shell {
  max-width: 44rem;
  margin-inline: auto;
}

.form-page-intro {
  max-width: 28rem;
  margin: 0 auto 1.25rem;
  text-align: center;
}

.form-page-card {
  max-width: 36rem;
  margin-inline: auto;
}

.public-form-child-hero,
.public-form-child-shell {
  border-color: rgba(34, 193, 145, 0.34);
  background:
    linear-gradient(135deg, rgba(34, 193, 145, 0.13), rgba(56, 189, 248, 0.08)),
    rgba(15, 26, 34, 0.86);
}

.public-form-child-hero {
  display: grid;
  gap: 0.45rem;
}

.public-form-child-meta {
  border-color: rgba(56, 189, 248, 0.22);
}

.manual-form-textarea {
  min-height: 8rem;
}

.manual-form-textarea.manual-form-textarea-compact {
  min-height: 6.5rem;
}

.manual-form-textarea.manual-form-textarea-generated {
  min-height: 14rem;
  overflow-y: hidden;
}

.manual-form-field-shell {
  position: relative;
}

.manual-form-field-targeted {
  border-radius: 0.75rem;
  outline: 2px solid rgba(52, 211, 153, 0.9);
  outline-offset: 0.35rem;
  animation: manual-form-field-target 1.4s ease-out;
}

@keyframes manual-form-field-target {
  0%, 45% { background: rgba(52, 211, 153, 0.16); }
  100% { background: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .manual-form-field-targeted { animation: none; }
}

.manual-form-field-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  border-radius: 1rem;
  background: rgba(9, 20, 31, 0.58);
  backdrop-filter: blur(2px);
  color: rgb(226 232 240);
  pointer-events: all;
}

.manual-form-field-loading-spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(148, 163, 184, 0.35);
  border-top-color: rgb(45 212 191);
  border-radius: 9999px;
  animation: manual-form-spin 0.8s linear infinite;
  flex-shrink: 0;
}

.manual-form-field-loading-copy {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
}

.manual-form-section-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.manual-form-section-action {
  flex-shrink: 0;
}

.manual-form-dense .field-label {
  margin-bottom: 0.2rem;
  font-size: 0.82rem;
}

.manual-form-dense .ui-field-input:not(.ui-field-textarea),
.manual-form-dense .ui-field-trigger.ui-field-trigger-lg {
  min-height: 2.9rem;
  padding: 0.62rem 0.78rem;
  font-size: 0.92rem;
}

.manual-form-dense .ui-field-tag {
  padding: 0.26rem 0.52rem;
  font-size: 0.78rem;
}

.manual-form-dense .manual-form-textarea {
  min-height: 6.5rem;
}

.ui-checkbox-row { position: relative; display: flex; width: 100%; min-width: 0; gap: 0.75rem; color: #dce7ee; }

.ui-checkbox-row:not(.is-disabled) { cursor: pointer; }

.ui-checkbox-row.is-disabled { opacity: 0.6; cursor: not-allowed; }

.ui-checkbox-row-inline { align-items: center; justify-content: space-between; min-height: 2rem; }

.ui-checkbox-row-field {
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.82rem 0.95rem;
  border: 1px solid rgba(83, 140, 161, 0.38);
  border-radius: 1rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)),
    rgba(15, 26, 34, 0.76);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.03),
    var(--diego-field-shadow);
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background-color 150ms ease,
    color 150ms ease;
}

.ui-checkbox-row-field:hover {
  border-color: rgba(122, 224, 190, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0)),
    rgba(22, 41, 53, 0.88);
}

.ui-checkbox-row-field.is-checked {
  border-color: rgba(122, 224, 190, 0.54);
  background:
    linear-gradient(180deg, rgba(34, 193, 145, 0.14), rgba(255, 255, 255, 0)),
    rgba(18, 34, 46, 0.92);
}

.ui-checkbox-row-field:focus-within {
  outline: none;
  border-color: var(--diego-field-border-strong);
  box-shadow:
    0 0 0 3px var(--diego-field-ring),
    var(--diego-field-shadow);
}

.ui-checkbox-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.ui-checkbox-copy { min-width: 0; flex: 1 1 auto; overflow-wrap: anywhere; }

.ui-checkbox-copy-inline { font-size: 0.875rem; color: #d1d5db; transition: color 150ms ease; }

.group:hover .ui-checkbox-copy-inline { color: #fff; }

.ui-checkbox-row-field .ui-checkbox-copy { font-size: 0.95rem; line-height: 1.5; }

.ui-checkbox-control {
  flex: 0 0 auto;
  border: 1px solid rgba(83, 140, 161, 0.5);
  border-radius: 0.72rem;
  background: rgba(15, 26, 34, 0.9);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.ui-checkbox-row-field .ui-checkbox-control { margin-top: 0.08rem; }

.ui-checkbox-row.is-checked .ui-checkbox-control {
  border-color: rgba(122, 224, 190, 0.82);
  background: linear-gradient(180deg, rgba(34, 193, 145, 0.98), rgba(16, 168, 123, 0.98));
  box-shadow:
    0 10px 24px rgba(16, 168, 123, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.ui-checkbox-row:not(.is-checked):not(.is-disabled):hover .ui-checkbox-control { border-color: rgba(122, 224, 190, 0.4); background: rgba(22, 41, 53, 0.95); }

@keyframes manual-form-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.manual-form-grid-dense {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(auto-fit, minmax(16.8rem, 1fr));
}

@media (min-width: 768px) {
  .manual-form-field-wide {
    grid-column: span 2 / span 2;
  }

  .manual-form-field-narrow {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(6.75rem, 8.75rem);
    align-items: center;
    column-gap: 0.6rem;
    row-gap: 0.18rem;
    max-width: 20rem;
    justify-self: start;
  }

  .manual-form-dense .manual-form-field-narrow > .field-label {
    margin-bottom: 0;
    line-height: 1.18;
  }

  .manual-form-dense .manual-form-field-narrow > .ui-field-input {
    min-height: 2.55rem;
    text-align: end;
  }

  .manual-form-dense .manual-form-field-narrow > .text-xs.text-muted {
    grid-column: 1 / -1;
    margin-top: 0;
  }

}

@media (max-width: 767px) {
  .manual-form-grid-dense {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }

  .form-page-shell {
    padding: 1.1rem;
  }

  .form-page-intro {
    text-align: start;
  }

  .form-page-card {
    max-width: 100%;
  }

  .manual-form-section-header {
    align-items: stretch;
  }

  .ui-checkbox-row-field {
    padding: 0.78rem 0.85rem;
  }
}
