/* ============================================================
 *  Nexus theme for Keycloak login page
 *  parent=base (нет конфликта с PatternFly из keycloak.v2)
 * ============================================================ */

:root {
  --nx-card-bg-light: rgba(255, 255, 255, 0.76);
  --nx-card-bg-dark: rgba(15, 23, 42, 0.84);
  --nx-border-light: rgba(255, 255, 255, 0.58);
  --nx-border-dark: rgba(102, 126, 234, 0.26);
  --nx-shadow-light: 0 24px 70px rgba(102, 126, 234, 0.16), 0 10px 24px rgba(240, 147, 251, 0.12);
  --nx-shadow-dark: 0 24px 70px rgba(0, 0, 0, 0.34), 0 0 0 1px rgba(102, 126, 234, 0.18) inset;
  --nx-card-bg: var(--nx-card-bg-light);
  --nx-card-border: var(--nx-border-light);
  --nx-card-shadow: var(--nx-shadow-light);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  color: #1e293b;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow-x: hidden;
}

/* === Canvas с эффектами === */
#auth-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

#effects-counter {
  position: fixed;
  right: 16px; bottom: 16px;
  z-index: 1;
  padding: 6px 12px;
  border-radius: 999px;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(102, 126, 234, 0.2);
  background: rgba(255, 255, 255, 0.55);
  color: #667eea;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  opacity: .65;
  pointer-events: none;
}

/* === Карточка === */
.nx-card {
  position: relative;
  z-index: 2;
  width: min(100%, 460px);
  background: var(--nx-card-bg);
  border: 1px solid var(--nx-card-border);
  border-radius: 26px;
  box-shadow: var(--nx-card-shadow);
  overflow: hidden;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  transition: transform .24s, box-shadow .24s;
}
.nx-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 30px 80px rgba(102, 126, 234, 0.22), 0 16px 30px rgba(240, 147, 251, 0.15);
}
.nx-card::before {
  content: '';
  display: block;
  height: 4px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 20%, #f093fb 40%, #4facfe 60%, #00f2fe 80%, #667eea 100%);
  background-size: 300% 100%;
  animation: rainbowShimmer 7s linear infinite;
}
@keyframes rainbowShimmer {
  0%   { background-position: 0 0; }
  100% { background-position: 300% 0; }
}

.nx-body {
  position: relative;
  padding: 40px 36px 34px;
}

/* === Лого Nexus === */
.nx-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.nx-logo-icon {
  width: 48px;
  height: 48px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  font-size: 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 55%, #f093fb 100%);
  box-shadow: 0 10px 26px rgba(102, 126, 234, 0.35);
  animation: softFloat 4.5s ease-in-out infinite;
}
@keyframes softFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25%      { transform: translateY(-5px) rotate(-2deg); }
  75%      { transform: translateY(2px) rotate(2deg); }
}
.nx-logo-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.nx-logo-sub {
  margin-top: 2px;
  font-size: 11px;
  color: #8b5cf6;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  opacity: 0.84;
}

/* === SSO-бейдж === */
.nx-sso-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(102, 126, 234, 0.12);
  color: #5b6fd8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* === Заголовок и подзаголовок === */
.nx-h1 {
  margin: 20px 0 8px;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.nx-sub {
  margin: 0 0 26px;
  color: #64748b;
  font-size: 14px;
  line-height: 1.68;
}

/* === Форма === */
.nx-form {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 4px;
}

.nx-label {
  display: block;
  margin: 14px 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

.nx-input {
  width: 100%;
  box-sizing: border-box;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid rgba(102, 126, 234, 0.22);
  background: rgba(255, 255, 255, 0.72);
  font-size: 15px;
  font-family: inherit;
  color: #1e293b;
  line-height: 1.4;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.nx-input:focus {
  outline: none;
  border-color: #667eea;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}
.nx-input::placeholder { color: #94a3b8; }

.nx-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 4px;
  color: #475569;
  font-size: 13px;
}
.nx-check input[type="checkbox"] {
  width: auto;
  accent-color: #667eea;
}

/* === Кнопка submit === */
.nx-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 18px;
  padding: 15px 18px;
  border-radius: 16px;
  border: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #fff;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  box-shadow: 0 16px 36px rgba(102, 126, 234, 0.28);
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: transform .18s, box-shadow .18s, filter .18s;
}
.nx-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 22px 44px rgba(102, 126, 234, 0.34);
}
#kc-logout{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 18px;
  padding: 15px 18px;
  border-radius: 16px;
  border: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #fff;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  box-shadow: 0 16px 36px rgba(102, 126, 234, 0.28);
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: transform .18s, box-shadow .18s, filter .18s;
}
#kc-logout:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 22px 44px rgba(102, 126, 234, 0.34);
}

#kc-info-message{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 18px;
  padding: 15px 18px;
  border-radius: 16px;
  border: 0;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #fff;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
  box-shadow: 0 16px 36px rgba(102, 126, 234, 0.28);
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: transform .18s, box-shadow .18s, filter .18s;
}

#kc-info-message:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 22px 44px rgba(102, 126, 234, 0.34);
}

/* === Подвал === */
.nx-foot {
  margin-top: 18px;
  color: #718096;
  font-size: 13px;
  line-height: 1.65;
  text-align: center;
}
.nx-foot strong { color: #475569; }

/* === Сообщения об ошибках === */
.nx-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(251, 191, 36, 0.2);
  background: rgba(251, 191, 36, 0.11);
  color: #7c5a08;
  font-size: 13px;
  line-height: 1.6;
}
.nx-banner--error {
  border-color: rgba(239, 68, 68, 0.28);
  background: rgba(239, 68, 68, 0.10);
  color: #b91c1c;
}

/* === Nexus dark theme === */
html[data-theme="dark"],
html.dark {
  --nx-card-bg: var(--nx-card-bg-dark);
  --nx-card-border: var(--nx-border-dark);
  --nx-card-shadow: var(--nx-shadow-dark);
  color-scheme: dark;
  background-color: #0f172a;
}

html[data-theme="dark"] body,
html.dark body {
  color: #f1f5f9;
}

html[data-theme="dark"] .nx-card:hover,
html.dark .nx-card:hover {
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(102, 126, 234, 0.24) inset;
}

html[data-theme="dark"] .nx-sso-badge,
html.dark .nx-sso-badge {
  background: rgba(96, 165, 250, 0.14);
  color: #bfdbfe;
}

html[data-theme="dark"] .nx-h1,
html.dark .nx-h1 {
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

html[data-theme="dark"] .nx-sub,
html.dark .nx-sub,
html[data-theme="dark"] .nx-foot,
html.dark .nx-foot {
  color: #94a3b8;
}

html[data-theme="dark"] .nx-foot strong,
html.dark .nx-foot strong {
  color: #e2e8f0;
}

html[data-theme="dark"] .nx-label,
html.dark .nx-label,
html[data-theme="dark"] .nx-check,
html.dark .nx-check {
  color: #cbd5e1;
}

html[data-theme="dark"] .nx-input,
html.dark .nx-input {
  border-color: rgba(102, 126, 234, 0.35);
  background: rgba(15, 23, 42, 0.72);
  color: #f1f5f9;
}

html[data-theme="dark"] .nx-input:focus,
html.dark .nx-input:focus {
  border-color: #667eea;
  background: rgba(15, 23, 42, 0.94);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
}

html[data-theme="dark"] .nx-input::placeholder,
html.dark .nx-input::placeholder {
  color: #64748b;
}

html[data-theme="dark"] .nx-banner,
html.dark .nx-banner {
  border-color: rgba(251, 191, 36, 0.18);
  background: rgba(120, 53, 15, 0.26);
  color: #fde68a;
}

html[data-theme="dark"] .nx-banner--error,
html.dark .nx-banner--error {
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(127, 29, 29, 0.28);
  color: #fecaca;
}

html[data-theme="dark"] #effects-counter,
html.dark #effects-counter {
  border-color: rgba(102, 126, 234, 0.38);
  background: rgba(15, 23, 42, 0.64);
  color: #c4b5fd;
}

/* === Mobile === */
@media (max-width: 560px) {
  .nx-body { padding: 34px 24px 28px; }
  .nx-h1   { font-size: 26px; }
  .nx-logo { margin-bottom: 24px; }
}
