/* Crescen-style Korean WYSIWYG editor
   Used by /admin/posts.php and /boards/write.php. Matches the Crescen
   screenshot: cream content area, light-blue toolbar, white buttons. */

.cresc-editor {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fef8eb;
  overflow: hidden;
  font-family: inherit;
}

.cresc-toolbar {
  background: #eff6fc;
  border-bottom: 1px solid #d8e1ea;
  padding: 8px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.cresc-toolbar > button,
.cresc-toolbar > select {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border: 1px solid #c8d2de;
  background: #ffffff;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
  color: #1f2937;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.cresc-toolbar > button:hover {
  background: #f1f5f9;
  border-color: #9ca6b3;
}
.cresc-toolbar > button:active,
.cresc-toolbar > button.is-active {
  background: #1e3a8a;
  color: #fff;
  border-color: #1e3a8a;
}
.cresc-toolbar > select {
  padding-right: 6px;
}
.cresc-sep {
  display: inline-block;
  width: 1px;
  height: 22px;
  background: #d8e1ea;
  margin: 0 4px;
}

/* Bold/italic/etc — make the letters look like the screenshot */
.cresc-toolbar .cmd-bold      { font-weight: 700; }
.cresc-toolbar .cmd-italic    { font-style: italic; font-family: Georgia, serif; }
.cresc-toolbar .cmd-underline { text-decoration: underline; }
.cresc-toolbar .cmd-strike    { text-decoration: line-through; }

.cresc-content {
  min-height: 360px;
  padding: 18px 22px;
  background: #ffffff;
  outline: none;
  font-size: 15px;
  line-height: 1.7;
  color: #1f2937;
  overflow-wrap: break-word;
}
.cresc-content:focus { background: #fffdf6; }
.cresc-content h2 { font-size: 22px; font-weight: 700; margin: 18px 0 8px; }
.cresc-content h3 { font-size: 18px; font-weight: 600; margin: 14px 0 6px; }
.cresc-content p  { margin: 0 0 12px; }
.cresc-content ul, .cresc-content ol { margin: 0 0 12px; padding-left: 26px; }
.cresc-content li { margin: 2px 0; }
.cresc-content blockquote {
  margin: 12px 0;
  padding: 8px 14px;
  border-left: 4px solid #1e3a8a;
  background: #f5fafd;
  color: #475569;
}
.cresc-content a { color: #1e3a8a; text-decoration: underline; }
.cresc-content img { max-width: 100%; height: auto; border-radius: 4px; margin: 8px 0; display: block; }
.cresc-content hr { border: 0; border-top: 2px solid #e2e8f0; margin: 18px 0; }
.cresc-content table { width: 100%; border-collapse: collapse; margin: 12px 0 16px; font-size: 14px; }
.cresc-content th, .cresc-content td { border: 1px solid #d0d5dd; padding: 8px 11px; text-align: left; min-width: 44px; vertical-align: top; }
.cresc-content th { background: #f2f4f8; font-weight: 600; }
.cresc-content td:empty:before, .cresc-content th:empty:before { content: '\00a0'; }
.cresc-content:empty:before {
  content: attr(data-placeholder);
  color: #9aa3af;
}

/* Hint shown right under the editor */
.cresc-hint {
  font-size: 12.5px;
  color: #6b7280;
  margin: 6px 2px 16px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.cresc-hint .ico { color: #1e3a8a; font-weight: 600; }

/* Attachments fieldset — cream like the screenshot */
.cresc-attach {
  background: #fff8e8;
  border: 1px solid #f4d77a;
  border-radius: 6px;
  padding: 14px 18px;
  margin-top: 6px;
}
.cresc-attach > legend {
  padding: 0 6px;
  font-weight: 700;
  color: #1e40af;
}
.cresc-attach .cresc-attach-hint {
  color: #78350f;
  font-size: 13px;
  margin-left: 8px;
  font-weight: 400;
}
.cresc-attach .file-row { margin: 6px 0; }
.cresc-attach .file-row input[type=file] {
  padding: 5px;
  background: #fff;
  border: 1px solid #e5d59f;
  border-radius: 4px;
  width: 100%;
  max-width: 520px;
}

/* Image dialog modal */
.cresc-modal-bg {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .55);
  display: none; align-items: center; justify-content: center;
  z-index: 9999;
}
.cresc-modal-bg.open { display: flex; }
.cresc-modal {
  background: #fff; border-radius: 8px; min-width: 380px; max-width: 90vw;
  padding: 20px 22px; box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.cresc-modal h3 { margin: 0 0 12px; font-size: 16px; }
.cresc-modal .row { display: flex; gap: 8px; margin: 8px 0; align-items: center; }
.cresc-modal input[type=text],
.cresc-modal input[type=url] {
  flex: 1; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 4px;
  font-family: inherit; font-size: 14px;
}
.cresc-modal .modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.cresc-modal button {
  padding: 7px 14px; border: 1px solid #cbd5e1; background: #fff;
  border-radius: 4px; cursor: pointer; font-family: inherit; font-size: 13px;
}
.cresc-modal button.primary { background: #1e3a8a; color: #fff; border-color: #1e3a8a; }
.cresc-modal .or { color: #94a3b8; font-size: 12px; text-align: center; padding: 4px 0; }
.cresc-modal .upload-status { font-size: 12px; color: #475569; margin: 4px 0; }
.cresc-modal .upload-status.err { color: #b91c1c; }

@media (max-width: 640px) {
  .cresc-toolbar > button,
  .cresc-toolbar > select { font-size: 12px; padding: 4px 8px; }
  .cresc-content { min-height: 280px; padding: 14px 16px; }
}
