/* ── Shared upload box ──
   Used by _includes/upload-box.html on the home page and every tool page.
   The ids and classes the tool scripts look up (#Inputbox, .file-input, #file-loader,
   .file-pick-dropdown, #dropfile, #error, ...) are kept as they were; only the look is shared. */
.ub {
  --ub-brand: #dd4db5;
  --ub-brand-strong: #c2379b;
  --ub-brand-soft: #fdf1fa;
  --ub-brand-line: #f6cfea;
  --ub-ink: #17131f;
  --ub-text: #4b4758;
  --ub-muted: #7b7788;
  --ub-line: #e9e7ef;
  --ub-tint: #faf9fc;
  --ub-shadow: 0 1px 2px rgba(23, 19, 31, 0.04), 0 12px 32px rgba(23, 19, 31, 0.07);
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 12px;
  border: 1px solid var(--ub-line);
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--ub-shadow);
  color: var(--ub-text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
}

.ub *,
.ub *::before,
.ub *::after {
  box-sizing: border-box;
}

.ub p {
  margin: 0;
}

.ub ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ub ul li {
  margin: 0;
  padding: 0;
}

.ub a {
  text-decoration: none;
}

/* ── Drop zone, and the loading / saving states that replace it ── */
.ub .file-input,
.ub #file-loader,
.ub .saving-file-download-wrap {
  padding: 36px 20px 28px;
  border: 2px dashed var(--ub-brand-line);
  border-radius: 16px;
  background: var(--ub-brand-soft);
  color: var(--ub-text);
  text-align: center;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.ub #file-loader {
  min-height: 300px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

/* CSS spinner in place of the gif, whose white background shows on the pink box */
.ub #file-loader img {
  display: none;
}

.ub #file-loader::before {
  content: "";
  width: 44px;
  height: 44px;
  border: 4px solid var(--ub-brand-line);
  border-top-color: var(--ub-brand);
  border-radius: 50%;
  animation: ub-spin 0.8s linear infinite;
}

.ub #file-loader p,
.ub .saving-file-download-wrap p {
  color: var(--ub-text);
  font-size: 15px;
}

.ub .saving-file-download-wrap {
  min-height: 300px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ub .saving-file-download-wrap .trust-img {
  width: 72px;
  height: 72px;
}

.ub #download-zip {
  padding: 10px 24px;
  border: 0;
  border-radius: 10px;
  background: var(--ub-brand);
  color: #fff;
  font-weight: 700;
}

.ub.is-dragover .file-input {
  border-color: var(--ub-brand);
  background: #fbe3f4;
}

.ub-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border-radius: 16px;
  background: #fff;
  color: var(--ub-brand);
  box-shadow: 0 4px 14px rgba(221, 77, 181, 0.18);
}

.ub-icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ub-lead {
  margin-bottom: 6px !important;
  color: var(--ub-brand-strong);
  font-size: 14px;
  font-weight: 700;
}

.ub-title {
  margin: 0 0 18px !important;
  color: var(--ub-ink);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

/* ── Select button ── */
.ub-picker {
  display: inline-flex;
  align-items: stretch;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(221, 77, 181, 0.32);
}

/* Tools that only hide the #inputbox part: hide the card around it too */
.ub--collapse:has(> #inputbox[style*="display: none"]) {
  display: none;
}

.ub .boxes {
  height: 54px;
  min-height: 0;
  margin: 0;
  background: var(--ub-brand);
  color: #fff;
  transition: background 0.18s ease;
}

.ub #Inputbox {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: auto;
  min-height: 0;
  padding: 0 28px 0 24px;
  border: 0;
  border-radius: 12px;
  background: var(--ub-brand);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.ub #Inputbox img {
  width: 20px;
  height: 20px;
}

.ub #Inputbox:hover {
  background: var(--ub-brand-strong);
}

.ub #Inputbox:focus-visible {
  outline: 3px solid rgba(221, 77, 181, 0.4);
  outline-offset: 3px;
}

/* ── Other sources: Google Drive, Dropbox, Paste URL, always on show ──
   The old dropdown wrapper is kept for the tool scripts (they toggle its inline display on click),
   so display: contents !important lays its buttons out in the row whatever they set. */
.ub-sources {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.ub-sources-label {
  color: var(--ub-muted);
  font-size: 13px;
  font-weight: 500;
}

.ub .ub-sources .file-pick-dropdown,
.ub .ub-sources .file-picker-dropdown {
  display: contents !important;
}

.ub .ub-sources .arrow-sign {
  display: none !important;
}

/* Theme and tool stylesheets give the old dropdown buttons width: 100% */
.ub .ub-sources button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  width: auto !important;
  height: 38px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--ub-line);
  border-radius: 999px;
  background: #fff;
  color: var(--ub-ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.ub .ub-sources button:hover,
.ub .ub-sources button[aria-expanded="true"] {
  border-color: var(--ub-brand-line);
  background: var(--ub-brand-soft);
}

.ub .ub-sources button:focus-visible {
  outline: 3px solid rgba(221, 77, 181, 0.4);
  outline-offset: 2px;
}

.ub .ub-sources svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}

.ub .ub-sources #dropbox svg {
  fill: #0061ff;
}

.ub .ub-url-toggle svg {
  fill: none;
  stroke: var(--ub-brand);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Paste URL field ── */
.ub-url {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 480px;
  margin: 12px auto 0;
}

.ub-url[hidden] {
  display: none;
}

.ub-url input {
  flex: 1;
  min-width: 0;
  height: 44px;
  margin: 0;
  padding: 0 14px;
  border: 1px solid var(--ub-line);
  border-radius: 10px;
  background: #fff;
  color: var(--ub-ink);
  font-size: 14px;
}

.ub-url input:focus {
  border-color: var(--ub-brand);
  outline: 3px solid rgba(221, 77, 181, 0.18);
}

.ub-url button {
  flex-shrink: 0;
  height: 44px;
  margin: 0;
  padding: 0 20px;
  border: 0;
  border-radius: 10px;
  background: var(--ub-brand);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.ub-url button:hover {
  background: var(--ub-brand-strong);
}

.ub-url button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.ub #dropfile {
  margin: 14px 0 0;
  color: var(--ub-muted);
  font-size: 14px;
}

.ub #error {
  margin: 0;
  padding: 0;
  background: none;
  color: #c62828;
  font-size: 14px;
  font-weight: 500;
}

.ub #error:not(:empty) {
  margin-top: 10px;
  visibility: visible;
}

/* ── Sample images ── */
.ub-samples {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--ub-brand-line);
}

.ub-samples-label {
  margin-bottom: 12px !important;
  color: var(--ub-text);
  font-size: 14px;
  font-weight: 600;
}

.ub-samples-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.ub .ub-sample {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: auto;
  height: auto;
  padding: 6px 16px 6px 6px;
  border: 1px solid var(--ub-line);
  border-radius: 12px;
  background: #fff;
  color: var(--ub-ink);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.ub .ub-sample img {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
}

.ub-sample-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.ub-sample-name {
  font-size: 14px;
  font-weight: 600;
}

.ub-sample-meta {
  color: var(--ub-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.ub .ub-sample:hover:not(:disabled),
.ub .ub-sample:focus-visible {
  border-color: var(--ub-brand);
  box-shadow: 0 6px 16px rgba(221, 77, 181, 0.16);
  transform: translateY(-1px);
  outline: none;
}

.ub .ub-sample:disabled {
  cursor: default;
  opacity: 0.55;
}

.ub .ub-sample.is-loading {
  opacity: 1;
  border-color: var(--ub-brand);
}

/* ── Links to other tools ── */
.ub-links {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--ub-brand-line);
}

.ub-links-label {
  margin-bottom: 10px !important;
  color: var(--ub-muted);
  font-size: 13px;
  font-weight: 600;
}

.ub-links-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.ub .ub-chip {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--ub-line);
  border-radius: 999px;
  background: #fff;
  color: var(--ub-text);
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.ub .ub-chip:hover,
.ub .ub-chip:focus-visible {
  border-color: var(--ub-brand);
  background: var(--ub-brand-soft);
  color: var(--ub-brand-strong);
  outline: none;
}

.ub .ub-chip.is-active {
  border-color: var(--ub-brand);
  background: var(--ub-brand);
  color: #fff;
}

@media (max-width: 600px) {
  .ub {
    padding: 8px;
    border-radius: 20px;
  }

  .ub .file-input,
  .ub #file-loader,
  .ub .saving-file-download-wrap {
    padding: 28px 12px 20px;
  }

  .ub-title {
    font-size: 18px;
  }

  .ub .ub-sample {
    flex: 1 1 100%;
  }

  .ub-sources-label {
    flex-basis: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ub * {
    transition: none !important;
  }
}

/* Spinner on the sample being loaded */
.ub .ub-sample.is-loading::after {
  content: "";
  width: 16px;
  height: 16px;
  margin-left: 4px;
  border: 2px solid var(--ub-brand-line);
  border-top-color: var(--ub-brand);
  border-radius: 50%;
  animation: ub-spin 0.7s linear infinite;
}

@keyframes ub-spin {
  to {
    transform: rotate(360deg);
  }
}
