/* tux.fan Toolbox — shared style for built-in tools
 * Loaded by every individual tool page. Changes here affect all tools.
 * Each tool's <body> gets .tool-page so this CSS only activates in tool pages.
 */

.tool-page {
  background: #f7f8fa;
  color: #111827;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.55;
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.tool-page * { box-sizing: border-box; }
.tool-page a { color: #dc2626; text-decoration: none; }
.tool-page a:hover { text-decoration: underline; }

/* Header */
.tool-page .tool-header {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 20px 0;
}
.tool-page .tool-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.tool-page .tool-header h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  color: #111827;
}
.tool-page .tool-header .tool-subtitle {
  font-size: 13px;
  color: #6b7280;
  margin-top: 4px;
}
.tool-page .tool-header .tool-nav {
  font-size: 13px;
  color: #6b7280;
}
.tool-page .tool-header .tool-nav a { margin-left: 14px; }

/* Lang switch */
.tool-page .lang-switch {
  display: flex;
  gap: 4px;
  background: #f7f8fa;
  padding: 3px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}
.tool-page .lang-btn {
  padding: 4px 12px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 0;
}
.tool-page .lang-btn.active {
  background: #ffffff;
  color: #111827;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.tool-page .lang-btn:hover:not(.active) { color: #111827; }

/* Main */
.tool-page main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px;
}

/* Tool layout */
.tool-page .tool-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
}
.tool-page .tool-panel {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.tool-page .tool-panel h2 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 12px;
  color: #111827;
}
.tool-page .tool-panel h2 .hint {
  font-size: 12px;
  font-weight: 400;
  color: #6b7280;
  margin-left: 8px;
}

/* Form controls */
.tool-page label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.tool-page input[type="text"],
.tool-page input[type="number"],
.tool-page select,
.tool-page textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  color: #111827;
  background: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
}
.tool-page input[type="text"]:focus,
.tool-page input[type="number"]:focus,
.tool-page select:focus,
.tool-page textarea:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}
.tool-page textarea {
  resize: vertical;
  min-height: 140px;
  line-height: 1.5;
}
.tool-page .row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.tool-page .row > * { flex: 1; min-width: 120px; }
.tool-page .row .auto { flex: 0 0 auto; min-width: 0; }

/* Buttons */
.tool-page .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  background: #dc2626;
  color: #ffffff;
  white-space: nowrap;
}
.tool-page .btn:hover { background: #b91c1c; }
.tool-page .btn:disabled { background: #d1d5db; cursor: not-allowed; }
.tool-page .btn-secondary {
  background: #ffffff;
  color: #111827;
  border-color: #e5e7eb;
}
.tool-page .btn-secondary:hover { background: #f7f8fa; border-color: #d1d5db; }
.tool-page .btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* Output area */
.tool-page .output {
  background: #f7f8fa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 14px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  color: #111827;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 360px;
  overflow: auto;
  min-height: 80px;
}
.tool-page .output:empty::before {
  content: "(empty)";
  color: #9ca3af;
  font-style: italic;
}
.tool-page .output.error { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }
.tool-page .output.ok { color: #166534; background: #f0fdf4; border-color: #bbf7d0; }

/* Stat row (for counters, sizes, etc.) */
.tool-page .stat-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #6b7280;
  margin: 8px 0 0;
}
.tool-page .stat-row .stat strong {
  color: #111827;
  font-weight: 700;
}

/* File drop zone */
.tool-page .dropzone {
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  padding: 22px;
  text-align: center;
  cursor: pointer;
  background: #ffffff;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.tool-page .dropzone:hover,
.tool-page .dropzone.dragover {
  border-color: #dc2626;
  background: #fef2f2;
}
.tool-page .dropzone input[type="file"] { display: none; }
.tool-page .dropzone p { margin: 0; font-size: 13px; color: #6b7280; }
.tool-page .dropzone .dz-name { font-weight: 600; color: #111827; margin-bottom: 4px; }

/* Preview box (for images) */
.tool-page .preview {
  max-width: 100%;
  max-height: 320px;
  display: block;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background-image:
    linear-gradient(45deg, #f3f4f6 25%, transparent 25%),
    linear-gradient(-45deg, #f3f4f6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f3f4f6 75%),
    linear-gradient(-45deg, transparent 75%, #f3f4f6 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

/* Color picker swatch */
.tool-page .swatch {
  width: 56px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Toast */
.tool-page .toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #111827;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
}
.tool-page .toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Footer */
.tool-page .tool-footer {
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
  padding: 18px 0;
  margin-top: 28px;
  font-size: 12px;
  color: #6b7280;
  text-align: center;
}
.tool-page .tool-footer a { color: #dc2626; }

/* zh tweaks */
body[data-lang="zh"] .tool-page label { text-transform: none; letter-spacing: 0; }

/* Responsive */
@media (max-width: 700px) {
  .tool-page main { padding: 18px 14px; }
  .tool-page .tool-panel { padding: 16px; }
  .tool-page .tool-header h1 { font-size: 19px; }
}