/* ============================================================
   PDF to Image — modal.css
   Password-unlock dialog, shown mid Step-1 when a selected PDF
   turns out to be password-protected (pdf.js's onPassword hook).
   Sits above everything except the toast (z-index 999 in base.css).
   ============================================================ */

.ip-pdf2img-modal {
  position: fixed;
  inset: 0;
  z-index: 998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ip-pdf2img-modal[hidden] {
  display: none;
}

.ip-pdf2img-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 34, 0.55);
  backdrop-filter: blur(2px);
  animation: ipModalFade 0.2s ease both;
}

.ip-pdf2img-modal__card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 24px;
  padding: 28px 24px 24px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.28);
  animation: ipModalPop 0.22s cubic-bezier(0.16, 1, 0.3, 1) both;
  /* The modal markup sits outside .ip-pdf2img-wrap (a sibling of <main>,
     like the toast), so it never inherited the Inter font stack set
     there — every descendant here (title, input, buttons) falls back
     to it via inheritance, same fix pattern as the toast in base.css. */
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

@keyframes ipModalFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes ipModalPop {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ip-pdf2img-modal__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--ip-brand-soft);
  color: var(--ip-brand-dark);
  margin-bottom: 14px;
}

.ip-pdf2img-modal__icon svg {
  width: 24px;
  height: 24px;
}

.ip-pdf2img-modal__title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 800;
  color: var(--ip-ink);
  letter-spacing: -0.2px;
}

.ip-pdf2img-modal__subtitle {
  margin: 0 0 20px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ip-ink-soft);
}

.ip-pdf2img-modal__form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ip-pdf2img-modal__inputwrap {
  position: relative;
  display: flex;
  align-items: center;
}

.ip-pdf2img-modal__input {
  width: 100%;
  height: 48px;
  padding: 0 46px 0 16px;
  border-radius: 12px;
  border: 1.5px solid var(--ip-line);
  background: var(--ip-bg);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--ip-ink);
  text-align: left;
}

.ip-pdf2img-modal__input::placeholder {
  color: #9a9aa8;
  font-weight: 500;
  letter-spacing: 0.1px;
}

.ip-pdf2img-modal__input:focus-visible {
  outline: none;
  border-color: var(--ip-brand);
  background: #fff;
  box-shadow: 0 0 0 4px var(--ip-brand-soft);
}

.ip-pdf2img-modal__input.is-error {
  border-color: var(--ip-error);
}

.ip-pdf2img-modal__input.is-error:focus-visible {
  box-shadow: 0 0 0 4px var(--ip-error-soft);
}

.ip-pdf2img-modal__input:disabled {
  opacity: 0.65;
}

.ip-pdf2img-modal__toggle {
  position: absolute;
  top: 50%;
  right: 5px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--ip-line);
  background: var(--ip-bg);
  color: var(--ip-ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.ip-pdf2img-modal__toggle svg {
  display: block;
  width: 18px;
  height: 18px;
}

/* Presentation attributes (stroke-width="1.6" in the markup) lose to
   any matching CSS rule, so targeting the paths directly here is what
   actually thickens the strokes — a plain `svg { stroke-width }` rule
   would be overridden by those attributes and do nothing. */
.ip-pdf2img-modal__toggle svg path,
.ip-pdf2img-modal__toggle svg circle {
  stroke-width: 1.8;
}

.ip-pdf2img-modal__toggle:hover {
  background: var(--ip-brand-soft);
  border-color: var(--ip-brand-soft);
  color: var(--ip-brand-dark);
}

.ip-pdf2img-modal__toggle:focus-visible {
  outline: none;
  border-color: var(--ip-brand);
  box-shadow: 0 0 0 3px var(--ip-brand-soft);
}

.ip-pdf2img-modal__toggle:active {
  transform: translateY(-50%) scale(0.92);
}

/* Password currently visible — toggle reads as "on" so it's obvious
   at a glance, not just on hover. */
.ip-pdf2img-modal__toggle[aria-label="Hide password"] {
  background: var(--ip-brand-soft);
  border-color: var(--ip-brand-soft);
  color: var(--ip-brand-dark);
}

.ip-pdf2img-modal__error {
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--ip-error-soft);
  color: var(--ip-error);
  font-size: 12.5px;
  font-weight: 700;
  text-align: left;
}

.ip-pdf2img-modal__error[hidden] {
  display: none;
}

.ip-pdf2img-modal__actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.ip-pdf2img-modal__actions .ip-pdf2img-btn {
  height: 46px;
  font-size: 14px;
}


/* ══════════════════════════════════════════
   ACCESSIBILITY
   ══════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .ip-pdf2img-modal__backdrop,
  .ip-pdf2img-modal__card {
    animation: none;
  }
}
