/* ============================================================
   Bulk Image Rename Tool — base.css
   Classes  : ir-image-rename-*
   Approach : Mobile-first (base = mobile, @media min-width = desktop)
   Brand    : #42B5A4 (teal) — protected across every UI state
   Contains : tokens, reset, header, stepper, panels, shared buttons, toast
   Siblings : dropzone.css (step 1), gallery.css (step 2 toolbar/cards),
              controls.css (step 2 pattern builder), export.css (step 3)
   ============================================================ */


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

:root {
  /* ── Brand color tokens — defined on :root (not scoped to
     .ir-image-rename-wrap) so elements rendered OUTSIDE the main
     wrapper — like the toast, which is a sibling of <main>, not a
     descendant — still inherit them. Kept identical to the other
     tools so the brand always looks the same across the suite. ── */
  --ir-brand: #42B5A4;
  --ir-brand-dark: #2E8577;
  --ir-brand-soft: #E8F8F6;

  --ir-ink: #1a1a22;
  --ir-ink-soft: #55555f;
  --ir-line: #e4e4ee;
  --ir-line-strong: #c4c4d4;
  --ir-bg: #f5f5fa;
  --ir-error: #c0392b;
  --ir-success: #1e8e5a;
}

.ir-image-rename-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;
}


/* The [hidden] attribute must always win. Many components below set
   their own `display` (flex, block…), and an author `display` rule beats
   the browser's built-in [hidden] style — which made "hidden" lock icons,
   the duplicate-name warning and the Digits/Start row show up anyway. */
.ir-image-rename-wrap [hidden],
.ir-tools [hidden] {
  display: none !important;
}


/* ══════════════════════════════════════════
   1. HEADER
   ══════════════════════════════════════════ */
.ir-image-rename-header {
  text-align: center;
  margin-bottom: 24px;
}

.ir-image-rename-header__title {
  font-weight: 800;
  font-size: clamp(1.65rem, 6.5vw, 2.4rem);
  letter-spacing: -0.9px;
  color: var(--ir-ink);
  margin: 0 0 8px;
}

.ir-image-rename-header__title strong {
  font-weight: 900;
  color: var(--ir-brand);
}

.ir-image-rename-header__subtitle {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--ir-ink-soft);
  line-height: 1.6;
  margin: 0;
}

.ir-image-rename-header__note {
  font-size: 12.5px;
  font-weight: 500;
  color: #8a8a96;
  line-height: 1.5;
  margin: 8px 0 0;
}

.ir-image-rename-header__subtitle b {
  font-weight: 800;
  color: var(--ir-ink);
}

.ir-image-rename-header__subtitle a {
  color: var(--ir-brand-dark);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: var(--ir-brand-soft);
  text-underline-offset: 2px;
}

.ir-image-rename-header__subtitle a:hover {
  text-decoration-color: currentColor;
}


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

.ir-image-rename-stepper__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ir-image-rename-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(--ir-line);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.ir-image-rename-stepper__step.is-active .ir-image-rename-stepper__dot {
  background: var(--ir-brand);
  border-color: var(--ir-brand);
  color: #fff;
}

.ir-image-rename-stepper__step.is-done .ir-image-rename-stepper__dot {
  background: var(--ir-brand-soft);
  border-color: var(--ir-brand);
  color: var(--ir-brand);
}

.ir-image-rename-stepper__dot--export {
  width: auto;
  border-radius: 9999px;
  padding: 0 16px;
  font-size: 12.5px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.ir-image-rename-stepper__label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ir-ink-soft);
}

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


/* ══════════════════════════════════════════
   3. PANELS
   ══════════════════════════════════════════ */
.ir-image-rename-panel {
  display: none;
}

.ir-image-rename-panel.is-active {
  display: block;
  animation: irFadeIn 0.28s ease backwards;
}

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


/* ══════════════════════════════════════════
   4. SPINNER (reused wherever a busy-state is shown)
   ══════════════════════════════════════════ */
.ir-image-rename-spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid var(--ir-line);
  border-top-color: var(--ir-brand);
  animation: irSpin 0.7s linear infinite;
}

@keyframes irSpin {
  to { transform: rotate(360deg); }
}


/* ══════════════════════════════════════════
   5. ACTION BUTTONS (shared across all 3 steps)
   ══════════════════════════════════════════ */
.ir-image-rename-actions {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.ir-image-rename-actions--top {
  margin-top: 0;
  margin-bottom: 18px;
}

.ir-image-rename-btn--icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.ir-image-rename-btn--icon svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.ir-image-rename-btn {
  flex: 1;
  height: 48px;
  border-radius: 9999px;
  font-family: inherit;
  font-weight: 800;
  font-size: 15.5px;
  border: 1.5px solid transparent;
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
}

.ir-image-rename-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

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

.ir-image-rename-btn--primary:active {
  transform: scale(0.98);
}

.ir-image-rename-btn--ghost {
  background: #fff;
  border-color: var(--ir-line);
  color: var(--ir-ink);
}

.ir-image-rename-btn--ghost:active {
  background: var(--ir-bg);
}

/* Secondary = "download one by one" — sits between ghost and primary,
   brand-tinted so it doesn't compete with the primary ZIP action */
.ir-image-rename-btn--secondary {
  background: var(--ir-brand-soft);
  border-color: var(--ir-brand-soft);
  color: var(--ir-brand-dark);
}

.ir-image-rename-btn--secondary:active {
  background: #d9f2ee;
}

/* Outline = "Reset" — quiet, so it never looks as important as Apply to All */
.ir-image-rename-btn--outline {
  background: transparent;
  border-color: var(--ir-line-strong);
  color: var(--ir-ink-soft);
  flex: 0 0 auto;
  padding: 0 20px;
}

.ir-image-rename-btn--outline:active {
  background: var(--ir-bg);
}


/* ══════════════════════════════════════════
   6. TOAST
   ══════════════════════════════════════════ */
.ir-image-rename-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px) scale(0.96);
  display: inline-flex;
  align-items: center;
  gap: 11px;
  background: var(--ir-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;
}

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

.ir-image-rename-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;
}

.ir-image-rename-toast.is-error {
  background: var(--ir-error);
}

.ir-image-rename-toast.is-error::before {
  content: '!';
}

.ir-image-rename-toast.is-success::before {
  content: '✓';
}


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

  .ir-image-rename-header__subtitle {
    font-size: 16px;
  }

  .ir-image-rename-stepper {
    gap: 10px;
    margin-bottom: 36px;
  }

  .ir-image-rename-stepper__line {
    width: 56px;
  }

  .ir-image-rename-btn--ghost:hover {
    border-color: var(--ir-ink);
  }

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

  .ir-image-rename-btn--secondary:hover {
    background: #d9f2ee;
  }

  .ir-image-rename-btn--outline:hover {
    border-color: var(--ir-ink);
    color: var(--ir-ink);
  }

  .ir-image-rename-actions--export {
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
  }
}


/* ══════════════════════════════════════════
   8. ACCESSIBILITY
   ══════════════════════════════════════════ */
.ir-image-rename-wrap :focus-visible {
  outline: 2px solid var(--ir-brand);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .ir-image-rename-panel.is-active {
    animation: none;
  }

  .ir-image-rename-spinner {
    animation-duration: 1.5s;
  }

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