/* Phone handoff for upload windows (phone-handoff.js, upload-panels.js).
   Theme tokens only, logical properties for RTL. */

/* Desktop status line styles live in styles.css (.upload-phone-status, .upw-*). */

/* ---- Phone: prompt at the top ---- */
.handoff-prompt {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  inset-inline: 8px;
  z-index: 9500;
  padding: 12px;
  border: 1px solid var(--border);
  border-inline-start: 4px solid var(--primary);
  border-radius: 10px;
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-md);
  animation: handoff-drop .18s ease-out;
}
@keyframes handoff-drop { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .handoff-prompt { animation: none; } }

.handoff-prompt-row { display: flex; align-items: flex-start; gap: 10px; }
.handoff-prompt-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
}
.handoff-prompt-text { flex: 1 1 auto; min-width: 0; font-size: 14px; line-height: 1.4; padding-top: 5px; overflow-wrap: anywhere; }
.handoff-prompt-label { color: var(--text-secondary); }
.handoff-prompt-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.handoff-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.handoff-prompt-actions .btn-primary,
.handoff-prompt-actions .btn-secondary { flex: 1 1 auto; }
.handoff-btn--quiet {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
}
.handoff-notify-link {
  display: block;
  margin-top: 8px;
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--primary);
  font-size: 13px;
  text-decoration: underline;
  text-align: start;
}

/* ---- Phone: sheet listing several windows ---- */
.handoff-sheet-wrap { position: fixed; inset: 0; z-index: 10050; }
.handoff-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .45); }
.handoff-sheet {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  max-height: 80vh;
  overflow-y: auto;
  padding: 8px 12px calc(env(safe-area-inset-bottom, 0px) + 12px);
  border-radius: 14px 14px 0 0;
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-md);
}
.handoff-sheet-head { display: flex; align-items: center; gap: 8px; padding: 8px 4px 10px; }
.handoff-sheet-title { flex: 1 1 auto; font-size: 15px; font-weight: 700; }
.handoff-icon-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  font-size: 24px;
  line-height: 1;
}
.handoff-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.handoff-item {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: start;
}
.handoff-item:active { background: var(--primary-subtle); }
.handoff-item-name { font-size: 15px; font-weight: 700; }
.handoff-item-meta { font-size: 13px; color: var(--text-secondary); }
.handoff-item-count { font-size: 12px; color: var(--success); font-weight: 600; }

/* ---- Phone: upload view ---- */
.handoff-view {
  position: fixed;
  inset: 0;
  z-index: 10040;
  display: none;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
}
.handoff-view.is-open { display: flex; }
body.handoff-view-open { overflow: hidden; }
.handoff-view-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top, 0px) + 6px) 8px 6px 16px;
  padding-inline-start: 16px;
  padding-inline-end: 8px;
  border-bottom: 1px solid var(--border-light);
  background: var(--surface);
}
.handoff-view-title { flex: 1 1 auto; font-size: 16px; font-weight: 700; }
.handoff-view-body { flex: 1 1 auto; overflow-y: auto; padding: 14px 14px 20px; }
.handoff-select-label { display: grid; gap: 4px; margin-bottom: 10px; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.handoff-select {
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
}
.handoff-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}
.handoff-card-name { font-size: 18px; font-weight: 700; }
.handoff-card-meta { margin-top: 2px; font-size: 13px; color: var(--text-secondary); }
.handoff-card-count { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--success); }
.handoff-closed {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--amber-tint, var(--surface-alt));
  color: var(--warning);
  font-size: 13px;
  font-weight: 600;
}
.handoff-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.handoff-big {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 84px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
}
.handoff-big svg { width: 26px; height: 26px; }
.handoff-big:disabled { opacity: .55; }
.handoff-files { display: grid; gap: 8px; margin-top: 16px; }
.handoff-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface);
}
.handoff-thumb {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface-alt);
  color: var(--text-secondary);
}
.handoff-thumb img { width: 100%; height: 100%; object-fit: cover; }
.handoff-file-main { flex: 1 1 auto; min-width: 0; }
.handoff-file-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.handoff-progress { height: 4px; margin: 6px 0 4px; border-radius: 2px; background: var(--border-light); overflow: hidden; }
.handoff-progress span { display: block; width: 0; height: 100%; background: var(--primary); transition: width .2s; }
.handoff-file[data-state="done"] .handoff-progress span { background: var(--success); }
.handoff-file[data-state="failed"] .handoff-progress { display: none; }
.handoff-file-status { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); }
.handoff-file[data-state="done"] .handoff-file-status { color: var(--success); font-weight: 600; }
.handoff-file[data-state="failed"] .handoff-file-status { color: var(--danger); }
.handoff-retry {
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
}
.handoff-view-foot {
  padding: 10px 14px calc(env(safe-area-inset-bottom, 0px) + 10px);
  border-top: 1px solid var(--border-light);
  background: var(--surface);
}
.handoff-view-foot .btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}
