/* temp-host.com — upload widget styles
 * Design tokens shared with index.html. Drop into any page that has the
 * .th-upload markup. Self-contained: no globals leaked beyond .th- prefix
 * (the body tokens cascade if present, otherwise we declare locals).
 */

:root {
  --bg: #0f0f0f;
  --bg-card: #1a1a1a;
  --border: #2a2a2a;
  --text: #ffffff;
  --text-dim: #888888;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --radius: 16px;
  --radius-sm: 10px;
}

.th-upload, .th-upload * { box-sizing: border-box; }

.th-upload {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ── Drop zone ─────────────────────────────────────────────────────── */
.th-dropzone {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s, background .18s, transform .18s;
  background: var(--bg-card);
  user-select: none;
}

.th-dropzone:hover { border-color: var(--accent); background: rgba(59,130,246,.05); }
.th-dropzone.is-dragover {
  border-color: var(--accent);
  background: rgba(59,130,246,.10);
  transform: scale(1.01);
}
.th-dropzone.is-busy { pointer-events: none; opacity: .7; }

.th-dropzone__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.th-dropzone__icon svg { width: 100%; height: 100%; }

.th-dropzone__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .35rem;
}
.th-dropzone__title strong { color: var(--accent); font-weight: 600; }

.th-dropzone__hint {
  font-size: .8rem;
  color: var(--text-dim);
}

.th-dropzone input[type="file"] { display: none; }

/* ── Options panel ─────────────────────────────────────────────────── */
.th-options {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .25rem 1rem;
}

.th-option-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .9rem 0;
  gap: 1rem;
  flex-wrap: wrap;
}

.th-option-row + .th-option-row { border-top: 1px solid var(--border); }

.th-option-label {
  font-size: .9rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.th-option-control {
  display: flex;
  gap: .5rem;
  align-items: center;
}

.th-select, .th-input {
  padding: .55rem .9rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: .85rem;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
  min-width: 140px;
}
.th-select:focus, .th-input:focus { border-color: var(--accent); }

.th-input--password {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: .05em;
}

/* ── Primary button ────────────────────────────────────────────────── */
.th-btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: .95rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  width: 100%;
  transition: background .15s, transform .05s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}

.th-btn:hover:not(:disabled) { background: var(--accent-hover); }
.th-btn:active:not(:disabled) { transform: translateY(1px); }
.th-btn:disabled {
  background: var(--border);
  color: var(--text-dim);
  cursor: not-allowed;
}

.th-btn--ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.th-btn--ghost:hover:not(:disabled) { background: var(--bg-card); border-color: var(--accent); }

.th-btn--small {
  width: auto;
  padding: .55rem .9rem;
  font-size: .85rem;
}

/* ── File list (one card per upload) ───────────────────────────────── */
.th-files { display: flex; flex-direction: column; gap: .9rem; }

.th-file {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  transition: border-color .2s;
}

.th-file--success { border-color: var(--green); }
.th-file--error { border-color: var(--red); }

.th-file__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.th-file__meta { min-width: 0; flex: 1; }

.th-file__name {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.th-file__sub {
  font-size: .75rem;
  color: var(--text-dim);
  margin-top: .25rem;
  font-variant-numeric: tabular-nums;
}

.th-file__status {
  font-size: .75rem;
  font-weight: 600;
  padding: .25rem .55rem;
  border-radius: 999px;
  background: var(--border);
  color: var(--text-dim);
  white-space: nowrap;
}
.th-file__status--queued    { background: rgba(136,136,136,.15); color: var(--text-dim); }
.th-file__status--uploading { background: rgba(59,130,246,.15); color: var(--accent); }
.th-file__status--success   { background: rgba(34,197,94,.15); color: var(--green); }
.th-file__status--error     { background: rgba(239,68,68,.15); color: var(--red); }

/* ── Progress bar ──────────────────────────────────────────────────── */
.th-progress {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.th-progress__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #60a5fa);
  border-radius: 999px;
  transition: width .25s linear;
}

.th-file--success .th-progress__fill { background: var(--green); }
.th-file--error .th-progress__fill   { background: var(--red); }

.th-rate {
  display: flex;
  justify-content: space-between;
  font-size: .72rem;
  color: var(--text-dim);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

/* ── Success card body ─────────────────────────────────────────────── */
.th-result {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin-top: .25rem;
}

.th-result__row {
  display: flex;
  gap: .5rem;
  align-items: stretch;
}

.th-result__url {
  flex: 1;
  min-width: 0;
  padding: .65rem .8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: .82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.th-copy {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 0 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: .85rem;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: .35rem;
  transition: background .15s;
  white-space: nowrap;
}
.th-copy:hover { background: var(--accent-hover); }
.th-copy svg { width: 14px; height: 14px; }
.th-copy.is-ok { background: var(--green); }

.th-result__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: .78rem;
  color: var(--text-dim);
}

.th-countdown {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: var(--yellow);
  font-variant-numeric: tabular-nums;
}

.th-countdown--expired { color: var(--red); }

/* QR */
.th-qr {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding-top: .25rem;
}
.th-qr canvas, .th-qr svg {
  background: #fff;
  padding: 6px;
  border-radius: 8px;
  width: 96px;
  height: 96px;
}
.th-qr__text {
  font-size: .75rem;
  color: var(--text-dim);
}

/* Error card */
.th-error {
  font-size: .85rem;
  color: var(--red);
  display: flex;
  align-items: flex-start;
  gap: .5rem;
}
.th-error svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }

.th-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

/* ── Mobile ────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .th-dropzone { padding: 2rem 1rem; }
  .th-dropzone__icon { width: 44px; height: 44px; }
  .th-option-row { flex-direction: column; align-items: stretch; gap: .5rem; }
  .th-option-control { justify-content: flex-end; }
  .th-select, .th-input { width: 100%; min-width: 0; }
  .th-result__row { flex-direction: column; }
  .th-copy { padding: .65rem 1rem; justify-content: center; }
  .th-qr { flex-direction: column; align-items: flex-start; }
}

/* Touch hint swap */
@media (hover: none) and (pointer: coarse) {
  .th-dropzone__title strong::before { content: "Tap "; }
  .th-dropzone__title strong { font-size: 1.05rem; }
  .th-dropzone__title em { display: none; }
}

/* ── Widget mode (chromeless) ──────────────────────────────────────── */
body.th-widget {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

body.th-widget .th-widget-shell {
  width: 100%;
  max-width: 560px;
}

body.th-widget .th-widget-mark {
  text-align: center;
  font-size: .75rem;
  color: var(--text-dim);
  margin-top: 1.5rem;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}
body.th-widget .th-widget-mark a { color: var(--accent); text-decoration: none; }
body.th-widget .th-widget-mark a:hover { text-decoration: underline; }
