/**
 * Member login and password reset pages (user_login_form, user_pass).
 * Everything is scoped to .ssuk-auth so the rest of the site is unaffected.
 */

.ssuk-auth {
  --auth-primary: #442d72;
  --auth-primary-hover: #5a3d96;
  --auth-primary-soft: rgba(68, 45, 114, 0.06);
  --auth-text: #1f1b2e;
  --auth-muted: #6b7280;
  --auth-border: #e4dff0;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  width: 100%;
  padding: clamp(2.5rem, 6vw, 4rem) 16px;
  font-family: 'Poppins', system-ui, sans-serif;
  color: var(--auth-text);
  min-height: 70vh;
}

.ssuk-auth *,
.ssuk-auth *::before,
.ssuk-auth *::after {
  box-sizing: border-box;
}

/* Neutralise the global style.css rules (yellow link background, input#edit-submit
   colours, form-required icon) inside the auth card only. */
.ssuk-auth a {
  background-color: transparent !important;
  background-image: none !important;
}

.ssuk-auth .ssuk-auth__tab.is-active {
  background-color: var(--auth-primary) !important;
  color: #ffffff !important;
}

.ssuk-auth .ssuk-auth__tab:focus-visible,
.ssuk-auth .ssuk-auth__meta a:focus-visible,
.ssuk-auth .ssuk-auth__back a:focus-visible,
.ssuk-auth__footer a:focus-visible,
.ssuk-auth__help a:focus-visible,
.ssuk-auth__form input:focus-visible,
.ssuk-auth__toggle:focus-visible {
  outline: 3px solid rgba(68, 45, 114, 0.35);
  outline-offset: 2px;
}

.ssuk-auth__form .form-required::after {
  display: inline !important;
  width: auto !important;
  height: auto !important;
  padding: 0 !important;
  margin: 0 !important;
  background: none !important;
  content: ' *' !important;
  color: #dc2626 !important;
}

/* Whole-page gradient on the login and reset routes. The theme's content
   containers are made transparent so the gradient shows behind the card. */
body:has(.ssuk-auth) {
  background: linear-gradient(135deg, #f8f7fc 0%, #ffffff 50%, #f0eef8 100%) !important;
}

body:has(.ssuk-auth) .main-box,
body:has(.ssuk-auth) .d8-fade,
body:has(.ssuk-auth) .w3-content,
body:has(.ssuk-auth) .w3-block-wrapper,
body:has(.ssuk-auth) .region-content,
body:has(.ssuk-auth) main {
  background: transparent !important;
  background-image: none !important;
}

/* The card carries its own heading and tabs, so hide the Drupal ones. */
body:has(.ssuk-auth) .block-page-title-block,
body:has(.ssuk-auth) .block-local-tasks-block {
  display: none;
}

/* ---- Card ---- */

.ssuk-auth__card {
  width: 100%;
  max-width: 28rem;
  padding: 2.25rem 2rem 2rem;
  background: #ffffff;
  border-radius: 20px;
  box-shadow:
    0 25px 50px -12px rgba(68, 45, 114, 0.18),
    0 0 0 1px rgba(68, 45, 114, 0.04);
}

@media (max-width: 480px) {
  .ssuk-auth__card {
    padding: 1.75rem 1.25rem 1.5rem;
  }
}

.ssuk-auth__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  color: #ffffff;
  background: linear-gradient(135deg, #442d72, #5a3d96);
  border-radius: 16px;
  box-shadow: 0 10px 25px -5px rgba(68, 45, 114, 0.35);
}

.ssuk-auth__icon svg {
  width: 28px;
  height: 28px;
}

.ssuk-auth__title {
  margin: 0;
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  color: var(--auth-primary);
}

.ssuk-auth__lead {
  margin: 0.5rem 0 1.5rem;
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: center;
  color: var(--auth-muted);
}

/* ---- Tabs (Log In / Reset Password) ---- */

.ssuk-auth .ssuk-auth__tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 1.5rem;
  background: var(--auth-primary-soft);
  border-radius: 12px;
}

.ssuk-auth .ssuk-auth__tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--auth-muted);
  text-decoration: none;
  border-radius: 9px;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.ssuk-auth .ssuk-auth__tab svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.ssuk-auth .ssuk-auth__tab:hover {
  color: var(--auth-primary);
}

.ssuk-auth .ssuk-auth__tab.is-active {
  color: #ffffff;
  background: var(--auth-primary);
  box-shadow: 0 4px 12px -2px rgba(68, 45, 114, 0.35);
}

/* ---- Form fields ---- */

.ssuk-auth__form .form-item {
  margin: 0 0 1.25rem;
}

.ssuk-auth__form label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--auth-text);
}

.ssuk-auth__form input[type='text'],
.ssuk-auth__form input[type='password'],
.ssuk-auth__form input[type='email'] {
  display: block;
  width: 100%;
  height: 48px;
  padding: 0 14px 0 42px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--auth-text);
  background-color: #ffffff;
  background-repeat: no-repeat;
  background-position: 14px center;
  background-size: 18px 18px;
  border: 1px solid var(--auth-border);
  border-radius: 10px;
  box-shadow: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.ssuk-auth__form input[name='name'] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
}

.ssuk-auth__form input[name='pass'] {
  padding-right: 48px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21 2-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0 3 3L22 7l-3-3m-3.5 3.5L19 4'/%3E%3C/svg%3E");
}

.ssuk-auth__form input:focus {
  outline: none;
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 4px rgba(68, 45, 114, 0.12);
}

.ssuk-auth__form .description {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--auth-muted);
}

.ssuk-auth__form .description em {
  font-style: italic;
  font-weight: 500;
}

/* Show/hide password toggle, added by user-auth.js. */
.ssuk-auth__password {
  position: relative;
}

.ssuk-auth__toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--auth-muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transform: translateY(-50%);
  transition: color 0.2s ease, background-color 0.2s ease;
}

.ssuk-auth__toggle:hover {
  color: var(--auth-primary);
  background-color: var(--auth-primary-soft);
}

.ssuk-auth__toggle svg {
  width: 18px;
  height: 18px;
}

.ssuk-auth .ssuk-auth__meta a,
.ssuk-auth .ssuk-auth__back a {
  font-weight: 500;
  color: var(--auth-primary);
  text-decoration: none;
}

.ssuk-auth .ssuk-auth__meta a:hover,
.ssuk-auth .ssuk-auth__back a:hover {
  color: var(--auth-primary-hover);
  text-decoration: underline;
}

.ssuk-auth__form .form-actions {
  margin: 0;
}

.ssuk-auth__back {
  margin: 1.25rem 0 0;
  font-size: 0.875rem;
  text-align: center;
}

/* ---- Footer lines ---- */

.ssuk-auth__footer,
.ssuk-auth__help {
  margin: 0;
  font-size: 0.9rem;
  text-align: center;
  color: var(--auth-muted);
}

.ssuk-auth__footer a,
.ssuk-auth__help a {
  font-weight: 500;
  color: var(--auth-primary);
  text-decoration: none;
}

.ssuk-auth__footer a:hover,
.ssuk-auth__help a:hover {
  color: var(--auth-primary-hover);
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  .ssuk-auth *,
  .ssuk-auth *::before,
  .ssuk-auth *::after {
    transition: none !important;
    transform: none !important;
  }
}

/* Submit button: a real <button> injected by ssuk_profile, with the icon and
   label in one centred flex row. The native Drupal submit is hidden but kept. */
.ssuk-auth__form .ssuk-auth__submit-native {
  display: none !important;
}

.ssuk-auth .ssuk-auth__submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  height: 48px;
  margin: 0;
  padding: 0 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: #ffffff;
  background: linear-gradient(90deg, #442d72, #5a3d96);
  border: 0;
  border-radius: 10px;
  box-shadow: 0 10px 20px -8px rgba(68, 45, 114, 0.5);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.ssuk-auth .ssuk-auth__submit:hover {
  background: linear-gradient(90deg, #5a3d96, #6b4aa7);
  box-shadow: 0 14px 24px -8px rgba(68, 45, 114, 0.55);
  transform: translateY(-1px);
}

.ssuk-auth .ssuk-auth__submit:focus-visible {
  outline: 3px solid rgba(68, 45, 114, 0.35);
  outline-offset: 2px;
}

.ssuk-auth__submit-icon,
.ssuk-auth__submit-icon svg {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ---- Status and error messages inside the card ---- */

.ssuk-auth [data-drupal-messages] {
  margin: 0 0 1.25rem;
}

.ssuk-auth .messages {
  position: relative;
  margin: 0 0 0.75rem;
  padding: 0.875rem 1rem 0.875rem 3rem;
  font-size: 0.875rem;
  line-height: 1.55;
  border: 1px solid;
  border-radius: 12px;
  box-shadow: none;
}

.ssuk-auth .messages::before {
  content: '';
  position: absolute;
  top: 0.9rem;
  left: 0.9rem;
  width: 20px;
  height: 20px;
  background-repeat: no-repeat;
  background-size: 20px 20px;
}

.ssuk-auth .messages--status {
  color: #1e5631 !important;
  background-color: #f0f9f4 !important;
  border-color: #b7e0c4 !important;
}

.ssuk-auth .messages--status::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%231e8a4a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E");
}

.ssuk-auth .messages--error {
  color: #8a1f1f !important;
  background-color: #fdf2f2 !important;
  border-color: #f0b8b8 !important;
}

.ssuk-auth .messages--error::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23b42318' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4'/%3E%3Cpath d='M12 16h.01'/%3E%3C/svg%3E");
}

.ssuk-auth .messages--warning {
  color: #7a4b00 !important;
  background-color: #fffaeb !important;
  border-color: #f5d28a !important;
}

.ssuk-auth .messages--warning::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23b54708' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E");
}

.ssuk-auth .messages h2.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

