/*
 * WeatherWorks login branding.
 *
 * Layered on top of the stock Keycloak "keycloak" login theme
 * (theme.properties -> parent=keycloak). Colors, fonts, logo and background are
 * taken from the weatherworks3 portal (apps/portal/app/globals.css and the
 * /public/images assets) so the Keycloak login page matches the app:
 *   - Font:       Barlow
 *   - Primary:    #0088cf  (WW light blue)
 *   - Secondary:  #14377d  (WW dark/navy blue)
 *   - Background: ww-globe.svg over a light page
 *   - Logo:       ww/horizontal.svg
 */

@import url("https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700;800&display=swap");

:root {
  --ww-primary: #0088cf;
  --ww-primary-600: #007abb;
  --ww-primary-700: #0066a3;
  --ww-secondary: #14377d;
  --ww-secondary-100: #d6e0f2;
  --ww-page-bg: #f1f5f9;
  --ww-panel-bg: #ffffff;
  --ww-text: #1b1b1b;
  --ww-gray: #696f7b;
}

/* ---- Page + typography --------------------------------------------------- */
.login-pf body {
  background: var(--ww-page-bg) url("../img/ww-globe.svg") no-repeat center center;
  background-size: cover;
  background-attachment: fixed;
  color: var(--ww-text);
  font-family: "Barlow", "Helvetica Neue", Arial, sans-serif;
}

.login-pf-page {
  padding-top: 40px;
}

/* ---- Header logo (replaces the realm name text) -------------------------- */
.login-pf-page .login-pf-header {
  margin-bottom: 28px;
}

/*
 * The header (#kc-header-wrapper) renders the realm's display name, which can be:
 *   - plain text (realm name), or
 *   - a custom displayNameHtml block (the master realm ships an image/markup
 *     logo, here an AEM-branded Keycloak mark).
 * Rather than trying to match every possible child element, we hide ALL of the
 * wrapper's children and paint the WeatherWorks wordmark on the wrapper itself.
 * The wrapper keeps a fixed height so the background logo has a box to render in
 * even though its content is hidden.
 */
#kc-header-wrapper {
  box-sizing: border-box;
  width: 100%;
  max-width: 320px;
  height: 64px;
  margin: 0 auto;
  padding: 0;
  background: url("../img/ww-horizontal.svg") no-repeat center center !important;
  background-size: contain !important;
  /* Hide the plain-text realm name while keeping it for a11y. */
  font-size: 0;
  color: transparent;
  line-height: 0;
  text-indent: -9999px;
  overflow: hidden;
}

/* Hide whatever the realm's displayNameHtml renders (div/img/svg/spans). */
#kc-header-wrapper > * {
  display: none !important;
}

/* ---- Login card ---------------------------------------------------------- */
.login-pf-page .card-pf {
  margin-top: 20px;
  padding: 32px 32px 28px;
  background: var(--ww-panel-bg);
  border: none;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(20, 55, 125, 0.15);
}

#kc-page-title {
  font-weight: 700;
  color: var(--ww-secondary);
  letter-spacing: -0.01em;
}

/* ---- Form inputs --------------------------------------------------------- */
.login-pf-page .form-control {
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--ww-secondary-100);
  font-size: 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-pf-page .form-control:focus {
  border-color: var(--ww-primary);
  box-shadow: 0 0 0 2px rgba(0, 136, 207, 0.2);
}

.login-pf-page label {
  color: var(--ww-secondary);
  font-weight: 500;
}

/* ---- Primary button (rounded pill, like the portal "SIGN IN") ------------ */
.login-pf-page .btn-primary,
.login-pf-page input[type="submit"].btn-primary,
.login-pf-page #kc-form-buttons input[type="submit"],
.login-pf-page .pf-c-button.pf-m-primary,
.login-pf-page .pf-v5-c-button.pf-m-primary {
  background-color: var(--ww-primary) !important;
  border-color: var(--ww-primary) !important;
  border-radius: 9999px !important;
  min-height: 44px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login-pf-page .btn-primary:hover,
.login-pf-page .btn-primary:focus,
.login-pf-page .btn-primary:active,
.login-pf-page .btn-primary:focus-visible,
.login-pf-page #kc-form-buttons input[type="submit"]:hover,
.login-pf-page .pf-c-button.pf-m-primary:hover,
.login-pf-page .pf-v5-c-button.pf-m-primary:hover {
  background-color: var(--ww-primary-700) !important;
  border-color: var(--ww-primary-700) !important;
}

/* ---- Links --------------------------------------------------------------- */
.login-pf-page a,
#kc-registration a,
#kc-info-message a {
  color: var(--ww-primary);
  font-weight: 600;
}

.login-pf-page a:hover {
  color: var(--ww-secondary);
}

/* ---- Checkbox accent (Remember me) --------------------------------------- */
.login-pf-page input[type="checkbox"] {
  accent-color: var(--ww-primary);
}

/* ---- Alerts: tint using brand colors ------------------------------------- */
.login-pf-page .alert-error {
  border-left: 3px solid #f90000;
}
.login-pf-page .alert-success {
  border-left: 3px solid var(--ww-primary);
}
