/*
 * Branded login, ported from mockup/login.html.
 *
 * This restyles WordPress's own wp-login.php rather than replacing it with a
 * custom form. The login screen is the one place where rolling your own is a
 * genuinely bad idea: wp-login.php carries brute-force throttling, the auth
 * cookie contract, interim-login re-auth, password reset, and every security
 * fix WordPress ships. A prettier form is not worth giving those up, so only
 * the presentation changes.
 *
 * Selectors therefore target WordPress's markup (#login, #loginform, #wp-submit)
 * while the values are lifted from the mockup.
 *
 * Note the palette: this page is amber (#d97706 / #f59e0b), not the dashboard's
 * blue (#5B9BD5). That is intentional in the approved design, not a mistake.
 */

:root {
  --wgm-bg: #f9fafb;
  --wgm-card: #ffffff;
  --wgm-line: #e5e7eb;
  --wgm-line-2: #d1d5db;
  --wgm-ink: #111827;
  --wgm-muted: #6b7280;
  --wgm-muted-2: #9ca3af;
  --wgm-amber: #d97706;
  --wgm-amber-2: #f59e0b;
}

body.login {
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--wgm-bg);
  color: var(--wgm-ink);
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 24px;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* The two amber glows behind the card. */
body.login::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(55% 45% at 50% -5%, rgba(245, 158, 11, 0.16), transparent 70%),
    radial-gradient(40% 40% at 90% 105%, rgba(217, 119, 6, 0.10), transparent 70%);
}

/* ---- the card ----------------------------------------------------------- */

#login {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 430px;
  padding: 40px 38px 28px;
  background: var(--wgm-card);
  border: 1px solid var(--wgm-line);
  border-radius: 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 30px 60px -25px rgba(17, 24, 39, 0.22);
  animation: wgm-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes wgm-rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  #login { animation: none; }
}

/* ---- logo --------------------------------------------------------------- */

#login h1 {
  margin: 0 0 22px;
}

/*
 * Served from the theme, not Cloudinary.
 *
 * The mockup hotlinks a Cloudinary copy of this logo; that file turned out to
 * be byte-identical to production's own
 * wp-content/themes/wgm/images/new/main_logo.png (same md5), so nothing changes
 * visually — it just stops depending on a mockup-era third-party account.
 *
 * The original is 6262x903 (100 KB) for a slot 42px tall. This is downscaled to
 * 582x84, which is still 2x for retina, at a tenth of the weight.
 */
#login h1 a,
.login .wp-login-logo a {
  display: block;
  height: 42px;
  margin: 0 auto;
  background-image: url("../img/wgm-logo.png");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  /* WordPress sizes its own logo with these; override both. */
  width: 100%;
  font-size: 0;
  text-indent: -9999px;
  overflow: hidden;
}

/* ---- "Members Area" badge + heading, injected via login_message ---------- */

.wgm-login-badge {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.wgm-login-badge span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wgm-amber);
  background: #fffbeb;
  border: 1px solid #fde68a;
  padding: 6px 12px;
  border-radius: 100px;
}

.wgm-login-badge .wgm-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--wgm-amber-2);
}

.wgm-login-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-align: center;
  margin: 0 0 8px;
  color: var(--wgm-ink);
}

.wgm-login-sub {
  color: var(--wgm-muted);
  font-size: 14.5px;
  line-height: 1.55;
  text-align: center;
  margin: 0 0 24px;
}

/* WordPress wraps login_message output in a bordered box; strip it. */
.login .message.wgm-login-intro {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  margin: 0;
}

/* ---- form --------------------------------------------------------------- */

/*
 * The dashed rule above the fields is the mockup's `.pwform` top border, which
 * separates the sign-in form from the messaging above it.
 */
#loginform {
  background: transparent;
  border: 0;
  border-top: 1px dashed var(--wgm-line);
  box-shadow: none;
  padding: 16px 0 0;
  margin: 6px 0 0;
}

/*
 * Not in the mockup. "Remember Me" is hidden rather than removed so WordPress
 * still receives a well-formed form; inc/login.php compensates by giving every
 * session the remembered duration.
 */
.login .forgetmenot {
  display: none;
}

/* The mockup ends with its own footer, not WordPress's "Go to site" link. */
.login #backtoblog {
  display: none;
}

#loginform label,
.login form .forgetmenot label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 7px;
}

.login form .input,
.login input[type="text"],
.login input[type="password"],
.login input[type="email"] {
  width: 100%;
  background: #fff;
  border: 1px solid var(--wgm-line-2);
  color: var(--wgm-ink);
  font-family: inherit;
  font-size: 15px;
  padding: 13px 15px;
  border-radius: 11px;
  box-shadow: none;
  margin: 0 0 13px;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.login input::placeholder {
  color: var(--wgm-muted-2);
}

.login form .input:focus,
.login input[type="text"]:focus,
.login input[type="password"]:focus,
.login input[type="email"]:focus {
  outline: none;
  border-color: var(--wgm-amber);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}

/* WordPress's built-in show/hide password button. */
.login .wp-pwd {
  position: relative;
}

.login .wp-pwd .button.wp-hide-pw {
  position: absolute;
  right: 6px;
  top: 6px;
  height: 38px;
  width: 38px;
  background: none;
  border: 0;
  box-shadow: none;
  color: var(--wgm-muted);
}

.login .wp-pwd .button.wp-hide-pw:hover {
  color: var(--wgm-amber);
}

.login .forgetmenot {
  margin-bottom: 14px;
}

.login .forgetmenot label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 500;
  color: var(--wgm-muted);
  margin: 0;
}

.login input[type="checkbox"] {
  accent-color: var(--wgm-amber);
}

/* ---- submit ------------------------------------------------------------- */

.login .button-primary,
#wp-submit {
  width: 100%;
  float: none;
  margin-top: 6px;
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  border: none;
  border-radius: 12px;
  padding: 13px 18px;
  height: auto;
  line-height: 1.2;
  cursor: pointer;
  text-shadow: none;
  background: linear-gradient(135deg, var(--wgm-amber) 0%, var(--wgm-amber-2) 100%);
  box-shadow: 0 10px 24px -12px rgba(217, 119, 6, 0.55);
  transition: transform 0.15s ease, filter 0.2s;
}

.login .button-primary:hover,
#wp-submit:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  background: linear-gradient(135deg, var(--wgm-amber) 0%, var(--wgm-amber-2) 100%);
}

.login .button-primary:focus,
#wp-submit:focus {
  outline: 2px solid var(--wgm-amber);
  outline-offset: 2px;
}

/* ---- notices ------------------------------------------------------------ */

.login #login_error,
.login .message,
.login .success {
  margin: 0 0 16px;
  padding: 11px 14px;
  border-radius: 11px;
  font-size: 13.5px;
  line-height: 1.5;
  border-left: 0;
  box-shadow: none;
}

.login #login_error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

.login .message,
.login .success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
}

/* ---- footer links ------------------------------------------------------- */

.login #nav,
.login #backtoblog {
  text-align: center;
  margin: 14px 0 0;
  padding: 0;
}

.login #nav a,
.login #backtoblog a {
  color: var(--wgm-muted);
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login #nav a:hover,
.login #backtoblog a:hover {
  color: var(--wgm-amber);
}

.wgm-login-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--wgm-line);
  color: var(--wgm-muted-2);
  font-size: 12px;
}

.wgm-login-footer .wgm-lock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.wgm-login-footer svg {
  width: 13px;
  height: 13px;
}

/* WordPress language switcher sits below the card. */
.login .language-switcher {
  margin-top: 18px;
}

/* =========================================================================
 * Corrections against mockup/login.html
 *
 * BuddyBoss Platform injects into the login screen from PHP, not only from the
 * stylesheet that is dequeued in inc/login.php — so these are the pieces that
 * survive that removal and still have to be undone.
 * ====================================================================== */

/* BuddyBoss prints the site name as a heading where the logo belongs. The
   mockup has the mark, not the words — and on dev the words are literally
   "Wing Girl Method (dev)". */
.login .bs-cs-login-title,
.login .bs-cs-login-desc {
  display: none !important;
}

/* With the title gone, the real logo needs its space back. */
.login h1.wp-login-logo {
  margin: 0 0 6px;
}

.login h1.wp-login-logo,
.login h1.wp-login-logo a {
  display: block;
  width: 100%;
  height: 46px;
  background-image: url("../img/wgm-logo.png");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  font-size: 0;
  text-indent: -9999px;
  overflow: hidden;
}

/* BuddyBoss adds a second "Forgot Password?" above the button and a Terms of
   Service link with a modal. The mockup has one forgot-password link, below the
   button, and no terms link. WordPress's own is `.wp-login-lost-password`, so
   anything else pointing at lostpassword is the duplicate. */
.login form .bb-login-forgot,
.login p.lostmenot,
.login form > a[href*="action=lostpassword"]:not(.wp-login-lost-password),
.login .terms-link,
.login .popup-terms,
.login #terms-modal {
  display: none !important;
}

/* Field labels. The mockup shows "Username" and "Password" above their inputs;
   placeholders alone disappear the moment somebody starts typing, which is
   exactly when a mislabelled field costs a login attempt. */
.login #loginform label[for="user_login"],
.login #loginform label[for="user_pass"] {
  display: block !important;
  position: static !important;
  width: auto !important;
  height: auto !important;
  clip: auto !important;
  clip-path: none !important;
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  overflow: visible;
}

/* The footer belongs inside the card, under a rule — see the note in
   inc/login.php about how it gets there. */
#login .wgm-login-footer {
  margin: 22px 0 0;
  padding-top: 16px;
  border-top: 1px solid #e9edf2;
}

/* The labels carry their text and are laid out, but collapse to zero height —
   WordPress's own login stylesheet still applies here and squashes them. Given
   an explicit line box they render, which is what the mockup shows above each
   field. */
.login #loginform label[for="user_login"],
.login #loginform label[for="user_pass"] {
  height: auto !important;
  min-height: 18px;
  line-height: 1.4 !important;
  visibility: visible !important;
}

/* The label text sits inside a `screen-reader-text` span, so the label has a
   line box and no visible words. Unhidden for these two fields only — the class
   is used legitimately elsewhere on this screen, including the h1 that gives
   the page its accessible name. */
.login #loginform label[for="user_login"] .screen-reader-text,
.login #loginform label[for="user_pass"] .screen-reader-text {
  position: static !important;
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  clip: auto !important;
  clip-path: none !important;
  overflow: visible !important;
  white-space: normal !important;
  border: 0;
}

/* ---- submit button: focus and click ------------------------------------- *
 *
 * The button appeared to be sliced through when focused or clicked. Three
 * things in WordPress core were doing it, all in `.wp-core-ui .button-primary`:
 *
 *   box-shadow: inset 0 0 0 1px #fff   a white ring drawn INSIDE the edge,
 *                                      which on an amber gradient reads as the
 *                                      button being cut open
 *   background: #3858e9                admin blue, replacing the gradient
 *   outline: 1px solid transparent     removes the visible focus ring
 *
 * Our earlier rule only set `outline`, so everything else in core's focus state
 * still applied. It also used `outline-offset`, which draws outside the layout
 * box and gets clipped by any ancestor that ever gains `overflow: hidden`.
 *
 * The ring is now a box-shadow instead: it cannot be clipped, costs no layout,
 * and stacks with the button's own glow rather than replacing it. Declared on
 * both selectors with `!important` because core's `.wp-core-ui .button-primary`
 * rules are loaded after ours and win on order at equal specificity.
 */

.login .button-primary:focus,
.login .button-primary:focus-visible,
#wp-submit:focus,
#wp-submit:focus-visible {
  background: linear-gradient(135deg, var(--wgm-amber) 0%, var(--wgm-amber-2) 100%) !important;
  border: none !important;
  color: #fff !important;
  outline: none !important;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.9),
    0 0 0 5px var(--wgm-amber),
    0 10px 24px -12px rgba(217, 119, 6, 0.55) !important;
}

/* Clicking should press, not jump. The hover rule lifts the button 1px; without
   this, the pointer-down state kept that lift and the button appeared to shift
   out from under the cursor. */
.login .button-primary:active,
#wp-submit:active {
  background: linear-gradient(135deg, var(--wgm-amber) 0%, var(--wgm-amber-2) 100%) !important;
  border: none !important;
  color: #fff !important;
  transform: translateY(0);
  filter: brightness(0.97);
  box-shadow: 0 6px 14px -10px rgba(217, 119, 6, 0.55) !important;
}

/* The focus ring sits 5px outside the button. The card has 38px of padding so
   there is room, but only while nothing above it clips -- and a stray
   `overflow: hidden` on a wrapper is exactly how this broke the first time. */
#login,
#loginform {
  overflow: visible;
}

/* ---- "Continue with Google" --------------------------------------------- *
 *
 * Rendered by BuddyBoss Platform Pro's SSO on the `login_form` hook. The markup
 * is theirs and so is the button's own styling, which follows Google's branding
 * rules -- so these rules place and size it rather than restyling it.
 *
 * One thing to know before changing anything here: BuddyBoss ships
 * `.bb-sso-container { display: none }` in an inline <style> block and reveals
 * it from JavaScript once the page settles. Anything decorative attached to the
 * OUTER wrapper therefore paints immediately, while the button it belongs to is
 * still hidden -- which is how an "or" separator ends up floating above nothing.
 * Everything below hangs off `.bb-sso-container-buttons`, which is inside the
 * hidden container and appears with it.
 */

/* Theirs is a bold grey rule with lines either side. Ours matches the card, so
   theirs is suppressed rather than both being drawn. */
.login #loginform .bb-sso-separator {
  display: none !important;
}

.login #loginform .bb-sso-container-buttons {
  position: relative;
  margin: 22px 0 0;
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login #loginform .bb-sso-container-buttons::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  border-top: 1px solid var(--wgm-line);
}

.login #loginform .bb-sso-container-buttons::after {
  content: "or";
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 10px;
  background: var(--wgm-card);
  color: #6b7280;
  font-size: 12px;
  line-height: 18px;
}

/* The provider markup is <a><div class="bb-sso-button">…</div></a>; the anchor
   carries no visual of its own, so it only has to stop being an inline box and
   let the button inside fill it. */
.login #loginform .bb-sso-container-buttons a {
  display: block;
  width: 100%;
  text-decoration: none;
  border-radius: 12px;
}

.login #loginform .bb-sso-button {
  width: 100%;
  box-sizing: border-box;
  min-height: 46px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
}

/* `data-align="left"` puts the label hard against the icon on a full-width
   button, leaving it stranded off-centre under a centred form. */
.login #loginform .bb-sso-container[data-align] {
  text-align: center;
}

.login #loginform .bb-sso-button-label-container {
  flex: 0 1 auto;
}

/* The same ring as the submit button: cannot be clipped, moves nothing. */
.login #loginform .bb-sso-container-buttons a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9), 0 0 0 5px var(--wgm-amber);
}
