/* Foto Larko uploader – matches the WordPress theme (navy/red, Outfit + Satoshi). */
:root {
  --red: #BA080B;
  --red-dark: #9a0609;
  --red-soft: #FDECEC;
  --navy: #06315B;
  --ink: #0b1f38;
  --muted: #5b6b80;
  --line: #dfe6ee;
  --bg: #f2f5f9;
  --card: #fff;
  --ok: #0f7a4a;
  --ok-soft: #e6f5ee;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(6, 49, 91, .06), 0 8px 24px rgba(6, 49, 91, .07);
  --shadow-lg: 0 18px 48px rgba(6, 49, 91, .16);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --header-h: 76px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  font: 16px/1.55 "Satoshi", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2 { font-family: "Outfit", system-ui, sans-serif; color: var(--navy); letter-spacing: -.01em; margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid rgba(186, 8, 11, .45); outline-offset: 2px; }
.pp-visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pp-skip { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--navy); color: #fff; padding: 8px 14px; border-radius: 8px; }
.pp-skip:focus { top: 12px; }

/* ---------- Buttons ---------- */
.pp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 22px; border-radius: 999px; border: 1.5px solid transparent;
  font-weight: 700; font-size: 15px; text-decoration: none; white-space: nowrap;
  transition: background .2s, color .2s, box-shadow .25s var(--ease), transform .2s var(--ease), opacity .2s;
}
.pp-btn svg { width: 18px; height: 18px; transition: transform .25s var(--ease); }
.pp-btn-primary { background: var(--red); color: #fff; }
.pp-btn-primary:hover { background: var(--red-dark); }
.pp-btn-primary:hover svg { transform: translateX(3px); }
.pp-btn-primary[aria-disabled="true"] { background: #c9d2dd; color: #fff; box-shadow: none; }
.pp-btn-primary.is-ready { box-shadow: 0 8px 22px rgba(186, 8, 11, .35); animation: pp-ready .6s var(--ease); }
.pp-btn-primary.is-loading { opacity: .75; pointer-events: none; }
.pp-btn-primary.is-loading span::after { content: "…"; }
.pp-btn-ghost { background: #fff; color: var(--navy); border-color: var(--line); cursor: pointer; }
.pp-btn-ghost:hover { border-color: var(--navy); }
@keyframes pp-ready { 0% { transform: scale(1); } 40% { transform: scale(1.06); } 100% { transform: scale(1); } }

/* ---------- Header ---------- */
.pp-header {
  position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
  transition: box-shadow .25s;
}
.pp-header.is-scrolled { box-shadow: 0 6px 20px rgba(6, 49, 91, .08); }
.pp-header-inner {
  max-width: 1320px; margin: 0 auto; height: var(--header-h); padding: 0 24px;
  display: flex; align-items: center; gap: 24px;
}
.pp-logo img { height: 52px; width: auto; display: block; }
.pp-logo { font-family: "Outfit"; font-weight: 800; color: var(--red); text-decoration: none; }
.pp-header-product { display: flex; flex-direction: column; padding-left: 24px; border-left: 1px solid var(--line); min-width: 0; }
.pp-eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.pp-header-title { font-family: "Outfit"; font-weight: 700; font-size: 19px; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-header-progress { margin-left: auto; width: 240px; }
.pp-progress-text { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.pp-progress-text strong { color: var(--navy); font-size: 16px; }
.pp-progress { height: 8px; border-radius: 99px; background: #e6ebf1; overflow: hidden; }
.pp-progress-fill {
  display: block; height: 100%; width: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--navy), var(--red));
  transform: scaleX(0); transform-origin: left;
  transition: transform .5s var(--ease);
}
.js-total { display: inline-block; }
.js-total.is-bump { animation: pp-bump .35s var(--ease); }
@keyframes pp-bump { 50% { transform: scale(1.25); color: var(--red); } }

/* ---------- Layout ---------- */
.pp-layout {
  max-width: 1320px; margin: 0 auto; padding: 28px 24px 120px;
  display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 28px; align-items: start;
}
.pp-side { position: sticky; top: calc(var(--header-h) + 20px); display: grid; gap: 16px; }
.pp-side-card, .pp-drop { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }

/* Drop zone */
.pp-drop { padding: 14px; transition: transform .25s var(--ease), box-shadow .25s; }
.pp-drop-target {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px;
  padding: 30px 18px; border: 2px dashed #c7d2df; border-radius: 12px; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.pp-drop-target:hover, .pp-drop.is-over .pp-drop-target { border-color: var(--red); background: var(--red-soft); }
.pp-drop.is-over { transform: scale(1.02); box-shadow: var(--shadow-lg); }
#pp-file:focus-visible + .pp-drop-target { outline: 3px solid rgba(186, 8, 11, .45); outline-offset: 2px; }
.pp-drop-icon {
  width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center;
  background: var(--red-soft); color: var(--red); margin-bottom: 6px; transition: transform .3s var(--ease);
}
.pp-drop-icon svg { width: 30px; height: 30px; }
.pp-drop-target:hover .pp-drop-icon, .pp-drop.is-over .pp-drop-icon { transform: translateY(-3px) rotate(-4deg); }
.pp-drop-title { font-family: "Outfit"; font-weight: 700; font-size: 18px; color: var(--navy); }
.pp-drop-hint { font-size: 13px; color: var(--muted); }
.pp-drop-hint u { color: var(--red); text-underline-offset: 2px; }
.pp-default-size { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 4px 2px; font-size: 14px; color: var(--muted); }
.pp-default-size select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: #fff; color: var(--navy); font-weight: 700; }
.pp-upload-status { padding: 12px 4px 2px; font-size: 14px; color: var(--navy); font-weight: 600; }
.pp-upload-status .pp-progress { margin-top: 8px; }
.pp-upload-status .pp-progress-fill { transition: transform .2s linear; }

/* Summary + thumbnails */
.pp-summary { padding: 18px; }
.pp-summary-count { font-family: "Outfit"; color: var(--navy); line-height: 1; }
.pp-summary-count strong { font-size: 40px; font-weight: 800; }
.pp-summary-count span { font-size: 20px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.pp-summary-msg { margin: 8px 0 0; font-size: 14px; color: var(--muted); transition: color .2s; }
.pp-summary-msg.is-done { color: var(--ok); font-weight: 700; }
.pp-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; max-height: 300px; overflow-y: auto; }
.pp-thumbs:empty { display: none; }
.pp-thumb {
  position: relative; aspect-ratio: 1; padding: 0; border: 0; border-radius: 8px; overflow: hidden;
  background: #e9eef4; animation: pp-pop .35s var(--ease) both;
}
.pp-thumb img { position: relative; width: 100%; height: 100%; object-fit: cover; display: block; }
.pp-thumb::before { /* spinner behind an image that's still loading */
  content: ""; position: absolute; inset: 50% auto auto 50%; width: 18px; height: 18px; margin: -9px;
  border: 2px solid rgba(6, 49, 91, .15); border-top-color: var(--red); border-radius: 50%;
  animation: pp-spin .8s linear infinite;
}
.pp-thumb-qty {
  position: absolute; right: 4px; bottom: 4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px;
  background: var(--red); color: #fff; font-size: 12px; font-weight: 800; line-height: 22px; text-align: center;
}
.pp-thumb.is-pending::before { display: none; }
.pp-thumb.is-pending img { opacity: .4; filter: grayscale(.6); }
.pp-thumb-status { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.pp-thumb-pct { font-size: 11px; font-weight: 800; color: var(--navy); background: rgba(255, 255, 255, .9); border-radius: 99px; padding: 0 6px; }
.pp-spinner { width: 18px; height: 18px; border: 2px solid rgba(6, 49, 91, .2); border-top-color: var(--red); border-radius: 50%; animation: pp-spin .8s linear infinite; }
@keyframes pp-spin { to { transform: rotate(360deg); } }
@keyframes pp-pop { from { opacity: 0; transform: scale(.85); } }

/* ---------- Content ---------- */
.pp-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.pp-toolbar h1 { font-size: 30px; font-weight: 800; }
.pp-sub { margin: 4px 0 0; color: var(--muted); max-width: 640px; }
.pp-view-toggle { display: inline-flex; background: #fff; border-radius: 12px; padding: 4px; box-shadow: var(--shadow); flex-shrink: 0; }
.pp-view-toggle button { width: 40px; height: 36px; border: 0; border-radius: 9px; background: none; color: var(--muted); display: grid; place-items: center; transition: background .2s, color .2s; }
.pp-view-toggle button svg { width: 20px; height: 20px; }
.pp-view-toggle button[aria-pressed="true"] { background: var(--navy); color: #fff; }

/* Empty state */
.pp-empty { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); text-align: center; padding: 56px 24px; }
.pp-has-photos .pp-empty { display: none; }
.pp-empty h2 { font-size: 22px; margin-top: 22px; }
.pp-empty p { color: var(--muted); margin: 6px 0 20px; }
.pp-empty-art { position: relative; width: 150px; height: 104px; margin: 0 auto; }
.pp-empty-art span {
  position: absolute; inset: 0; margin: auto; width: 96px; height: 72px; border-radius: 6px;
  background: linear-gradient(160deg, #dbe4ee, #f6f8fb); border: 5px solid #fff; box-shadow: 0 8px 20px rgba(6, 49, 91, .14);
  animation: pp-fan 3.2s var(--ease) infinite alternate;
}
.pp-empty-art span:nth-child(1) { --r: -14deg; --x: -26px; }
.pp-empty-art span:nth-child(2) { --r: 9deg; --x: 24px; animation-delay: .15s; }
.pp-empty-art span:nth-child(3) { --r: -2deg; --x: 0px; background: linear-gradient(160deg, #f9d9d9, #fff); animation-delay: .3s; }
@keyframes pp-fan { from { transform: rotate(0) translateX(0); } to { transform: rotate(var(--r)) translateX(var(--x)); } }

/* Photo cards */
.pp-cards { display: grid; gap: 14px; }
.pp-card {
  display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 20px; padding: 14px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: opacity .35s var(--ease), transform .35s var(--ease), box-shadow .25s;
}
.pp-card:hover { box-shadow: 0 2px 4px rgba(6, 49, 91, .06), 0 14px 32px rgba(6, 49, 91, .1); }
.pp-card.is-entering { opacity: 0; transform: translateY(14px) scale(.98); }
.pp-card.is-leaving { opacity: 0; transform: scale(.96); }
.pp-card.is-flash { animation: pp-flash 1s var(--ease); }
@keyframes pp-flash { 0%, 100% { box-shadow: var(--shadow); } 30% { box-shadow: 0 0 0 3px var(--red), var(--shadow-lg); } }
.pp-card-photo {
  position: relative; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: #e9eef4;
  aspect-ratio: 1; cursor: zoom-in;
}
.pp-card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s var(--ease); }
.pp-card-photo:hover img { transform: scale(1.05); }
.pp-card-body { display: flex; flex-direction: column; min-width: 0; padding: 4px 4px 4px 0; }
.pp-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pp-card-name { font-weight: 700; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.pp-card-remove {
  width: 36px; height: 36px; border: 0; border-radius: 10px; background: none; color: var(--muted);
  display: grid; place-items: center; transition: background .2s, color .2s;
}
.pp-card-remove svg { width: 19px; height: 19px; }
.pp-card-remove:hover { background: var(--red-soft); color: var(--red); }
.pp-lines-head, .pp-line { display: grid; grid-template-columns: minmax(0, 1fr) auto 32px; gap: 14px; align-items: center; }
.pp-lines-head { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; font-weight: 700; color: var(--muted); padding-bottom: 6px; }
.pp-lines-head span:last-child { grid-column: 2; text-align: center; }
.pp-lines { display: grid; gap: 8px; }
.pp-line { padding: 8px 0; border-top: 1px solid #edf1f5; }
.pp-line:first-child { border-top: 0; }
.pp-line.is-new { animation: pp-line-in .45s var(--ease); }
@keyframes pp-line-in { from { opacity: 0; transform: translateY(-8px); background: var(--red-soft); } }

.pp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pp-chip, .pp-chip-static {
  min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff;
  font-weight: 700; font-size: 14px; color: var(--navy);
  transition: border-color .2s, background .2s, color .2s, transform .15s var(--ease);
}
.pp-chip-static { display: inline-flex; align-items: center; background: #f6f8fb; }
.pp-chip:hover:not(:disabled) { border-color: var(--navy); }
.pp-chip:active:not(:disabled) { transform: scale(.96); }
.pp-chip[aria-checked="true"] { border-color: var(--red); background: var(--red-soft); color: var(--red); }
.pp-chip:disabled { opacity: .4; cursor: not-allowed; text-decoration: line-through; }

.pp-qty { display: inline-flex; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.pp-qty-btn { width: 40px; height: 40px; border: 0; background: none; font-size: 20px; font-weight: 700; color: var(--navy); transition: background .15s; }
.pp-qty-btn:hover:not(:disabled) { background: #f0f4f8; }
.pp-qty-btn:disabled { color: #c3ccd7; cursor: not-allowed; }
.pp-qty input {
  width: 52px; height: 40px; border: 0; text-align: center; font-weight: 800; font-size: 16px; color: var(--navy);
  -moz-appearance: textfield; appearance: textfield;
}
.pp-qty input::-webkit-inner-spin-button, .pp-qty input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.pp-line-remove { width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 22px; line-height: 1; }
.pp-line-remove:hover { background: var(--red-soft); color: var(--red); }
.pp-add-size {
  align-self: flex-start; margin-top: 10px; padding: 8px 14px; border-radius: 10px; border: 1.5px dashed #c7d2df;
  background: none; color: var(--navy); font-weight: 700; font-size: 14px; transition: border-color .2s, color .2s, background .2s;
}
.pp-add-size:hover:not(:disabled) { border-color: var(--red); color: var(--red); background: var(--red-soft); }
.pp-add-size:disabled { opacity: .45; cursor: not-allowed; }
.pp-add-size[hidden] { display: none; }

/* Grid view */
.is-grid .pp-cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.is-grid .pp-card { grid-template-columns: 1fr; gap: 12px; }
.is-grid .pp-card-photo { aspect-ratio: 4 / 3; }
.is-grid .pp-card-body { padding: 0 2px 2px; }
.is-grid .pp-lines-head, .is-grid .pp-line { grid-template-columns: 1fr auto 28px; gap: 8px; }
.is-grid .pp-chip { padding: 0 10px; min-height: 36px; font-size: 13px; }
.is-grid .pp-qty-btn { width: 34px; height: 36px; }
.is-grid .pp-qty input { width: 38px; height: 36px; }

/* ---------- Dialogs & toasts ---------- */
dialog { border: 0; padding: 0; background: none; color: inherit; }
dialog::backdrop { background: rgba(6, 22, 40, .7); backdrop-filter: blur(3px); }
dialog[open] { animation: pp-dialog .3s var(--ease); }
@keyframes pp-dialog { from { opacity: 0; transform: translateY(12px) scale(.97); } }
.pp-lightbox { max-width: min(92vw, 1100px); max-height: 90vh; }
.pp-lightbox img { display: block; max-width: 100%; max-height: 90vh; border-radius: 12px; box-shadow: var(--shadow-lg); }
.pp-lightbox-close {
  position: fixed; top: 18px; right: 22px; width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: #fff; color: var(--navy); font-size: 28px; line-height: 1; box-shadow: var(--shadow);
}
.pp-confirm { background: #fff; border-radius: var(--radius); padding: 26px; width: min(92vw, 400px); box-shadow: var(--shadow-lg); }
.pp-confirm-msg { margin: 0 0 20px; font-family: "Outfit"; font-weight: 700; font-size: 20px; color: var(--navy); }
.pp-confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }
.pp-toasts { position: fixed; z-index: 60; right: 20px; bottom: 20px; display: grid; gap: 10px; width: min(380px, calc(100vw - 40px)); }
.pp-toast {
  padding: 14px 16px; border-radius: 12px; background: var(--navy); color: #fff; font-weight: 600; font-size: 14px;
  box-shadow: var(--shadow-lg); animation: pp-toast-in .35s var(--ease); transition: opacity .4s, transform .4s var(--ease);
}
.pp-toast.is-error { background: #fff; color: var(--red); box-shadow: inset 0 0 0 1.5px rgba(186, 8, 11, .35), var(--shadow-lg); }
.pp-toast.is-success { background: var(--ok); }
.pp-toast.is-leaving { opacity: 0; transform: translateX(20px); }
@keyframes pp-toast-in { from { opacity: 0; transform: translateY(14px); } }

/* ---------- Mobile ---------- */
.pp-mobilebar { display: none; }
@media (max-width: 960px) {
  .pp-layout { grid-template-columns: 1fr; padding: 16px 14px 120px; gap: 16px; }
  .pp-side { position: static; }
  .pp-header-progress, .pp-header .js-complete { display: none; }
  .pp-header-inner { padding: 0 16px; gap: 14px; --header-h: 64px; height: 64px; }
  .pp-logo img { height: 38px; }
  .pp-header-product { padding-left: 14px; }
  .pp-header-title { font-size: 16px; }
  .pp-drop-target { padding: 22px 14px; }
  .pp-thumbs { grid-template-columns: repeat(6, 1fr); max-height: 150px; }
  .pp-summary { padding: 14px 16px; }
  .pp-summary-count strong { font-size: 30px; }
  .pp-toolbar h1 { font-size: 24px; }
  .pp-mobilebar {
    display: flex; align-items: center; gap: 14px; position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: #fff; box-shadow: 0 -8px 24px rgba(6, 49, 91, .12);
  }
  .pp-mobilebar-text { flex: 1; font-size: 14px; color: var(--muted); }
  .pp-mobilebar-text strong { color: var(--navy); font-size: 17px; }
  .pp-mobilebar .pp-progress { margin-top: 6px; }
  .pp-toasts { bottom: 90px; }
}
@media (max-width: 600px) {
  .pp-card { grid-template-columns: 96px minmax(0, 1fr); gap: 12px; padding: 12px; }
  .pp-card-photo { align-self: start; }
  .pp-lines-head { display: none; }
  .pp-line { grid-template-columns: 1fr auto; gap: 8px; }
  .pp-line .pp-chips { grid-column: 1 / -1; }
  .pp-line .pp-qty { justify-self: start; }
  .pp-line-remove-spacer { display: none; }
  .pp-chip { padding: 0 12px; min-height: 38px; font-size: 13px; }
  .pp-view-toggle { display: none; }
  .is-grid .pp-cards { grid-template-columns: 1fr; }
  .pp-thumbs { grid-template-columns: repeat(5, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .pp-thumb::before, .pp-spinner { animation: pp-spin 2.4s linear infinite !important; }
}
