/* <doc-field> (Task 1.2e): a content field of an admin page, shown as students see it, with its Edit button (and, since
   Task 1.3i, «صورة» and «رسم», and a text box for a document of text only; since Task 1.7d, «HTML»; since Task 1.7f the
   three in one menu, «إضافة ⌄»); and the frame that shows the builders' page over the app page while docBuilder,
   svgBuilder or htmlBuilder is open (components/builders-frame.ts). */
doc-field {
  display: block;
  min-inline-size: 0;
}

.doc-field-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  margin-block-end: var(--space-2);
}

.doc-field-label {
  font-size: var(--font-size-card-title);
  font-weight: 700;
}

.doc-field-tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* «إضافة ⌄» (Task 1.7f): the app's action menu (action-menu.css), its button drawn as the plain one next to it
   («تحرير», .button and .button-secondary in base.css): its room before the word, its border and words, pressed and
   greyed as it is (while the field is busy) */
.doc-field-add .am-button {
  padding-inline-start: var(--space-4);
  border-color: var(--color-input-border);
  color: var(--color-text);
}

.doc-field-add .am-button:hover {
  background: var(--color-bg);
}

.doc-field-add .am-button:active {
  box-shadow: inset 0 3px 5px color-mix(in srgb, var(--color-text) 15%, transparent);
}

.doc-field-add .am-button:disabled {
  opacity: 0.6;
  cursor: progress;
}

/* a document of text only, typed in the field (Task 1.3i) */
.doc-field-text {
  inline-size: 100%;
  min-block-size: var(--control-height);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius);
  background: var(--color-input-bg);
  color: var(--color-text);
  font: inherit;
  line-height: var(--line-height);
  resize: vertical;
}

/* a teal ring round the field you type in, its line the text's colour (Task indoor: the kit's field, as base.css's) */
.doc-field-text:focus {
  border-color: var(--color-input-focus);
  outline: 3px solid var(--color-on);
  outline-offset: 1px;
}

.doc-field-text:disabled {
  opacity: 0.7;
}

/* the box takes the direction of what is typed in it (dir="auto"), and an empty one has none: its hint, Arabic, reads
   right to left (Task 1.4o) */
.doc-field-text:placeholder-shown {
  direction: rtl;
}

.doc-field-view {
  min-block-size: var(--control-height);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-input-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.doc-field-empty {
  margin: 0;
  color: var(--color-muted);
}

.doc-field-status {
  margin-block: var(--space-2) 0;
  color: var(--color-danger);
}

/* what is happening (a picture being added), not what went wrong */
.doc-field-status.is-info {
  color: var(--color-muted);
}

/* the page behind the frame doesn't scroll */
html.doc-frame-open {
  overflow: hidden;
}

/* The frame covers the page. Until docBuilder is open, the page is dimmed and a line says it's coming; then docBuilder's
   own window dims it (the builders' page is transparent in a frame). */
.doc-frame {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--color-backdrop);
}

.doc-frame.is-open {
  background: transparent;
}

.doc-frame-editor {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  border: 0;
}

.doc-frame-editor.is-loading {
  visibility: hidden;
}

.doc-frame-wait {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-inline: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-raised);
}

.doc-frame-status {
  margin: 0;
}

/* /admin/doc-check: its three fields, one under the other */
.doc-check-fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-block-start: var(--space-4);
}
