/* Sol-styled SS14 document editor (scoped to .doc-editor-shell) */

.doc-editor-shell {
  --de-paper: #fafafa;
  --de-paper-text: #333;
  display: flex;
  flex-direction: row;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg-space);
  color: var(--text);
  overflow: hidden;
}

.doc-editor-shell .monospace {
  font-family: "Consolas", "Monaco", "Courier New", monospace !important;
  font-size: 18px;
  letter-spacing: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  display: inline;
  line-height: 1;
}

.doc-editor-shell #toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  color: var(--text);
  width: 280px;
  min-width: 240px;
  max-width: 280px;
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  flex-shrink: 0;
  min-height: 0;
}

.doc-editor-shell #editor {
  flex: 6 1 0;
  padding: 1rem;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: 0.9rem;
  background: var(--bg-panel-2);
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text);
  height: auto;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  resize: none;
  outline: none;
  overflow: auto;
}

.doc-editor-shell #editor::placeholder {
  color: var(--text-muted);
}

.doc-editor-shell #render-container {
  flex: 3 1 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 1rem 1rem 0.85rem;
  box-sizing: border-box;
  overflow: hidden;
  background: var(--bg-space);
  min-width: 0;
  min-height: 0;
}

.doc-editor-shell #render-scroll {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.doc-editor-shell #render-sizer {
  flex: 0 0 auto;
  position: relative;
  overflow: hidden;
  width: 0;
  height: 0;
}

/* Out of flow so natural size never expands site layout */
.doc-editor-shell #render-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 520px;
  transform-origin: top left;
  will-change: transform;
}

.doc-editor-shell #render {
  width: 520px;
  min-height: 724px;
  height: auto;
  padding: 1.25rem;
  background-color: var(--de-paper);
  font-family: "Noto Sans", var(--font-body), sans-serif;
  font-size: 16px;
  font-weight: 300;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  line-height: 1.35;
  box-sizing: border-box;
  border-radius: 40px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--de-paper-text);
  font-variant-ligatures: none;
  letter-spacing: 0;
  text-rendering: geometricPrecision;
  font-kerning: none;
  overflow: visible;
}

.doc-editor-shell .underscore-normal {
  font-family: "Courier New", monospace !important;
  font-style: normal !important;
  display: inline;
}

.doc-editor-shell #color-picker {
  position: absolute;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem;
  z-index: 1000;
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(30px, 1fr));
  gap: 5px;
  width: 200px;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.doc-editor-shell .color-box {
  width: 30px;
  height: 30px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.doc-editor-shell .color-box:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.35);
}

.doc-editor-shell #render b {
  font-weight: 600;
}

.doc-editor-shell #render i {
  font-style: italic;
}

.doc-editor-shell #render b i,
.doc-editor-shell #render i b {
  font-weight: 600;
  font-style: italic;
}

.doc-editor-shell #render i span[style*="font-weight:bold"] {
  font-weight: normal !important;
  font-style: italic !important;
}

.doc-editor-shell .image-container {
  flex: 0 0 auto;
  width: 100%;
  max-width: none;
  text-align: center;
  margin-top: 0.75rem;
  padding-bottom: 0.15rem;
}

.doc-editor-shell .image-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
  line-height: 1.35;
}

.doc-editor-shell .badge-container p {
  margin: 0 0 0.4rem;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
}

.doc-editor-shell .badge-container a {
  display: inline-flex;
  flex: 0 0 auto;
  line-height: 0;
  text-decoration: none;
}

.doc-editor-shell .badge-container img {
  display: block;
  width: auto;
  height: 20px;
  max-width: none;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  object-fit: unset;
}

.doc-editor-shell button {
  background: var(--btn);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-body);
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  box-shadow: none;
  width: 100%;
}

.doc-editor-shell button:hover {
  background: var(--btn-hover);
  border-color: rgba(233, 242, 169, 0.28);
  color: var(--text);
}

.doc-editor-shell .multiple-buttons {
  display: flex;
  gap: 0.35rem;
}

.doc-editor-shell #template-picker {
  display: none;
  flex: 1 1 auto;
  position: static;
  min-width: 0;
  min-height: 8rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel-2);
  box-shadow: none;
  z-index: 1;
  font-family: var(--font-body);
  font-size: 0.8rem;
  padding: 0.35rem 0.25rem;
}

.doc-editor-shell .template-folder-group {
  padding: 0.2rem 0;
}

.doc-editor-shell .template-folder-group:hover {
  background: rgba(233, 242, 169, 0.04);
}

.doc-editor-shell .template-folder-title {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
  padding: 0.2rem 0.35rem;
  border-radius: 4px;
}

.doc-editor-shell .template-folder-title:hover {
  background: rgba(233, 242, 169, 0.1);
}

.doc-editor-shell .template-entry {
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  margin: 0.1rem 0;
  border-radius: 4px;
  transition: background 0.15s;
  background: rgba(70, 73, 102, 0.25);
  color: var(--text-muted);
}

.doc-editor-shell .template-entry:hover {
  background: rgba(233, 242, 169, 0.12);
  color: var(--text);
}

.doc-editor-shell .button-formatting {
  background: var(--bg-elevated) !important;
}

.doc-editor-shell .button-headers {
  background: #3a3d52 !important;
}

.doc-editor-shell .button-colors {
  background: rgba(187, 50, 50, 0.45) !important;
}

.doc-editor-shell .button-logos {
  background: rgba(70, 73, 102, 0.9) !important;
}

.doc-editor-shell .button-templates {
  background: rgba(49, 132, 62, 0.35) !important;
}

.doc-editor-shell .collapsed > div:not(.template-folder-title) {
  display: none !important;
}

.doc-editor-shell .embedded-logo {
  display: inline-block;
  max-width: 45%;
  height: auto;
  image-rendering: pixelated;
}

@media (max-width: 720px) {
  .doc-editor-shell {
    flex-direction: column;
    height: auto;
    max-height: none;
    min-height: calc(100dvh - var(--site-header-height));
    overflow: auto;
  }

  .doc-editor-shell #toolbar {
    width: 100%;
    min-width: 0;
    max-width: none;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .doc-editor-shell #template-picker {
    min-height: 10rem;
    max-height: 14rem;
  }

  .doc-editor-shell #editor {
    flex: none;
    height: 40vh;
    min-height: 12rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .doc-editor-shell #render-container {
    flex: none;
    min-height: 28rem;
    padding: 1rem 0.75rem 1rem;
  }

  .doc-editor-shell #render-scroll {
    flex: 1 1 auto;
    min-height: 18rem;
  }

  .doc-editor-shell #render {
    border-radius: 32px;
  }
}
