/* ============================================================
   HTLCloud login theme — overrides for keycloak.v2 (PF v5)
   Palette: green #00A88E / dark green #0B6F60 / text #14231F
   ============================================================ */

:root {
  --htl-green: #00A88E;
  --htl-green-dark: #0B6F60;
  --htl-text: #14231F;
  --htl-text-soft: #51706B;
  --htl-border: rgba(22, 48, 43, .08);
}

/* ---------- CRITICAL: keycloak.v2 sets pf-v5-theme-dark on <html>,
   which switches ALL PatternFly variables to the dark palette (dark
   inputs, blue primary, light text). Redefine them on :root AND on the
   dark scope so the light values win regardless of cascade order. ---- */
:root,
.login-pf.pf-v5-theme-dark,
.pf-v5-theme-dark {
  color-scheme: light;

  --pf-v5-global--Color--100: #14231F;
  --pf-v5-global--Color--200: #51706B;
  --pf-v5-global--Color--dark-100: #14231F;
  --pf-v5-global--Color--dark-200: #51706B;

  --pf-v5-global--BackgroundColor--100: #fff;
  --pf-v5-global--BackgroundColor--150: #F7FAF9;
  --pf-v5-global--BackgroundColor--200: #F0F5F4;
  --pf-v5-global--BackgroundColor--300: #E8EFED;
  --pf-v5-global--BackgroundColor--dark-100: #fff;
  --pf-v5-global--BackgroundColor--dark-150: #F7FAF9;
  --pf-v5-global--BackgroundColor--dark-200: #F7FAF9;
  --pf-v5-global--BackgroundColor--dark-300: #F0F5F4;
  --pf-v5-global--BackgroundColor--dark-400: #14231F;

  --pf-v5-global--primary-color--100: #00A88E;
  --pf-v5-global--primary-color--200: #007A69;
  --pf-v5-global--primary-color--dark-100: #007A69;
  --pf-v5-global--primary-color--dark-200: #00A88E;

  --pf-v5-global--link--Color: #00A88E;
  --pf-v5-global--link--Color--hover: #007A69;
  --pf-v5-global--link--Color--visited: #007A69;

  --pf-v5-global--BorderColor--100: #C9D6D2;
  --pf-v5-global--BorderColor--200: #B7C9C4;
  --pf-v5-global--BorderColor--300: #C9D6D2;
  --pf-v5-global--BorderColor--dark-100: #C9D6D2;
  --pf-v5-global--BorderColor--dark-200: #B7C9C4;

  --pf-v5-global--active-color--100: rgba(0, 168, 142, .25);
  --pf-v5-global--active-color--200: rgba(0, 168, 142, .15);
  --pf-v5-global--primary-color--disabled: #A8D8D0;
}

/* ---------- page: soft green-tinted background (contrast for the
   white card; replaces the dark Keycloak artwork).
   The gradient goes on the ROOT element only: a root background
   propagates to the canvas and is painted across the ENTIRE scrollable
   area. Painting it on body instead leaves a solid fallback band below
   the first viewport (visible color change as soon as the page
   scrolls). The body keeps the artwork removed and stays transparent
   so the canvas (root) shows through. ---------- */
html {
  background-color: #F4F8F7 !important;
  background-image: linear-gradient(180deg, #E9F4F1 0%, #F4F8F7 340px) !important;
  background-repeat: no-repeat !important;
  background-attachment: scroll !important;
  color-scheme: light;
}

body {
  background-image: none !important;   /* keycloak.v2 dark artwork */
  background-attachment: scroll !important;
  font-family: Roboto, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--htl-text);
}

/* ---------- page shell: compact margins, TOP-aligned card ----------
   PatternFly vertically centers the card (.pf-v5-c-login { align-items:
   center } from 576px) and pads 24px top/bottom. On short pages that
   looks balanced — on the tall Terms page it pushes the top out of the
   viewport and leaves the card hanging. Use small page paddings and
   top alignment so tall pages start right below the logo and scroll
   naturally, and short pages just get a thin margin. ---------- */
.pf-v5-c-login {
  --pf-v5-c-login--PaddingTop: .75rem;
  --pf-v5-c-login--PaddingBottom: 1.5rem;
  --pf-v5-c-login__main--MarginBottom: 0;
}

@media (min-width: 576px) {
  .pf-v5-c-login {
    align-items: flex-start;   /* PF: center → clips tall pages */
  }
}

/* ---------- logo: HTLCloud brand (cloud mark + wordmark) ---------- */
.pf-v5-c-login__header {
  padding-top: .75rem;
  padding-bottom: .5rem;
}

#kc-header-wrapper {
  padding: 0;
  margin: 0;
  font-size: 0;              /* hides the plain realm-name text        */
  width: 214px;
  height: 48px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='230' height='48'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%2300A88E'/%3E%3Cstop offset='1' stop-color='%230B6F60'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect x='0' y='3' width='42' height='42' rx='12' fill='url(%23g)'/%3E%3Cpath d='M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14a6 6 0 0 0 6 6h13a5 5 0 0 0 5-5c0-2.64-2.05-4.78-4.65-7.96Z' fill='%23fff' transform='translate(10.5 10.5) scale(0.875)'/%3E%3Ctext x='54' y='33' font-family='Roboto, Arial, sans-serif' font-size='25' font-weight='800' fill='%2300A88E'%3EHTL%3C/text%3E%3Ctext x='107' y='33' font-family='Roboto, Arial, sans-serif' font-size='25' font-weight='400' fill='%2314231F'%3ECloud%3C/text%3E%3C/svg%3E") no-repeat left center / contain;
}

/* ---------- login card: white, rounded, green accent top ---------- */
.pf-v5-c-login__main {
  background-color: #fff;
  border: 1px solid var(--htl-border);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(11, 63, 54, .08) !important;
  padding: 0;
  overflow: hidden;   /* clips the header accent to the rounded corners */
}

.pf-v5-c-login__main-header {
  border-top: 4px solid var(--htl-green);   /* was PatternFly blue */
}

.pf-v5-c-login__main-header .pf-v5-c-title {
  color: var(--htl-text);
  font-weight: 700;
  letter-spacing: -.01em;
}

/* ---------- form ---------- */
.pf-v5-c-form__label-text {
  color: #3E5B54;
  font-weight: 500;
}

.pf-v5-c-form-control {
  background-color: #fff;
  border: 1px solid #C9D6D2;
  border-radius: 8px;
}

.pf-v5-c-form-control input,
.pf-v5-c-form-control select,
.pf-v5-c-form-control textarea {
  background-color: transparent;
  border-radius: 8px;
  color: var(--htl-text);
}

.pf-v5-c-form-control input::placeholder {
  color: #8AA09A;
}

  .pf-v5-c-form-control:focus-within {
    border-color: var(--htl-green) !important;
    box-shadow: 0 0 0 2px rgba(0, 168, 142, .18) !important;
  }

input[type='checkbox'] {
  accent-color: var(--htl-green);
}

/* ---------- buttons: HTL green ---------- */
.pf-v5-c-button.pf-m-primary {
  background-color: var(--htl-green);
  border-color: var(--htl-green);
  border-radius: 10px;
  font-weight: 600;
  color: #fff;
}

  .pf-v5-c-button.pf-m-primary:hover,
  .pf-v5-c-button.pf-m-primary:focus {
    background-color: var(--htl-green-dark);
    border-color: var(--htl-green-dark);
  }

/* ---------- password show/hide toggle (PF input-group) ----------
   The toggle button sits in a .pf-v5-c-input-group next to the input;
   PF paints it with the dark control palette → dark square sticking
   out of the white input. Make it a flush white segment with a green
   eye icon. ---------- */
.pf-v5-c-input-group {
  align-items: stretch;
}

.pf-v5-c-input-group .pf-v5-c-form-control {
  flex: 1 1 auto;
  border-radius: 8px 0 0 8px;   /* square right edge, button rounds it */
}

.pf-v5-c-input-group .pf-v5-c-form-control input {
  border-radius: 8px 0 0 8px;
}

.pf-v5-c-input-group .pf-v5-c-button.pf-m-control {
  flex: 0 0 auto;
  width: 46px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: #fff;
  border: 1px solid #C9D6D2;
  border-left: 0;
  border-radius: 0 8px 8px 0;
  color: var(--htl-green);
  cursor: pointer;
}

.pf-v5-c-input-group .pf-v5-c-button.pf-m-control:hover,
.pf-v5-c-input-group .pf-v5-c-button.pf-m-control:focus {
  background-color: #F0F5F4;
  border-color: #C9D6D2;
  color: var(--htl-green-dark);
}

.pf-v5-c-button.pf-m-control {
  background-color: transparent;
  color: var(--htl-text);
  border-radius: 8px;
}

/* ---------- links ---------- */
.pf-v5-c-login__main-body a,
.pf-v5-c-login__main-footer a,
.pf-v5-c-login__main-footer-band a {
  color: var(--htl-green);
  text-decoration: none;
  font-weight: 500;
}

  .pf-v5-c-login__main-body a:hover,
  .pf-v5-c-login__main-footer a:hover,
  .pf-v5-c-login__main-footer-band a:hover {
    color: var(--htl-green-dark);
    text-decoration: underline;
  }

/* ---------- alerts / messages ---------- */
.pf-v5-c-alert {
  background-color: #fff;
  border-radius: 12px;
}

.pf-v5-c-alert__title {
  color: var(--htl-text);
}

  .pf-v5-c-alert.pf-m-danger {
    border-color: rgba(176, 58, 46, .30);
  }

/* ---------- Terms and Conditions page (required action) ----------
   Rendered by our custom terms.ftl: a SHORT summary of the main points
   (the full binding version lives at apps.htl-neufelden.at/legal
   and is linked), a required consent checkbox and Agree/Decline buttons.
   The agree button stays disabled until the checkbox is ticked. ---------- */
#kc-terms-text {
  padding: 1.1rem 1.25rem 1.25rem;
  margin: 0 0 1.15rem;
  background-color: #F7FAF9;
  border: 1px solid var(--htl-border);
  border-radius: 12px;
  color: var(--htl-text);
  font-size: .9rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

#kc-terms-text .htl-terms-kicker {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--htl-green-dark);
  background: rgba(0, 168, 142, .08);
  border: 1px solid rgba(0, 168, 142, .25);
  border-radius: 8px;
  padding: .45rem .7rem;
  margin: 0 0 1rem;
}

#kc-terms-text h3 {
  font-size: .95rem;
  font-weight: 700;
  color: var(--htl-green-dark);
  margin: 1rem 0 .4rem;
}

#kc-terms-text p {
  margin: 0 0 .8em;
  color: var(--htl-text);
}

#kc-terms-text p:last-child {
  margin-bottom: 0;
}

#kc-terms-text ul {
  margin: .3em 0 1em;
  padding-left: 1.35em;
  list-style: disc outside;
}

#kc-terms-text li {
  margin-bottom: .45em;
  padding-left: .1em;
}

#kc-terms-text li:last-child {
  margin-bottom: 0;
}

#kc-terms-text li::marker {
  color: var(--htl-green);
}

#kc-terms-text strong {
  color: var(--htl-green-dark);
  font-weight: 700;
}

#kc-terms-text a {
  color: var(--htl-green-dark);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* The Terms page is the tallest login page — trim the trailing space
   so it fits without a large empty strip below the buttons: the PF
   main-footer pads 3xl (~48px) block-end and our footer-band adds
   margin/border on top of that. Scoped via :has() so it only applies
   to pages that actually render the terms gate. ---------- */
.pf-v5-c-login__main:has(#kc-terms-form) .pf-v5-c-login__main-footer {
  padding-block-end: 0 !important;
}

.pf-v5-c-login__main:has(#kc-terms-form) .pf-v5-c-login__main-footer-band {
  margin-top: 0 !important;
  border-top: 0 !important;
  padding-block-start: 0 !important;
}

/* consent checkbox — the active acceptance gate */
.kc-terms-consent {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  margin: 0 0 1.1rem;
  padding: .85rem 1rem;
  background: rgba(0, 168, 142, .07);
  border: 1px solid rgba(0, 168, 142, .28);
  border-radius: 10px;
}

.kc-terms-consent .pf-v5-c-check__input {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: .1rem;
  flex: none;
  accent-color: var(--htl-green);
  cursor: pointer;
}

.kc-terms-consent .pf-v5-c-check__label {
  color: var(--htl-text);
  font-weight: 600;
  font-size: .92rem;
  line-height: 1.45;
  cursor: pointer;
}

.pf-v5-c-login__main-body input[type='checkbox'] {
  accent-color: var(--htl-green);
}

/* ---------- footer band under the card ---------- */
.pf-v5-c-login__main-footer-band {
  background-color: transparent;
  border-top: 1px solid var(--htl-border);
  color: var(--htl-text-soft);
  padding-top: 1rem;
  margin-top: 1.5rem;
}

  .pf-v5-c-login__main-footer-band-item {
    color: var(--htl-text-soft);
  }

/* ---------- social / idp buttons ----------
   Keycloak emits the button as flex with justify-content:
   space-between (icon far left, label far right). Wrap the icon and
   label in a centered inner flex group instead: icon left + centered
   vertically, label centered both ways next to it. ---------- */
.pf-v5-c-login__main-footer-links .pf-v5-c-button {
  border-radius: 10px;
}

#kc-social-providers .pf-v5-c-button {
  background-color: #fff;
  border: 1px solid #C9D6D2;
  border-radius: 10px;
  color: var(--htl-text);
  font-weight: 600;
  justify-content: center;   /* override PF space-between */
  gap: .6rem;                /* icon ↔ label spacing */
}

#kc-social-providers .pf-v5-c-button:hover,
#kc-social-providers .pf-v5-c-button:focus {
  border-color: var(--htl-green);
  color: var(--htl-green-dark);
}

/* ---------- Google icon for the IdP button ----------
   The IdP is a GENERIC OIDC provider (only the built-in "Google"
   broker TYPE renders the G icon natively — the icon comes from the
   provider type, not the alias). Keycloak 26 names the button
   id="social-<alias>" → "social-google".
   Hide the placeholder box SVG and show the real Google "G". -------- */
#social-google svg {
  display: none;
}

#social-google::before {
  content: "";
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48'%3E%3Cpath fill='%23EA4335' d='M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z'/%3E%3Cpath fill='%234285F4' d='M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.46-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z'/%3E%3Cpath fill='%23FBBC05' d='M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z'/%3E%3Cpath fill='%2334A853' d='M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z'/%3E%3C/svg%3E") no-repeat center / contain;
}
