/* ============================================
   InfluenceHub – Auth modal mode & role buttons a11y
   - Visible :focus-visible ring for the login/register
     mode toggle (.auth-mode-btn) and the influencer/
     client role toggle (.auth-role-btn) inside the
     auth modal.
   - 44px minimum touch target (WCAG 2.5.5) for mobile
     users on both button groups.
   - Dark mode, prefers-reduced-motion and forced-colors
     support.
   ============================================ */

/* ---------- Base: 44px minimum touch targets ---------- */

.auth-mode-btn,
.auth-role-btn {
  /* WCAG 2.5.5 – minimum 44x44px touch target for mobile users */
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 1;
}

/* The auth form submit button must also meet the 44px touch target
   so mobile users can reliably complete authentication. */
#auth-form button[type="submit"] {
  /* WCAG 2.5.5 – minimum 44x44px touch target for mobile users */
  min-height: 44px;
  min-width: 44px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 1;
}

/* The mode toggle sits inside a padded pill – keep the visual size
   compact while guaranteeing the tappable area. */
.auth-mode-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

/* The role buttons already use inline-flex – make sure the icon and
   label stay vertically centred when the button grows to 44px. */
.auth-role-btn {
  line-height: 1.2;
}

/* ---------- Focus-visible ring (keyboard) ---------- */

/* High-contrast, always-visible ring for keyboard users. The ring is
   drawn with both an outline and a box-shadow halo so it stays visible
   against the light pill background and the dark-mode surface. */
.auth-mode-btn:focus-visible,
.auth-role-btn:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
}

/* The auth form submit button uses a dark slate fill in light mode and
   a brand violet fill in dark mode – add a white inner ring so the
   violet outline stays visible against the dark fill. */
#auth-form button[type="submit"]:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow:
    0 0 0 2px #ffffff,
    0 0 0 6px rgba(124, 58, 237, 0.35);
}

/* The active mode button uses a white fill with a subtle shadow in
   light mode – add a violet inner ring so the outline stays visible
   against the white surface. */
.auth-mode-btn.auth-mode-active:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow:
    0 0 0 2px #ffffff,
    0 0 0 6px rgba(124, 58, 237, 0.35);
}

/* The active role button uses a brand-50 fill with a violet border –
   keep the ring visible against the tinted surface. */
.auth-role-btn.auth-role-active:focus-visible {
  outline: 2px solid #7c3aed;
  outline-offset: 2px;
  box-shadow:
    0 0 0 2px #ffffff,
    0 0 0 6px rgba(124, 58, 237, 0.35);
}

/* ---------- Dark mode ---------- */

.dark .auth-mode-btn:focus-visible,
.dark .auth-role-btn:focus-visible {
  outline-color: #c4b5fd;
  box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
}

/* In dark mode the submit button uses the brand violet fill – add a
   dark inner ring so the light violet outline stays visible. */
.dark #auth-form button[type="submit"]:focus-visible {
  outline-color: #c4b5fd;
  box-shadow:
    0 0 0 2px #0f172a,
    0 0 0 6px rgba(196, 181, 253, 0.45);
}

/* Active mode button in dark mode uses a slate-800 fill – add a dark
   inner ring so the light violet outline stays visible. */
.dark .auth-mode-btn.auth-mode-active:focus-visible {
  outline-color: #c4b5fd;
  box-shadow:
    0 0 0 2px #0f172a,
    0 0 0 6px rgba(196, 181, 253, 0.45);
}

/* Active role button in dark mode uses a translucent violet fill –
   add a dark inner ring so the light violet outline stays visible. */
.dark .auth-role-btn.auth-role-active:focus-visible {
  outline-color: #c4b5fd;
  box-shadow:
    0 0 0 2px #0f172a,
    0 0 0 6px rgba(196, 181, 253, 0.45);
}

/* ---------- Fallback for browsers without :focus-visible ---------- */

@supports not selector(:focus-visible) {
  .auth-mode-btn:focus,
  .auth-role-btn:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25);
  }

  #auth-form button[type="submit"]:focus {
    outline: 2px solid #7c3aed;
    outline-offset: 2px;
    box-shadow:
      0 0 0 2px #ffffff,
      0 0 0 6px rgba(124, 58, 237, 0.35);
  }

  .auth-mode-btn.auth-mode-active:focus,
  .auth-role-btn.auth-role-active:focus {
    box-shadow:
      0 0 0 2px #ffffff,
      0 0 0 6px rgba(124, 58, 237, 0.35);
  }

  .dark .auth-mode-btn:focus,
  .dark .auth-role-btn:focus {
    outline-color: #c4b5fd;
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35);
  }

  .dark #auth-form button[type="submit"]:focus {
    outline-color: #c4b5fd;
    box-shadow:
      0 0 0 2px #0f172a,
      0 0 0 6px rgba(196, 181, 253, 0.45);
  }

  .dark .auth-mode-btn.auth-mode-active:focus,
  .dark .auth-role-btn.auth-role-active:focus {
    box-shadow:
      0 0 0 2px #0f172a,
      0 0 0 6px rgba(196, 181, 253, 0.45);
  }
}

/* ---------- Small screens: keep the 44px target when stacked ---------- */

@media (max-width: 480px) {
  .auth-mode-btn,
  .auth-role-btn,
  #auth-form button[type="submit"] {
    min-height: 44px;
    min-width: 44px;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .auth-mode-btn,
  .auth-role-btn,
  #auth-form button[type="submit"] {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  /* Neutralise any hover/focus transform so no motion is perceived */
  .auth-mode-btn:hover,
  .auth-mode-btn:focus,
  .auth-mode-btn:active,
  .auth-role-btn:hover,
  .auth-role-btn:focus,
  .auth-role-btn:active,
  #auth-form button[type="submit"]:hover,
  #auth-form button[type="submit"]:focus,
  #auth-form button[type="submit"]:active {
    transform: none !important;
    transition: none !important;
  }

  /* Keep the focus ring visible but static (no animated halo) */
  .auth-mode-btn:focus-visible,
  .auth-role-btn:focus-visible {
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.25) !important;
  }

  .auth-mode-btn.auth-mode-active:focus-visible,
  .auth-role-btn.auth-role-active:focus-visible {
    box-shadow:
      0 0 0 2px #ffffff,
      0 0 0 6px rgba(124, 58, 237, 0.35) !important;
  }

  .dark .auth-mode-btn:focus-visible,
  .dark .auth-role-btn:focus-visible {
    box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.35) !important;
  }

  .dark .auth-mode-btn.auth-mode-active:focus-visible,
  .dark .auth-role-btn.auth-role-active:focus-visible {
    box-shadow:
      0 0 0 2px #0f172a,
      0 0 0 6px rgba(196, 181, 253, 0.45) !important;
  }

  /* Submit button – keep the ring visible but static */
  #auth-form button[type="submit"]:focus-visible {
    box-shadow:
      0 0 0 2px #ffffff,
      0 0 0 6px rgba(124, 58, 237, 0.35) !important;
  }

  .dark #auth-form button[type="submit"]:focus-visible {
    box-shadow:
      0 0 0 2px #0f172a,
      0 0 0 6px rgba(196, 181, 253, 0.45) !important;
  }
}

/* ---------- Forced colors (Windows High Contrast) ---------- */

@media (forced-colors: active) {
  .auth-mode-btn,
  .auth-role-btn,
  #auth-form button[type="submit"] {
    border: 1px solid CanvasText;
    color: CanvasText;
    background: Canvas;
  }

  .auth-mode-btn:hover,
  .auth-role-btn:hover {
    background: Highlight;
    color: HighlightText;
  }

  .auth-mode-btn.auth-mode-active,
  .auth-role-btn.auth-role-active {
    background: Highlight;
    color: HighlightText;
    border-color: Highlight;
  }

  .auth-mode-btn:focus-visible,
  .auth-role-btn:focus-visible,
  .auth-mode-btn:focus,
  .auth-role-btn:focus,
  #auth-form button[type="submit"]:focus-visible,
  #auth-form button[type="submit"]:focus {
    outline: 2px solid Highlight;
    outline-offset: 2px;
    box-shadow: none;
    background: Highlight;
    color: HighlightText;
  }
}
