/* ============================================================
   ORAYON — Merge  ·  styles.css
   Agregador de PDFs — construído sobre os tokens do design system
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { background: var(--bg); }
body {
  font-family: var(--font-body);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; }
a { color: inherit; text-decoration: none; }

.app { min-height: 100vh; display: flex; flex-direction: column; }
.wrap { width: 100%; max-width: 920px; margin: 0 auto; padding: 0 32px; }

/* ---------------- Header ---------------- */
.hd {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.hd-in { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.lockup { display: flex; align-items: center; gap: 11px; }
.lockup img { height: 32px; width: auto; display: block; }
.lockup .wm { font-family: var(--font-body); font-weight: 700; font-size: 23px; letter-spacing: -.02em; color: var(--text); }
.lockup .prod {
  margin-left: 2px; align-self: center;
  font-family: var(--font-body); font-weight: 600; font-size: 13px;
  letter-spacing: .04em; color: var(--text-dim);
  padding: 3px 9px; border-radius: var(--radius-pill); border: 1px solid var(--border);
  background: var(--bg-card);
}

/* Language selector (from Hub kit) */
.lang { position: relative; }
.lang-btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 14px; font-weight: 600; color: var(--text);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 8px 14px; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: border-color .18s ease, box-shadow .18s ease;
}
.lang-btn:hover { border-color: var(--border-strong); }
.flag { width: 20px; height: 14px; border-radius: 3px; overflow: hidden; display: block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.flag svg { display: block; width: 100%; height: 100%; }
.lang-btn .caret { transition: transform .2s ease; color: var(--text-dim); display: inline-flex; }
.lang-btn[aria-expanded="true"] .caret { transform: rotate(180deg); }
.lang-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 184px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-pop); padding: 6px;
  transform-origin: top right; animation: menuIn .18s cubic-bezier(.22,1,.36,1); z-index: 60;
}
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.lang-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  font-size: 14px; font-weight: 500; color: var(--text);
  background: none; border: 0; cursor: pointer; text-align: left;
  padding: 9px 10px; border-radius: var(--radius-sm); transition: background .14s ease;
}
.lang-item:hover { background: var(--bg-2); }
.lang-item.active { color: var(--core-signal); font-weight: 600; }
.lang-item .flag { width: 22px; height: 15px; }
.lang-item .check { margin-left: auto; color: var(--core-signal); display: inline-flex; }

/* ---------------- Hero ---------------- */
.hero { padding: 64px 0 32px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 600;
  letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--text-mute);
  margin-bottom: 20px;
}
.dot { position: relative; width: 9px; height: 9px; border-radius: 50%; background: var(--success); }
.dot::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 2px solid var(--success); opacity: .6;
  animation: pulse 1.8s cubic-bezier(0,0,.2,1) infinite;
}
@keyframes pulse { 0% { transform: scale(.5); opacity: .7; } 100% { transform: scale(1.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .dot::after { animation: none; opacity: 0; } }

.hero h1 {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(38px, 5.4vw, 56px); line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight); color: var(--text); max-width: 18ch;
}
.hero h1 .grad {
  background: var(--grad-brand); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero .lede {
  margin-top: 20px; max-width: 56ch; font-size: var(--fs-body-lg);
  line-height: var(--lh-relaxed); color: var(--text-mute);
}

/* ---------------- Stage / main ---------------- */
.stage { padding-bottom: 56px; }

/* Dropzone */
.drop {
  position: relative; border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-lg); background: var(--grad-soft);
  padding: 56px 32px; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.drop:hover { border-color: color-mix(in srgb, var(--core-signal-bright) 45%, var(--border-strong)); }
.drop.over {
  border-color: var(--core-signal-bright);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}
.drop .ic {
  width: 64px; height: 64px; margin: 0 auto 20px; border-radius: var(--radius-md);
  background: var(--bg-card); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--core-signal);
  box-shadow: var(--shadow-sm);
}
.drop .ic svg { width: 30px; height: 30px; }
.drop h2 { font-family: var(--font-display); font-weight: 700; font-size: var(--fs-h3); color: var(--text); }
.drop .or { display: inline-flex; align-items: center; gap: 12px; margin: 14px 0 16px; color: var(--text-dim); font-size: 13px; }
.drop .or::before, .drop .or::after { content: ""; width: 32px; height: 1px; background: var(--border-strong); }
.drop-hint { margin-top: 18px; font-family: var(--font-mono); font-size: 12px; letter-spacing: var(--tracking-wide); color: var(--text-dim); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-size: 15px; font-weight: 600; cursor: pointer; white-space: nowrap;
  border-radius: var(--radius-pill); padding: 12px 22px; border: 1px solid transparent;
  transition: transform .1s ease, box-shadow .2s ease, border-color .18s ease, background .18s ease, color .18s ease;
}
.btn:active { transform: scale(.98); }
.btn svg { width: 18px; height: 18px; }
.btn-grad { background: var(--grad-brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn-grad:hover { box-shadow: var(--shadow-brand); }
.btn-grad:disabled { background: var(--bg-2); color: var(--text-dim); box-shadow: none; cursor: not-allowed; }
.btn-outline { background: var(--bg-card); color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover { border-color: var(--core-signal-bright); color: var(--core-signal); }
.btn-ghost { background: none; color: var(--text-mute); padding: 12px 16px; }
.btn-ghost:hover { color: var(--danger); }

/* Toolbar above list */
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 18px;
}
.bar .count { display: flex; align-items: baseline; gap: 8px; }
.bar .count b { font-family: var(--font-display); font-weight: 700; font-size: 24px; color: var(--text); }
.bar .count span { font-size: 14px; color: var(--text-mute); }
.bar .tools { display: flex; align-items: center; gap: 8px; }
.bar .reorder-hint { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-dim); margin-right: 4px; }
.bar .reorder-hint svg { width: 15px; height: 15px; }

/* File list */
.list { display: flex; flex-direction: column; gap: 12px; }
.row {
  display: flex; align-items: center; gap: 16px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px 14px; box-shadow: var(--shadow-card);
  transition: box-shadow .2s ease, border-color .2s ease, opacity .18s ease, transform .12s ease;
}
.row:hover { box-shadow: var(--shadow-card-hover); }
.row.dragging { opacity: .45; }
.row.drag-over { border-color: var(--core-signal-bright); }
.row .handle {
  flex: none; width: 26px; cursor: grab; color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
}
.row .handle:active { cursor: grabbing; }
.row .handle svg { width: 18px; height: 18px; }
.row .idx {
  flex: none; width: 24px; height: 24px; border-radius: var(--radius-pill);
  background: var(--bg-2); color: var(--text-mute);
  font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.thumb {
  flex: none; width: 50px; height: 66px; border-radius: var(--radius-xs);
  background: var(--bg-2); border: 1px solid var(--border); overflow: hidden;
  display: flex; align-items: center; justify-content: center; color: var(--text-dim);
  position: relative;
}
.thumb canvas, .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .ph svg { width: 22px; height: 22px; }
.thumb .spin { width: 18px; height: 18px; }
.row .meta { flex: 1 1 auto; min-width: 0; }
.row .meta .name {
  font-size: 15px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.row .meta .sub { margin-top: 4px; font-size: 13px; color: var(--text-mute); display: flex; align-items: center; gap: 8px; }
.row .meta .sub .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-dim); }
.row .meta .sub .pages { font-family: var(--font-mono); font-size: 12px; letter-spacing: var(--tracking-wide); }
.row .rm {
  flex: none; width: 34px; height: 34px; border-radius: var(--radius-pill);
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text-dim);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.row .rm:hover { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); background: color-mix(in srgb, var(--danger) 6%, var(--bg-card)); }
.row .rm svg { width: 16px; height: 16px; }

/* Action footer (sticky) */
.action {
  position: sticky; bottom: 0; margin-top: 22px; z-index: 30;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  padding: 16px 0 22px;
}
.action-in {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 14px 16px 14px 22px;
}
.action-in .lbl { font-size: 14px; color: var(--text-mute); }
.action-in .lbl b { color: var(--text); }
.action-in .btn-grad { padding: 14px 26px; font-size: 16px; }

/* Toasts / errors */
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--dark-matter); color: #fff; font-size: 14px; font-weight: 500;
  padding: 12px 16px; border-radius: var(--radius-pill); box-shadow: var(--shadow-pop);
  animation: toastIn .24s cubic-bezier(.22,1,.36,1);
}
.toast svg { width: 17px; height: 17px; flex: none; color: var(--warning); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* Merging overlay (within action btn) */
.spinner { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.brand { border-color: rgba(62,89,253,.25); border-top-color: var(--core-signal); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Success state */
.done { text-align: center; padding: 36px 24px 8px; }
.done .seal {
  width: 88px; height: 88px; margin: 0 auto 26px; border-radius: var(--radius-pill);
  background: var(--grad-brand); display: flex; align-items: center; justify-content: center;
  color: #fff; box-shadow: var(--shadow-brand);
  animation: pop .4s cubic-bezier(.22,1.4,.4,1);
}
.done .seal svg { width: 42px; height: 42px; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.done h2 { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-h2); color: var(--text); }
.done p { margin-top: 12px; font-size: var(--fs-body-lg); color: var(--text-mute); }
.done .stat { margin-top: 8px; font-family: var(--font-mono); font-size: 13px; letter-spacing: var(--tracking-wide); color: var(--text-dim); }
.done .acts { display: flex; gap: 12px; justify-content: center; margin-top: 30px; flex-wrap: wrap; }

/* Footer note */
.foot { margin-top: auto; border-top: 1px solid var(--border); }
.foot-in { padding: 26px 0; display: flex; align-items: center; gap: 10px; color: var(--text-dim); font-size: 13px; }
.foot-in svg { width: 16px; height: 16px; color: var(--success); }

@media (max-width: 600px) {
  .wrap { padding: 0 18px; }
  .lockup .prod { display: none; }
  .action-in { flex-direction: column; align-items: stretch; }
  .action-in .btn-grad { width: 100%; }
  .bar .reorder-hint { display: none; }
}
