
/* Modern AI-app demo skin (layout + typography only). */

:root {
  --pm-bg: #f3f2f1; /* Word background grey */
  --pm-surface: #ffffff;
  --pm-surface-2: #ffffff;
  --pm-border: #d2d2d2;
  --pm-text: #323130;
  --pm-muted: #605e5d;
  --pm-accent: #2b579a; /* Word Blue */
}

html, body {
  height: 100%;
}

body {
  font-family: "Segoe UI", "Calibri", "Microsoft YaHei", system-ui, -apple-system, Arial, sans-serif;
  margin: 0;
  background: var(--pm-bg);
  color: var(--pm-text);
}

textarea {
  width: 100%;
  border: 1px solid #c8c6c4;
  min-height: 40em;
  padding: 4px 8px;
  border-radius: 2px;
}

.left, .right {
  width: 50%;
  float: left;
}

.pm-app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.pm-topbar {
  background: var(--pm-accent);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  color: white;
}

.pm-topbar-inner {
  max-width: 100%;
  margin: 0;
  padding: 4px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.pm-brand {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: white;
  user-select: none;
}

.pm-workspace {
  flex: 1;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  background: var(--pm-bg);
}

.pm-page-sheet {
  margin: 20px auto 40px;
  width: 210mm;
  min-height: 297mm;
  background: #ffffff;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.15);
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  /* Word-style Crop Marks (pointing outwards to margins) */
  background-image:
    linear-gradient(to left, #a19f9d 1px, transparent 1px),
    linear-gradient(to top, #a19f9d 1px, transparent 1px),
    linear-gradient(to right, #a19f9d 1px, transparent 1px),
    linear-gradient(to top, #a19f9d 1px, transparent 1px),
    linear-gradient(to left, #a19f9d 1px, transparent 1px),
    linear-gradient(to bottom, #a19f9d 1px, transparent 1px),
    linear-gradient(to right, #a19f9d 1px, transparent 1px),
    linear-gradient(to bottom, #a19f9d 1px, transparent 1px);
  background-repeat: no-repeat;
  background-size: 15px 15px;
  background-position:
    96px 96px, 96px 96px,
    calc(100% - 96px) 96px, calc(100% - 96px) 96px,
    96px calc(100% - 96px), 96px calc(100% - 96px),
    calc(100% - 96px) calc(100% - 96px), calc(100% - 96px) calc(100% - 96px);
}

.full {
  width: 100%;
}

.pm-canvas {
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pm-title {
  padding: 120px 110px 10px; /* Shifted down to avoid top marks, increased horizontal margin */
  text-align: center; /* Centered title */
}

.pm-zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pm-export-controls {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pm-export-btn {
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  min-height: 32px;
  padding: 6px 10px;
}

.pm-export-btn:hover {
  background: #edebe9;
  border-color: #d2d2d2;
}

.pm-export-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.pm-zoom-btn {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: #666;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 20px;
}

.pm-zoom-btn:hover {
  background: #edebe9;
  border-color: #d2d2d2;
}

.pm-zoom-controls .pm-zoom-btn svg {
  width: 22px !important;
  height: 22px !important;
  max-width: 22px !important;
  max-height: 22px !important;
  min-width: 22px !important;
  min-height: 22px !important;
}

.pm-zoom-btn:active {
  transform: translateY(1px);
}

.pm-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pm-title textarea {
  width: 100%;
  box-sizing: border-box;
  border: none;
  min-height: unset; /* Override global 40em min-height */
  padding: 10px 0; /* Increased bottom spacing of text */
  font-size: 18pt;
  font-weight: bold;
  background: transparent;
  color: var(--pm-text);
  font-family: inherit;
  border-bottom: 2px solid transparent;
  text-align: center; /* Ensure text inside input is centered */
  resize: none;
  overflow: hidden;
  display: block;
}

.pm-title textarea::placeholder {
  color: #c8c6c4;
}

.pm-title textarea:hover {
  border-bottom-color: #edebe9;
  background: transparent;
}

.pm-title textarea:focus {
  outline: none;
  border-bottom-color: var(--pm-accent);
  background: transparent;
  color: var(--pm-text);
}

.marked {
  background: #ff6
}

.ProseMirror-menubar-wrapper {
  position: relative;
  background: transparent;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.ProseMirror-menubar {
  background: #ffffff;
  border-bottom: 1px solid var(--pm-border);
  padding: 8px 20px;
  position: sticky;
  top: 0;
  left: 0 !important; /* Force left 0 to override JS dynamic positioning */
  right: 0 !important;
  z-index: 20;
  width: 100% !important; /* Force 100% width regardless of JS calculations */
  max-width: none !important;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center; /* Center the ribbon buttons within the full-width bar */
  flex-wrap: wrap;
  gap: 4px 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border-radius: 0; /* Remove radius for a continuous top bar look */
}

/* Ensure the spacer added by the plugin doesn't break layout */
.ProseMirror-menubar-spacer {
  width: 100% !important;
}

.pm-menuctrl {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 4px 12px;
  border-right: 1px solid var(--pm-border);
  min-height: 40px; /* Ensure consistent height for two rows */
}

.pm-menuctrl-label {
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--pm-muted);
}

.pm-menuctrl-select {
  font-size: 14px;
  height: 32px;
  border: 1px solid var(--pm-border);
  border-radius: 4px;
  background: #ffffff;
  color: var(--pm-text);
  padding: 0 8px;
}

.pm-menuctrl-select:focus {
  outline: none;
  border-color: rgba(37, 99, 235, 0.6);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.pm-menuctrl-color {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--pm-border);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.95);
  cursor: pointer;
}

.pm-align {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 8px;
  padding: 4px 12px 4px 0;
  border-right: 1px solid var(--pm-border);
}

.pm-align-btn {
  height: 32px;
  min-width: 32px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pm-align-btn:hover {
  background: #edebe9;
}

.pm-align-btn.is-active {
  background: #c8c6c4;
}

/* Make the example-setup toolbar look more like Word ribbon buttons. */
.ProseMirror-menuitem {
  margin: 2px;
  display: inline-flex;
  align-items: center;
}

.ProseMirror-menuitem .ProseMirror-icon {
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 6px;
  font-size: 1.25em; /* Make icons larger */
  min-width: 1.25em;
  text-align: center;
}

.ProseMirror-menuitem > * {
  border: 1px solid transparent;
  border-radius: 4px;
  min-height: 32px;
  display: flex;
  align-items: center;
}

.ProseMirror-menuitem:hover > *,
.ProseMirror-menuitem:hover .ProseMirror-icon {
  background: #edebe9;
  border-color: #d2d2d2;
}

.ProseMirror-menuseparator {
  border-right: 1px solid var(--pm-border);
  margin: 4px 8px;
  height: 24px;
}

.ProseMirror {
  padding: 10px 110px 120px; /* Matched horizontal padding with title, increased bottom to match top clearance */
  line-height: 1.5;
  font-family: "Calibri", "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 11pt;
  color: var(--pm-text);
  flex: 1;
  width: 100%;
  background: transparent;
  box-sizing: border-box;
}

.ProseMirror:focus {
  outline: none;
}

.ProseMirror p {
  margin-top: 0;
  margin-bottom: 8pt;
}

/* 修复浏览器在空段落中使用 text-indent 时光标不缩进的问题 */
.ProseMirror p::before {
  content: "";
  display: inline-block;
  width: 0;
  vertical-align: middle;
}

.ProseMirror h1, .ProseMirror h2, .ProseMirror h3 {
  color: #2b579a;
  font-family: "Segoe UI Light", "Segoe UI", sans-serif;
  font-weight: normal;
  margin-top: 12pt;
  margin-bottom: 4pt;
}

.ProseMirror h1 { font-size: 24pt; }
.ProseMirror h2 { font-size: 18pt; border-bottom: 1px solid #eee; }
.ProseMirror h3 { font-size: 14pt; }

.ProseMirror blockquote {
  border-left: 3px solid #2b579a;
  padding-left: 10px;
  margin-left: 0;
  font-style: italic;
  color: #605e5d;
}

.ProseMirror table {
  border-collapse: collapse;
  margin: 10px 0;
  width: 100%;
}

.ProseMirror th, .ProseMirror td {
  border: 1px solid #bfbfbf;
  padding: 4px 8px;
  text-align: left;
}

.ProseMirror th {
  background: #f2f2f2;
  font-weight: bold;
}

.pm-ai-suggest {
  color: #a19f9d !important; /* Force grey color for ghost text */
  white-space: pre-wrap;
  pointer-events: none;
  font-style: italic; /* Optional: adds a visual hint that it's a suggestion */
}

/* Keep links readable in the Word theme. */
.ProseMirror a {
  color: var(--pm-accent);
  text-decoration: underline;
}

/* AI "Complete It" Button Style - Updates the look to be more modern and integrated */
.pm-ai-complete-btn {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 6px 14px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2), 0 1px 2px rgba(79, 70, 229, 0.1);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  margin-right: 4px;
}

.pm-ai-complete-btn:hover {
  background: linear-gradient(135deg, #5b5ee9 0%, #4338ca 100%);
  box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3), 0 2px 4px -1px rgba(79, 70, 229, 0.15);
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.2);
}

.pm-ai-complete-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.2);
  background: #4338ca;
}

.pm-ai-complete-btn::before {
  content: "?";
  font-size: 14px;
  opacity: 0.9;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.1));
}

