/* DOCX document viewer styles */

/* === Shared container === */
.docx-viewer-container {
  position: relative;
  border: 1px solid var(--color-secondary);
  border-radius: var(--border-radius);
  background: var(--color-body);
  margin: 0;
  overflow: hidden;
}

.docx-viewer-container .format-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 3px;
  background: var(--color-accent);
  color: #fff;
  opacity: 0.85;
  pointer-events: none;
}

/* === Loading state === */
.docx-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 16px;
  font-size: 14px;
  color: var(--color-text-light);
}

.docx-loading::before {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-secondary);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: chem-spin 0.8s linear infinite;
}

/* === Error state === */
.docx-error {
  padding: 16px;
  font-size: 14px;
  color: var(--color-error-text, var(--color-red));
  background: var(--color-error-bg, rgba(255, 0, 0, 0.05));
  border-radius: var(--border-radius);
  text-align: center;
}

/* === Rendered content area === */
.docx-content {
  max-height: 800px;
  overflow: auto;
  padding: 16px;
  background: #fff;
}

/* docx-preview renders into a wrapper div — give it a paper-like appearance */
.docx-content .docx-rendered {
  max-width: 100%;
  margin: 0 auto;
}

/* Page breaks: add visual separator between pages */
.docx-content .docx-rendered > section {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--color-secondary);
}

.docx-content .docx-rendered > section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

/* Ensure images in docx don't overflow */
.docx-content img {
  max-width: 100%;
  height: auto;
}

/* Tables in docx */
.docx-content table {
  border-collapse: collapse;
  max-width: 100%;
}

.docx-content table td,
.docx-content table th {
  border: 1px solid var(--color-secondary-alpha-40, rgba(0,0,0,0.12));
  padding: 4px 8px;
}

/* === Inline modifier (markdown embeds) === */
.docx-inline {
  margin: 16px 0;
}

.docx-inline .docx-content {
  max-height: 500px;
}

/* === Caption === */
.docx-caption {
  padding: 6px 12px;
  font-size: 13px;
  color: var(--color-text-light);
  text-align: center;
  border-top: 1px solid var(--color-secondary);
}
