html,
body {
  height: 100%;
  font-size: 0.9rem;
  padding-top: 4rem;
}
.editor-container {
  height: 60vh;
  min-height: 400px;
}

.footer-nav {
  margin-bottom: 10px;
}

#editor,
#preview {
  height: 100%;
  resize: none;
  font-family: "Courier New", monospace;
  font-size: 0.85rem;
}

#preview {
  overflow-y: auto;
  border: 1px solid var(--bs-border-color);
  padding: 0.75rem;
  background-color: var(--bs-body-bg);
  color: var(--bs-body-color);
}

/* Force dark theme styling for preview */
[data-bs-theme="dark"] #preview {
  background-color: #212529 !important;
  color: #dee2e6 !important;
  border-color: #495057 !important;
}

/* Override any hardcoded backgrounds in preview content */
[data-bs-theme="dark"] #preview pre,
[data-bs-theme="dark"] #preview code,
[data-bs-theme="dark"] #preview .markdown-preview,
[data-bs-theme="dark"] #preview .rtf-preview,
[data-bs-theme="dark"] #preview .pdf-preview {
  background-color: #2b2b2b !important;
  color: #e9ecef !important;
  border-color: #444 !important;
}

[data-bs-theme="dark"] #preview div[style*="background: white"],
[data-bs-theme="dark"] #preview div[style*="background:white"],
[data-bs-theme="dark"] #preview div[style*="background:#fff"],
[data-bs-theme="dark"] #preview div[style*="background: #fff"] {
  background-color: #2b2b2b !important;
}

/* Specific styling for different preview types */
.markdown-preview {
  background: transparent;
  color: var(--bs-body-color);
  border: 1px solid var(--bs-border-color);
}

.rtf-preview {
  background: transparent;
  color: var(--bs-body-color);
  border: 1px solid var(--bs-border-color);
}

.pdf-preview {
  background: transparent;
  color: var(--bs-body-color);
}

.btn-sm {
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
}

.toolbar {
  gap: 0.25rem;
}

#saveStatus {
  font-size: 0.8rem;
  color: var(--bs-success);
}

.form-control-sm {
  font-size: 0.85rem;
}

.editor-area {
  height: 70vh;
  min-height: 300px;
}

.monospace {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
}

.split-col {
  height: 70vh;
  min-height: 300px;
  overflow: auto;
}

/* Mobile responsive adjustments */
@media (max-width: 991.98px) {
  .editor-area,
  .split-col {
    height: 50vh !important;
    min-height: 300px !important;
    overflow-y: auto;
  }

  .btn-group-sm .btn {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
  }

  .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  /* Equal height cards on mobile */
  .card {
    margin-bottom: 1rem;
  }

  .card:last-child {
    margin-bottom: 0;
  }
}

@media (max-width: 575.98px) {
  .editor-area,
  .split-col {
    height: 45vh !important;
    min-height: 250px !important;
    overflow-y: auto;
  }

  .btn-group {
    flex-wrap: wrap;
  }

  .btn-group-sm .btn {
    font-size: 0.65rem;
    padding: 0.15rem 0.3rem;
    margin: 1px;
    min-width: 2rem;
    white-space: nowrap;
  }

  /* Ensure proper spacing between sections */
  .row.g-2 > * {
    margin-bottom: 0.5rem;
  }
}
.preview.prose pre {
  padding: 0.75rem;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] .preview.prose pre {
  background: rgba(255, 255, 255, 0.1) !important;
}

/* Blockquote styling for preview */
.preview blockquote {
  border-left: 4px solid #ddd;
  margin: 0 0 16px;
  padding: 0 16px;
  color: #666;
  font-style: italic;
}

[data-bs-theme="dark"] .preview blockquote {
  border-left-color: #555;
  color: #ccc;
}

.preview blockquote p {
  margin-bottom: 0;
}

.preview blockquote p:last-child {
  margin-bottom: 0;
}

/* Cross-browser compatible tooltips */
.btn-group .btn {
  position: relative;
}

.tooltip-custom {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #000;
  color: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 1050;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
  pointer-events: none;
}

.tooltip-custom::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #000;
}

.tooltip-custom.show {
  opacity: 1;
  visibility: visible;
}

[data-bs-theme="dark"] .tooltip-custom {
  background: #fff;
  color: #000;
}

[data-bs-theme="dark"] .tooltip-custom::after {
  border-top-color: #fff;
}

@keyframes tooltip-fade-in {
  to {
    opacity: 1;
  }
}

/* Reduce space between wrapper and bottom navbar */
.wrapper {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
  min-height: calc(100vh - 30px) !important;
  display: flex;
  flex-direction: column;
}
