/* =====================================================================
   Upload card — every state from empty to ready
   ===================================================================== */

.uploader {
  padding: clamp(1.5rem, 1rem + 1.5vw, 2rem);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.uploader__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}
.uploader__head--stacked { flex-direction: column; align-items: flex-start; gap: var(--s-2); }

/* --- Drop zone ------------------------------------------------------ */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-4);
  min-height: 11rem;
  padding: var(--s-8) var(--s-5);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t-base) var(--ease),
              background var(--t-base) var(--ease),
              transform var(--t-fast) var(--ease);
}
.dropzone:hover { border-color: var(--primary); background: var(--surface-3); }
.dropzone:focus-within { outline: 2px solid var(--focus-ring); outline-offset: 3px; }

.dropzone.is-dragging {
  border-color: var(--primary);
  border-style: solid;
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
  transform: scale(1.01);
}

.dropzone.is-compact { min-height: 0; padding: var(--s-5); flex-direction: row; gap: var(--s-3); }
.dropzone.is-compact .dropzone__text strong { font-size: var(--small); }

.dropzone__icon {
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  flex: none;
}
.dropzone.is-compact .dropzone__icon { width: 38px; height: 38px; border-radius: var(--r-md); }

.dropzone__text { display: grid; gap: 3px; }
.dropzone__text strong { font-size: var(--body); font-weight: 600; }
.dropzone__browse { color: var(--primary); text-decoration: underline; text-underline-offset: 0.18em; }

/* --- File list ------------------------------------------------------ */
.filelist { margin-top: var(--s-5); }

.filelist__items { list-style: none; display: grid; gap: var(--s-2); max-height: 17rem; overflow-y: auto; }
.filelist__items--progress { max-height: 14rem; margin-top: var(--s-6); }

.fileitem {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3);
  border-radius: var(--r-md);
  background: var(--surface-2);
  animation: tf-rise var(--t-base) var(--ease-out) both;
}
.fileitem.is-over { background: var(--danger-bg); }
.fileitem.is-failed { background: var(--danger-bg); }
.fileitem.is-done .fileitem__ext { background: var(--success-bg); color: var(--success-ink); }

.fileitem__ext {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px; height: 38px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--text-muted);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  overflow: hidden;
}

.fileitem__body { min-width: 0; flex: 1; }
.fileitem__name {
  display: block;
  font-size: var(--small);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fileitem__meta { display: block; font-size: var(--tiny); color: var(--text-muted); }
.fileitem.is-over .fileitem__meta { color: var(--danger-ink); font-weight: 600; }

.fileitem__pct { font-size: var(--tiny); font-variant-numeric: tabular-nums; color: var(--text-muted); flex: none; }

.fileitem__remove {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-faint);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.fileitem__remove:hover { background: var(--danger-bg); color: var(--danger-ink); }

.fileitem__track {
  height: 3px;
  margin-top: var(--s-2);
  border-radius: var(--r-pill);
  background: var(--border);
  overflow: hidden;
}
.fileitem__fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--primary);
  transition: width var(--t-base) var(--ease);
}
.fileitem.is-failed .fileitem__fill { background: var(--danger); }
.fileitem.is-done .fileitem__fill { background: var(--success); }

.filelist__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
  margin-top: var(--s-4);
}
.filelist__totals { color: var(--text-muted); display: flex; gap: var(--s-2); }
.filelist__dot { color: var(--text-faint); }

/* --- Limit warning -------------------------------------------------- */
.limit-actions { display: flex; gap: var(--s-2); margin-top: var(--s-3); flex-wrap: wrap; }

/* --- Mode + fields -------------------------------------------------- */
.uploader__mode { margin-top: var(--s-6); }
.uploader__fields { margin-top: var(--s-5); }

/* --- Advanced ------------------------------------------------------- */
.advanced { margin-top: var(--s-5); border-top: 1px solid var(--border); padding-top: var(--s-4); }
.advanced__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  min-height: 36px;
  cursor: pointer;
  list-style: none;
  font-size: var(--small);
  font-weight: 600;
  color: var(--text-muted);
}
.advanced__summary::-webkit-details-marker { display: none; }
.advanced__summary svg { transition: transform var(--t-base) var(--ease); }
.advanced[open] .advanced__summary svg { transform: rotate(180deg); }
.advanced[open] .advanced__summary { color: var(--text); }
.advanced__body { padding-top: var(--s-5); }

.password-field { margin-top: var(--s-3); animation: tf-rise var(--t-base) var(--ease-out) both; }

.upsell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

/* --- Submit --------------------------------------------------------- */
.uploader__submit { margin-top: var(--s-6); }
.uploader__terms { margin-top: var(--s-4); text-align: center; }
.uploader__terms a { color: var(--text-muted); text-decoration: underline; }

.uploader__actions { display: flex; gap: var(--s-3); margin-top: var(--s-6); }
.uploader__actions--center { justify-content: center; flex-wrap: wrap; }
.uploader__actions .btn { flex: 1; }
.uploader__actions--center .btn { flex: 0 1 auto; }

/* --- Progress ------------------------------------------------------- */
.progress { margin-top: var(--s-2); }

.progress__bar {
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  overflow: hidden;
}
.progress__fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width var(--t-base) var(--ease);
}
.is-paused .progress__fill { background: var(--warning); }
.is-offline .progress__fill { background: var(--text-faint); }

.progress__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  margin-top: var(--s-4);
}
.progress__pct { font-size: var(--h3); font-weight: 600; letter-spacing: -0.01em; }

.progress__status { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--small); color: var(--text-muted); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); flex: none; }
@keyframes tf-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.dot--live { animation: tf-pulse 1.6s var(--ease) infinite; }
.dot--warn { background: var(--warning); }
.dot--off  { background: var(--text-faint); }

.progress__stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  margin-top: var(--s-3);
}

/* --- Ready ---------------------------------------------------------- */
.uploader__panel--ready { text-align: center; align-items: center; }

.ready__tick {
  display: grid;
  place-items: center;
  width: 56px; height: 56px;
  margin: 0 auto var(--s-5);
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--success-ink);
  animation: tf-rise var(--t-slow) var(--ease-out) both;
}
.ready__title { margin-bottom: var(--s-3); }
.ready__lede { margin-bottom: var(--s-6); }

.linkbox {
  display: flex;
  gap: var(--s-2);
  padding: var(--s-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--surface-2);
}
.linkbox__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding-inline: var(--s-4);
  font-size: var(--small);
  font-family: var(--font-mono);
  color: var(--text);
}
.linkbox__input:focus { outline: none; }
.linkbox__copy { flex: none; }

.ready__facts {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-2) var(--s-5);
  margin-top: var(--s-6);
  font-size: var(--small);
  color: var(--text-muted);
}
.ready__facts li { display: flex; align-items: center; gap: var(--s-2); }
.ready__facts li::before {
  content: "";
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--text-faint);
  flex: none;
}
.ready__signup { margin-top: var(--s-6); }

/* --- Small screens -------------------------------------------------- */
@media (max-width: 520px) {
  .uploader { border-radius: var(--r-xl); }
  .uploader__actions { flex-direction: column; }
  .uploader__actions .btn { width: 100%; }
  .linkbox { flex-direction: column; padding: var(--s-3); }
  .linkbox__input { padding: var(--s-2) 0; text-align: center; }
  .filelist__foot { flex-direction: column; align-items: stretch; gap: var(--s-3); }
  .filelist__totals { justify-content: center; }
  .progress__pct { font-size: var(--body-lg); }
}
