/* Markdown to PDF Converter Stylesheet */

.markdown-to-pdf-wrapper {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #0f172a;
}

/* Initial Choice Box inside Theme .Landing */
.mtp-choice-landing {
  margin: 30px auto;
  width: 100%;
}

.mtp-choice-landing .innerContent {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  border: 1px solid #e2e8f0;
  padding: 32px 24px;
  text-align: center;
}

.mtp-choice-title {
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 6px 0;
}

.mtp-choice-subtitle {
  color: #64748b;
  font-size: 15px;
  margin: 0 0 24px 0;
}

.mtp-choice-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 10px;
}

@media (max-width: 640px) {
  .mtp-choice-options-grid {
    grid-template-columns: 1fr;
  }
}

.mtp-choice-card {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px 18px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mtp-choice-card:hover {
  transform: translateY(-3px);
  border-color: #3e3ef4;
  box-shadow: 0 8px 20px rgba(62, 62, 244, 0.12);
  background: #ffffff;
}

.mtp-card-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.mtp-card-icon.upload {
  background: #dcfce7;
  color: #10b981;
}

.mtp-card-icon.write {
  background: #e0e7ff;
  color: #3e3ef4;
}

.mtp-choice-card h3 {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px 0;
}

.mtp-choice-card p {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 16px 0;
  line-height: 1.5;
  flex: 1;
}

.mtp-choice-btn {
  width: 100%;
  padding: 9px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mtp-choice-btn.primary {
  background: #10b981;
  color: #ffffff;
}

.mtp-choice-btn.primary:hover {
  background: #059669;
}

.mtp-choice-btn.secondary {
  background: #3e3ef4;
  color: #ffffff;
}

.mtp-choice-btn.secondary:hover {
  background: #2b2bd9;
}

/* Primary & Secondary Buttons */
.pdf-btn-primary {
  background-color: #3e3ef4;
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.2s;
}

.pdf-btn-primary:hover {
  background-color: #2b2bd9;
}

.pdf-btn-secondary {
  background-color: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}

.pdf-btn-secondary:hover {
  background-color: #e2e8f0;
  color: #0f172a;
}

.pdf-btn-success {
  background-color: #10b981;
  color: #ffffff;
}

.pdf-btn-success:hover {
  background-color: #059669;
}

/* Full-Page Workspace Overlay Layout */
#mtp-workspace-section {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99900;
  background: #f1f5f9;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.mtp-full-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: #ffffff;
  border-bottom: 1px solid #cbd5e1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  flex-wrap: wrap;
  gap: 12px;
  z-index: 10;
}

.mtp-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mtp-brand-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}

.mtp-brand-title svg {
  color: #3e3ef4;
}

.mtp-doc-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.mtp-doc-name {
  font-size: 14px;
  color: #334155;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 6px;
}

.mtp-badge {
  background: #e0e7ff;
  color: #3730a3;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 700;
}

.mtp-badge.secondary {
  background: #dcfce7;
  color: #166534;
}

/* Header Controls & Options */
.mtp-header-options {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.mtp-option-group {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}

.mtp-select {
  padding: 5px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: #0f172a;
  background-color: #ffffff;
  outline: none;
  cursor: pointer;
}

.mtp-select:focus {
  border-color: #3e3ef4;
}

.mtp-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Main Split Workspace */
.mtp-workspace {
  flex: 1;
  display: flex;
  gap: 16px;
  padding: 16px;
  overflow: hidden;
  box-sizing: border-box;
}

/* Left Pane: Editor */
.mtp-editor-pane {
  flex: 1;
  min-width: 320px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.mtp-pane-header {
  padding: 10px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.mtp-pane-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
}

.mtp-toolbar-quick-inserts {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.mtp-toolbar-quick-inserts button {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.mtp-toolbar-quick-inserts button:hover {
  background: #3e3ef4;
  color: #ffffff;
  border-color: #3e3ef4;
}

.mtp-editor-area {
  flex: 1;
  position: relative;
  display: flex;
}

.mtp-textarea {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  padding: 16px;
  font-family: 'Fira Code', 'Courier New', Courier, monospace;
  font-size: 14px;
  line-height: 1.6;
  color: #0f172a;
  resize: none;
  box-sizing: border-box;
  background: #fafafa;
}

.mtp-editor-footer-status {
  padding: 8px 14px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.mtp-text-btn {
  background: none;
  border: none;
  color: #3e3ef4;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
}

.mtp-text-btn:hover {
  text-decoration: underline;
}

.mtp-text-btn.danger {
  color: #ef4444;
}

/* Right Pane: Live PDF Page Preview */
.mtp-viewer-pane {
  flex: 1.1;
  min-width: 340px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.mtp-viewer-controls {
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.mtp-viewer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
}

.mtp-viewer-title svg {
  color: #10b981;
}

.mtp-viewport-container {
  flex: 1;
  overflow: auto;
  background: #334155;
  padding: 24px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Paper Page Simulation */
.mtp-paper-page {
  background: #ffffff;
  width: 100%;
  max-width: 794px;
  /* A4 width at 96 DPI */
  min-height: 1000px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  box-sizing: border-box;
  transition: all 0.2s ease;
  overflow-wrap: break-word;
}

/* Font Families */
.mtp-paper-page.font-sans {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.mtp-paper-page.font-serif {
  font-family: 'Merriweather', 'Georgia', Cambria, serif;
}

.mtp-paper-page.font-mono {
  font-family: 'Fira Code', 'Courier New', Courier, monospace;
}

.mtp-paper-page.font-roboto {
  font-family: 'Roboto', sans-serif;
}

/* Margins */
.mtp-paper-page.margin-compact {
  padding: 24px;
}

.mtp-paper-page.margin-normal {
  padding: 40px;
}

.mtp-paper-page.margin-wide {
  padding: 60px;
}

/* Themes */
/* GitHub Theme */
.mtp-paper-page.theme-github {
  background: #ffffff;
  color: #24292e;
}

.mtp-paper-page.theme-github h1,
.mtp-paper-page.theme-github h2 {
  border-bottom: 1px solid #eaecef;
  padding-bottom: 0.3em;
  color: #1b1f23;
}

.mtp-paper-page.theme-github code {
  background-color: rgba(27, 31, 35, 0.05);
  border-radius: 3px;
  font-size: 85%;
  padding: 0.2em 0.4em;
}

.mtp-paper-page.theme-github pre {
  background-color: #f6f8fa;
  border-radius: 6px;
  padding: 16px;
  overflow: auto;
}

.mtp-paper-page.theme-github table {
  border-collapse: collapse;
  width: 100%;
}

.mtp-paper-page.theme-github th,
.mtp-paper-page.theme-github td {
  border: 1px solid #dfe2e5;
  padding: 8px 13px;
}

.mtp-paper-page.theme-github tr:nth-child(2n) {
  background-color: #f6f8fa;
}

/* Dark Elegance Theme */
.mtp-paper-page.theme-dark {
  background: #1e1e2e;
  color: #cdd6f4;
}

.mtp-paper-page.theme-dark h1,
.mtp-paper-page.theme-dark h2,
.mtp-paper-page.theme-dark h3 {
  color: #89b4fa;
}

.mtp-paper-page.theme-dark a {
  color: #f5e0dc;
}

.mtp-paper-page.theme-dark code {
  background: #313244;
  color: #f9e2af;
  padding: 2px 6px;
  border-radius: 4px;
}

.mtp-paper-page.theme-dark pre {
  background: #11111b;
  border: 1px solid #313244;
  padding: 16px;
  border-radius: 8px;
}

.mtp-paper-page.theme-dark table th,
.mtp-paper-page.theme-dark table td {
  border: 1px solid #45475a;
  padding: 8px 12px;
}

.mtp-paper-page.theme-dark tr:nth-child(2n) {
  background-color: #181825;
}

/* Academic Paper Theme */
.mtp-paper-page.theme-academic {
  background: #fffdfa;
  color: #2b2b2b;
  line-height: 1.8;
}

.mtp-paper-page.theme-academic h1 {
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 24px;
}

.mtp-paper-page.theme-academic h2 {
  border-bottom: 2px solid #2b2b2b;
}

/* Modern Indigo Theme */
.mtp-paper-page.theme-indigo {
  background: #ffffff;
  color: #1e1b4b;
}

.mtp-paper-page.theme-indigo h1 {
  color: #3730a3;
  font-weight: 800;
}

.mtp-paper-page.theme-indigo h2 {
  color: #4338ca;
}

.mtp-paper-page.theme-indigo blockquote {
  border-left: 4px solid #6366f1;
  background: #eef2ff;
  padding: 12px 18px;
  border-radius: 0 8px 8px 0;
  margin: 16px 0;
}

/* Rendered HTML Styling inside Preview */
.mtp-rendered-html h1,
.mtp-rendered-html h2,
.mtp-rendered-html h3,
.mtp-rendered-html h4 {
  margin-top: 1.2em;
  margin-bottom: 0.6em;
  line-height: 1.25;
}

.mtp-rendered-html p {
  margin-top: 0;
  margin-bottom: 1em;
  line-height: 1.6;
}

.mtp-rendered-html ul,
.mtp-rendered-html ol {
  padding-left: 2em;
  margin-bottom: 1em;
}

.mtp-rendered-html li {
  margin-bottom: 0.3em;
}

.mtp-rendered-html blockquote {
  margin: 1em 0;
  padding: 8px 16px;
  color: #64748b;
  border-left: 4px solid #cbd5e1;
}

.mtp-rendered-html img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.mtp-rendered-html table {
  margin: 1em 0;
}

/* Loading Overlay */
.mtp-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: #ffffff;
}

.mtp-spinner {
  width: 48px;
  height: 48px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: mtp-spin 0.8s ease-in-out infinite;
  margin-bottom: 16px;
}

@keyframes mtp-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Non-Overlapping Left & Right Sidebar Ads Layout */
.appscms-sidebar-left,
.appscms-sidebar-right,
.appscms-left-sidebar,
.appscms-right-sidebar {
  z-index: 100000 !important;
}

@media (min-width: 1400px) {
  #mtp-workspace-section {
    padding-left: 230px;
    padding-right: 230px;
    transition: padding 0.2s ease;
  }
}

@media (max-width: 1399px) {
  #mtp-workspace-section {
    padding-left: 0;
    padding-right: 0;
  }

  .appscms-sidebar-left,
  .appscms-sidebar-right,
  .appscms-left-sidebar,
  .appscms-right-sidebar {
    display: none !important;
  }
}