/* ORAC Forms — full width + symmetric 2-column grids */

.admin-forms-page .admin-page-header {
  padding-left: var(--app-page-pad-x, 24px);
  padding-right: var(--app-page-pad-x, 24px);
  box-sizing: border-box;
}

.admin-forms-page__intro {
  margin: 8px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--theme-gray-500);
  max-width: 40rem;
}

.admin-forms-page .admin-form-builder-msg {
  margin-left: var(--app-page-pad-x, 24px);
  margin-right: var(--app-page-pad-x, 24px);
}

.admin-forms-page .admin-form-builder-panel {
  padding-top: 12px;
  padding-left: var(--app-page-pad-x, 24px);
  padding-right: var(--app-page-pad-x, 24px);
  max-width: none;
  width: 100%;
  box-sizing: border-box;
}

.admin-forms-content {
  width: 100%;
  max-width: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-sizing: border-box;
}

.admin-forms-panel {
  background: var(--surface-card);
  border: 1px solid var(--surface-card-border);
  border-radius: 18px;
  box-shadow: var(--surface-card-shadow);
  padding: 22px clamp(18px, 2.5vw, 40px) 28px;
  box-sizing: border-box;
  width: 100%;
}

.admin-forms-panel__title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--theme-gray-900);
  line-height: 1.25;
}

.admin-forms-panel__lead {
  margin: 0 0 20px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--theme-gray-600);
  max-width: none;
}

.admin-forms-panel__lead code {
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--code-bg);
  color: var(--theme-gray-700);
}

/* Create form — 2 equal columns */
.admin-forms-create-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 28px;
  align-items: start;
}

.admin-forms-create-grid .admin-form-builder-field {
  margin: 0;
  min-width: 0;
}

.admin-forms-create-grid .admin-form-builder-field--full {
  grid-column: 1 / -1;
}

/* Created: date | time on one row (full width of form) */
.admin-forms-datetime-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 28px;
  align-items: start;
}

.admin-forms-datetime-row__hint {
  grid-column: 1 / -1;
  margin: -4px 0 0;
}

@media (max-width: 720px) {
  .admin-forms-datetime-row {
    grid-template-columns: 1fr;
  }
}

.admin-forms-create-grid .admin-form-builder-field label {
  color: var(--theme-gray-600);
}

.admin-forms-create-grid .admin-form-builder-field input:not([type='checkbox']):not([type='radio']),
.admin-forms-create-grid .admin-form-builder-field select,
.admin-forms-create-grid .admin-form-builder-field textarea {
  border-color: var(--theme-gray-200);
  border-radius: 10px;
  background: var(--theme-white);
  width: 100%;
  box-sizing: border-box;
}

/* Section picker — nested card, checkbox tiles (avoids width:100% breaking checkboxes) */
.admin-forms-section-picker {
  margin-top: 2px;
  padding: 16px 18px 18px;
  border-radius: 12px;
  border: 1px solid var(--theme-gray-100);
  background: linear-gradient(180deg, var(--theme-gray-50, #fafafa) 0%, var(--theme-white) 48%);
  box-sizing: border-box;
}

.admin-forms-section-picker__head {
  margin-bottom: 12px;
}

.admin-forms-section-picker__title {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--theme-gray-600);
  margin: 0 0 6px;
}

.admin-forms-section-picker__subtitle {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--theme-gray-500);
}

.admin-forms-section-picker__subtitle code {
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--code-bg);
  color: var(--theme-gray-700);
}

.admin-forms-section-picker__empty {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--theme-gray-600);
}

.admin-forms-section-picker__scroll {
  max-height: min(38vh, 340px);
  overflow-y: auto;
  margin: 0 -4px;
  padding: 0 4px 2px;
  scrollbar-gutter: stable;
}

.admin-forms-section-picker__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 8px;
}

.admin-forms-section-picker__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--theme-gray-100);
  background: var(--theme-white);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.admin-forms-section-picker__item:hover {
  border-color: var(--theme-gray-200);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.admin-forms-section-picker__item--on {
  border-color: var(--theme-maroon-border, #c4a0a8);
  background: var(--theme-maroon-soft, rgba(139, 21, 56, 0.06));
  box-shadow: 0 0 0 1px var(--theme-maroon-soft, rgba(139, 21, 56, 0.12));
}

/* Beats `.admin-form-builder-field input { width:100% }` from AdminFormBuilderPage.css */
.admin-forms-section-picker input[type='checkbox'] {
  width: 1.125rem;
  height: 1.125rem;
  min-width: 1.125rem;
  margin: 2px 0 0;
  flex-shrink: 0;
  accent-color: var(--theme-maroon, #7a1530);
  cursor: pointer;
}

.admin-forms-section-picker__item:has(input[type='checkbox']:disabled) {
  opacity: 0.65;
  cursor: not-allowed;
}

.admin-forms-section-picker__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.admin-forms-section-picker__name {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--theme-gray-900);
  word-break: break-word;
}

.admin-forms-section-picker__id {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--theme-gray-500);
  font-variant-numeric: tabular-nums;
}

.admin-forms-section-picker__country-field {
  margin-bottom: 12px;
}

.admin-forms-location-dropdown-block {
  margin-top: 4px;
}

.admin-forms-location-dropdown-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 16px;
  align-items: end;
}

.admin-forms-location-dropdown-row .admin-form-builder-field {
  margin: 0;
  min-width: 0;
}

.admin-forms-location-dropdown-row__btn {
  white-space: nowrap;
  margin-bottom: 1px;
}

@media (max-width: 560px) {
  .admin-forms-location-dropdown-row {
    grid-template-columns: 1fr;
  }

  .admin-forms-location-dropdown-row__btn {
    width: 100%;
    justify-content: center;
  }
}

.admin-forms-selected-locations {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--theme-gray-100);
}

.admin-forms-selected-locations__label {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--theme-gray-500);
}

.admin-forms-selected-locations__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-forms-selected-locations__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--theme-gray-100);
  background: var(--theme-white);
  font-size: 14px;
}

.admin-forms-selected-locations__meta {
  color: var(--theme-gray-500);
  font-weight: 400;
}

/* Form details — linked locations */
.admin-forms-locations-block {
  margin-top: 20px;
}

.admin-forms-locations-block__lead {
  margin: 0 0 12px;
  max-width: none;
}

.admin-forms-locations-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  border: 1px solid var(--theme-gray-100);
  border-radius: 12px;
  overflow: hidden;
  background: var(--theme-white);
}

.admin-forms-locations-list__empty {
  margin: 0;
  padding: 14px 18px;
  font-size: 14px;
  color: var(--theme-gray-500);
}

.admin-forms-locations-list__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--theme-gray-100);
  font-size: 14px;
}

.admin-forms-locations-list__row:last-child {
  border-bottom: 0;
}

.admin-forms-locations-list__meta {
  color: var(--theme-gray-500);
  font-weight: 400;
}

.admin-forms-location-add {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-forms-add-section--location {
  margin-top: 0;
}

.admin-forms-create-grid .admin-form-builder-field textarea {
  min-height: 100px;
  resize: vertical;
}

.admin-forms-create-grid .admin-form-builder-hint {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--theme-gray-500);
}

.admin-forms-create-actions {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding-top: 20px;
  border-top: 1px solid var(--theme-gray-100);
  display: flex;
  justify-content: flex-start;
}

.admin-forms-create-actions .admin-action-button {
  min-width: 180px;
  padding: 10px 22px;
  font-size: 13px;
  border-radius: 10px;
}

@media (max-width: 720px) {
  .admin-forms-create-grid {
    grid-template-columns: 1fr;
  }
}

/* Edit panel — toolbar row: select | delete */
.admin-forms-toolbar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px 24px;
  align-items: end;
  margin-bottom: 4px;
}

.admin-forms-toolbar-row .admin-form-builder-field {
  margin: 0;
  min-width: 0;
}

.admin-forms-toolbar-row .admin-form-builder-field label {
  color: var(--theme-gray-600);
}

.admin-forms-toolbar-row select {
  border-color: var(--theme-gray-200);
  border-radius: 10px;
  background: var(--theme-white);
  width: 100%;
  box-sizing: border-box;
}

.admin-forms-toolbar-row__actions {
  display: flex;
  align-items: center;
  padding-bottom: 2px;
}

@media (max-width: 640px) {
  .admin-forms-toolbar-row {
    grid-template-columns: 1fr;
  }

  .admin-forms-toolbar-row__actions {
    justify-content: flex-start;
  }
}

/* Legacy toolbar (if used alone) */
.admin-forms-toolbar {
  margin-bottom: 4px;
}

.admin-forms-toolbar .admin-form-builder-field {
  margin: 0;
  max-width: 100%;
}

/* Metadata — 2×3 symmetric grid */
.admin-forms-meta--grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin-top: 16px;
  border: 1px solid var(--theme-gray-100);
  border-radius: 12px;
  overflow: hidden;
  background: var(--theme-gray-100);
}

.admin-forms-meta__cell {
  background: var(--theme-white);
  padding: 14px 18px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-forms-meta__cell .admin-forms-meta__label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--theme-gray-500);
}

.admin-forms-meta__cell .admin-forms-meta__value {
  font-size: 14px;
  font-weight: 500;
  color: var(--theme-gray-900);
  word-break: break-word;
  line-height: 1.4;
}

@media (max-width: 640px) {
  .admin-forms-meta--grid {
    grid-template-columns: 1fr;
  }
}

.admin-forms-toolbar-actions {
  margin-top: 14px;
  margin-bottom: 4px;
}

/* Add section — 2 columns: field | button */
.admin-forms-add-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px 20px;
  align-items: end;
  margin-top: 16px;
}

.admin-forms-add-section .admin-form-builder-field {
  margin: 0;
  min-width: 0;
}

.admin-forms-add-section .admin-form-builder-field label {
  color: var(--theme-gray-600);
}

.admin-forms-add-section select {
  border-color: var(--theme-gray-200);
  border-radius: 10px;
  background: var(--theme-white);
  width: 100%;
}

.admin-forms-add-section .admin-action-button {
  white-space: nowrap;
  margin-bottom: 1px;
}

@media (max-width: 560px) {
  .admin-forms-add-section {
    grid-template-columns: 1fr;
  }

  .admin-forms-add-section .admin-action-button {
    width: 100%;
    justify-content: center;
  }
}

.admin-forms-composition-title {
  margin: 22px 0 4px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--theme-gray-900);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--theme-gray-100);
}

.admin-form-builder-section-block {
  margin-top: 14px;
}

.admin-orac-page .admin-forms-panel select {
  cursor: pointer;
}

.admin-forms-panel .admin-form-builder-field input:focus,
.admin-forms-panel .admin-form-builder-field select:focus,
.admin-forms-panel .admin-form-builder-field textarea:focus {
  outline: none;
  border-color: var(--theme-maroon-border);
  box-shadow: 0 0 0 3px var(--theme-maroon-soft);
}

/* Edit form — compact read-only line + editable metadata */
.admin-forms-meta--inline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  margin: 0 0 18px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--theme-gray-700);
  background: var(--theme-gray-50, #fafafa);
  border-radius: 10px;
  border: 1px solid var(--theme-gray-100);
}

.admin-forms-meta__inline-item .admin-forms-meta__label {
  color: var(--theme-gray-500);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-right: 4px;
}

.admin-forms-edit-metadata {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--theme-gray-100);
}

.admin-forms-edit-metadata__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 24px;
  margin-bottom: 16px;
}

.admin-forms-edit-metadata__grid .admin-form-builder-field--full {
  grid-column: 1 / -1;
}

.admin-forms-edit-metadata__actions {
  margin-top: 4px;
}

@media (max-width: 720px) {
  .admin-forms-edit-metadata__grid {
    grid-template-columns: 1fr;
  }
}

.admin-forms-add-sections-batch {
  margin-top: 8px;
  margin-bottom: 8px;
}

/* Success popup — form edit page */
.admin-orac-form-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
}

.admin-orac-form-popup-dialog {
  width: min(400px, 100%);
  border-radius: 16px;
  border: 1px solid var(--surface-card-border, rgba(148, 163, 184, 0.35));
  background: var(--surface-card, #fff);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
  padding: 28px 24px 22px;
  text-align: center;
}

.admin-orac-form-popup-dialog h3 {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--theme-gray-900, #0f172a);
}

.admin-orac-form-popup-dialog p {
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--theme-gray-600, #475569);
}

.admin-orac-form-popup-dialog .admin-orac-form-popup-ok {
  min-width: 120px;
}
