/* Online tools: catalog and converter pages. Loaded only under /en/tools/. */

/* The scripts toggle buttons, forms and panels with the hidden attribute; .btn and others set display. */
[hidden] {
  display: none !important;
}

.fmt-pair {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.fmt {
  padding: 3px 9px;
  border-radius: 7px;
  background: var(--blue-tint);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.fmt-webp { background: #e6f6ec; color: #17733f; }
.fmt-jpeg { background: #fff1e3; color: #a4520a; }
.fmt-pdf { background: #fdebee; color: var(--red); }
.fmt-avif { background: #f1e9fd; color: #6a32c2; }
.fmt-image { background: #e7f3fb; color: #145f8f; }
.fmt-file { background: var(--soft); color: var(--navy); }
.fmt-hash { background: #eef0f4; color: #3d4a63; }

/* Header */

.tool-head {
  margin-bottom: 16px;
  padding: 22px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
}

.tool-head h1 {
  margin-top: 10px;
  color: var(--navy);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.tool-head > p:not(.fmt-pair) {
  max-width: 760px;
  margin: 6px 0 0;
  color: var(--ink-soft);
}

.tool-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 12px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 600;
}

.tool-trust li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tool-trust .icon {
  color: var(--green);
}

/* Converter */

.tool-app {
  margin-bottom: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow);
  min-width: 0;
}

.drop {
  position: relative;
}

.drop-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.drop-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 210px;
  padding: 24px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--blue-soft);
  color: var(--navy);
  text-align: center;
  cursor: pointer;
}

.drop-label:hover,
.drop.is-over .drop-label {
  border-color: var(--blue);
  background: var(--blue-tint);
}

.drop-input:focus-visible + .drop-label {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.drop-icon {
  width: 40px;
  height: 40px;
  color: var(--blue);
}

.drop-label strong {
  font-size: 18px;
}

.drop-label small {
  color: var(--ink-soft);
  font-size: 13px;
}

.tool-app.has-files .drop-label {
  flex-direction: row;
  flex-wrap: wrap;
  min-height: 0;
  padding: 14px;
}

.tool-app.has-files .drop-icon {
  width: 24px;
  height: 24px;
}

.tool-app.has-files .drop-label strong {
  font-size: 15px;
}

.tool-msg,
.tool-note {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.tool-work {
  margin-top: 16px;
}

.file-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.file-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.file-item:last-child {
  border-bottom: 0;
}

.file-thumb {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink-soft);
  font-size: 22px;
}

.file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-name {
  overflow: hidden;
  color: var(--navy);
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta {
  color: var(--ink-soft);
  font-size: 13px;
}

.file-meta a {
  font-weight: 600;
}

.file-item.is-error .file-meta {
  color: var(--red);
}

.file-item.is-done .file-meta {
  color: var(--green);
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink-soft);
  font-size: 16px;
  cursor: pointer;
}

.icon-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.icon-btn.down .icon {
  transform: rotate(180deg);
}

.tool-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 22px;
  margin: 16px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
}

fieldset.tool-settings {
  min-width: 0;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--navy);
  font-size: 14px;
  font-weight: 600;
}

.field select,
.field input[type="text"] {
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}

.field input[type="range"] {
  width: 220px;
  accent-color: var(--blue);
}

.field input[type="color"] {
  width: 64px;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--white);
}

.field-wide {
  flex: 1 1 260px;
}

.field input[type="number"] {
  width: 110px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}

.field input[type="text"].mono,
.field textarea {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

.field textarea {
  width: 100%;
  min-height: 96px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
  resize: vertical;
}

/* Details under a file: metadata, hashes, detected type. */

.file-panel {
  grid-column: 1 / -1;
  min-width: 0;
  font-size: 13px;
}

.file-panel:empty {
  display: none;
}

.kv {
  display: grid;
  grid-template-columns: minmax(110px, max-content) minmax(0, 1fr);
  gap: 4px 14px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--soft);
}

.kv dt {
  color: var(--ink-soft);
  font-weight: 600;
}

.kv dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
}

.kv .mono {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12.5px;
}

.kv-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.kv-row .icon-btn {
  flex: none;
  width: 28px;
  height: 28px;
  font-size: 14px;
}

.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-ok { background: #e6f6ec; color: #17733f; }
.badge-warn { background: #fff1e3; color: #a4520a; }
.badge-bad { background: #fdebee; color: var(--red); }

.cmd {
  margin: 0 0 16px;
  padding: 12px 14px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.5;
}

.panel-note {
  margin: 6px 0 0;
  color: var(--ink-soft);
}

.panel-note.is-warn {
  color: #a4520a;
  font-weight: 600;
}

/* QR code generator */

.qr-app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  min-width: 0;
}

.qr-form {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
}

.qr-form .tool-settings {
  margin: 0;
}

.qr-preview {
  display: grid;
  justify-items: stretch;
  align-content: start;
  gap: 12px;
  min-width: 0;
}

.qr-preview > [data-qr] svg {
  width: 100%;
  max-width: 280px;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.qr-preview .btn {
  width: 100%;
  justify-content: center;
}

.qr-fields {
  display: grid;
  gap: 12px;
}

.qr-fields .field input[type="text"],
.qr-fields .field input[type="password"],
.qr-fields .field select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}

@media (max-width: 760px) {
  .qr-app {
    grid-template-columns: minmax(0, 1fr);
  }
}

.choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--navy);
  font-size: 14px;
  font-weight: 600;
}

.choice input {
  accent-color: var(--blue);
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.btn-quiet {
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--navy);
}

.btn-quiet:hover {
  background: var(--blue-soft);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.tool-progress {
  width: 100%;
  height: 8px;
  margin-top: 14px;
  accent-color: var(--blue);
}

.tool-status {
  min-height: 1.5em;
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.tool-status.is-error {
  color: var(--red);
}

/* Article */

.tool-layout {
  margin-top: 4px;
}

.tool-limits {
  margin-bottom: 12px;
}

.tool-article h3.faq-q {
  margin-top: 16px;
}

/* Catalog */

.tools-search {
  position: relative;
  max-width: 460px;
  margin-top: 14px;
}

.tools-search .icon {
  position: absolute;
  top: 50%;
  left: 12px;
  color: var(--ink-soft);
  transform: translateY(-50%);
}

.tools-search input {
  width: 100%;
  height: 42px;
  padding: 0 12px 0 38px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font: inherit;
}

.tool-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 14px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
  color: var(--navy);
}

.tool-card:hover {
  border-color: #b9cdf6;
  text-decoration: none;
}

.tool-card strong {
  margin-top: 6px;
  font-size: 16px;
}

.tool-card > span {
  color: var(--ink-soft);
  font-size: 13px;
}

.tool-cards-compact {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  padding-top: 10px;
}

.tool-cards-compact .tool-card {
  box-shadow: none;
}

.tools-empty {
  margin-top: 20px;
  color: var(--ink-soft);
}

.tools-desktop {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tools-desktop li {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
}

.tools-desktop a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

@media (max-width: 640px) {
  .tool-head {
    padding: 18px;
  }

  .tool-head h1 {
    font-size: 24px;
  }

  .tool-app {
    padding: 12px;
  }

  .drop-label {
    min-height: 170px;
  }

  .file-item {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .file-thumb {
    width: 40px;
    height: 40px;
  }

  .file-actions {
    grid-column: 2;
  }

  .field input[type="range"] {
    width: 100%;
  }

  .tool-actions .btn {
    flex: 1 1 100%;
  }
}
