/* Tools Section Styles */

/* Tool Sections Base Styles */
#smartOptimizerSection,
#markdownSection,
#tokenSection,
#csvSection {
  display: none;
  padding: 1rem;
  max-width: 900px;
  margin: 0 auto 3rem;
}

#markdownSection {
  max-width: 1200px;
  margin: 0 auto 2rem;
}

#smartOptimizerSection.open,
#markdownSection.open,
#tokenSection.open,
#csvSection.open {
  display: block;
}

/* Markdown Section */
#markdownSection textarea,
#tokenSection textarea {
  width: 100%;
  font-family: var(--mono);
  resize: vertical;
  box-sizing: border-box;
}

#mdInput {
  max-height: 45rem;
}

.markdown-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.markdown-header-text h2 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.02em;
}

.markdown-subtitle {
  margin: .35rem 0 0 0;
  color: var(--muted);
  font-size: .95rem;
}

.markdown-header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .35rem;
}

.markdown-action-group {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.markdown-file-btn {
  white-space: nowrap;
}

/* Markdown Guide */
.markdown-guide {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.markdown-guide summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--fg);
}

.markdown-guide[open] summary {
  margin-bottom: .5rem;
}

.markdown-guide-body {
  font-size: .85rem;
  color: var(--fg);
}

.markdown-guide-lead {
  margin: 0;
  color: var(--muted);
}

.markdown-guide-action {
  margin-top: .35rem;
  margin-bottom: .75rem;
}

.markdown-guide-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
}

@media (max-width: 900px) {
  .markdown-guide-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .markdown-guide-grid {
    grid-template-columns: 1fr;
  }
}

.markdown-guide-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .5rem .6rem;
}

.markdown-guide-item pre {
  margin: .35rem 0 0 0;
  background: transparent;
  border: none;
  padding: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.markdown-guide-item code {
  font-family: var(--mono);
  color: var(--fg);
}

.markdown-guide-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}

.markdown-import-help {
  color: var(--muted);
  font-size: .8rem;
}

/* Markdown Layout */
.markdown-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
}

.markdown-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.markdown-panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  padding: 1rem 1.25rem .75rem;
  border-bottom: 1px solid var(--border);
}

.markdown-panel-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--fg);
}

.markdown-panel-subtitle {
  margin: .25rem 0 0 0;
  font-size: .8rem;
  color: var(--muted);
}

.markdown-panel-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.markdown-panel-body {
  padding: 1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.markdown-textarea-label {
  display: block;
}

.markdown-textarea {
  min-height: 30rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .75rem;
  line-height: 1.5;
  overflow-y: auto;
}

.markdown-input-hint {
  font-size: .8rem;
  color: var(--muted);
}

.markdown-banner {
  background: var(--info-bg, #e6f4f8);
  border: 1px solid var(--info-border, #cbe7f0);
  color: var(--info-fg, #0c5460);
  padding: .5rem .75rem;
  border-radius: var(--radius);
  font-size: .8rem;
}

@media (min-width: 900px) {
  .markdown-layout {
    grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr);
  }
}

@media (max-width: 800px) {
  .markdown-header {
    flex-direction: column;
    align-items: stretch;
  }

  .markdown-header-actions {
    align-items: flex-start;
  }

  .markdown-action-group {
    justify-content: flex-start;
  }
}

/* =====================================================
   TOKEN ESTIMATOR - Professional Redesign
   ===================================================== */

/* Header Section */
.token-header {
  margin-bottom: 1.5rem;
  text-align: center;
}

.token-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.02em;
}

.token-subtitle {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0;
}

/* Token Metrics Display */
.token-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 500px) {
  .token-metrics {
    grid-template-columns: 1fr;
  }
}

.token-metric-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.token-metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.token-metric-primary {
  border-color: var(--primary);
  background: linear-gradient(135deg, 
    rgba(var(--primary-rgb), 0.08) 0%, 
    rgba(var(--primary-rgb), 0.02) 100%);
}

.token-metric-icon {
  font-size: 2rem;
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: 10px;
}

.token-metric-primary .token-metric-icon {
  background: rgba(var(--primary-rgb), 0.15);
}

.token-metric-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.token-metric-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.token-metric-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--fg);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.token-metric-primary .token-metric-value {
  color: var(--primary);
}

/* Text Input Wrapper */
.token-input-wrapper {
  margin-bottom: 1rem;
}

.token-input-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 0.5rem;
}

.token-textarea {
  width: 100%;
  min-height: 280px;
  padding: 1rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--fg);
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 10px;
  resize: vertical;
  box-sizing: border-box;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.token-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.token-textarea::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.token-input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.token-input-hint {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
}

/* Advanced Settings */
.token-settings {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.token-settings-trigger {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition: background 0.2s ease;
}

.token-settings-trigger::-webkit-details-marker {
  display: none;
}

.token-settings-trigger:hover {
  background: var(--card);
}

.token-settings-icon {
  font-size: 1.1rem;
}

.token-settings-chevron {
  margin-left: auto;
  font-size: 0.65rem;
  transition: transform 0.2s ease;
  color: var(--muted);
}

.token-settings[open] .token-settings-chevron {
  transform: rotate(180deg);
}

.token-settings-content {
  padding: 1rem 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--card);
}

.token-settings-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.token-setting-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  min-width: 120px;
}

.token-setting-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.token-setting-input {
  width: 100%;
  max-width: 120px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.token-setting-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
}

.token-settings-help {
  margin: 1rem 0 0;
  padding: 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--bg-secondary);
  border-radius: 6px;
  line-height: 1.5;
}

.token-settings-help strong {
  color: var(--fg);
}

/* Button Icon */
.btn-icon {
  margin-right: 0.25rem;
}

/* Dark Mode Adjustments */
:root[data-theme="dark"] .token-metric-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

:root[data-theme="dark"] .token-settings {
  background: #252525;
}

:root[data-theme="dark"] .token-settings-content {
  background: #2a2a2a;
}

:root[data-theme="dark"] .token-settings-help {
  background: #252525;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .token-metric-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  }
  
  :root:not([data-theme="light"]) .token-settings {
    background: #252525;
  }
  
  :root:not([data-theme="light"]) .token-settings-content {
    background: #2a2a2a;
  }
  
  :root:not([data-theme="light"]) .token-settings-help {
    background: #252525;
  }
}

/* Legacy metric-card styles (kept for compatibility) */
.token-estimates {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .75rem;
  margin: .5rem 0 1rem 0;
}

.metric-card {
  background: var(--card);
  border: 1px solid #e5e7eb;
  border-radius: var(--radius);
  padding: .75rem .9rem;
  box-shadow: var(--shadow);
}

.metric-card.primary {
  border-color: #2563eb;
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.12), rgba(37, 99, 235, 0.04));
}

.metric-label {
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.metric-value {
  font-size: 2rem;
  line-height: 1.2;
  font-weight: 800;
  margin-top: .2rem;
}

.metric-sub {
  margin-top: .25rem;
  font-size: .8rem;
  color: var(--muted);
}

:root[data-theme="dark"] .metric-card {
  border-color: #2a2a2a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .metric-card {
    border-color: #2a2a2a;
  }
}

/* Markdown Preview */
#mdPreview {
  background: var(--bg-secondary);
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: auto;
  min-height: 280px;
}

#mdPreview h1,
#mdPreview h2,
#mdPreview h3,
#mdPreview h4,
#mdPreview h5,
#mdPreview h6 {
  font-weight: 700;
  line-height: 1.25;
  margin: 1rem 0 .5rem 0;
}

#mdPreview h1 { font-size: 1.6rem; }
#mdPreview h2 { font-size: 1.35rem; }
#mdPreview h3 { font-size: 1.15rem; }

#mdPreview pre {
  background: var(--bg-secondary);
  color: var(--fg);
  padding: .5rem;
  border-radius: var(--radius);
  overflow: auto;
  border: 1px solid var(--border);
}

#mdPreview code {
  font-family: var(--mono);
  color: var(--fg);
}

#mdPreview a {
  color: #0d6efd;
  text-decoration: underline;
}

#mdPreview a:hover,
#mdPreview a:focus-visible {
  color: #0a58ca;
}

#mdPreview strong {
  font-weight: 700;
}

#mdPreview em {
  font-style: italic;
}

/* Markdown Task Lists */
#mdPreview ul.contains-task-list {
  margin: .15rem 0;
  padding-left: 0;
}

#mdPreview ul.contains-task-list li {
  margin: 0;
  padding: 0;
}

#mdPreview ul,
#mdPreview ol {
  margin: .35rem 0 .5rem 1.25rem;
}

#mdPreview li > p {
  margin: 0;
}

#mdPreview .task-list-item {
  list-style: none;
  padding: 0;
  border: none;
  margin: 0;
  line-height: 1.15;
}

#mdPreview .task-list-item-checkbox {
  margin: 0;
  transform: none;
  accent-color: var(--primary, #2563eb);
  flex: 0 0 auto;
  align-self: center;
}

#mdPreview .contains-task-list {
  padding-left: .4rem;
}

#mdPreview .task-list-item-label {
  display: inline;
  border: none;
  margin: 0;
  line-height: 1.15;
}

#mdPreview .task-list-item > p {
  margin: 0;
  display: flex;
  align-items: center;
  gap: .3rem;
}

#mdPreview .task-list-item p {
  margin: 0;
}

#mdPreview .task-list-item + .task-list-item {
  margin-top: 0;
}

#mdPreview .contains-task-list li {
  margin-bottom: 0;
}

#mdPreview .contains-task-list > li {
  margin: 0;
  padding: 0;
}

#mdPreview .contains-task-list li + li {
  margin-top: 0;
}

/* CSV Section */
.info {
  background: var(--info-bg, #e6f4f8);
  border: 1px solid var(--info-border, #cbe7f0);
  color: var(--info-fg, #0c5460);
  padding: 12px;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: .85rem;
}

.error {
  background: var(--error-bg, #f8d7da);
  border: 1px solid var(--error-border, #f5c6cb);
  color: var(--error-fg, #721c24);
  padding: 12px;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  display: none;
  font-size: .85rem;
}

/* Message states */
.error-message {
  display: block;
  background-color: var(--error-bg, #f8d7da);
  border-color: var(--error-border, #f5c6cb);
  color: var(--error-fg, #721c24);
}

.success-message {
  display: block;
  background-color: var(--success-bg, #d4edda);
  border-color: var(--success-border, #c3e6cb);
  color: var(--success-fg, #155724);
}

.file-list {
  margin: 1rem 0;
  padding: .75rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 50px;
  font-size: .9rem;
}

.file-item {
  padding: .5rem .75rem;
  margin: .4rem 0;
  background: var(--card);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: .75rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}

.file-name {
  flex: 1 1 auto;
  min-width: 180px;
}

.file-minimize-option {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .2rem .5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--fg);
  font-size: .78rem;
  white-space: nowrap;
}

.file-minimize-option input {
  margin: 0;
}

.file-item .remove-file {
  margin-left: auto;
}

.remove-file {
  background: var(--danger, #dc3545);
  color: #fff;
  border: none;
  padding: .25rem .5rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: .75rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.remove-file:hover {
  background: #c82333;
  transform: scale(1.05);
}

.remove-file:active {
  transform: scale(0.95);
}

#csvOutput {
  width: 100%;
  min-height: 400px;
  padding: .75rem;
  border: 1px solid #d1d5db;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: .8rem;
  resize: vertical;
  background: var(--card);
}

.action-buttons {
  display: flex;
  gap: .5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.csv-actions {
  align-items: center;
}

.csv-output-actions {
  margin: .25rem 0 .75rem 0;
}

.csv-output-notices {
  margin-bottom: .75rem;
}

.csv-output-notices .info {
  margin: 0 0 .75rem 0;
}

.csv-output-notices .info:last-child {
  margin-bottom: 0;
}

.csv-token-estimate {
  margin: 0 0 .75rem 0;
  font-weight: 700;
  color: var(--fg);
}

.csv-token-estimate-row {
  font-size: 1rem;
}

.csv-token-estimate-row[hidden] {
  display: none;
}

.csv-token-estimate-muted {
  font-weight: 500;
  color: var(--muted);
  font-size: .9rem;
  margin-top: .2rem;
}

.csv-actions .csv-file-btn {
  flex: 0 0 auto;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-base);
  min-height: 40px;
  white-space: nowrap;
  background: var(--surface-secondary);
  color: var(--text-primary);
  border: 2px solid var(--border-primary);
  box-shadow: var(--shadow-sm);
  transform: none;
}

.csv-actions .csv-file-btn:hover {
  background: var(--surface-tertiary);
  border-color: var(--border-secondary);
  box-shadow: var(--shadow-md);
  color: var(--text-primary);
  transform: none;
}

.csv-inline-option {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .35rem .6rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  font-size: .85rem;
  min-height: 38px;
}

.csv-inline-option input {
  margin: 0;
}

.csv-inline-help {
  display: block;
  margin: -.4rem 0 1rem 0;
  color: var(--muted);
  font-size: .8rem;
}

.csv-reconcat-notice {
  margin: -.5rem 0 .75rem 0;
  padding: .45rem .7rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--fg);
  font-size: .85rem;
  font-weight: 600;
}

.markdown-buttons {
  display: flex;
  gap: .5rem;
  margin: 0;
  flex-wrap: wrap;
}

/* History Modal */
.history-entry {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.history-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .5rem;
}

.history-entry-time {
  font-weight: 600;
  color: var(--muted);
}

.history-entry-preview {
  background: #f3f4f6;
  padding: .5rem;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: .8rem;
  max-height: 200px;
  overflow: auto;
  margin: .5rem 0;
}

/* Dark mode adjustments for tools */
:root[data-theme="dark"] .file-list {
  background: #1a1a1a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .file-list {
    background: #1a1a1a;
  }
}

:root[data-theme="dark"] .info {
  background: #1e3a4a;
  border-color: #2e5a7a;
  color: #8ac5e1;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .info {
    background: #1e3a4a;
    border-color: #2e5a7a;
    color: #8ac5e1;
  }
}

:root[data-theme="dark"] .history-entry-preview {
  background: #1a1a1a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .history-entry-preview {
    background: #1a1a1a;
  }
}

/* Enhanced Markdown Preview Styles */

/* Professional Table Styling */
.markdown-table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border-radius: 8px;
  overflow: hidden;
}

.markdown-table-head {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.markdown-table-header {
  padding: 12px 16px;
  font-weight: 600;
  text-align: left;
  border-bottom: 2px solid #dee2e6;
  color: #495057;
}

.markdown-table-body .markdown-table-row:nth-child(even) {
  background-color: #f8f9fa;
}

.markdown-table-cell {
  padding: 10px 16px;
  border-bottom: 1px solid #dee2e6;
  vertical-align: top;
}

/* Task List Styling */
.task-list-item {
  list-style: none;
  margin: 0.25rem 0;
  padding-left: 0;
}

.task-list-checkbox {
  margin-right: 0.5rem;
  transform: scale(1.1);
  accent-color: #0066cc;
}

.task-list-item input[type="checkbox"]:checked + * {
  text-decoration: line-through;
  opacity: 0.7;
  color: #6c757d;
}

/* Callout/Alert Styling */
.markdown-callout {
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 8px;
  border-left: 4px solid;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.callout-icon {
  font-size: 1.25em;
  flex-shrink: 0;
  margin-top: 0.1em;
}

.callout-content {
  flex: 1;
  font-weight: 500;
}

.callout-info {
  background-color: #e3f2fd;
  border-left-color: #2196f3;
  color: #1565c0;
}

.callout-warning {
  background-color: #fff3e0;
  border-left-color: #ff9800;
  color: #e65100;
}

.callout-danger {
  background-color: #ffebee;
  border-left-color: #f44336;
  color: #c62828;
}

.callout-success {
  background-color: #e8f5e8;
  border-left-color: #4caf50;
  color: #2e7d32;
}

.callout-note {
  background-color: #f3e5f5;
  border-left-color: #9c27b0;
  color: #7b1fa2;
}

.callout-tip {
  background-color: #e0f2f1;
  border-left-color: #009688;
  color: #00695c;
}

/* Enhanced Code Block Styling */
.markdown-code-block {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  padding: 1rem;
  margin: 1rem 0;
  overflow-x: auto;
  font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', monospace;
  font-size: 0.875rem;
  line-height: 1.5;
}

.markdown-code-block code {
  background: none;
  padding: 0;
  border: none;
}

/* Enhanced Blockquote Styling */
.markdown-blockquote {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: #f8f9fa;
  border-left: 4px solid #6c757d;
  border-radius: 0 6px 6px 0;
  font-style: italic;
  color: #495057;
}

/* Word Export Button Enhancement */
.word-export-button {
  background: linear-gradient(135deg, #2b5ce6 0%, #1a4bb8 100%);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(43, 92, 230, 0.2);
}

.word-export-button:hover {
  background: linear-gradient(135deg, #1a4bb8 0%, #164494 100%);
  box-shadow: 0 4px 8px rgba(43, 92, 230, 0.3);
  transform: translateY(-1px);
}

.word-export-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(43, 92, 230, 0.2);
}

/* Dark Mode Enhancements */
:root[data-theme="dark"] .markdown-table {
  background: #2d3748;
  color: #e2e8f0;
}

:root[data-theme="dark"] .markdown-table-head {
  background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

:root[data-theme="dark"] .markdown-table-header {
  color: #e2e8f0;
  border-bottom-color: #4a5568;
}

:root[data-theme="dark"] .markdown-table-body .markdown-table-row:nth-child(even) {
  background-color: #3a4556;
}

:root[data-theme="dark"] .markdown-table-cell {
  border-bottom-color: #4a5568;
}

:root[data-theme="dark"] .markdown-code-block {
  background: #2d3748;
  border-color: #4a5568;
  color: #e2e8f0;
}

:root[data-theme="dark"] .markdown-blockquote {
  background: #2d3748;
  color: #a0aec0;
}

:root[data-theme="dark"] #mdPreview a {
  color: #7fb3ff;
}

:root[data-theme="dark"] #mdPreview a:hover,
:root[data-theme="dark"] #mdPreview a:focus-visible {
  color: #a7c9ff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .markdown-table {
    background: #2d3748;
    color: #e2e8f0;
  }

  :root:not([data-theme="light"]) .markdown-table-head {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
  }

  :root:not([data-theme="light"]) .markdown-code-block {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
  }

  :root:not([data-theme="light"]) #mdPreview a {
    color: #7fb3ff;
  }

  :root:not([data-theme="light"]) #mdPreview a:hover,
  :root:not([data-theme="light"]) #mdPreview a:focus-visible {
    color: #a7c9ff;
  }

}
