/* Gimme Studio Keycloak Login Theme */
/* Design tokens aligned with app_studio (HeroUI + Tailwind config) */

:root {
  --bg:           #eff0ec;
  --surface:      #ffffff;
  --surface-2:    #fafaf7;
  --primary:      #80ba27;
  --primary-hover:#6a9920;
  --primary-fg:   #000000;
  --foreground:   #000000;
  --muted:        #686868;
  --subtle:       #a0a0a0;
  --border:       #e5e7eb;
  --border-input: #d1d5db;
  --focus-ring:   rgba(128, 186, 39, 0.15);
  --danger:       #b2002e;
  --danger-bg:    #fef2f2;
  --danger-border:#fecdd3;
  --success:      #247d34;
  --shadow-card:  0px 0px 5px 0px rgb(0 0 0 / 0.02), 0px 2px 10px 0px rgb(0 0 0 / 0.06);
  --radius-sm:    0.5rem;
  --radius-md:    0.75rem;
  --radius-lg:    0.875rem;
  --font:         'museo-sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  height: 100%;
  overflow-y: auto;
}

html,
body {
  /* Override PatternFly (common/keycloak) which sets bg-login.jpg and overflow:hidden on body.login-pf */
  background: transparent !important;
  background-image: none !important;
}

body,
body.login-pf {
  min-height: 100%;
  overflow: visible !important;
  overflow-y: auto !important;
}

body {
  font-family: var(--font);
  font-size: 16px;
  color: var(--foreground);
}

/* ── Split-screen layout ─────────────────────────────────────────────── */

.kc-page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: row;
  background: linear-gradient(135deg, #e8f4d4 0%, #f0f8e3 50%, #deeec4 100%);
}

/* Brand panel — left column, 50% split, sticky while form panel scrolls */
.kc-brand-panel {
  flex: 1;
  background: transparent;
  border-right: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 56px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

.kc-brand-inner {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: left;
  width: 100%;
  max-width: 400px;
  height: 100%;
}

.brand-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-footer {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: block;
  width: 120px;
  height: auto;
}

.brand-tagline {
  color: var(--foreground);
  font-size: 42px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.04em;
  margin: 0 0 16px;
}

.brand-sub {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
  margin-bottom: 36px;
  max-width: 320px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}

.brand-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.brand-ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border: 1.5px solid var(--border-input);
  border-radius: 980px;
  color: var(--foreground);
  font-size: 12px;
  font-weight: 500;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.brand-ghost-btn:hover {
  border-color: var(--foreground);
  color: var(--foreground);
  background-color: rgba(0, 0, 0, 0.04);
}

/* Form panel — right column, grows to fill remaining space */
.kc-form-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: transparent;
}

/* ── Container & Card ────────────────────────────────────────────────── */
/*
 * PatternFly sets .login-pf .container { position: absolute; bottom: 13%; padding-left: ... }
 * which pulls the container out of the flex flow. Reset to normal flow.
 * Only applied to .login-pf and .kc-page-wrapper — NOT .kc-form-panel which has its own padding.
 */

.login-pf .container,
.kc-page-wrapper .container {
  position: static !important;
  bottom: auto !important;
  padding-left: 0 !important;
  background-color: transparent !important;
  color: inherit !important;
  clear: none !important;
}

.kc-form-panel .container {
  position: static !important;
  bottom: auto !important;
  background-color: transparent !important;
  color: inherit !important;
  clear: none !important;
  width: 100%;
  max-width: 420px;
  margin-top: auto;
  margin-bottom: auto;
  padding: 2rem 1.5rem !important;
}

/* On desktop the logo is shown in the brand panel — hide it inside the card */
@media (min-width: 961px) {
  .login-logo {
    display: none !important;
  }

  /* Entire header hidden on desktop — brand panel handles greeting and logo */
  .login-pf-header {
    display: none;
  }

  /* Mobile-only logo footer is hidden on desktop */
  .mobile-brand-footer {
    display: none;
  }
}

.card-pf {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 40px;
  border: 1px solid rgba(0, 0, 0, 0.07);
}

/* ── Header ──────────────────────────────────────────────────────────── */

.login-pf-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  display: block;
  margin: 0 auto 18px;
  width: 110px;
  height: auto;
}

.login-pf-header h1 {
  color: var(--foreground);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.login-tagline {
  color: var(--foreground);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 6px !important;
}

.login-sub {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 !important;
}

/* ── Form groups ─────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 16px;
}

.form-group label,
.form-group .control-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.01em;
}

.form-control,
.login-pf .form-control,
.kc-page-wrapper .form-control {
  width: 100%;
  height: auto !important;
  min-height: 48px !important;
  padding: 13px 16px !important;
  border: 1.5px solid #e4e4e7 !important;
  border-radius: var(--radius-sm) !important;
  font-size: 14px !important;
  font-family: var(--font) !important;
  background: #fafafa !important;
  color: var(--foreground) !important;
  box-shadow: none !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  -webkit-appearance: none;
}

.form-control:hover {
  border-color: #a1a1aa !important;
  background: #f5f5f5;
}

.form-control:focus {
  outline: none !important;
  border-color: var(--primary) !important;
  background: #ffffff !important;
  box-shadow: 0 0 0 3px var(--focus-ring) !important;
}

.form-control::placeholder {
  color: var(--subtle);
}

/* ── Password header ─────────────────────────────────────────────────── */

.password-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.forgot-password-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.forgot-password-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* ── Primary button (submit / main action) ───────────────────────────── */
/*
 * Intentionally dark-neutral rather than green: social login is the
 * preferred path; email/password is the backup.  A charcoal button is
 * clearly actionable but doesn't compete with the social CTAs above it.
 */

.btn {
  display: block;
  width: 100%;
  padding: 10px 20px;
  background: #18181b;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
  margin-top: 8px;
  text-align: center;
  text-decoration: none;
}

.btn:hover,
.btn:focus {
  background: #27272a !important;
  background-image: none !important;
  border-color: transparent !important;
  color: #ffffff !important;
  text-decoration: none;
  box-shadow: none !important;
  outline: none !important;
}

.btn:active {
  background: #3f3f46 !important;
  border-color: transparent !important;
}

/* Secondary / light button */
.btn-secondary {
  background: var(--surface-2);
  color: var(--foreground);
  border: 1px solid var(--border);
  font-weight: 500;
}

.btn-secondary:hover,
.btn-secondary:focus {
  opacity: 1;
  background: #e3e3e3 !important;
  background-image: none !important;
  border-color: var(--border) !important;
  color: var(--foreground) !important;
  box-shadow: none !important;
  outline: none !important;
}

/* ── Alerts / messages ───────────────────────────────────────────────── */

.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.alert-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.alert-success {
  background: #f0fdf4;
  color: var(--success);
  border: 1px solid #bbf7d0;
}

.alert-warning {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.alert-info {
  background: #eff6ff;
  color: #21385e;
  border: 1px solid #bfdbfe;
}

/* ── Validation errors ───────────────────────────────────────────────── */

.help-block {
  color: var(--danger);
  font-size: 13px;
  margin-top: 4px;
  display: block;
}

input[aria-invalid="true"] {
  border-color: var(--danger) !important;
}

input[aria-invalid="true"]:focus {
  border-color: var(--danger) !important;
}

/* ── Social login ────────────────────────────────────────────────────── */

.social-providers {
  margin-bottom: 20px;
}

.btn-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 10px;
  border: 1.5px solid #d4d4d8;
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--foreground);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  font-family: var(--font);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.06);
}

.btn-social:hover,
.btn-social:focus {
  background: var(--surface-2) !important;
  background-image: none !important;
  border-color: #a1a1aa !important;
  color: var(--foreground) !important;
  text-decoration: none;
  box-shadow: none !important;
  opacity: 1 !important;
}

.social-icon {
  flex-shrink: 0;
}

/* ── Divider ─────────────────────────────────────────────────────────── */

.divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.divider span {
  margin: 0 12px;
  color: var(--subtle);
  font-size: 13px;
  font-weight: 500;
}

/* ── Checkbox ────────────────────────────────────────────────────────── */

.checkbox-group {
  margin-bottom: 16px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  line-height: 16px;
  color: var(--muted);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--primary);
  flex-shrink: 0;
  /* PatternFly sets margin: 4px 0 0 which misaligns the checkbox in flex */
  margin: 0 !important;
  padding: 0 !important;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* ── Register link ───────────────────────────────────────────────────── */

.register-link {
  text-align: center;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}

.register-btn {
  color: var(--primary) !important;
  text-decoration: none;
  font-weight: 600;
}

.register-btn:hover {
  color: var(--primary-hover) !important;
  text-decoration: underline;
}

/* ── Links (global) ──────────────────────────────────────────────────── */

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* ── Instruction / info blocks ───────────────────────────────────────── */

.instruction,
.info-message {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 14px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.info-message p {
  margin: 0;
}

.warning-message {
  background: #fffbeb !important;
  border-color: #fde68a !important;
  color: #92400e !important;
}

/* ── Info / error pages ──────────────────────────────────────────────── */

.info-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 0 4px;
}

.info-page-icon {
  color: var(--primary);
  margin-bottom: 20px;
}

.info-page-title {
  color: var(--foreground);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}

.info-page-text {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 28px;
  max-width: 280px;
}

.info-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* ── Logout pages ────────────────────────────────────────────────────── */

.logout-message {
  text-align: center;
  margin-bottom: 1.5rem;
}

.logout-icon {
  color: var(--subtle);
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
}

.logout-message h2 {
  color: var(--foreground);
  font-size: 1.375rem;
  font-weight: 600;
  margin: 0 0 0.375rem 0;
}

.logout-text {
  color: var(--muted);
  font-size: 0.9375rem;
  margin: 0;
  line-height: 1.5;
}

.logout-complete {
  text-align: center;
  margin-top: 1rem;
}

.success-message {
  color: var(--success);
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 1.25rem;
}

.logout-actions {
  display: flex;
  justify-content: center;
}

.logout-info {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-top: 1.25rem;
  text-align: center;
}

.logout-info p {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0;
}

.logout-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

.logout-buttons .btn {
  flex: 1;
  min-width: 140px;
  max-width: 200px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
}

.btn-icon {
  fill: currentColor;
  flex-shrink: 0;
}

/* ── TOTP setup ──────────────────────────────────────────────────────── */

.totp-setup h3 {
  color: var(--foreground);
  font-size: 17px;
  margin-bottom: 14px;
  font-weight: 600;
}

.totp-instructions {
  margin-bottom: 26px;
}

.totp-apps ul {
  list-style: none;
  padding: 0;
  margin: 12px 0;
}

.totp-apps li {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 13px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
}

.totp-qr-section {
  text-align: center;
  margin-bottom: 26px;
}

.qr-code-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin: 16px auto;
  display: inline-block;
}

.qr-code-container img {
  display: block;
  max-width: 200px;
  height: auto;
}

.totp-alternative {
  margin-top: 16px;
}

.totp-alternative a {
  color: var(--primary);
  font-size: 14px;
  font-weight: 500;
}

.totp-secret-key {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px;
  margin: 10px 0;
  font-family: 'Courier New', monospace;
  color: var(--foreground);
  font-size: 13px;
  word-break: break-all;
}

/* ── Trust badge ─────────────────────────────────────────────────────── */

.kc-trust-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
  color: var(--subtle);
  font-size: 12px;
  line-height: 1;
}

.kc-trust-badge svg {
  flex-shrink: 0;
  opacity: 0.6;
}

.kc-trust-badge .trust-badge-link {
  color: var(--primary);
  font-weight: 500;
  text-decoration: none;
}

.kc-trust-badge .trust-badge-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* ── Responsive ──────────────────────────────────────────────────────── */

/*
 * Breed scherm: brand panel zichtbaar, logo in card verborgen.
 * Smal scherm:  brand panel volledig verborgen, logo in card zichtbaar.
 */

@media (max-width: 960px) {
  /* Verberg het volledige brand panel — enkel de login card tonen */
  .kc-brand-panel {
    display: none;
  }

  .kc-page-wrapper {
    flex-direction: column;
  }

  .kc-form-panel {
    width: 100%;
    min-height: 100vh;
  }

  .kc-form-panel .container {
    margin-top: auto;
    margin-bottom: auto;
    padding: 2rem 1.25rem;
  }

  /* Logo bovenaan verbergen op mobile — staat onderaan als handtekening */
  .login-logo {
    display: none !important;
  }

  /* Mobile footer logo als handtekening */
  .mobile-brand-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 0 16px;
  }

  .mobile-brand-logo {
    width: 80px;
    height: auto;
    opacity: 0.6;
  }

  .mobile-brand-link {
    color: var(--muted);
    font-size: 13px;
    font-weight: 400;
    text-decoration: none;
  }

  .mobile-brand-link:hover {
    color: var(--foreground);
    text-decoration: underline;
  }

  .card-pf {
    padding: 28px 20px;
  }

  .logout-buttons {
    flex-direction: column;
    align-items: center;
  }

  .logout-buttons .btn {
    width: 100%;
    max-width: 280px;
  }

  .logout-message h2 {
    font-size: 1.25rem;
  }
}
