/* ============================================================
   validdata Keycloak Login Theme
   Mirrors the app's Tailwind CSS + shadcn/svelte design system.
   PatternFly v4 class targets (pf-c-*).
   ============================================================ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  --vd-dark-blue: #0a1923;
  --vd-light-blue: #0a3246;

  --background: oklch(1 0 0);
  --foreground: oklch(0.205 0.029 239.452);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.205 0.029 239.452);
  --primary: oklch(0.755 0.165 65.281);
  --primary-foreground: oklch(1 0 0);
  --muted: oklch(0.96 0.004 248.224);
  --muted-foreground: oklch(0.581 0.039 248.519);
  --border: oklch(0.92 0.007 248.077);
  --input: oklch(0.92 0.007 248.077);
  --ring: oklch(0.755 0.165 65.281);
  --destructive: oklch(0.577 0.245 27.325);
  --radius: 0.625rem;
}

/* ── Full-page background ─────────────────────────────────── */
html.login-pf,
.login-pf body,
body.login-pf,
.login-pf-page {
  background: var(--vd-dark-blue) url("../img/validdata-background.jpg")
    no-repeat center top 0px !important;
  background-size: cover !important;
  background-attachment: fixed !important;
  min-height: 100vh;
}

/* ── Page layout ──────────────────────────────────────────── */
.login-pf-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 16px;
}

/* ── Header / Logo ────────────────────────────────────────── */
#kc-header {
  padding: 0 0 32px 0;
  margin: 0;
}

#kc-header-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60px;
  max-width: 280px;
  margin: 0 auto;
  padding: 0 !important;
  font-size: 0 !important;
  color: transparent !important;
  overflow: hidden;
}

#kc-header-wrapper .kc-logo-text,
#kc-header-wrapper .kc-logo-text span {
  display: none !important;
}

#kc-header-wrapper::before {
  content: "";
  display: block;
  width: 280px;
  height: 60px;
  background-image: url("../img/vd-suite-logo.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/* ── Login Card ───────────────────────────────────────────── */
.card-pf {
  background: var(--card) !important;
  color: var(--card-foreground) !important;
  border: 1px solid var(--border) !important;
  border-radius: calc(var(--radius) + 4px) !important;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1),
    0 20px 60px -10px rgba(0, 0, 0, 0.25) !important;
  padding: 24px !important;
  max-width: 420px;
  width: 100%;
  margin: 0 auto !important;
}

/* ── Card Title ───────────────────────────────────────────── */
.login-pf-header {
  margin-bottom: 24px;
}

#kc-page-title {
  color: var(--foreground) !important;
  font-size: 1.25rem !important;
  font-weight: 600 !important;
  text-align: center;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.75rem;
  letter-spacing: -0.025em;
}

/* ── Form Groups ──────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px !important;
}

/* ── Labels ────────────────────────────────────────────────── */
.login-pf .pf-c-form__label,
.login-pf .pf-c-form__label-text,
.login-pf label {
  color: var(--foreground) !important;
  font-weight: 500 !important;
  font-size: 0.875rem !important;
  line-height: 1.25rem !important;
  margin-bottom: 6px !important;
  display: block;
}

/* ── Text Inputs ──────────────────────────────────────────── */
.login-pf .pf-c-form-control,
.login-pf input[type="text"],
.login-pf input[type="password"],
.login-pf input[type="email"] {
  height: 36px !important;
  border: 1px solid var(--input) !important;
  border-radius: calc(var(--radius) - 2px) !important;
  padding: 4px 12px !important;
  font-size: 0.875rem !important;
  line-height: 1.25rem !important;
  background: var(--background) !important;
  color: var(--foreground) !important;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
  transition: color 0.15s, box-shadow 0.15s !important;
  outline: none !important;
  -webkit-appearance: none;
}

.login-pf .pf-c-form-control:focus,
.login-pf input[type="text"]:focus,
.login-pf input[type="password"]:focus,
.login-pf input[type="email"]:focus {
  border-color: var(--ring) !important;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05),
    0 0 0 3px oklch(0.755 0.165 65.281 / 50%) !important;
  outline: none !important;
}

/* ── Password input-group ─────────────────────────────────── */
.pf-c-input-group {
  display: flex !important;
  align-items: stretch !important;
  position: relative !important;
}

.pf-c-input-group .pf-c-form-control,
.pf-c-input-group input[type="password"] {
  border-right: none !important;
  border-radius: calc(var(--radius) - 2px) 0 0 calc(var(--radius) - 2px) !important;
  flex: 1 !important;
}

/* ── Password Visibility Toggle ───────────────────────────── */
.pf-c-input-group .pf-c-button.pf-m-control {
  border: 1px solid var(--input) !important;
  border-left: none !important;
  border-radius: 0 calc(var(--radius) - 2px) calc(var(--radius) - 2px) 0 !important;
  background: var(--background) !important;
  color: var(--muted-foreground) !important;
  padding: 0 12px !important;
  height: 36px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: color 0.15s, box-shadow 0.15s !important;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
  cursor: pointer !important;
  outline: none !important;
}

.pf-c-input-group:focus-within .pf-c-button.pf-m-control {
  border-color: var(--ring) !important;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05),
    0 0 0 3px oklch(0.755 0.165 65.281 / 50%) !important;
}

.pf-c-input-group .pf-c-button.pf-m-control:hover {
  color: var(--foreground) !important;
  background: var(--muted) !important;
  border-color: var(--input) !important;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
}

.pf-c-input-group .pf-c-button.pf-m-control:focus,
.pf-c-input-group .pf-c-button.pf-m-control:focus-visible {
  outline: none !important;
  border-color: var(--ring) !important;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05),
    0 0 0 3px oklch(0.755 0.165 65.281 / 50%) !important;
}

/* Kill PatternFly blue pseudo-element borders on toggle */
.pf-c-button.pf-m-control::after,
.pf-c-button.pf-m-control::before {
  display: none !important;
}

.pf-c-button.pf-m-control:hover,
.pf-c-button.pf-m-control:focus {
  --pf-c-button--m-control--hover--BorderBottomColor: transparent !important;
  --pf-c-button--m-control--focus--BorderBottomColor: transparent !important;
  --pf-c-button--m-control--active--BorderBottomColor: transparent !important;
}

/* ── Primary Button (Sign In) ─────────────────────────────── */
#kc-login,
.login-pf .pf-c-button.pf-m-primary,
.login-pf input[type="submit"].pf-m-primary {
  background-color: var(--primary) !important;
  border: 1px solid transparent !important;
  color: var(--primary-foreground) !important;
  border-radius: var(--radius) !important;
  height: 36px !important;
  padding: 0 10px !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  cursor: pointer !important;
  transition: all 0.15s !important;
  box-shadow: none !important;
  width: 100%;
  line-height: 1.25rem !important;
  margin-top: 4px;
  outline: none !important;
  -webkit-appearance: none;
}

#kc-login:hover,
.login-pf .pf-c-button.pf-m-primary:hover {
  opacity: 0.9;
}

#kc-login:active,
.login-pf .pf-c-button.pf-m-primary:active {
  transform: translateY(1px);
}

#kc-login:focus-visible,
.login-pf .pf-c-button.pf-m-primary:focus-visible {
  border-color: var(--ring) !important;
  box-shadow: 0 0 0 3px oklch(0.755 0.165 65.281 / 50%) !important;
  outline: none !important;
}

/* ── Secondary / Link Buttons ─────────────────────────────── */
.login-pf .btn-default,
.login-pf .pf-c-button.pf-m-link {
  color: var(--primary) !important;
  border-radius: var(--radius) !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
}

.login-pf .btn-default:hover,
.login-pf .pf-c-button.pf-m-link:hover {
  text-decoration: underline !important;
  text-underline-offset: 4px !important;
}

/* ── Links ─────────────────────────────────────────────────── */
.login-pf a {
  color: var(--primary) !important;
  text-decoration: none !important;
  font-size: 0.875rem;
}

.login-pf a:hover {
  text-decoration: underline !important;
  text-underline-offset: 4px !important;
}

/* ── Form Options ──────────────────────────────────────────── */
#kc-form-options {
  text-align: right;
}

.login-pf-settings {
  margin-bottom: 4px !important;
}

/* ── Checkbox ──────────────────────────────────────────────── */
.login-pf .checkbox label {
  color: var(--muted-foreground) !important;
  font-size: 0.875rem !important;
  font-weight: 400 !important;
}

.login-pf input[type="checkbox"]:checked {
  accent-color: oklch(0.755 0.165 65.281);
}

/* ── Alerts ────────────────────────────────────────────────── */
.login-pf .alert,
.login-pf .pf-c-alert {
  margin-bottom: 16px !important;
  font-size: 0.875rem !important;
}

.login-pf .alert-error,
.login-pf .pf-c-alert.pf-m-danger {
  border-color: var(--destructive) !important;
}

/* ── Locale Selector ───────────────────────────────────────── */
#kc-locale ul {
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  border-radius: calc(var(--radius) - 2px) !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -2px rgba(0, 0, 0, 0.1) !important;
}

#kc-locale-wrapper > a,
#kc-locale > .kc-dropdown > a,
#kc-locale > div > a {
  color: white !important;
  font-size: 0.875rem !important;
}

#kc-locale ul li a,
#kc-locale .kc-dropdown-item a {
  color: var(--foreground) !important;
  font-size: 0.875rem !important;
  padding: 6px 12px !important;
  display: block;
}

#kc-locale ul li a:hover,
#kc-locale .kc-dropdown-item a:hover {
  background: var(--muted) !important;
  color: var(--foreground) !important;
  text-decoration: none !important;
}

/* ── Social / IDP Section ──────────────────────────────────── */
#kc-social-providers {
  margin-top: 8px !important;
}

#kc-social-providers hr {
  border: none !important;
  border-top: 1px solid var(--border) !important;
  margin: 16px 0 !important;
}

#kc-social-providers h2,
#kc-social-providers h4,
#kc-social-providers .pf-c-login__main-footer-band-item {
  color: var(--muted-foreground) !important;
  font-size: 0.8125rem !important;
  font-weight: 400 !important;
  text-align: center;
  margin-bottom: 12px !important;
}

/* Social links list — remove default list styling */
#kc-social-providers ul {
  list-style: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* ── Social / IDP Buttons ──────────────────────────────────── */
#kc-social-providers .kc-social-item,
#kc-social-providers .zocial,
.login-pf .social-provider-link {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 40px !important;
  border: 1px solid var(--foreground) !important;
  border-radius: var(--radius) !important;
  margin-bottom: 8px !important;
  padding: 0 16px !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  color: var(--primary-foreground) !important;
  background: var(--foreground) !important;
  text-decoration: none !important;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s !important;
  cursor: pointer !important;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1) !important;
}

#kc-social-providers .kc-social-item:hover,
#kc-social-providers .zocial:hover,
.login-pf .social-provider-link:hover {
  opacity: 0.9;
  text-decoration: none !important;
}

#kc-social-providers .kc-social-item:active,
#kc-social-providers .zocial:active,
.login-pf .social-provider-link:active {
  transform: translateY(1px);
}

#kc-social-providers .kc-social-item:focus-visible,
#kc-social-providers .zocial:focus-visible,
.login-pf .social-provider-link:focus-visible {
  border-color: var(--ring) !important;
  box-shadow: 0 0 0 3px oklch(0.755 0.165 65.281 / 50%) !important;
  outline: none !important;
}

/* Override PatternFly control button pseudo-elements on social items */
#kc-social-providers .pf-c-button.pf-m-control::after,
#kc-social-providers .pf-c-button.pf-m-control::before {
  display: none !important;
}

#kc-social-providers .kc-social-provider-name {
  color: var(--primary-foreground) !important;
}

/* ── Footer / Info ─────────────────────────────────────────── */
#kc-info,
#kc-info-wrapper {
  text-align: center;
  margin-top: 16px;
}

#kc-info a {
  color: rgba(255, 255, 255, 0.55) !important;
  font-size: 0.8125rem !important;
}

#kc-info a:hover {
  color: white !important;
}

/* ── Registration link ─────────────────────────────────────── */
#kc-registration {
  margin-top: 16px;
  text-align: center;
}

#kc-registration span {
  color: var(--muted-foreground) !important;
  font-size: 0.875rem !important;
}

/* ── Tab bar (credentials vs OTP) ──────────────────────────── */
.login-pf .nav-tabs > li.active > a,
.login-pf .nav-tabs > li > a:hover {
  border-bottom-color: var(--primary) !important;
  color: var(--primary) !important;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 480px) {
  .card-pf {
    margin: 0 8px !important;
    padding: 20px 16px !important;
    border-radius: calc(var(--radius) + 2px) !important;
  }

  #kc-header-wrapper::before {
    width: 220px;
    height: 48px;
  }

  #kc-header {
    padding-bottom: 24px;
  }
}
