/* css/components/dialog.css
 * Generic modal-dialog component (backdrop + panel + actions).
 * Currently used by the Report dialog (#report-modal / #report-dialog in
 * includes/footer.php, controller in js/app.js), but the .g-dialog* classes
 * are intentionally generic so any future real dialog can reuse them.
 *
 * Ownership: this file owns dialog/backdrop styling exclusively. Do not
 * duplicate these rules in css/theme-v3.css or css/gobstagram.css.
 */

.g-dialog-backdrop[hidden] { display: none; }

.g-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, .6);
  box-sizing: border-box;
}

/* Width is a variable so a variant can widen the panel from its own rule:
   this file loads after theme-v3.css, so a plain `width` there would lose the
   cascade to the 340px below and silently keep the narrow panel. */
.g-dialog {
  width: min(var(--g-dialog-width, 340px), 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 20px;
  box-sizing: border-box;
  background: var(--g-surface-panel, #fff);
  border: 2px solid var(--g-border-strong, #8f4a39);
  color: var(--g-text-primary, #101114);
  font-family: Tahoma, Arial, sans-serif;
  font-size: 12px;
}

.g-dialog h2 {
  margin: 0 0 8px;
  font-size: 14px;
}

/* Title + close (X) row, for a dialog built with openComposerDialog()
   (js/app.js) rather than static markup. */
.composer-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.composer-dialog-head h2 { margin: 0; }
.composer-dialog-head button { font-size: 14px; line-height: 1; }

.g-dialog p {
  margin: 0 0 12px;
}

.g-dialog label {
  display: block;
  margin-bottom: 4px;
  color: var(--g-text-secondary, #555);
}

.g-dialog select,
.g-dialog textarea,
.g-dialog input[type="text"] {
  width: 100%;
  padding: 5px;
  margin-bottom: 10px;
  box-sizing: border-box;
  border: 1px solid var(--g-border-default, #ccc);
  border-radius: 3px;
}

.g-dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.g-dialog-actions button {
  padding: 5px 12px;
  border: none;
  border-radius: 3px;
  cursor: pointer;
}

#report-cancel {
  background: #ccc;
}

.g-danger-action {
  background: var(--g-danger, #cc6600);
  color: #fff;
  font-weight: bold;
}

/* Prevent background scroll while a dialog is open. */
.has-dialog-open {
  overflow: hidden;
}

/* Generic list-of-items-with-an-action row, for a dialog that lists existing
   values alongside the input that adds a new one (e.g. the pin-a-tag
   dialog's pinned-tags list in js/app.js). */
.g-dialog-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.g-dialog-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--g-border-default, #ccc);
}
