/* 
 * DeepSeek去星号 - Markdown转TXT工具
 * 版本: 1.0.0
 * 描述: 一款在线工具，可以将Markdown格式文本快速转换为纯文本(TXT)格式
 * 作者: TownBoats
 */

 :root {
  --bg-color: #f8f9fa;
  --editor-bg: #ffffff;
  --text-color: #333333;
  --accent-color: #4a6ee0;
  --border-color: #dddddd;
  --button-hover: #e8eeff;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --primary: #5865f2;
  --primary-hover: #4752c4;
  --secondary: #e2e8f0;
  --secondary-hover: #cbd5e1;
  --editor-height: 70vh;
  --font-mono: "Courier New", Courier, monospace;
}

.dark {
  --primary: #818cf8;
  --primary-hover: #6366f1;
  --secondary: #4b5563;
  --secondary-hover: #6b7280;
  --bg-color: #121212;
  --editor-bg: #1e1e1e;
  --text-color: #e0e0e0;
  --border-color: #2d2d2d;
  --button-hover: #3a3a3a;
  --shadow-color: rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans",
    "Helvetica Neue", sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  transition: background-color 0.3s, color 0.3s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 1rem;
  background-color: var(--accent-color);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 5px var(--shadow-color);
}

.app-title {
  font-size: 1.5rem;
  font-weight: bold;
}

.theme-toggle {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.3rem 0.6rem;
  border-radius: 50%;
  transition: background-color 0.3s;
}

.theme-toggle:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

main {
  flex: 1;
  display: flex;
  flex-direction: row;
  padding: 1rem;
  gap: 1rem;
}

.editor-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.editor-label {
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.font-controls {
  display: flex;
  gap: 0.5rem;
}

.font-control-btn {
  background: var(--editor-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s;
}

.font-control-btn:hover {
  background-color: var(--button-hover);
}

.editor {
  width: 100%;
  height: calc(100vh - 180px);
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--editor-bg);
  resize: none;
  font-family: "Courier New", Courier, monospace;
  line-height: 1.5;
  tab-size: 4;
  overflow: auto;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

#markdown-editor,
#txt-preview {
  height: var(--editor-height);
  min-height: 300px;
  font-family: var(--font-mono);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1rem;
  background-color: var(--bg-color);
  border-top: 1px solid var(--border-color);
  justify-content: center;
}

.btn {
  background-color: var(--editor-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background-color 0.2s, transform 0.1s;
}

.btn:hover {
  background-color: var(--button-hover);
}

.btn:active {
  transform: translateY(1px);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--secondary);
  color: #475569;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dark .btn-secondary {
  color: #e2e8f0;
}

.btn-secondary:hover {
  background-color: var(--secondary-hover);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(0);
}

.file-input {
  display: none;
}

.settings-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.settings-panel {
  background-color: var(--editor-bg);
  padding: 1.5rem;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 12px var(--shadow-color);
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-color);
}

.setting-group {
  margin-bottom: 1.5rem;
}

.setting-title {
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.range-input {
  flex: 1;
  margin: 0 0.5rem;
}

.notification {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 0.8rem 1.2rem;
  background-color: #5865f2;
  color: white;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  z-index: 1000;
}

.notification.show {
  transform: translateY(0);
  opacity: 1;
}

/* 移动端适配 */
@media (max-width: 768px) {
  main {
    flex-direction: column;
  }

  .editor {
    height: 40vh;
  }

  .actions {
    justify-content: center;
  }

  #markdown-editor,
  #txt-preview {
    height: 40vh;
  }

  :root {
    --editor-height: 40vh;
  }
}

/* 动画过渡效果 */
.fade-enter {
  opacity: 0;
}

.fade-enter-active {
  opacity: 1;
  transition: opacity 0.3s;
}

.fade-exit {
  opacity: 1;
}

.fade-exit-active {
  opacity: 0;
  transition: opacity 0.3s;
}

/* Toastify自定义样式 */
.toastify {
  border-radius: 8px !important;
  font-family: "Inter", sans-serif !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
}

/* 美化滚动条 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(156, 163, 175, 0.5);
  border-radius: 20px;
}

.dark ::-webkit-scrollbar-thumb {
  background-color: rgba(75, 85, 99, 0.5);
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(107, 114, 128, 0.7);
}

.dark ::-webkit-scrollbar-thumb:hover {
  background-color: rgba(107, 114, 128, 0.7);
}

/* 自定义按钮样式 */
.btn-icon-text {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: white;
  color: #475569;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  transition: all 0.2s;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dark .btn-icon-text {
  background-color: #1f2937;
  color: #e2e8f0;
  border-color: #374151;
}

.btn-icon-text:hover {
  background-color: #f8fafc;
  transform: translateY(-1px);
}

.dark .btn-icon-text:hover {
  background-color: #374151;
}

.btn-icon-text:active {
  transform: translateY(0);
}

/* 打印样式优化 */
@media print {
  header,
  footer,
  .settings-container,
  .notification {
    display: none !important;
  }

  body {
    background-color: white;
  }

  main {
    display: block;
  }

  #markdown-editor {
    display: none;
  }

  #txt-preview {
    height: auto;
    overflow: visible;
    border: none;
    font-size: 12pt;
    line-height: 1.5;
    color: black;
    background: white;
  }
}

/* 无障碍优化 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* 性能优化 - 减少重绘和重排 */
.hardware-accelerated {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* 添加SEO相关的样式 */
.seo-heading {
  font-size: 0;
  height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

/* 添加响应式图片支持 */
img {
  max-width: 100%;
  height: auto;
}

/* 添加焦点样式，提高可访问性 */
:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* 添加键盘导航支持 */
.keyboard-focus:focus {
  box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.5);
}

/* 添加高对比度模式支持 */
@media (prefers-contrast: high) {
  :root {
    --accent-color: #0000ff;
    --text-color: #000000;
    --bg-color: #ffffff;
    --border-color: #000000;
  }

  .dark {
    --accent-color: #ffff00;
    --text-color: #ffffff;
    --bg-color: #000000;
    --border-color: #ffffff;
  }
}

/* 添加减少动画模式支持 */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
