/* ═══════════════════════════════════════════════════════════
   Osmio — Keycloak Login Theme v3.0.0
   Centered card layout matching reference implementation
   ═══════════════════════════════════════════════════════════ */

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

/* ─── Staggered Reveal Animation ────────────────────────── */
@keyframes loginFadeInUp {
  0%   { opacity: 0; transform: translateY(16px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ─── Cube Animations ───────────────────────────────────── */
@keyframes orbitalSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes cubeRotateY {
  from { transform: rotateY(0deg) rotateX(0deg); }
  to   { transform: rotateY(360deg) rotateX(0deg); }
}
@keyframes cubeRotateX {
  0%   { transform: rotateY(0deg) rotateX(0deg); }
  50%  { transform: rotateY(180deg) rotateX(15deg); }
  100% { transform: rotateY(360deg) rotateX(0deg); }
}


/* ═══════════════════════════════════════════
   Hard Reset — Kill ALL PatternFly / Keycloak
   ═══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0 !important;
  padding: 0 !important;
  min-height: 100dvh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  color: #f1f5f9;
  background: #020617 !important;
  background-image: none !important;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Strip PF backgrounds but keep display flow intact */
.login-pf,
.login-pf body,
body.login-pf,
.login-pf-page,
.login-pf-page .card-pf,
.card-pf,
.pf-c-page, .pf-v5-c-page,
.pf-c-login, .pf-v5-c-login {
  background: none !important;
  background-image: none !important;
  border: none !important;
  box-shadow: none !important;
  max-width: none !important;
  padding: 0 !important;
  margin: 0 !important;
}

/* Content wrappers — transparent but keep block layout */
#kc-content,
#kc-content-wrapper {
  display: block !important;
  background: transparent !important;
  padding: 0 !important;
  margin: 0 !important;
  width: 100% !important;
}

/* Hide Keycloak header completely */
#kc-header, #kc-header-wrapper, .login-pf-page-header {
  display: none !important;
}


/* ═══════════════════════════════════════════
   Canvas Background
   ═══════════════════════════════════════════ */
#osmio-bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}


/* ═══════════════════════════════════════════
   Page Container — Centered Card
   ═══════════════════════════════════════════ */
.osmio-page {
  position: relative;
  display: flex;
  min-height: 100dvh;
  width: 100%;
  align-items: center;
  justify-content: center;
  background: #020617;
  overflow: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  color: #f1f5f9;
  z-index: 1;
}


/* ═══════════════════════════════════════════
   Glass Card — 420px centered
   ═══════════════════════════════════════════ */
.osmio-card {
  position: relative;
  z-index: 10;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(148, 163, 184, 0.06);
  border-radius: 22px;
  padding: 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  max-width: 420px;
  width: 100%;
  margin: 20px;
}


/* ═══════════════════════════════════════════
   Staggered Reveal
   ═══════════════════════════════════════════ */
.osmio-reveal {
  opacity: 0;
  animation: loginFadeInUp 0.5s ease-out forwards;
  width: 100%;
}

.osmio-reveal-0 { animation-delay: 0ms; }
.osmio-reveal-1 { animation-delay: 100ms; }
.osmio-reveal-2 { animation-delay: 200ms; }
.osmio-reveal-3 { animation-delay: 300ms; }
.osmio-reveal-4 { animation-delay: 400ms; }
.osmio-reveal-5 { animation-delay: 500ms; }
.osmio-reveal-6 { animation-delay: 600ms; }
.osmio-reveal-7 { animation-delay: 700ms; }
.osmio-reveal-8 { animation-delay: 800ms; }


/* ═══════════════════════════════════════════
   Cube Logo Wrapper
   ═══════════════════════════════════════════ */
.osmio-cube-wrap {
  margin-bottom: 28px;
  perspective: 200px;
  display: flex;
  justify-content: center;
}


/* ═══════════════════════════════════════════
   3D Cube
   ═══════════════════════════════════════════ */
.cubeScene {
  position: relative;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cubeGlow {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 170, 255, 0.18) 0%, transparent 70%);
  pointer-events: none;
}

.orbital {
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1.5px solid rgba(0, 170, 255, 0.3);
  animation: orbitalSpin 8s linear infinite;
}

.orbital-dot {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00aaff;
  box-shadow: 0 0 8px rgba(0, 170, 255, 0.8);
}

.cubeContainer {
  width: 48px;
  height: 48px;
  perspective: 200px;
  position: relative;
  z-index: 1;
}

.cube {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  animation: cubeRotateY 20s linear infinite, cubeRotateX 15s linear infinite;
}

.face {
  position: absolute;
  width: 48px;
  height: 48px;
  background: #000000;
  border: 1.5px solid #00aaff;
  box-shadow:
    0 0 8px rgba(0, 170, 255, 0.7),
    inset 0 0 6px rgba(0, 170, 255, 0.12);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #00aaff;
  font-size: 20px;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(0, 170, 255, 0.9);
}

.faceFront  { transform: translateZ(24px); }
.faceBack   { transform: rotateY(180deg) translateZ(24px); }
.faceLeft   { transform: rotateY(-90deg) translateZ(24px); }
.faceRight  { transform: rotateY(90deg)  translateZ(24px); }
.faceTop    { transform: rotateX(90deg)  translateZ(24px); }
.faceBottom { transform: rotateX(-90deg) translateZ(24px); }


/* ═══════════════════════════════════════════
   Brand Label
   ═══════════════════════════════════════════ */
.osmio-brand-label {
  margin-bottom: 6px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #3b82f6;
}


/* ═══════════════════════════════════════════
   Title & Subtitle
   ═══════════════════════════════════════════ */
.osmio-title {
  font-size: 24px !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em;
  color: #f8fafc !important;
  margin: 0 0 6px 0 !important;
  text-align: center;
  padding: 0 !important;
}

.osmio-subtitle {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 28px 0;
  text-align: center;
  max-width: 280px;
  line-height: 1.5;
}


/* ═══════════════════════════════════════════
   Form Layout
   ═══════════════════════════════════════════ */
#kc-form-login {
  width: 100%;
}

.osmio-form-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
}


/* ═══════════════════════════════════════════
   Input Fields
   ═══════════════════════════════════════════ */
.osmio-field {
  width: 100%;
}

.osmio-input-wrap {
  position: relative;
}

.osmio-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  transition: color 200ms;
  pointer-events: none;
  display: flex;
  align-items: center;
}

.osmio-input-wrap input,
input[type="text"],
input[type="password"],
input[type="email"],
.pf-c-form-control,
.pf-v5-c-form-control {
  width: 100% !important;
  height: 48px !important;
  background: rgba(15, 23, 42, 0.5) !important;
  border: 1px solid rgba(148, 163, 184, 0.1) !important;
  border-radius: 8px !important;
  padding: 0 16px 0 42px !important;
  font-size: 14px !important;
  color: #f1f5f9 !important;
  outline: none !important;
  box-shadow: none !important;
  transition: border-color 200ms, box-shadow 200ms;
  font-family: 'Inter', -apple-system, sans-serif !important;
}

.osmio-input-wrap input:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
.pf-c-form-control:focus,
.pf-v5-c-form-control:focus {
  border-color: rgba(37, 99, 235, 0.5) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

.osmio-input-wrap input:focus ~ .osmio-input-icon,
.osmio-input-wrap input:focus + .osmio-input-icon {
  color: #3b82f6;
}

input::placeholder {
  color: #64748b !important;
  opacity: 1 !important;
}

.osmio-field-error {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #ef4444;
}

/* Password toggle button */
.osmio-toggle-pw {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none !important;
  border: none !important;
  color: #64748b !important;
  cursor: pointer;
  padding: 4px !important;
  font-size: 14px;
  transition: color 200ms;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.osmio-toggle-pw svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

/* Give password inputs extra right padding when toggle is present */
.osmio-input-wrap .osmio-toggle-pw ~ input,
.osmio-input-wrap input:has(~ .osmio-toggle-pw),
input[type="password"] {
  padding-right: 48px !important;
}

.osmio-toggle-pw:hover {
  color: #94a3b8 !important;
}

/* Override PF input-group that wraps password */
.pf-c-input-group {
  display: contents !important;
}

/* Remove all PF form labels — our design uses placeholders + icons */
label,
.control-label,
.pf-c-form__label,
.pf-c-form__label-text,
.pf-v5-c-form__label-text {
  display: none !important;
}

/* Remove PF form-group spacing */
.form-group {
  margin: 0 !important;
  padding: 0 !important;
}


/* ═══════════════════════════════════════════
   Primary Button
   ═══════════════════════════════════════════ */
.osmio-btn-primary,
input[type="submit"]#kc-login,
#kc-login {
  width: 100% !important;
  height: 48px !important;
  margin-top: 8px !important;
  background: #2563eb !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  border-radius: 10px !important;
  border: none !important;
  cursor: pointer;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px;
  transition: background 200ms, transform 120ms;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25) !important;
  font-family: 'Inter', -apple-system, sans-serif !important;
  padding: 0 !important;
}

.osmio-btn-primary:hover,
#kc-login:hover {
  background: #1d4ed8 !important;
}

.osmio-btn-primary:active,
#kc-login:active {
  transform: scale(0.98);
}

.osmio-btn-primary:focus-visible,
#kc-login:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.35) !important;
}

/* Secondary / Cancel Button */
.osmio-btn-secondary {
  width: 100% !important;
  height: 44px !important;
  margin-top: 8px !important;
  background: transparent !important;
  color: #94a3b8 !important;
  font-weight: 500 !important;
  font-size: 13px !important;
  border-radius: 10px !important;
  border: 1px solid rgba(148, 163, 184, 0.12) !important;
  cursor: pointer;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: background 200ms, border-color 200ms;
  font-family: 'Inter', -apple-system, sans-serif !important;
  padding: 0 !important;
}

.osmio-btn-secondary:hover {
  background: rgba(148, 163, 184, 0.06) !important;
  border-color: rgba(148, 163, 184, 0.18) !important;
}

.osmio-btn-secondary:active {
  transform: scale(0.98);
}


/* ═══════════════════════════════════════════
   Remember Me + Forgot Password
   ═══════════════════════════════════════════ */
.osmio-form-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  font-size: 12.5px;
  color: #64748b;
}

.osmio-remember {
  display: flex !important;
  align-items: center;
  gap: 6px;
  color: #64748b !important;
  font-size: 12.5px !important;
  font-weight: 400 !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  cursor: pointer;
}

.osmio-remember input[type="checkbox"] {
  width: 14px !important;
  height: 14px !important;
  accent-color: #2563eb;
  padding: 0 !important;
}

.osmio-forgot {
  font-size: 12.5px;
  color: #3b82f6 !important;
  text-decoration: none;
  font-weight: 500;
}

.osmio-forgot:hover {
  text-decoration: underline;
}

/* Logout other sessions checkbox (update-password page) */
.osmio-logout-sessions {
  margin-bottom: 16px;
  margin-top: 4px;
}

.osmio-logout-sessions .osmio-remember {
  display: flex !important;
}


/* ═══════════════════════════════════════════
   Alerts
   ═══════════════════════════════════════════ */
.osmio-alert {
  width: 100%;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
}

.osmio-alert-error,
.osmio-alert-danger {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.osmio-alert-warning {
  background: rgba(217, 119, 6, 0.08);
  border: 1px solid rgba(217, 119, 6, 0.2);
  color: #fde047;
}

.osmio-alert-success {
  background: rgba(5, 150, 105, 0.08);
  border: 1px solid rgba(5, 150, 105, 0.2);
  color: #6ee7b7;
}

.osmio-alert-info {
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  color: #93c5fd;
}

/* Hide PF alert icons */
.pf-c-alert__icon { display: none !important; }

/* Kill PF alert styling */
.alert, .pf-c-alert, .pf-v5-c-alert {
  all: unset !important;
}


/* ═══════════════════════════════════════════
   Social Providers
   ═══════════════════════════════════════════ */
.osmio-social {
  width: 100%;
  margin-top: 20px;
}

.osmio-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  color: #475569;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.osmio-divider::before,
.osmio-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(148, 163, 184, 0.08);
}

.osmio-social-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.osmio-social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(148, 163, 184, 0.08);
  border-radius: 8px;
  color: #e2e8f0 !important;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 200ms, background 200ms;
}

.osmio-social-btn:hover {
  background: rgba(15, 23, 42, 0.5);
  border-color: rgba(148, 163, 184, 0.15);
  text-decoration: none;
}


/* ═══════════════════════════════════════════
   Info / Signup Link
   ═══════════════════════════════════════════ */
.osmio-info,
.osmio-signup-link {
  margin-top: 20px;
  font-size: 12.5px;
  color: #64748b;
  text-align: center;
}

.osmio-signup-link a,
.osmio-info a {
  color: #3b82f6;
  text-decoration: none;
  font-weight: 500;
}

.osmio-signup-link a:hover,
.osmio-info a:hover {
  text-decoration: underline;
}


/* ═══════════════════════════════════════════
   Attempted Username (re-auth)
   ═══════════════════════════════════════════ */
.osmio-attempted-user {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.osmio-attempted-user label {
  display: inline !important;
  color: #e2e8f0 !important;
  font-size: 14px !important;
  font-weight: 500;
}

.osmio-attempted-user a {
  color: #64748b;
  font-size: 12px;
}


/* ═══════════════════════════════════════════
   Footer Brand
   ═══════════════════════════════════════════ */
.osmio-footer-brand {
  margin-top: 28px;
  text-align: center;
  font-size: 10px;
  color: #334155;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}


/* ═══════════════════════════════════════════
   Locale Switcher
   ═══════════════════════════════════════════ */
.osmio-locale {
  position: absolute;
  top: 16px;
  right: 16px;
}

.osmio-locale button {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.08);
  border-radius: 4px;
  color: #64748b;
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  transition: border-color 150ms;
}

.osmio-locale button:hover {
  border-color: rgba(148, 163, 184, 0.15);
}


/* ═══════════════════════════════════════════
   Selection & Scrollbar
   ═══════════════════════════════════════════ */
::selection {
  background: rgba(37, 99, 235, 0.30);
  color: #f8fafc;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.25); }


/* ═══════════════════════════════════════════
   Links (generic)
   ═══════════════════════════════════════════ */
a, a:link {
  color: #3b82f6;
  text-decoration: none;
  transition: color 150ms;
}

a:hover {
  color: #60a5fa;
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid rgba(37, 99, 235, 0.4);
  outline-offset: 2px;
  border-radius: 2px;
}


/* ═══════════════════════════════════════════
   Mobile Responsive
   ═══════════════════════════════════════════ */
@media (max-width: 480px) {
  .osmio-card {
    padding: 36px 24px;
    border-radius: 18px;
    margin: 16px;
  }

  .osmio-title {
    font-size: 20px !important;
  }
}
