/* Online Proofing System — app chrome (Wiley / Paper Perfect–style layout) */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: "Open Sans", system-ui, sans-serif;
  background: #eef1f4;
  color: #1c1d1e;
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

/* Warning marquee (from articlereview.paperperfect.ai) */
.marquee {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  display: flex;
  align-items: stretch;
  min-height: 36px;
  background: #f9f4f6;
  border-top: 1px solid #bb9000;
  color: #856404;
  font-size: 13px;
}

.marquee.hidden {
  display: none;
}

.marquee-text {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 48px 8px 16px;
  text-align: center;
}

.marquee-text strong {
  color: #8b5401;
}

.marquee-close {
  position: absolute;
  right: 12px;
  bottom: 8px;
  width: 28px;
  height: 28px;
  border: 1px solid #bb9000;
  background: #f59815;
  color: #fff;
  border-radius: 3px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  box-shadow: 1px 1px 3px #4d4f4f;
}

/* Top toolbar (legacy single-row; stacked layout in rte-toolbar.css) */
.proof-header:not(.proof-header--stacked) {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 0 16px;
  background: #005274;
  color: #fff;
  flex-shrink: 0;
}

.proof-brand {
  font-weight: 700;
  font-size: 15px;
  margin-right: 16px;
  white-space: nowrap;
}

.proof-brand span {
  font-weight: 400;
  opacity: 0.85;
  font-size: 12px;
  display: block;
}

.proof-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  flex-wrap: wrap;
}

.proof-toolbar .sep {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.35);
  margin: 0 4px;
}

.proof-btn {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

.proof-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.proof-btn.primary {
  background: #7cd1f9;
  border-color: #5eb8e8;
  color: #003d52;
  font-weight: 600;
}

.proof-btn.primary:hover {
  background: #9ddeff;
}

.proof-status {
  margin-left: auto;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.abs-formatter-link {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 6px;
  background: #0369a1;
  color: #fff !important;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.abs-formatter-link:hover {
  background: #0284c7;
}

.save-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8bc34a;
}

.save-dot.unsaved {
  background: #ffc107;
}

.save-dot.error {
  background: #f44336;
}

/* Shell layout */
.proof-shell {
  display: grid;
  grid-template-columns: 220px 1fr 300px;
  padding-bottom: 36px;
  flex: 1;
  min-height: 0;
}

.proof-nav,
.proof-side {
  background: #fff;
  border-right: 1px solid #d8d9da;
  overflow-y: auto;
}

.proof-side {
  border-right: none;
  border-left: 1px solid #d8d9da;
}

.proof-main {
  overflow-y: auto;
  background: #fff;
}

.panel-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #5a738e;
  padding: 12px 14px 8px;
  border-bottom: 1px solid #eee;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
}

.nav-list li button {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  color: #1c1d1e;
}

.nav-list li button:hover,
.nav-list li button.active {
  background: rgba(0, 82, 116, 0.08);
  color: #005274;
}

.nav-list .nav-group {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #9aa5b1;
  padding: 12px 14px 4px;
}

/* Side panel tabs */
.side-tabs {
  display: flex;
  border-bottom: 1px solid #d8d9da;
}

.side-tab {
  flex: 1;
  border: none;
  background: #f5f8fa;
  padding: 10px 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  color: #5a738e;
}

.side-tab.active {
  background: #fff;
  color: #005274;
  border-bottom: 2px solid #005274;
}

.side-panel {
  padding: 12px 14px;
  display: none;
}

.side-panel.active {
  display: block;
}

.change-item,
.query-card,
.comment-card {
  border: 1px solid #d8d9da;
  border-radius: 4px;
  padding: 10px;
  margin-bottom: 10px;
  font-size: 12px;
  background: #fafbfc;
}

.change-item .meta {
  color: #6c757d;
  font-size: 11px;
  margin-bottom: 6px;
}

.panel-queries-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #e9eef1;
  margin: -12px -14px 12px;
}

.panel-queries-head .panel-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.queries-panel-toolbar {
  margin-bottom: 12px;
}

.queries-panel-hint {
  font-size: 12px;
  color: #495057;
  margin: 0 0 8px;
  line-height: 1.45;
}

.queries-open-count {
  font-size: 11px;
  font-weight: 600;
  color: #856404;
  background: #fff3cd;
  padding: 2px 8px;
  border-radius: 10px;
}

.query-anchor-label {
  font-size: 11px;
  color: #6c757d;
  margin-left: auto;
}

.query-answer-readonly {
  font-size: 12px;
  line-height: 1.5;
  padding: 8px;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 3px;
  margin-bottom: 8px;
  white-space: pre-wrap;
}

.query-card--focus {
  box-shadow: 0 0 0 2px rgba(0, 82, 116, 0.35);
}

.query-card .question {
  font-weight: 600;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #d8d9da;
}

.query-card textarea {
  width: 100%;
  min-height: 60px;
  font-size: 12px;
  border: 1px solid #ccc;
  padding: 6px;
  resize: vertical;
}

.empty-hint {
  color: #9aa5b1;
  font-size: 12px;
  font-style: italic;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-panel {
  background: #fff;
  border-radius: 5px;
  max-width: 520px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-header {
  padding: 16px 18px 10px;
  border-bottom: 1px solid #e9eef1;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: rgba(0, 0, 0, 0.65);
}

.modal-body {
  padding: 16px 18px;
}

.modal-body label {
  display: block;
  font-size: 13px;
  margin-bottom: 12px;
}

.modal-body input,
.modal-body textarea {
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid #ccc;
  font-size: 14px;
}

.modal-footer {
  padding: 13px 16px;
  background: #f5f8fa;
  border-top: 1px solid #e9eef1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-footer .btn-confirm {
  background: #7cd1f9;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 24px;
  font-weight: 600;
  cursor: pointer;
}

.modal-footer .btn-cancel {
  background: #efefef;
  color: #555;
  border: none;
  border-radius: 8px;
  padding: 6px 24px;
  font-weight: 600;
  cursor: pointer;
}

/* Toast */
.toast {
  position: fixed;
  top: 64px;
  right: 16px;
  z-index: 400;
  background: #323232;
  color: #fff;
  padding: 12px 18px;
  border-radius: 4px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.toast.show {
  opacity: 1;
}

.role-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  gap: 6px;
}
.role-select {
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.95);
  color: #1c1d1e;
}
.role-select:disabled {
  opacity: 0.85;
  cursor: not-allowed;
}
.role-link-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.35);
}
.role-link-badge--editor {
  background: rgba(59, 130, 246, 0.25);
}
.role-link-badge--author {
  background: rgba(34, 197, 94, 0.25);
}

.panel-action-btn {
  font-size: 11px;
  padding: 5px 10px;
  margin: 2px 4px 2px 0;
  border: 1px solid #d8d9da;
  background: #fff;
  border-radius: 3px;
  cursor: pointer;
  color: #005274;
}
.panel-action-btn:hover { background: #f0f7fa; }
.panel-action-btn.accept { border-color: #81c784; color: #2e7d32; }
.panel-action-btn.reject { border-color: #e57373; color: #c62828; }
.panel-action-btn.subtle { color: #6c757d; }

.status-pill, .prod-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  background: #e9eef1;
  color: #5a738e;
  margin-left: 4px;
}
.change-item--pending .status-pill { background: #fff3cd; color: #856404; }
.change-item--accepted .status-pill { background: #d4edda; color: #155724; }

.changes-author-hint {
  font-size: 12px;
  line-height: 1.45;
  padding: 10px;
  margin-bottom: 10px;
  background: #d1ecf1;
  border: 1px solid #bee5eb;
  border-radius: 4px;
  color: #0c5460;
}

.role-pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  margin-right: 6px;
}

.role-pill--editor {
  background: #17a2b8;
  color: #fff;
}

.role-pill--author {
  background: #6c757d;
  color: #fff;
}

.change-item--role-editor {
  border-left: 3px solid #17a2b8;
}

@media print {
  body.print-corrected-pdf .proof-header,
  body.print-corrected-pdf .proof-nav,
  body.print-corrected-pdf .proof-side,
  body.print-corrected-pdf #warning-marquee,
  body.print-corrected-pdf .asset-toolbar,
  body.print-corrected-pdf .comment-pin {
    display: none !important;
  }

  body.print-corrected-pdf .proof-shell {
    display: block;
  }

  body.print-corrected-pdf .proof-main {
    width: 100%;
    max-width: none;
    padding: 0;
  }

  body.print-corrected-pdf .change-insert,
  body.print-corrected-pdf .change-delete,
  body.print-corrected-pdf .change-insert--author,
  body.print-corrected-pdf .change-insert--editor,
  body.print-corrected-pdf .change-delete--author,
  body.print-corrected-pdf .change-delete--editor {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  body.print-corrected-pdf::before {
    content: "Corrected proof — tracked changes shown";
    display: block;
    font-size: 11pt;
    font-weight: 600;
    margin-bottom: 12pt;
    color: #333;
  }
}
.change-item--rejected .status-pill { background: #f8d7da; color: #721c24; }
.query-card--open .status-pill { background: #fff3cd; color: #856404; }
.query-card--resolved .status-pill { background: #cce5ff; color: #004085; }
.query-card--closed .status-pill { background: #e2e3e5; color: #383d41; }

.diff-preview {
  font-size: 12px;
  line-height: 1.5;
  margin: 8px 0;
  padding: 8px;
  background: #fff;
  border: 1px solid #eee;
}

.change-actions, .query-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 8px;
}

.query-meta {
  margin-bottom: 8px;
}

.asset-toolbar {
  margin-bottom: 8px;
}
.asset-comment-btn {
  font-size: 11px;
  padding: 4px 10px;
  background: #005274;
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
}
.asset-comment-btn:hover { background: #003d52; }

.comment-pin {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f59815;
  color: #fff;
  border: 1px solid #bb9000;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  z-index: 5;
}

.comment-anchor-highlight {
  outline: 3px solid #f59815;
  outline-offset: 4px;
}

/* Paragraph blocks are not highlighted — only inline ins/del show corrections */
.has-tracked-change,
.has-editor-change,
.article-html [data-block-id].is-editing-correction {
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
}

.query-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 3px;
}
.query-badge--open { background: #fff3cd; color: #856404; }
.query-badge--answered { background: #d1ecf1; color: #0c5460; }
.query-badge--resolved { background: #d4edda; color: #155724; }

.article-html h2.has-query { border-left: 4px solid #bb9000; padding-left: 8px; }
.article-html h2.has-query-answered { border-left-color: #17a2b8; }
.article-html h2.has-query-resolved { border-left-color: #28a745; }

.article-html p.has-query,
.article-html .editable.has-query {
  background: var(--wiley-query, #fff8e1);
  box-shadow: inset 3px 0 0 #bb9000;
}

.article-html p.has-query-answered,
.article-html .editable.has-query-answered {
  background: #e8f6f8;
  box-shadow: inset 3px 0 0 #17a2b8;
}

.article-html p.has-query-resolved,
.article-html .editable.has-query-resolved {
  background: #e8f5e9;
  box-shadow: inset 3px 0 0 #28a745;
}

.query-pin {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 5;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid #bb9000;
  border-radius: 11px;
  background: #fff3cd;
  color: #856404;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  line-height: 20px;
}

.query-pin--answered {
  border-color: #17a2b8;
  background: #d1ecf1;
  color: #0c5460;
}

.asset-query-btn {
  margin-left: 6px;
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid #bb9000;
  background: #fff8e1;
  color: #856404;
  border-radius: 3px;
  cursor: pointer;
}

.asset-query-btn:hover {
  background: #ffecb3;
}

.comment-anchor-highlight,
.query-anchor-highlight {
  outline: 2px solid #005274;
  outline-offset: 2px;
}

.validation-list {
  margin: 12px 0 0;
  padding-left: 20px;
  font-size: 13px;
}
.validation-list li { margin-bottom: 8px; }
.val-summary { font-weight: 600; padding: 10px; border-radius: 4px; }
.val-summary.val-pass { background: #d4edda; color: #155724; }
.val-summary.val-warn { background: #fff3cd; color: #856404; }
.val-summary.val-error { background: #f8d7da; color: #721c24; }
.val-pass { color: #155724; }
.val-warn { color: #856404; }
.val-error { color: #c62828; }

.modal-hint { font-size: 12px; color: #6c757d; }

.pub-info-dl {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}
.pub-info-dl dt {
  font-weight: 700;
  color: #005274;
  margin-top: 10px;
}
.pub-info-dl dt:first-child { margin-top: 0; }
.pub-info-dl dd {
  margin: 4px 0 0;
}
.attachment-list {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
}
.doi-preview {
  margin-top: 12px;
  padding: 10px;
  background: #f5f8fa;
  border: 1px solid #e9eef1;
  font-size: 12px;
  min-height: 40px;
}

/* Find highlights */
.find-match {
  background: #fff59d;
  outline: 1px solid #fbc02d;
}

@media (max-width: 1100px) {
  .proof-shell {
    grid-template-columns: 180px 1fr 260px;
  }
}

@media (max-width: 900px) {
  .proof-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }
  .proof-nav,
  .proof-side {
    max-height: 200px;
  }
}
