/* ==========================================================
   Custom pages - "New page" dialog and the rendered page
   ========================================================== */

/* ---------- dialog ---------- */

.page-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  background: rgba(12, 26, 38, 0.55);
}

.page-dialog {
  width: 100%;
  max-width: 640px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  padding: 26px 28px 22px 28px;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: #1f2d3d;
}

.page-dialog h2 {
  margin: 0 0 4px 0;
  font-size: 1.35em;
  color: #10283b;
}

.page-dialog .page-dialog-sub {
  margin: 0 0 20px 0;
  color: #6b7c8c;
  font-size: 0.92em;
}

.page-dialog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}

.page-dialog-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.page-dialog-field.is-full {
  grid-column: 1 / -1;
}

.page-dialog-field label {
  font-size: 0.82em;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #64748b;
}

.page-dialog-field input,
.page-dialog-field select,
.page-dialog-field textarea {
  border: 1px solid #d8e0e8;
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 0.96em;
  font-family: inherit;
  color: #1f2d3d;
  background: #fff;
}

.page-dialog-field input:focus,
.page-dialog-field select:focus,
.page-dialog-field textarea:focus {
  outline: none;
  border-color: #2d7ff9;
  box-shadow: 0 0 0 3px rgba(45, 127, 249, 0.15);
}

.page-dialog-field textarea {
  resize: vertical;
  min-height: 72px;
}

.page-dialog-field .page-dialog-hint {
  font-size: 0.78em;
  color: #8a97a5;
}

.page-dialog-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 9px;
}

.page-dialog-checkbox label {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.95em;
  color: #1f2d3d;
}

.page-dialog-preview {
  grid-column: 1 / -1;
  height: 130px;
  border-radius: 10px;
  border: 1px dashed #d8e0e8;
  background: #f6f9fc center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9aa7b4;
  font-size: 0.85em;
}

.page-dialog-error {
  grid-column: 1 / -1;
  margin: 0;
  color: #d9534f;
  font-size: 0.88em;
  min-height: 1em;
}

.page-dialog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

.page-dialog-actions .page-dialog-spacer {
  margin-left: auto;
}

.page-dialog-actions button {
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
}

.page-dialog-actions button[data-action="save"] {
  background: #174a6c;
  color: #fff;
}

.page-dialog-actions button[data-action="save"]:hover {
  background: #0f3552;
}

.page-dialog-actions button[data-action="cancel"] {
  background: #eef2f6;
  color: #46586a;
}

.page-dialog-actions button[data-action="delete"] {
  background: #fff;
  color: #d9534f;
  border: 1px solid #f0c2c1;
}

@media (max-width: 560px) {
  .page-dialog-grid { grid-template-columns: 1fr; }
}

/* ---------- rendered custom page ---------- */

.custom-page-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: #123047 center/cover no-repeat;
  color: #fff;
  padding: 0 20px;
}

.custom-page-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(9, 27, 41, 0.55);
}

.custom-page-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 760px;
}

.custom-page-hero h1 {
  margin: 0 0 12px 0;
  font-size: 2.4em;
  line-height: 1.15;
}

.custom-page-hero p {
  margin: 0;
  font-size: 1.06em;
  opacity: 0.92;
}

.custom-page-body {
  margin: 0 auto;
  padding: 44px 20px 64px 20px;
  color: #24313f;
  line-height: 1.65;
}

.custom-page-body p {
  margin: 0 0 16px 0;
  white-space: pre-wrap;
}

.custom-page-missing {
  max-width: 560px;
  margin: 80px auto;
  padding: 32px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  text-align: center;
  color: #46586a;
}
