/* ============================================================
   Image to PDF — base.css
   Classes  : ip-img2pdf-*
   Approach : Mobile-first (base = mobile, @media min-width = desktop)
   Brand    : #42B5A4 (teal) — same system as sibling tools
   Contains : tokens, reset, header, stepper, panels, buttons, toast
   Siblings : dropzone.css, gallery.css, controls.css, preview.css, export.css
   ============================================================ */


/* ══════════════════════════════════════════
   0. BASE / RESET / BRAND TOKENS
   ══════════════════════════════════════════ */
.ip-img2pdf-wrap,
.ip-img2pdf-wrap * {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  /* ── Brand color tokens — defined on :root (not scoped to
     .ip-img2pdf-wrap) so elements rendered OUTSIDE the main wrapper —
     like the toast, which is a sibling of <main>, not a descendant —
     still inherit them. ── */
  --ip-brand: #42B5A4;
  --ip-brand-dark: #2E8577;
  --ip-brand-soft: #E8F8F6;

  --ip-ink: #1a1a22;
  --ip-ink-soft: #55555f;
  --ip-line: #e4e4ee;
  --ip-line-strong: #c4c4d4;
  --ip-bg: #f5f5fa;
  --ip-error: #c0392b;
  --ip-error-soft: #fbebe9;
  --ip-success: #1e8e5a;
  --ip-warn: #9a6400;
  --ip-warn-soft: #fdf1dc;
}

html, body {
  overflow-x: hidden;
  max-width: 100%;
}

.ip-img2pdf-wrap {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 56px;
  touch-action: manipulation;
  overscroll-behavior-y: contain;
}


/* ══════════════════════════════════════════
   1. HEADER
   ══════════════════════════════════════════ */
.ip-img2pdf-header {
  text-align: center;
  margin-bottom: 24px;
}

.ip-img2pdf-header__title {
  font-weight: 800;
  font-size: clamp(1.5rem, 6vw, 2.2rem);
  letter-spacing: -0.8px;
  color: var(--ip-ink);
  margin: 0 0 8px;
}

.ip-img2pdf-header__title strong {
  font-weight: 900;
  color: var(--ip-brand);
}

.ip-img2pdf-header__subtitle {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ip-ink-soft);
  line-height: 1.6;
  margin: 0;
}

.ip-img2pdf-header__subtitle a {
  color: var(--ip-brand-dark);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ip-img2pdf-header__subtitle a:hover,
.ip-img2pdf-header__subtitle a:focus-visible {
  color: var(--ip-brand);
}

.ip-img2pdf-header__note {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ip-ink-soft);
  opacity: 0.85;
  line-height: 1.5;
  margin: 8px 0 0;
}


/* ══════════════════════════════════════════
   2. STEPPER
   ══════════════════════════════════════════ */
.ip-img2pdf-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 28px;
}

.ip-img2pdf-stepper__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ip-img2pdf-stepper__dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #9999a2;
  background: #fff;
  border: 1.5px solid var(--ip-line);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.ip-img2pdf-stepper__step.is-active .ip-img2pdf-stepper__dot {
  background: var(--ip-brand);
  border-color: var(--ip-brand);
  color: #fff;
}

.ip-img2pdf-stepper__step.is-done .ip-img2pdf-stepper__dot {
  background: var(--ip-brand-soft);
  border-color: var(--ip-brand);
  color: var(--ip-brand);
}

.ip-img2pdf-stepper__dot--export {
  width: auto;
  border-radius: 9999px;
  padding: 0 16px;
  font-size: 12px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.ip-img2pdf-stepper__label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ip-ink-soft);
}

.ip-img2pdf-stepper__line {
  width: 28px;
  height: 2px;
  background: var(--ip-line);
  margin-top: -18px;
}


/* ══════════════════════════════════════════
   3. PANELS
   ══════════════════════════════════════════ */
.ip-img2pdf-panel {
  display: none;
}

.ip-img2pdf-panel.is-active {
  display: block;
  animation: ipFadeIn 0.28s ease both;
}

@keyframes ipFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ══════════════════════════════════════════
   4. ACTION BUTTONS (shared across all 3 steps)
   ══════════════════════════════════════════ */
.ip-img2pdf-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.ip-img2pdf-btn {
  flex: 1;
  height: 48px;
  border-radius: 9999px;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  border: 1.5px solid transparent;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
}

.ip-img2pdf-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ip-img2pdf-btn--primary {
  background: var(--ip-brand);
  color: #fff;
  box-shadow: 0 2px 10px rgba(66,181,164,0.28);
}

.ip-img2pdf-btn--primary:active {
  transform: scale(0.98);
}

.ip-img2pdf-btn--ghost {
  background: #fff;
  border-color: var(--ip-line);
  color: var(--ip-ink);
}

.ip-img2pdf-btn--ghost:active {
  background: var(--ip-bg);
}

.ip-img2pdf-btn--secondary {
  background: var(--ip-brand-soft);
  border-color: var(--ip-brand-soft);
  color: var(--ip-brand-dark);
}

.ip-img2pdf-btn--secondary:active {
  background: #d9f2ee;
}


/* ══════════════════════════════════════════
   5. TOGGLE SWITCH (page numbers / watermark)
   ══════════════════════════════════════════ */
.ip-img2pdf-switch {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.ip-img2pdf-switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.ip-img2pdf-switch__track {
  width: 44px;
  height: 26px;
  border-radius: 9999px;
  background: var(--ip-line-strong);
  display: block;
  position: relative;
  transition: background 0.2s ease;
}

.ip-img2pdf-switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.24);
  transition: transform 0.2s ease;
}

.ip-img2pdf-switch input:checked + .ip-img2pdf-switch__track {
  background: var(--ip-brand);
}

.ip-img2pdf-switch input:checked + .ip-img2pdf-switch__track .ip-img2pdf-switch__thumb {
  transform: translateX(18px);
}


/* ══════════════════════════════════════════
   6. TOAST
   ══════════════════════════════════════════ */
.ip-img2pdf-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px) scale(0.96);
  display: inline-flex;
  align-items: center;
  gap: 11px;
  background: var(--ip-ink);
  color: #fff;
  padding: 13px 20px 13px 15px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 999;
  box-shadow: 0 12px 32px rgba(0,0,0,0.24), 0 2px 8px rgba(0,0,0,0.14);
  max-width: 90vw;
  text-align: left;
}

.ip-img2pdf-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.ip-img2pdf-toast::before {
  content: '✓';
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(255,255,255,0.16);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.ip-img2pdf-toast.is-error {
  background: var(--ip-error);
}

.ip-img2pdf-toast.is-error::before {
  content: '!';
}


/* ══════════════════════════════════════════
   7. DESKTOP ENHANCEMENTS (≥768px)
   ══════════════════════════════════════════ */
@media (min-width: 768px) {
  .ip-img2pdf-wrap {
    padding: 40px 24px 72px;
  }

  .ip-img2pdf-header__subtitle {
    font-size: 16px;
  }

  .ip-img2pdf-stepper {
    gap: 10px;
    margin-bottom: 36px;
  }

  .ip-img2pdf-stepper__line {
    width: 56px;
  }

  .ip-img2pdf-btn--ghost:hover {
    border-color: var(--ip-ink);
  }

  .ip-img2pdf-btn--primary:hover {
    box-shadow: 0 4px 16px rgba(66,181,164,0.36);
  }

  .ip-img2pdf-btn--secondary:hover {
    background: #d9f2ee;
  }

  .ip-img2pdf-actions {
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
  }

  .ip-img2pdf-actions--export {
    max-width: 560px;
  }
}


/* ══════════════════════════════════════════
   8. ACCESSIBILITY
   ══════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .ip-img2pdf-panel.is-active {
    animation: none;
  }

  .ip-img2pdf-toast {
    transition: opacity 0.15s ease;
    transform: translate(-50%, 0) scale(1);
  }
}
