@import url('tool-shared.css');

.viewer-card .actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.viewer-layout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto;
  gap: 1.5rem;
  align-items: start;
}

.preview-pane .pane-header {
  align-items: flex-start;
}

.preview-surface {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 1.2rem 1.35rem;
  min-height: 280px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  line-height: 1.7;
  color: var(--text-main);
  overflow-wrap: break-word;
}

.preview-placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.preview-surface h1,
.preview-surface h2,
.preview-surface h3,
.preview-surface h4,
.preview-surface h5,
.preview-surface h6 {
  margin: 1rem 0 0.6rem;
  font-weight: 700;
  line-height: 1.2;
}

.preview-surface h1 { font-size: 1.9rem; letter-spacing: -0.02em; }
.preview-surface h2 { font-size: 1.6rem; }
.preview-surface h3 { font-size: 1.3rem; }
.preview-surface h4 { font-size: 1.15rem; }
.preview-surface h5 { font-size: 1.05rem; }
.preview-surface h6 { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.08em; }

.preview-surface p {
  margin: 0.75rem 0;
  color: var(--text-main);
}

.preview-surface ul,
.preview-surface ol {
  margin: 0.75rem 0 0.75rem 1.25rem;
  padding-left: 0.5rem;
  color: var(--text-main);
  display: grid;
  gap: 0.35rem;
}

.preview-surface blockquote {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--accent);
  background: rgba(0, 207, 213, 0.06);
  color: var(--text-main);
  border-radius: 10px;
}

.preview-surface code {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
}

.preview-surface pre {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
}

.preview-surface pre code {
  background: transparent;
  padding: 0;
  display: block;
  white-space: pre-wrap;
}

.preview-surface table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.95rem;
}

.preview-surface th,
.preview-surface td {
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 0.6rem 0.75rem;
  text-align: left;
}

.preview-surface th {
  background: rgba(255, 255, 255, 0.05);
  font-weight: 700;
}

.viewer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.sticky-actions {
  position: sticky;
  top: 1rem;
  z-index: 2;
  background: linear-gradient(135deg, rgba(24, 25, 32, 0.95), rgba(9, 10, 14, 0.9));
  padding: 1rem 1.25rem;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.action-hint {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.pdf-button {
  background: linear-gradient(135deg, #00cfd5, #00a7ad);
  color: #041013;
  border: 1px solid rgba(0, 207, 213, 0.35);
  box-shadow: 0 14px 32px rgba(0, 207, 213, 0.35);
}

.pdf-button:hover {
  box-shadow: 0 18px 38px rgba(0, 207, 213, 0.45);
}

.pdf-button:active {
  transform: translateY(0);
}

@media (max-width: 992px) {
  .viewer-card .actions {
    justify-content: flex-start;
  }

  .viewer-actions {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media print {
  body {
    background: #ffffff !important;
    color: #000000;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    margin: 0;
    padding: 0;
  }

  body * {
    visibility: hidden;
  }

  main{
    margin-top: 0px!important;
    padding-top: 0px!important;
  }

  header {
    height: 0px;
  }

  #md-preview,
  #md-preview * {
    visibility: visible;
  }

  #md-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    background: #ffffff;
    color: #000000;
    border: none !important;
    box-shadow: none !important;
    padding: 0.5in;
    margin: 0;
    border-radius: 0;
  }

  .preview-surface,
  .card,
  .viewer-card {
    background: #ffffff !important;
    color: #000000 !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
  }

  .preview-surface h1,
  .preview-surface h2,
  .preview-surface h3,
  .preview-surface h4,
  .preview-surface h5,
  .preview-surface h6,
  .preview-surface p,
  .preview-surface li,
  .preview-surface strong,
  .preview-surface em {
    color: #000000 !important;
  }

  .preview-surface code {
    background: #f6f8fa;
    color: #000000;
    border-radius: 4px;
    padding: 0.15rem 0.35rem;
  }

  .preview-surface table,
  .preview-surface th,
  .preview-surface td {
    border-color: #cccccc;
    color: #000000;
  }

  .sticky-actions,
  .viewer-actions {
    display: none !important;
    height: 0px;
  }
}
