/* ============================================================
   tools.css — Unified styles for all /tools/* pages
   Uses existing CSS variables from theme files (no hardcoded colors)
   ============================================================ */

/* --- Tool container --- */
.tool-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --- Tool info banner (supported formats / privacy note) --- */
.tool-info {
  padding: 10px 14px;
  border-left: 3px solid var(--link-color);
  background: var(--code-background-color);
  color: var(--text-color);
  font-size: 0.9em;
  line-height: 1.5;
}

.tool-info strong {
  color: var(--heading-color);
}

/* --- Form sections --- */
.tool-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tool-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tool-field label {
  font-size: 0.9em;
  color: var(--heading-color);
  font-weight: bold;
}

.tool-field input:not([type="checkbox"]):not([type="radio"]),
.tool-field select,
.tool-field textarea {
  width: 100%;
  box-sizing: border-box;
}

/* --- Checkbox group --- */
.tool-checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tool-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.95em;
  color: var(--text-color);
}

.tool-checkbox-label input[type="checkbox"] {
  width: 20px;
  flex-shrink: 0;
}

/* --- Action row (buttons) --- */
.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* --- File input (styled as drop zone) --- */
.tool-file-input {
  position: relative;
  border: 2px dashed var(--code-border-color);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
  background: var(--code-background-color);
}

.tool-file-input:hover {
  border-color: var(--link-color);
}

.tool-file-input input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.tool-file-input-hint {
  color: var(--text-color);
  font-size: 0.92em;
  opacity: 0.7;
  pointer-events: none;
}

.tool-file-input-count {
  font-size: 0.85em;
  color: var(--link-color);
  margin-top: 4px;
  pointer-events: none;
}

/* --- Status message (errors only) --- */
.tool-status {
  font-size: 0.92em;
  color: #c0392b;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 0;
}

/* --- Result / download area --- */
.tool-results {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tool-result-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.92em;
}

.tool-result-item a {
  text-decoration: underline;
  word-break: break-all;
}

.tool-result-meta {
  opacity: 0.65;
  font-size: 0.85em;
  white-space: nowrap;
}

/* --- Text result panel (OCR output, metadata preview) --- */
.tool-output-panel {
  border: 2px solid var(--code-border-color);
  background: var(--code-background-color);
  padding: 12px;
  font-size: 0.88em;
  color: var(--code-color);
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  /* thin scrollbar */
  scrollbar-width: thin;
  scrollbar-color: var(--code-border-color) transparent;
}

.tool-output-panel::-webkit-scrollbar { width: 6px; }
.tool-output-panel::-webkit-scrollbar-thumb { background: var(--code-border-color); }
.tool-output-panel::-webkit-scrollbar-track { background: transparent; }

/* --- Output block inside panel (per-file) --- */
.tool-output-block {
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--code-border-color);
}

.tool-output-block:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.tool-output-block-title {
  font-weight: bold;
  margin-bottom: 6px;
  color: var(--heading-color);
  font-size: 0.95em;
}

/* --- Divider --- */
.tool-divider {
  border: 0;
  border-top: 1px solid var(--code-border-color);
  margin: 4px 0;
}

/* --- Iframe tools --- */
.tool-iframe {
  width: 100%;
  height: 700px;
  border: 2px solid var(--code-border-color);
  display: block;
}

/* --- Simple tool (coinflip, base64) result display --- */
.tool-result-display {
  padding: 10px 14px;
  border: 2px solid var(--code-border-color);
  background: var(--code-background-color);
  color: var(--heading-color);
  font-size: 1.1em;
  min-height: 2.5em;
  display: flex;
  align-items: center;
}

/* --- QR result display --- */
#qrcode {
  margin-top: 8px;
}

#qrcode canvas {
  display: block;
  border: 2px solid var(--code-border-color);
}

/* --- Responsiveness --- */
@media (max-width: 600px) {
  .tool-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .tool-actions button {
    width: 100%;
  }
}
