/* Edix Images to PDF — scoped styles */
.edix-img2pdf-wrap {
  --edix-bg: #0B1220;
  --edix-surface: #111B2E;
  --edix-surface-2: #15213A;
  --edix-ink: #E8EDF4;
  --edix-ink-soft: #8B98AC;
  --edix-line: #243149;
  --edix-accent: #E0732E;
  --edix-teal: #4A90D9;
  --edix-teal-soft: #15213A;
  --edix-danger: #E5594B;
  --edix-radius: 14px;
  --edix-shadow: 0 1px 0 #15213A, 0 3px 0 #243149, 0 10px 20px -8px rgba(0,0,0,.55);

  background: var(--edix-bg);
  color: var(--edix-ink);
  font-family: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  border-radius: var(--edix-radius);
  padding: 40px 28px 48px;
  max-width: 880px;
  margin: 0 auto;
  box-sizing: border-box;
}

.edix-img2pdf-wrap *, .edix-img2pdf-wrap *::before, .edix-img2pdf-wrap *::after {
  box-sizing: border-box;
}

/* Brand Header */
.edix-i2p__brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--edix-line);
}
.edix-i2p__brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.edix-i2p__brand-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.edix-i2p__brand-name {
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
}
.edix-i2p__brand-edix { color: var(--edix-accent); }
.edix-i2p__brand-product { color: var(--edix-ink); }

/* Title */
.edix-i2p__title {
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-weight: 600;
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  letter-spacing: -0.015em;
  margin: 0 0 10px;
  color: var(--edix-ink);
}
.edix-i2p__lede {
  color: var(--edix-ink-soft);
  font-size: 1rem;
  max-width: 540px;
  margin: 0 0 28px;
}
.edix-i2p__lede strong, .edix-i2p__lede b {
  color: var(--edix-ink);
  font-weight: 600;
}

/* Dropzone */
.edix-i2p__dropzone {
  border: 1.5px dashed var(--edix-line);
  border-radius: var(--edix-radius);
  background: var(--edix-surface);
  padding: 48px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.edix-i2p__dropzone:hover,
.edix-i2p__dropzone:focus-visible,
.edix-i2p__dropzone.edix-dragover {
  border-color: var(--edix-accent);
  background: #1A2740;
}
.edix-i2p__dropzone:focus-visible {
  outline: 2px solid var(--edix-accent);
  outline-offset: 3px;
}
.edix-i2p__stack-icon { width: 64px; height: 64px; }
.edix-i2p__dz-text { font-weight: 600; font-size: 1rem; color: var(--edix-ink); }
.edix-i2p__dz-sub { color: var(--edix-ink-soft); font-size: 0.85rem; }

/* Stack section */
.edix-i2p__stack-section { margin-top: 28px; }
.edix-i2p__stack-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.edix-i2p__stack-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  color: var(--edix-ink-soft);
}
.edix-i2p__clear-all {
  background: none;
  border: none;
  color: var(--edix-ink-soft);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px;
}
.edix-i2p__clear-all:hover { color: var(--edix-danger); }

/* Grid */
.edix-i2p__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 14px;
}

/* Card */
.edix-i2p__card {
  position: relative;
  background: var(--edix-surface);
  border-radius: 8px;
  box-shadow: var(--edix-shadow);
  aspect-ratio: 3/4;
  overflow: hidden;
  transition: transform .15s ease, opacity .15s ease;
}
.edix-i2p__card.edix-dragging { opacity: .4; }
.edix-i2p__card.edix-drop-target { outline: 2px solid var(--edix-accent); outline-offset: 2px; }
.edix-i2p__card img {
  width: 100%; height: 100%; object-fit: contain;
  background: #0B1220; display: block;
}
.edix-i2p__card .edix-badge {
  position: absolute; top: 6px; left: 6px;
  background: var(--edix-teal); color: #fff;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem; padding: 2px 6px;
  border-radius: 4px; line-height: 1.3;
}
.edix-i2p__card .edix-remove {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px;
  background: rgba(11,18,32,.85);
  color: #fff; border: none; border-radius: 50%;
  font-size: 0.85rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.edix-i2p__card .edix-remove:hover { background: var(--edix-danger); }
.edix-i2p__card .edix-nudge {
  position: absolute; bottom: 6px;
  width: 22px; height: 22px;
  background: rgba(11,18,32,.85);
  color: #fff; border: none; border-radius: 50%;
  font-size: 0.75rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity .12s ease;
}
.edix-i2p__card .edix-nudge:disabled { opacity: .25; cursor: default; }
.edix-i2p__card .edix-nudge.edix-left { left: 6px; }
.edix-i2p__card .edix-nudge.edix-right { right: 6px; }
.edix-i2p__card:hover .edix-nudge,
.edix-i2p__card:focus-within .edix-nudge { opacity: 1; }
@media (hover: none) { .edix-i2p__card .edix-nudge { opacity: 1; } }

/* Add tile */
.edix-i2p__add-tile {
  aspect-ratio: 3/4;
  border: 1.5px dashed var(--edix-line);
  border-radius: 8px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 6px;
  color: var(--edix-ink-soft);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.78rem;
}
.edix-i2p__add-tile:hover { border-color: var(--edix-accent); color: var(--edix-accent); }
.edix-i2p__add-tile .edix-plus { font-size: 1.4rem; line-height: 1; }

/* Settings */
.edix-i2p__settings {
  margin-top: 28px;
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  padding: 20px;
  background: var(--edix-teal-soft);
  border-radius: var(--edix-radius);
}
.edix-i2p__field { display: flex; flex-direction: column; gap: 6px; min-width: 140px; }
.edix-i2p__field label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--edix-teal);
  font-weight: 600;
}
.edix-i2p__field select,
.edix-i2p__field input[type="text"] {
  font-family: inherit;
  font-size: 0.92rem;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--edix-line);
  background: var(--edix-surface);
  color: var(--edix-ink);
}
.edix-i2p__field select:disabled { opacity: .5; }

/* Action row */
.edix-i2p__action-row {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.edix-i2p__filename-field {
  display: flex; align-items: center;
  border: 1px solid var(--edix-line);
  border-radius: 8px;
  background: var(--edix-surface);
  overflow: hidden;
}
.edix-i2p__filename-field input {
  border: none; outline: none;
  padding: 11px 4px 11px 12px;
  font-family: inherit; font-size: 0.92rem; width: 160px;
  background: transparent; color: var(--edix-ink);
}
.edix-i2p__filename-field span {
  padding: 11px 12px 11px 0;
  color: var(--edix-ink-soft); font-size: 0.92rem;
}
.edix-i2p__primary {
  background: var(--edix-teal);
  color: #fff; border: none;
  font-family: "Space Grotesk", inherit;
  font-weight: 600; font-size: 0.98rem;
  padding: 12px 24px; border-radius: 8px;
  cursor: pointer;
  transition: transform .1s ease, background .15s ease;
}
.edix-i2p__primary:hover { background: #3D7AC2; }
.edix-i2p__primary:active { transform: scale(.98); }
.edix-i2p__primary:disabled { background: #28344A; color: var(--edix-ink-soft); cursor: not-allowed; }

.edix-i2p__note { font-size: 0.85rem; color: var(--edix-ink-soft); }
.edix-i2p__note.edix-error { color: var(--edix-danger); font-weight: 600; }

/* Result */
.edix-i2p__result { margin-top: 28px; }
.edix-i2p__result-card {
  background: var(--edix-surface-2);
  color: #fff;
  border-radius: var(--edix-radius);
  padding: 22px 24px;
  display: flex; align-items: center;
  justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  border: 1px solid var(--edix-line);
}
.edix-i2p__result-card .edix-meta { font-size: 0.85rem; color: var(--edix-ink-soft); }
.edix-i2p__result-card .edix-meta strong { color: #fff; }
.edix-result-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.edix-download-btn {
  background: var(--edix-teal); color: #fff;
  text-decoration: none; font-weight: 600;
  font-size: 0.9rem; padding: 10px 18px;
  border-radius: 7px; display: inline-block;
}
.edix-reset-btn {
  background: transparent;
  border: 1px solid var(--edix-line);
  color: #fff; font-size: 0.9rem;
  padding: 10px 16px; border-radius: 7px;
  cursor: pointer; font-family: inherit;
}
.edix-reset-btn:hover { border-color: #fff; }

/* Footer */
.edix-i2p__footer {
  margin-top: 40px;
  font-size: 0.78rem;
  color: var(--edix-ink-soft);
  border-top: 1px solid var(--edix-line);
  padding-top: 16px;
  text-align: center;
}
.edix-i2p__footer-link {
  color: var(--edix-accent);
  text-decoration: none;
  font-size: 0.78rem;
  opacity: 0.85;
  transition: opacity 0.2s;
}
.edix-i2p__footer-link:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 480px) {
  .edix-img2pdf-wrap { padding: 20px 14px 36px; }
  .edix-i2p__dropzone { padding: 28px 14px; }
  .edix-i2p__stack-icon { width: 52px; height: 52px; }
  .edix-i2p__grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
  .edix-i2p__card .edix-remove,
  .edix-i2p__card .edix-nudge { width: 26px; height: 26px; font-size: 0.9rem; }
  .edix-i2p__settings { gap: 14px; padding: 16px; }
  .edix-i2p__field { min-width: 0; flex: 1 1 calc(50% - 7px); }
  .edix-i2p__action-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .edix-i2p__filename-field { width: 100%; }
  .edix-i2p__filename-field input { width: 100%; }
  .edix-i2p__primary { width: 100%; padding: 13px 24px; }
  .edix-i2p__result-card { flex-direction: column; align-items: flex-start; }
  .edix-result-actions { width: 100%; }
  .edix-download-btn, .edix-reset-btn { flex: 1; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .edix-img2pdf-wrap *, .edix-img2pdf-wrap *::before, .edix-img2pdf-wrap *::after {
    transition: none !important; animation: none !important;
  }
}

/* Dropzone action buttons */
.edix-i2p__dz-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
  justify-content: center;
}
.edix-i2p__dz-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: 8px;
  border: 1px solid var(--edix-line);
  background: var(--edix-surface-2);
  color: var(--edix-ink);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.edix-i2p__dz-btn:hover { border-color: var(--edix-teal); background: #1A2740; }
.edix-i2p__dz-btn--cam { border-color: var(--edix-accent); color: var(--edix-accent); }
.edix-i2p__dz-btn--cam:hover { background: #1E1810; }

/* Camera modal */
.edix-cam-modal {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
}
.edix-cam-modal[hidden] { display: none; }
.edix-cam-inner {
  background: #000;
  border-radius: 0;
  border: none;
  width: 100%;
  max-width: none;
  height: 100%;
  /* iOS Safari: fall back to 100% above, use dvh where supported so the
     browser chrome doesn't clip the shutter/footer */
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.edix-cam-header {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) 14px 12px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.55), rgba(0,0,0,0));
  border-bottom: none;
}
.edix-cam-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  color: #fff;
}
.edix-cam-header-actions { display: flex; align-items: center; gap: 8px; }
.edix-cam-flip, .edix-cam-close {
  background: rgba(20,26,38,0.55);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  border-radius: 8px;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  transition: color .15s, border-color .15s;
}
.edix-cam-flip:hover { color: var(--edix-teal); border-color: var(--edix-teal); }
.edix-cam-close:hover { color: var(--edix-danger); border-color: var(--edix-danger); }

.edix-cam-viewport {
  position: relative;
  background: #000;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.edix-cam-video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.edix-cam-error {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--edix-ink-soft);
  font-size: 0.9rem;
  text-align: center;
  padding: 24px;
  background: rgba(7,16,30,0.9);
}
.edix-cam-error[hidden] { display: none; }

.edix-cam-footer {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, rgba(0,0,0,0.65), rgba(0,0,0,0));
  border-top: none;
}
.edix-cam-count {
  font-size: 0.8rem;
  color: var(--edix-ink-soft);
  min-width: 80px;
}
.edix-cam-shutter {
  width: 62px; height: 62px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--edix-line);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  transition: transform .1s, background .1s;
  flex-shrink: 0;
}
.edix-cam-shutter:hover { transform: scale(1.05); }
.edix-cam-shutter:active { transform: scale(0.95); background: #ddd; }
.edix-cam-shutter-ring {
  display: block;
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 2px solid #ccc;
}
.edix-cam-done {
  min-width: 80px;
  background: var(--edix-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background .15s;
}
.edix-cam-done:hover { background: #c85f20; }
.edix-cam-done:disabled { background: #28344A; color: var(--edix-ink-soft); cursor: not-allowed; }

/* Thumbnail strip */
.edix-cam-strip {
  display: flex;
  gap: 8px;
  padding: 0 16px 16px;
  overflow-x: auto;
  min-height: 0;
}
.edix-cam-strip:empty { display: none; }
.edix-cam-thumb {
  position: relative;
  flex-shrink: 0;
  width: 64px; height: 64px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--edix-line);
}
.edix-cam-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.edix-cam-thumb-remove {
  position: absolute; top: 2px; right: 2px;
  width: 18px; height: 18px;
  background: rgba(7,16,30,.85);
  color: #fff; border: none; border-radius: 50%;
  font-size: 0.7rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.edix-cam-thumb-remove:hover { background: var(--edix-danger); }

/* On wider screens (tablet/desktop) keep the camera as a contained,
   centered panel instead of stretching it edge-to-edge like a phone app */
@media (min-width: 700px) {
  .edix-cam-modal {
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(7,16,30,0.92);
    backdrop-filter: blur(6px);
  }
  .edix-cam-inner {
    max-width: 560px;
    height: min(90vh, 720px);
    border-radius: 16px;
    border: 1px solid var(--edix-line);
    background: var(--edix-surface);
  }
  .edix-cam-header {
    position: relative;
    background: transparent;
    border-bottom: 1px solid var(--edix-line);
    padding: 14px 18px;
  }
  .edix-cam-title { color: var(--edix-ink); }
  .edix-cam-flip, .edix-cam-close {
    background: none;
    border: 1px solid var(--edix-line);
    color: var(--edix-ink-soft);
  }
  .edix-cam-footer {
    background: transparent;
    border-top: 1px solid var(--edix-line);
    padding: 16px 20px;
  }
}