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

:root {
  --brand:       #0f79d8;
  --brand-hover: #0d6abf;
  --brand-pale:  #e8f2fd;
  --bg:          #f5f7fa;
  --surface:     #ffffff;
  --surface-2:   #f9fafb;
  --line:        #e5eaf2;
  --text:        #1a1f2e;
  --muted:       #6b7a99;
  --success:     #0d7a4a;
  --error:       #c0192e;
  --radius:      14px;
  --radius-sm:   10px;
  --shadow-sm:   0 2px 8px rgba(15,30,70,.07);
  --shadow:      0 4px 20px rgba(15,30,70,.10);
  --shadow-md:   0 8px 32px rgba(15,30,70,.12);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }

/* ─── App wrapper ─────────────────────────── */
.pdfPassApp {
  min-height: 100vh;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

/* ─── Top bar ─────────────────────────────── */
.pdfPassApp__top {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}

.pdfPassApp__topInner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pdfPassApp__brand {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--brand);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.pdfPassApp__brand span { color: var(--text); }

.pdfPassApp__topActions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pdfPassApp__lang { position: relative; }

.pdfPassApp__lang summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  transition: border-color .18s, background .18s;
}
.pdfPassApp__lang summary:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-pale);
}

.pdfPassApp__langMenu {
  position: absolute;
  right: 0;
  top: 40px;
  min-width: 76px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 20;
}
.pdfPassApp__langMenu a {
  display: block;
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: background .15s, color .15s;
}
.pdfPassApp__langMenu a:hover {
  background: var(--brand-pale);
  color: var(--brand);
}

/* ─── Step indicator ──────────────────────── */
.stepBar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
}

.stepBar__inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 52px;
}

.stepBar__item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  transition: color .2s;
  white-space: nowrap;
}
.stepBar__item.is-active { color: var(--brand); }
.stepBar__item.is-done   { color: var(--success); }

.stepBar__num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
  transition: background .2s, color .2s, border-color .2s;
}
.stepBar__item.is-active .stepBar__num {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.stepBar__item.is-done .stepBar__num {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.stepBar__sep {
  flex: 1;
  height: 2px;
  background: var(--line);
  margin: 0 12px;
  border-radius: 2px;
  min-width: 24px;
  max-width: 100px;
}

/* ─── Wizard steps ────────────────────────── */
.wizardStep { display: none; }
.wizardStep.is-active { display: block; }

/* ─── STEP 1: Upload ──────────────────────── */
.pdfPassHero {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 48px 24px 44px;
  text-align: center;
}
.pdfPassHero__inner {
  max-width: 620px;
  margin: 0 auto;
}
.pdfPassHero h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3.2vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
}
.pdfPassHero p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.97rem;
  font-weight: 500;
  line-height: 1.6;
}

.pdfPassDrop {
  max-width: 620px;
  margin: 32px auto 0;
}

.dropZone {
  border: 2px dashed #c5d8f5;
  border-radius: var(--radius);
  background: var(--brand-pale);
  padding: 44px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.dropZone:hover,
.dropZone.is-over {
  border-color: var(--brand);
  background: #ddeeff;
}
.dropZone.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}
.dropZone__icon  { font-size: 2.8rem; display: block; margin-bottom: 12px; }
.dropZone__title { display: block; font-size: 1.05rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.dropZone__sub   { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 18px; }

.fileInfo {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: center;
}

/* features */
.pdfPassFeatures {
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 32px 24px;
}
.pdfPassFeatures__inner {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.featureItem { display: flex; align-items: flex-start; gap: 14px; }
.featureItem__icon  { font-size: 1.6rem; flex-shrink: 0; line-height: 1; }
.featureItem__title { font-size: 0.88rem; font-weight: 700; color: var(--text); margin: 0 0 4px; }
.featureItem__desc  { font-size: 0.83rem; color: var(--muted); line-height: 1.5; margin: 0; }

/* SEO */
.pdfPassSeo {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 24px 16px;
}
.pdfPassSeo h2 { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 12px; color: var(--text); }
.pdfPassSeo h3 { font-size: 1rem; font-weight: 700; margin: 28px 0 8px; color: var(--text); }
.pdfPassSeo p  { color: var(--muted); font-size: 0.93rem; line-height: 1.7; margin: 0 0 10px; max-width: 760px; }

.seoGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 8px; }
.seoGrid__item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 18px; background: var(--surface); }
.seoGrid__item h4 { font-size: 0.88rem; font-weight: 700; margin: 0 0 6px; color: var(--text); }
.seoGrid__item p  { font-size: 0.83rem; margin: 0; }

/* FAQ */
.pdfPassFaq { max-width: 1120px; margin: 0 auto; padding: 8px 24px 48px; }
.pdfPassFaq h2 { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 14px; color: var(--text); }
.pdfPassFaq details {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 14px 18px;
  margin-top: 8px;
  transition: box-shadow .2s;
}
.pdfPassFaq details[open] { box-shadow: var(--shadow-sm); }
.pdfPassFaq summary {
  font-size: 0.93rem; font-weight: 700; cursor: pointer; color: var(--text);
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.pdfPassFaq summary::after { content: '+'; font-size: 1.1rem; color: var(--brand); flex-shrink: 0; transition: transform .2s; }
.pdfPassFaq details[open] summary::after { transform: rotate(45deg); }
.pdfPassFaq p { margin: 10px 0 0; color: var(--muted); font-size: 0.88rem; line-height: 1.65; }

/* ─── STEP 2: Settings ────────────────────── */
.pdfPassSettings {
  max-width: 680px;
  margin: 40px auto 0;
  padding: 0 24px 48px;
}

.settingsHeader { margin-bottom: 24px; }
.settingsHeader h2 { margin: 0 0 6px; font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
.settingsHeader p  { margin: 0; color: var(--muted); font-size: 0.93rem; }

.selectedFileBar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 24px;
}
.selectedFileBar__icon { font-size: 1.4rem; flex-shrink: 0; }
.selectedFileBar__info { flex: 1; min-width: 0; }
.selectedFileBar__name {
  font-weight: 700; font-size: 0.9rem; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.selectedFileBar__size { font-size: 0.8rem; color: var(--muted); margin-top: 1px; }
.selectedFileBar__change {
  font-size: 0.8rem; color: var(--brand); font-weight: 600;
  cursor: pointer; background: none; border: none; padding: 0;
  flex-shrink: 0; text-decoration: underline; text-underline-offset: 2px;
}
.selectedFileBar__change:hover { color: var(--brand-hover); }

.settingsCard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 16px;
}
.settingsCard__head {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.settingsCard__head h3 { margin: 0; font-size: 0.9rem; font-weight: 800; }
.settingsCard__head p  { margin: 3px 0 0; font-size: 0.82rem; color: var(--muted); }
.settingsCard__body { padding: 18px 20px 20px; }

.field { margin-top: 14px; }
.field:first-child { margin-top: 0; }
.field label { display: block; margin-bottom: 5px; font-size: 0.84rem; font-weight: 600; color: #374151; }

input[type="password"],
input[type="text"],
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7a99' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
input[type="password"]:focus,
input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15,121,216,.14);
}

.permissionsGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.inlineToggle {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface-2);
  cursor: pointer; transition: border-color .18s, background .18s; user-select: none;
}
.inlineToggle:hover { border-color: var(--brand); background: var(--brand-pale); }
.inlineToggle input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); flex-shrink: 0; cursor: pointer; }
.inlineToggle span { font-size: 0.82rem; font-weight: 500; color: #374151; line-height: 1.3; }

.statusBar {
  margin-top: 14px; padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 0.84rem; font-weight: 600; background: var(--surface-2);
  color: var(--muted); border: 1px solid var(--line);
  display: flex; align-items: center; gap: 7px; min-height: 40px;
  transition: background .2s, color .2s, border-color .2s;
}
.statusBar.is-error { background: #fff5f6; color: var(--error); border-color: #f5c0c8; }
.statusBar.is-ok    { background: #f0faf6; color: var(--success); border-color: #b3e0c9; }

.actionBar { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }

.mergeQueue {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mergeQueue__empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  color: var(--muted);
  font-size: 0.84rem;
  background: var(--surface-2);
}

.mergeQueue__item {
  display: grid;
  grid-template-columns: 86px 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px;
  background: var(--surface-2);
}

.mergeQueue__thumb {
  width: 82px;
  height: 110px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.74rem;
  line-height: 1.2;
  padding: 6px;
  overflow: hidden;
}

.mergeQueue__thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.mergeQueue__meta { min-width: 0; }

.mergeQueue__name {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mergeQueue__sub {
  margin-top: 3px;
  font-size: 0.8rem;
  color: var(--muted);
}

.mergeQueue__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ─── STEP 3: Download ────────────────────── */
.pdfPassDownload {
  max-width: 560px;
  margin: 60px auto 0;
  padding: 0 24px 60px;
  text-align: center;
}

.downloadSuccess__icon  { font-size: 3.5rem; display: block; margin-bottom: 16px; }
.downloadSuccess__title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 8px; color: var(--text); }
.downloadSuccess__sub   { font-size: 0.95rem; color: var(--muted); margin: 0 0 32px; }

.downloadCard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 20px;
  text-align: left;
}
.downloadCard__row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 18px; font-size: 0.88rem; border-bottom: 1px solid var(--line);
}
.downloadCard__row:last-child { border-bottom: none; }
.downloadCard__row:nth-child(even) { background: var(--surface-2); }
.downloadCard__label { color: var(--muted); font-size: 0.82rem; font-weight: 500; }
.downloadCard__value { font-weight: 700; color: var(--text); font-size: 0.88rem; text-align: right; max-width: 65%; word-break: break-all; }

.downloadActions { display: flex; flex-direction: column; gap: 8px; }

.newFileLink {
  display: inline-block; margin-top: 20px; font-size: 0.85rem;
  color: var(--brand); font-weight: 600; cursor: pointer;
  background: none; border: none;
  text-decoration: underline; text-underline-offset: 2px;
}
.newFileLink:hover { color: var(--brand-hover); }

/* ─── Buttons ─────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 18px; background: var(--surface); color: var(--text);
  font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  transition: background .18s, border-color .18s, box-shadow .18s, transform .1s;
  width: 100%; text-decoration: none; white-space: nowrap;
}
.btn:focus-visible { outline: 3px solid rgba(15,121,216,.3); outline-offset: 2px; }
.btn:disabled      { opacity: 0.42; cursor: not-allowed; pointer-events: none; }

.btn--primary {
  background: var(--brand); color: #fff;
  border-color: rgba(10,55,130,.2);
  box-shadow: 0 2px 8px rgba(15,121,216,.22);
}
.btn--primary:hover:not(:disabled) { background: var(--brand-hover); box-shadow: 0 4px 14px rgba(15,121,216,.30); }
.btn--primary:active:not(:disabled) { transform: scale(0.98); }

.btn--ghost { background: var(--surface-2); border-color: var(--line); color: var(--muted); }
.btn--ghost:hover:not(:disabled) { background: var(--line); color: var(--text); }

.btn--sm { width: auto; min-height: 38px; padding: 7px 14px; font-size: 0.85rem; }

.small { font-size: 0.82rem; font-weight: 500; color: var(--muted); }

/* ─── Responsive ──────────────────────────── */
@media (max-width: 860px) {
  .pdfPassFeatures__inner { grid-template-columns: 1fr 1fr; gap: 20px; }
  .seoGrid { grid-template-columns: 1fr; }
}

@media (max-width: 580px) {
  .pdfPassApp__topInner { padding: 0 16px; }
  .pdfPassHero { padding: 32px 16px 28px; }
  .dropZone { padding: 30px 16px; }
  .pdfPassSettings { padding: 0 16px 40px; margin-top: 24px; }
  .settingsCard__head, .settingsCard__body { padding-left: 16px; padding-right: 16px; }
  .permissionsGrid { grid-template-columns: 1fr; }
  .mergeQueue__item { grid-template-columns: 1fr; gap: 10px; }
  .mergeQueue__thumb { width: 100%; max-width: 160px; margin: 0 auto; }
  .mergeQueue__actions { flex-direction: row; }
  .pdfPassDownload { margin-top: 32px; padding: 0 16px 40px; }
  .pdfPassFeatures { padding: 24px 16px; }
  .pdfPassFeatures__inner { grid-template-columns: 1fr; gap: 18px; }
  .pdfPassSeo, .pdfPassFaq { padding-left: 16px; padding-right: 16px; }
  .stepBar__label { display: none; }
  .stepBar__sep { max-width: 40px; }
}

/* bg remove wizard */
.bgRangeRow {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bgRangeRow input[type="range"] {
  flex: 1;
  margin: 0;
}

.bgRangeValue {
  min-width: 44px;
  text-align: right;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.bgPreviewPair {
  --preview-ratio: 4 / 3;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.bgPreviewPair--final {
  margin-top: 6px;
}

.bgPreviewCard {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 10px;
}

.bgPreviewCard figcaption {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.bgPreviewStage {
  position: relative;
  aspect-ratio: var(--preview-ratio);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}

.bgPreviewStage--checker {
  background-color: #f9fafb;
  background-image:
    linear-gradient(45deg, #eef1f6 25%, transparent 25%),
    linear-gradient(-45deg, #eef1f6 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef1f6 75%),
    linear-gradient(-45deg, transparent 75%, #eef1f6 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

.bgPreviewStage canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.bgPreviewPlaceholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 14px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

@media (max-width: 580px) {
  .bgPreviewPair { grid-template-columns: 1fr; }
}

/* image upscaler wizard */
.upWarn {
  color: #9a3412;
}

.upInfoLine {
  margin-top: 10px;
}

.upProgressWrap {
  display: none;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 10px 12px;
}

.upProgressWrap.is-visible {
  display: block;
}

.upProgressBar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e3e9f2;
  overflow: hidden;
}

.upProgressBar__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0f79d8, #1492ff);
  transition: width .18s ease;
}
