/* ---------------------------------------------------------------------------
   Yumi Image Uploader
   Simple, editorial styling in the spirit of yumi.co.uk: black/white,
   generous whitespace, a soft rose accent, clean sans-serif type.
   Not a design system - just enough to keep every screen consistent.
--------------------------------------------------------------------------- */

@import url("https://fonts.googleapis.com/css2?family=Assistant:wght@500;600;700&family=Figtree:wght@400;500;600;700&display=swap");

:root {
  --ink: #121212;
  --ink-soft: rgba(18, 18, 18, 0.7);
  --ink-faint: rgba(18, 18, 18, 0.45);
  --paper: #ffffff;
  --paper-soft: #faf9f7;
  --line: #e7e3df;
  --line-soft: #f0ede9;
  --rose: #d98ba0;
  --rose-soft: #f6e3e8;
  --green: #2f7a4f;
  --green-soft: #e7f3ec;
  --amber: #b9791f;
  --amber-soft: #fbf0dd;
  --red: #b93a3a;
  --red-soft: #fbe9e9;
  --radius: 6px;
  --radius-lg: 10px;
  --shadow: 0 8px 24px rgba(18, 18, 18, 0.08);
  --font-body: "Figtree", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Assistant", var(--font-body);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background: var(--paper-soft);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

h1,
h2,
h3 {
  font-family: var(--font-head);
  font-weight: 600;
  margin: 0 0 0.4em;
  letter-spacing: -0.01em;
}

button {
  font-family: inherit;
}

/* --- Layout ---------------------------------------------------------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.site-header .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}

.site-header .brand-logo {
  height: 26px;
  width: auto;
  display: block;
}

.site-header .brand-divider {
  width: 1px;
  height: 20px;
  background: var(--line);
}

.site-header .brand-label {
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 14px;
}

.site-header nav a {
  text-decoration: none;
  color: var(--ink-soft);
}

.site-header nav a:hover {
  color: var(--ink);
}

.site-header form {
  display: inline;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--ink-soft);
  cursor: pointer;
}

.link-button:hover {
  color: var(--ink);
}

main {
  max-width: 920px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}

.page-title {
  text-align: center;
  font-size: 30px;
  margin-bottom: 8px;
}

.page-subtitle {
  text-align: center;
  color: var(--ink-faint);
  margin-bottom: 40px;
  font-size: 15px;
}

/* --- Buttons ----------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.05s ease;
  text-decoration: none;
}

.btn:hover {
  opacity: 0.85;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--ink);
}

.btn-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.btn-outline:hover {
  border-color: var(--ink);
}

.btn-danger {
  background: var(--red);
  border-color: var(--red);
}

.btn-block {
  width: 100%;
}

.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* --- Destination selector ---------------------------------------------- */

.destination-question {
  text-align: center;
  font-size: 15px;
  color: var(--ink-soft);
  margin-bottom: 16px;
}

.destination-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 48px;
}

.destination-btn {
  padding: 14px 26px;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--line);
  background: var(--paper);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.12s ease;
}

.destination-btn:hover {
  border-color: var(--ink);
}

.destination-btn.selected {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.destination-grid.dragover {
  outline: 2px solid var(--rose);
  outline-offset: 8px;
  border-radius: 12px;
}

/* --- Dropzone ------------------------------------------------------------ */

.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  padding: 72px 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone.dragover {
  border-color: var(--rose);
  background: var(--rose-soft);
}

.dropzone.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dropzone-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

.dropzone-title {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 6px;
}

.dropzone-hint {
  color: var(--ink-faint);
  font-size: 14px;
}

.dropzone-browse {
  color: var(--rose);
  text-decoration: underline;
  cursor: pointer;
}

/* --- Staging screen ------------------------------------------------------ */

.staging-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 4px;
}

.staging-dest {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
}

.staging-meta {
  color: var(--ink-faint);
  font-size: 14px;
  margin-bottom: 20px;
}

.status-summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.status-pill {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 13px;
}

.status-pill .count {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-head);
}

.status-pill.new .count { color: var(--green); }
.status-pill.identical .count { color: var(--ink-faint); }
.status-pill.conflict .count { color: var(--amber); }

.file-list {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
  max-height: 480px;
  overflow-y: auto;
}

.file-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  align-items: center;
  gap: 16px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}

.file-row:last-child {
  border-bottom: none;
}

.file-row .fname {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row .fsize {
  color: var(--ink-faint);
  font-size: 13px;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.new { background: var(--green-soft); color: var(--green); }
.badge.identical { background: var(--line-soft); color: var(--ink-faint); }
.badge.conflict { background: var(--amber-soft); color: var(--amber); }
.badge.uploading { background: var(--rose-soft); color: var(--rose); }
.badge.uploaded { background: var(--green-soft); color: var(--green); }
.badge.skipped { background: var(--line-soft); color: var(--ink-faint); }
.badge.failed { background: var(--red-soft); color: var(--red); }
.badge.pending { background: var(--line-soft); color: var(--ink-faint); }
.badge.replace { background: var(--amber-soft); color: var(--amber); }
.badge.keep_both { background: var(--rose-soft); color: var(--rose); }

.file-row .action-select {
  font-size: 13px;
  padding: 5px 8px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.file-row .remove-btn {
  background: none;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  font-size: 16px;
  padding: 2px 6px;
}

.file-row .remove-btn:hover {
  color: var(--red);
}

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--rose-soft);
  border: 1px solid var(--rose);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 14px;
}

.bulk-bar strong {
  margin-right: 4px;
}

.staging-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* --- Conflict comparison ------------------------------------------------- */

.conflict-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 18, 18, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 24px;
}

.conflict-modal {
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  max-width: 720px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px;
}

.conflict-modal h3 {
  font-size: 15px;
  color: var(--ink-faint);
  margin-bottom: 4px;
  font-weight: 500;
  font-family: var(--font-body);
}

.conflict-modal .conflict-filename {
  font-size: 20px;
  margin-bottom: 24px;
  word-break: break-all;
}

.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.compare-col {
  text-align: center;
}

.compare-col .label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 700;
  margin-bottom: 10px;
}

.compare-col .thumb {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--paper-soft) center/contain no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-faint);
  font-size: 13px;
  margin-bottom: 10px;
  overflow: hidden;
}

.compare-col .thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.compare-col .meta {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.7;
}

.compare-col .meta .hash {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--ink-faint);
  word-break: break-all;
}

.keep-both-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  font-size: 14px;
}

.keep-both-row input {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}

.conflict-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.conflict-progress {
  text-align: center;
  color: var(--ink-faint);
  font-size: 13px;
  margin-top: 16px;
}

/* --- Upload progress ------------------------------------------------------ */

.progress-screen {
  text-align: center;
  padding: 24px 0;
}

.progress-bar-track {
  width: 100%;
  height: 14px;
  background: var(--line-soft);
  border-radius: 100px;
  overflow: hidden;
  margin: 24px 0 12px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--rose), var(--ink));
  width: 0%;
  transition: width 0.2s ease;
}

.progress-pct {
  font-family: var(--font-head);
  font-size: 32px;
  font-weight: 700;
}

.progress-current-file {
  color: var(--ink-faint);
  font-size: 14px;
  margin-top: 4px;
  min-height: 20px;
}

.progress-stats {
  display: flex;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.progress-stats .stat {
  text-align: center;
}

.progress-stats .stat .n {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
  display: block;
}

.progress-stats .stat .l {
  font-size: 12px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* --- Result screen ---------------------------------------------------------- */

.result-screen {
  text-align: center;
  padding: 24px 0;
}

.result-check {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 20px;
}

.result-dest {
  color: var(--ink-faint);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.result-count {
  font-size: 15px;
  color: var(--ink-soft);
  margin-bottom: 28px;
}

/* --- Tables (history) --------------------------------------------------------- */

.history-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.history-table th,
.history-table td {
  text-align: left;
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.history-table th {
  color: var(--ink-faint);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.history-table tr:last-child td {
  border-bottom: none;
}

.history-table a {
  text-decoration: none;
  font-weight: 600;
}

.history-table a:hover {
  text-decoration: underline;
}

.empty-state {
  text-align: center;
  color: var(--ink-faint);
  padding: 60px 20px;
}

/* --- Forms (login) ----------------------------------------------------------- */

.auth-card {
  max-width: 380px;
  margin: 96px auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  text-align: center;
  margin-bottom: 28px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: inherit;
}

.field input:focus {
  outline: 2px solid var(--rose);
  outline-offset: 1px;
}

.form-error {
  background: var(--red-soft);
  color: var(--red);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 18px;
}

.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mt-24 {
  margin-top: 24px;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

@media (max-width: 640px) {
  main {
    padding: 32px 16px 64px;
  }
  .compare-grid {
    grid-template-columns: 1fr;
  }
  .file-row {
    grid-template-columns: 1fr auto;
  }
  .file-row .fsize {
    display: none;
  }
}
