/* ==========================================================================
   tools.css —— 新增工具 (Cron / Diff / Markdown / 格式转换 / 加解密 / 文件哈希 / 图片)
   与主设计系统共用设计令牌。
   ========================================================================== */

/* ---------- 通用: 行内 code ---------- */
.alert code,
.msg code {
  font-family: var(--mono);
  font-size: 12px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(139, 92, 246, 0.12);
  color: var(--grape);
}

/* ============================ Cron ============================ */
.run-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.run-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.85);
  animation: fadeUp 0.4s var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 40ms);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s;
}
.run-item:hover {
  transform: translateX(3px);
  box-shadow: var(--sh-xs);
}
.run-idx {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
}
.run-time {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-700);
}
.run-rel {
  margin-left: auto;
  font-size: 12px;
  color: var(--violet);
  font-weight: 650;
}

/* ============================ Diff ============================ */
.diff-inputs,
.conv-split,
.md-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.diff-inputs .textarea {
  min-height: 190px;
}
.diff-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.ds {
  font-size: 12.5px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(131, 122, 153, 0.12);
  color: var(--ink-500);
}
.ds.add {
  background: rgba(22, 163, 74, 0.14);
  color: #15803d;
}
.ds.del {
  background: rgba(190, 40, 60, 0.13);
  color: #b4232a;
}
.ds.ok {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}
.ds.warn {
  background: rgba(217, 119, 6, 0.15);
  color: #b45309;
}
.diff-view {
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.5);
  max-height: 560px;
  overflow-y: auto;
}
.diff-row {
  display: flex;
  align-items: flex-start;
  font-family: var(--mono);
  font-size: 12.4px;
  line-height: 1.6;
  border-bottom: 1px solid rgba(139, 92, 246, 0.08);
}
.diff-row:last-child {
  border-bottom: none;
}
.diff-row.add {
  background: rgba(22, 163, 74, 0.1);
}
.diff-row.del {
  background: rgba(190, 40, 60, 0.09);
}
.diff-ln {
  width: 46px;
  flex-shrink: 0;
  text-align: right;
  padding: 2px 8px;
  color: var(--ink-300);
  user-select: none;
  font-size: 11px;
  border-right: 1px solid rgba(139, 92, 246, 0.1);
}
.diff-sign {
  width: 22px;
  flex-shrink: 0;
  text-align: center;
  font-weight: 700;
  color: var(--ink-400);
}
.diff-row.add .diff-sign {
  color: #15803d;
}
.diff-row.del .diff-sign {
  color: #b4232a;
}
.diff-text {
  flex: 1;
  padding: 2px 10px 2px 2px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink-700);
}

/* ============================ Markdown ============================ */
.md-src {
  min-height: 460px;
}
.md-preview {
  min-height: 460px;
  max-height: 640px;
  overflow: auto;
  padding: 18px 20px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--sh-xs), inset 0 1px 2px rgba(76, 45, 140, 0.05);
}
.md-body {
  font-size: 14px;
  line-height: 1.78;
  color: var(--ink-800);
  word-wrap: break-word;
}
.md-body > *:first-child {
  margin-top: 0;
}
.md-body h1,
.md-body h2,
.md-body h3,
.md-body h4 {
  margin: 20px 0 10px;
  font-weight: 750;
  line-height: 1.35;
  color: var(--ink-900);
}
.md-body h1 {
  font-size: 24px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(139, 92, 246, 0.18);
}
.md-body h2 {
  font-size: 20px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(139, 92, 246, 0.12);
}
.md-body h3 {
  font-size: 16.5px;
}
.md-body p {
  margin: 10px 0;
}
.md-body ul,
.md-body ol {
  margin: 10px 0;
  padding-left: 24px;
}
.md-body li {
  margin: 4px 0;
}
.md-body li input[type="checkbox"] {
  margin-right: 6px;
}
.md-body a {
  color: var(--violet);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.md-body blockquote {
  margin: 12px 0;
  padding: 6px 16px;
  border-left: 3px solid var(--lilac);
  background: rgba(167, 139, 250, 0.09);
  border-radius: 0 10px 10px 0;
  color: var(--ink-500);
}
.md-body code {
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(139, 92, 246, 0.12);
  color: var(--grape);
}
.md-body pre {
  margin: 12px 0;
  padding: 14px 16px;
  border-radius: var(--r-sm);
  background: rgba(46, 39, 66, 0.055);
  border: 1px solid rgba(139, 92, 246, 0.14);
  overflow-x: auto;
}
.md-body pre code {
  background: none;
  padding: 0;
  color: var(--ink-700);
}
.md-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
  font-size: 13px;
}
.md-body th,
.md-body td {
  border: 1px solid rgba(139, 92, 246, 0.2);
  padding: 7px 12px;
  text-align: left;
}
.md-body th {
  background: rgba(167, 139, 250, 0.12);
  font-weight: 700;
}
.md-body hr {
  border: none;
  border-top: 1px solid rgba(139, 92, 246, 0.2);
  margin: 18px 0;
}
.md-body img {
  max-width: 100%;
  border-radius: 10px;
}

/* ============================ 拖拽上传区 ============================ */
.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 52px 20px;
  border-radius: var(--r-lg);
  border: 2px dashed rgba(139, 92, 246, 0.34);
  background: rgba(255, 255, 255, 0.42);
  color: var(--ink-400);
  cursor: pointer;
  transition: background 0.3s, border-color 0.3s, transform 0.3s var(--ease-out);
}
.drop-zone:hover,
.drop-zone.over {
  background: rgba(167, 139, 250, 0.14);
  border-color: var(--violet);
  transform: translateY(-2px);
}
.drop-zone b {
  font-size: 15px;
  color: var(--ink-700);
}
.drop-zone span:last-of-type {
  font-size: 12px;
  color: var(--ink-300);
}

/* ============================ 文件哈希 ============================ */
.fh-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.fh-item {
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: var(--sh-xs);
  animation: fadeUp 0.45s var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 45ms);
}
.fh-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.fh-name {
  font-weight: 700;
  color: var(--ink-800);
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 46%;
}
.fh-size {
  font-size: 12px;
  color: var(--ink-400);
}
.fh-head .btn {
  margin-left: auto;
}
.fh-bar {
  height: 5px;
  border-radius: 999px;
  margin-top: 10px;
  background: rgba(139, 92, 246, 0.14);
  overflow: hidden;
}
.fh-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #b39dff, #8b5cf6);
  transition: width 0.25s var(--ease-out);
}
.fh-hashes {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fh-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 11px;
  border-radius: 9px;
  background: rgba(139, 92, 246, 0.06);
}
.fh-algo {
  flex-shrink: 0;
  width: 62px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--violet);
  letter-spacing: 0.02em;
}
.fh-val {
  flex: 1;
  font-family: var(--mono);
  font-size: 11.8px;
  color: var(--ink-600, var(--ink-500));
  word-break: break-all;
  line-height: 1.5;
}
.fh-err {
  margin-top: 8px;
  font-size: 12.5px;
  color: #b4232a;
}

/* ============================ 图片工具箱 ============================ */
.img-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  margin-bottom: 16px;
}
.img-toolbar .field {
  width: 130px;
  margin-bottom: 0;
}
.img-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.img-pane .label {
  margin-bottom: 8px;
}
.img-box {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  padding: 10px;
  border-radius: var(--r-md);
  background:
    linear-gradient(45deg, rgba(139, 92, 246, 0.06) 25%, transparent 25%) 0 0 / 18px 18px,
    linear-gradient(-45deg, rgba(139, 92, 246, 0.06) 25%, transparent 25%) 0 9px / 18px 18px,
    linear-gradient(45deg, transparent 75%, rgba(139, 92, 246, 0.06) 75%) 9px -9px / 18px 18px,
    linear-gradient(-45deg, transparent 75%, rgba(139, 92, 246, 0.06) 75%) -9px 0 / 18px 18px,
    rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.85);
  overflow: hidden;
}
.img-box img {
  max-width: 100%;
  max-height: 420px;
  border-radius: 8px;
  box-shadow: var(--sh-sm);
}
.ratio {
  margin-left: 8px;
  font-weight: 750;
  font-style: normal;
}
.ratio.good {
  color: #15803d;
}
.ratio.bad {
  color: #b45309;
}

/* ============================ 收藏 / 主题 / 面板操作 ============================ */
.cat-sep {
  height: 1px;
  margin: 8px 10px;
  background: var(--hairline-soft);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  color: var(--ink-400);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: var(--sh-xs);
  transition: transform 0.28s var(--ease-spring), color 0.25s, background 0.28s, box-shadow 0.28s;
}
.icon-btn:hover {
  transform: translateY(-2px);
  color: var(--violet);
  background: rgba(255, 255, 255, 0.85);
  box-shadow: var(--sh-sm);
}
.icon-btn:active {
  transform: translateY(0) scale(0.95);
}
.icon-btn.active {
  color: #fff;
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
  border-color: transparent;
  box-shadow: var(--sh-glow);
}
.icon-btn.active svg {
  fill: currentColor;
}

.tile-star {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: var(--ink-300);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.85);
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.25s var(--ease-out), transform 0.3s var(--ease-spring), color 0.2s, background 0.2s;
}
.tile:hover .tile-star,
.tile-star.on {
  opacity: 1;
  transform: scale(1);
}
.tile-star:hover {
  color: var(--violet);
  background: #fff;
}
.tile-star.on {
  color: #fff;
  background: linear-gradient(135deg, #f0abfc, #a855f7);
  border-color: transparent;
}
.tile-star.on svg {
  fill: currentColor;
}

.panel-acts {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ============================ 响应式 ============================ */
@media (max-width: 760px) {
  .diff-inputs,
  .conv-split,
  .md-split,
  .img-compare {
    grid-template-columns: 1fr;
  }
  .md-preview,
  .md-src {
    min-height: 300px;
  }
  .fh-name {
    max-width: 100%;
  }
}
