/* /funcionalidades/transferencias-de-archivos/ — Transfers with Quick Share
   open. Four scenes (pantallas-escenas.js): 0 the files chosen, 1 the
   upload, 2 the link being prepared, 3 the link ready — the resting state.
   Every label is in the markup; the only digits drawn here are the upload
   percentage and the countdown's seconds, as CSS counters. */

@property --tf-p {
  syntax: '<integer>';
  inherits: false;
  initial-value: 100;
}

@property --tf-s {
  syntax: '<integer>';
  inherits: false;
  initial-value: 58;
}

/* ---------- the list behind the dialog ---------- */

.pn-frame[data-screen="file-transfers"] .tf-list { display: flex; flex-direction: column; }

.pn-frame[data-screen="file-transfers"] .tf-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 18px;
}

.pn-frame[data-screen="file-transfers"] .tf-row + .tf-row { border-top: 1px solid var(--ac-line); }

.pn-frame[data-screen="file-transfers"] .tf-row-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
}

.pn-frame[data-screen="file-transfers"] .tf-row-title b { font-weight: 600; }

.pn-frame[data-screen="file-transfers"] .tf-pill {
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--ac-faint);
  color: var(--ac-mut);
  font-size: 9.5px;
}

.pn-frame[data-screen="file-transfers"] .tf-row-meta {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  color: var(--ac-mut);
  font-size: 9.5px;
}

.pn-frame[data-screen="file-transfers"] .tf-row-exp {
  margin-top: 3px;
  color: var(--ac-dim);
  font-size: 9.5px;
}

.pn-frame[data-screen="file-transfers"] .tf-row-acts {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
}

.pn-frame[data-screen="file-transfers"] .md-btn.is-danger {
  border-color: var(--ac-bad);
  background: var(--ac-bad);
  color: #fff;
}

/* ---------- Quick Share ---------- */

.pn-frame[data-screen="file-transfers"] .tf-overlay {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgb(17 19 24 / 0.25);
}

.pn-frame[data-screen="file-transfers"] .tf-modal {
  width: 540px;
  border: 1px solid var(--ac-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 60px rgb(17 19 24 / 0.18), 0 2px 8px rgb(17 19 24 / 0.08);
}

.pn-frame[data-screen="file-transfers"] .tf-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 20px 13px;
  border-bottom: 1px solid var(--ac-line);
}

.pn-frame[data-screen="file-transfers"] .tf-modal-head p { font-size: 14.5px; font-weight: 650; }

.pn-frame[data-screen="file-transfers"] .tf-close { width: 15px; height: 15px; color: var(--ac-dim); }

.pn-frame[data-screen="file-transfers"] .tf-modal-body {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 16px 20px 18px;
}

.pn-frame[data-screen="file-transfers"] .tf-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 112px;
  border: 2px dashed var(--ac-line);
  border-radius: 12px;
  background: rgb(243 244 246 / 0.4);
  text-align: center;
  transition: opacity 0.3s ease;
}

.pn-frame[data-screen="file-transfers"] .tf-drop b { font-size: 11px; font-weight: 600; }
.pn-frame[data-screen="file-transfers"] .tf-drop em { color: var(--ac-mut); font-size: 9.5px; }

.pn-frame[data-screen="file-transfers"] .tf-drop-icon {
  display: grid;
  width: 32px;
  height: 32px;
  margin-bottom: 6px;
  place-items: center;
  border-radius: 50%;
  background: rgb(37 99 235 / 0.1);
  color: var(--ac-blue);
}

.pn-frame[data-screen="file-transfers"] .tf-drop-icon svg { width: 15px; height: 15px; }

.pn-frame[data-screen="file-transfers"] .tf-files { display: flex; flex-direction: column; gap: 6px; }

.pn-frame[data-screen="file-transfers"] .tf-file {
  padding: 7px 10px;
  border: 1px solid var(--ac-line);
  border-radius: 9px;
}

.pn-frame[data-screen="file-transfers"] .tf-file-line { display: flex; align-items: center; gap: 9px; }
.pn-frame[data-screen="file-transfers"] .tf-clip { width: 13px; height: 13px; flex-shrink: 0; color: var(--ac-dim); }

.pn-frame[data-screen="file-transfers"] .tf-file-name {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
}

.pn-frame[data-screen="file-transfers"] .tf-file-name b {
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pn-frame[data-screen="file-transfers"] .tf-file-name em { color: var(--ac-mut); font-size: 9.5px; }

.pn-frame[data-screen="file-transfers"] .tf-remove {
  display: none;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 7px;
  color: var(--ac-bad);
}

.pn-frame[data-screen="file-transfers"] .tf-remove svg { width: 12px; height: 12px; }

.pn-frame[data-screen="file-transfers"] .tf-bar {
  display: none;
  height: 5px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--ac-faint);
}

.pn-frame[data-screen="file-transfers"] .tf-bar u {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 99px;
  background: var(--ac-blue);
}

.pn-frame[data-screen="file-transfers"] .tf-summary { color: var(--ac-mut); font-size: 9.5px; text-align: right; }

.pn-frame[data-screen="file-transfers"] .tf-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.pn-frame[data-screen="file-transfers"] .tf-label { margin-bottom: 5px; font-size: 10.5px; font-weight: 600; }

.pn-frame[data-screen="file-transfers"] .tf-input {
  overflow: hidden;
  padding: 7px 9px;
  border: 1px solid var(--ac-line);
  border-radius: 8px;
  background: #fff;
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pn-frame[data-screen="file-transfers"] .tf-input.is-area {
  min-height: 50px;
  line-height: 1.4;
  white-space: normal;
}

.pn-frame[data-screen="file-transfers"] .tf-input.is-link { background: var(--ac-faint); }

.pn-frame[data-screen="file-transfers"] .tf-hint { margin-top: 4px; color: var(--ac-dim); font-size: 9px; }

.pn-frame[data-screen="file-transfers"] .tf-total { display: none; }

.pn-frame[data-screen="file-transfers"] .tf-total p {
  display: flex;
  justify-content: space-between;
  color: var(--ac-mut);
  font-size: 9.5px;
}

.pn-frame[data-screen="file-transfers"] .tf-total .tf-bar { display: block; height: 7px; margin-top: 6px; }

.pn-frame[data-screen="file-transfers"] .tf-pct { counter-reset: tfp var(--tf-p, 100); font-weight: 500; }
.pn-frame[data-screen="file-transfers"] .tf-pct::after { content: counter(tfp) "%"; }

.pn-frame[data-screen="file-transfers"] .tf-processing {
  display: none;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--ac-faint);
  color: var(--ac-mut);
  font-size: 10.5px;
}

.pn-frame[data-screen="file-transfers"] .tf-actions { display: flex; justify-content: flex-end; gap: 8px; }
.pn-frame[data-screen="file-transfers"] .tf-actions .md-btn { display: none; }

/* The ready link. */

.pn-frame[data-screen="file-transfers"] .tf-ready { display: none; }

.pn-frame[data-screen="file-transfers"] .tf-ok {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 14px;
  border: 1px solid rgb(21 128 61 / 0.3);
  border-radius: 12px;
  background: rgb(21 128 61 / 0.08);
}

.pn-frame[data-screen="file-transfers"] .tf-ok b { font-size: 12px; font-weight: 650; }
.pn-frame[data-screen="file-transfers"] .tf-ok p { margin-top: 3px; color: var(--ac-mut); font-size: 10.5px; }

.pn-frame[data-screen="file-transfers"] .tf-ok-icon {
  display: grid;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  place-items: center;
  border-radius: 50%;
  background: rgb(21 128 61 / 0.15);
  color: var(--ac-good);
}

.pn-frame[data-screen="file-transfers"] .tf-ok-icon svg { width: 16px; height: 16px; }

.pn-frame[data-screen="file-transfers"] .tf-sec { counter-reset: tfs var(--tf-s, 58); }
.pn-frame[data-screen="file-transfers"] .tf-sec::after { content: counter(tfs); }

.pn-frame[data-screen="file-transfers"] .tf-link-acts { display: flex; flex-wrap: wrap; gap: 8px; }

.pn-frame[data-screen="file-transfers"] .tf-deliv {
  padding: 10px 12px;
  border: 1px solid var(--ac-line);
  border-radius: 9px;
}

.pn-frame[data-screen="file-transfers"] .tf-deliv-title { font-size: 10.5px; font-weight: 600; }

.pn-frame[data-screen="file-transfers"] .tf-deliv-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  color: var(--ac-mut);
  font-size: 9.5px;
}

.pn-frame[data-screen="file-transfers"] .tf-state { display: grid; justify-items: end; }
.pn-frame[data-screen="file-transfers"] .tf-state i { grid-area: 1 / 1; }
.pn-frame[data-screen="file-transfers"] .tf-state .is-pending { opacity: 0; }

.pn-frame[data-screen="file-transfers"] .tf-full { color: var(--ac-dim); font-size: 9.5px; }

/* ---------- which parts each scene shows ---------- */

.pn-frame[data-screen="file-transfers"][data-mk-scene="0"] .tf-remove { display: grid; }
.pn-frame[data-screen="file-transfers"][data-mk-scene="0"] .tf-actions .is-when-select { display: inline-flex; }

.pn-frame[data-screen="file-transfers"][data-mk-scene="1"] .tf-file .tf-bar { display: block; }
.pn-frame[data-screen="file-transfers"][data-mk-scene="1"] .tf-total { display: block; }
.pn-frame[data-screen="file-transfers"][data-mk-scene="1"] .tf-actions .is-when-upload { display: inline-flex; }

.pn-frame[data-screen="file-transfers"][data-mk-scene="2"] .tf-processing { display: block; }
.pn-frame[data-screen="file-transfers"][data-mk-scene="2"] .tf-actions .is-when-processing { display: inline-flex; }

.pn-frame[data-screen="file-transfers"][data-mk-scene="1"] .tf-drop,
.pn-frame[data-screen="file-transfers"][data-mk-scene="2"] .tf-drop { opacity: 0.6; }

.pn-frame[data-screen="file-transfers"][data-mk-scene="3"] .tf-form { display: none; }
.pn-frame[data-screen="file-transfers"][data-mk-scene="3"] .tf-ready { display: flex; }

/* ---------- motion, only for those who did not ask for less ---------- */

@media (prefers-reduced-motion: no-preference) {
  /* The files land one after another, as a drop lands them. */
  .pn-frame[data-screen="file-transfers"][data-mk-scene="0"] .tf-file { animation: tf-land 0.4s ease-out both; }
  .pn-frame[data-screen="file-transfers"][data-mk-scene="0"] .tf-file:nth-child(2) { animation-delay: 0.15s; }
  .pn-frame[data-screen="file-transfers"][data-mk-scene="0"] .tf-file:nth-child(3) { animation-delay: 0.3s; }
  .pn-frame[data-screen="file-transfers"][data-mk-scene="0"] .tf-start { animation: tf-press 0.36s ease 2.2s both; }

  /* Each file fills at its own pace — the small one first — and the total
     with them. */
  .pn-frame[data-screen="file-transfers"][data-mk-scene="1"] .tf-bar u.is-f1 { animation: tf-fill 0.7s ease-out both; }
  .pn-frame[data-screen="file-transfers"][data-mk-scene="1"] .tf-bar u.is-f2 { animation: tf-fill 1.9s ease-out both; }
  .pn-frame[data-screen="file-transfers"][data-mk-scene="1"] .tf-bar u.is-f3 { animation: tf-fill 3.1s cubic-bezier(0.4, 0.1, 0.4, 1) both; }
  .pn-frame[data-screen="file-transfers"][data-mk-scene="1"] .tf-total .tf-bar u { animation: tf-fill 3.1s cubic-bezier(0.3, 0.3, 0.4, 1) both; }
  .pn-frame[data-screen="file-transfers"][data-mk-scene="1"] .tf-pct { animation: tf-count 3.1s cubic-bezier(0.3, 0.3, 0.4, 1) both; }

  .pn-frame[data-screen="file-transfers"][data-mk-scene="2"] .tf-processing { animation: tf-breathe 1.6s ease-in-out infinite; }

  /* The link is live: its clock runs, the second email goes out, the link
     is copied. */
  .pn-frame[data-screen="file-transfers"][data-mk-scene="3"] .tf-ready { animation: tf-land 0.35s ease-out both; }
  .pn-frame[data-screen="file-transfers"][data-mk-scene="3"] .tf-sec { animation: tf-tick 58s steps(58, end) both; }
  /* A swap, not a cross-fade: the two words never share the cell. */
  .pn-frame[data-screen="file-transfers"][data-mk-scene="3"] .tf-state.is-later .is-pending { animation: tf-fade-out 0.14s ease-in 2s both; }
  .pn-frame[data-screen="file-transfers"][data-mk-scene="3"] .tf-state.is-later .is-sent { animation: tf-fade-in 0.2s ease-out 2.14s both; }
  .pn-frame[data-screen="file-transfers"][data-mk-scene="3"] .tf-copy { animation: tf-press 0.36s ease 3.1s both; }
}

@keyframes tf-land {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes tf-fill {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes tf-count {
  from { --tf-p: 0; }
  to { --tf-p: 100; }
}

@keyframes tf-tick {
  from { --tf-s: 58; }
  to { --tf-s: 0; }
}

@keyframes tf-press {
  0%, 100% { transform: none; }
  45% { transform: scale(0.95); background: var(--ac-faint); }
}

@keyframes tf-breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.62; }
}

@keyframes tf-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes tf-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
