/* ============================================================
   Modern Login Theme — Celltronik
   Loaded AFTER the stock login styles: overrides them safely.
   ============================================================ */

:root {
  --cx-bg-1: #0b1224;
  --cx-bg-2: #101b3a;
  --cx-accent-1: #22d3ee;
  --cx-accent-2: #3b82f6;
  --cx-accent-3: #8b5cf6;
  --cx-text: #e8edf7;
  --cx-text-dim: #93a0b8;
  --cx-card-bg: rgba(255, 255, 255, 0.055);
  --cx-card-border: rgba(255, 255, 255, 0.12);
  --cx-input-bg: rgba(255, 255, 255, 0.06);
  --cx-input-border: rgba(255, 255, 255, 0.14);
}

html, body.cx-login {
  height: 100%;
}

body.cx-login {
  margin: 0;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(1200px 800px at 85% -10%, rgba(59, 130, 246, 0.28), transparent 60%),
              radial-gradient(1000px 700px at -10% 110%, rgba(139, 92, 246, 0.25), transparent 60%),
              linear-gradient(160deg, var(--cx-bg-1) 0%, var(--cx-bg-2) 100%) !important;
  color: var(--cx-text);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  padding: 24px 16px;
}

/* ---------- Animated background ---------- */

.cx-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.cx-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 30%, transparent 75%);
}

.cx-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  animation: cx-float 14s ease-in-out infinite;
}

.cx-orb-1 {
  width: 420px; height: 420px;
  background: radial-gradient(circle at 30% 30%, var(--cx-accent-2), transparent 70%);
  top: -120px; right: -80px;
}

.cx-orb-2 {
  width: 360px; height: 360px;
  background: radial-gradient(circle at 60% 40%, var(--cx-accent-3), transparent 70%);
  bottom: -100px; left: -90px;
  animation-delay: -5s;
}

.cx-orb-3 {
  width: 260px; height: 260px;
  background: radial-gradient(circle at 50% 50%, var(--cx-accent-1), transparent 70%);
  top: 40%; left: 12%;
  opacity: 0.35;
  animation-delay: -9s;
}

@keyframes cx-float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(0, -30px, 0) scale(1.06); }
}

/* ---------- Card ---------- */

/* !important neutralises the legacy JS that sets an inline margin-top */
.cx-login .login-box,
.cx-login .login-box * {
  box-sizing: border-box;
}

.cx-login .login-box {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  margin: 0 auto !important;
  margin-top: 0 !important;
  background: var(--cx-card-bg);
  border: 1px solid var(--cx-card-border);
  border-radius: 22px;
  padding: 38px 34px 30px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45),
              inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: cx-card-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.cx-login .login-box::before {
  content: "";
  position: absolute;
  top: 0; left: 22px; right: 22px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--cx-accent-1), var(--cx-accent-2), transparent);
  opacity: 0.9;
}

@keyframes cx-card-in {
  from { opacity: 0; transform: translateY(22px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Brand ---------- */

.cx-brand {
  text-align: center;
  margin-bottom: 26px;
}

.cx-brand img {
  max-height: 64px;
  max-width: 200px;
  object-fit: contain;
  margin-bottom: 14px;
  filter: drop-shadow(0 6px 18px rgba(34, 211, 238, 0.25));
}

.cx-logo-fallback {
  width: 62px; height: 62px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  font-size: 28px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--cx-accent-1), var(--cx-accent-2) 55%, var(--cx-accent-3));
  box-shadow: 0 10px 30px rgba(59, 130, 246, 0.35);
}

.cx-brand h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--cx-text);
}

.cx-brand .cx-sub {
  margin: 0;
  font-size: 13px;
  color: var(--cx-text-dim);
}

/* ---------- Form ---------- */

.cx-login .login-box-body {
  background: transparent !important;
  padding: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
}

.cx-field {
  position: relative;
  margin-bottom: 16px;
}

.cx-field .cx-field-icon {
  position: absolute;
  top: 50%; left: 14px;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  fill: var(--cx-text-dim);
  pointer-events: none;
  transition: fill 0.2s ease;
}

.cx-field:focus-within .cx-field-icon {
  fill: var(--cx-accent-1);
}

.cx-login .cx-field input.form-control {
  box-sizing: border-box;
  width: 100%;
  height: 48px;
  padding: 0 44px;
  font-size: 14.5px;
  color: var(--cx-text);
  background: var(--cx-input-bg);
  border: 1px solid var(--cx-input-border);
  border-radius: 13px;
  box-shadow: none;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.cx-login .cx-field input.form-control::placeholder {
  color: var(--cx-text-dim);
  opacity: 0.85;
}

.cx-login .cx-field input.form-control:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.09);
  border-color: var(--cx-accent-1);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18);
}

.cx-login .cx-field input.form-control:disabled {
  opacity: 0.55;
}

/* autofill fix on dark background */
.cx-login .cx-field input.form-control:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #1a2745 inset;
  -webkit-text-fill-color: var(--cx-text);
  caret-color: var(--cx-text);
  transition: background-color 99999s ease-in-out 0s;
}

.cx-toggle-pass {
  position: absolute;
  top: 50%; right: 8px;
  transform: translateY(-50%);
  width: 34px; height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.cx-toggle-pass svg {
  width: 19px; height: 19px;
  fill: none;
  stroke: var(--cx-text-dim);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.2s ease;
}

.cx-toggle-pass:hover svg {
  stroke: var(--cx-accent-1);
}

.cx-toggle-pass .cx-eye-off { display: none; }
.cx-toggle-pass.is-visible .cx-eye     { display: none; }
.cx-toggle-pass.is-visible .cx-eye-off { display: block; }

/* ---------- Button ---------- */

.cx-login #login-btn.btn {
  box-sizing: border-box;
  width: 100%;
  height: 48px;
  margin-top: 6px;
  border: 0;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #fff;
  background: linear-gradient(135deg, var(--cx-accent-1) 0%, var(--cx-accent-2) 55%, var(--cx-accent-3) 120%);
  background-size: 160% 160%;
  box-shadow: 0 12px 28px rgba(34, 100, 246, 0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease, background-position 0.3s ease, filter 0.18s ease;
}

.cx-login #login-btn.btn:hover,
.cx-login #login-btn.btn:focus {
  background-position: 100% 50%;
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(34, 100, 246, 0.45);
  color: #fff;
}

.cx-login #login-btn.btn:active {
  transform: translateY(0);
  filter: brightness(0.95);
}

.cx-login #login-btn.btn[disabled] {
  opacity: 0.75;
  cursor: progress;
}

/* ---------- Links & alerts ---------- */

.cx-links {
  margin-top: 20px;
  text-align: center;
}

.cx-links a {
  font-size: 13px;
  color: var(--cx-text-dim);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.cx-links a:hover {
  color: var(--cx-accent-1);
  border-color: var(--cx-accent-1);
}

.cx-login .alert {
  border-radius: 12px;
  font-size: 13.5px;
}

.cx-footer-note {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  text-align: center;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.28);
  letter-spacing: 0.3px;
}

/* ---------- Demo credentials table (kept functional) ---------- */

.cx-login #credentials {
  margin-top: 18px;
}

.cx-login #credentials .table {
  color: var(--cx-text);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 12px;
  overflow: hidden;
}

.cx-login #credentials .table td {
  border-color: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

/* ---------- Forgot-password modal (Bootstrap 3) ---------- */

.cx-login .modal-content {
  border: 1px solid var(--cx-card-border);
  border-radius: 18px;
  background: #131c36;
  color: var(--cx-text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.cx-login .modal-header,
.cx-login .modal-footer {
  border-color: rgba(255, 255, 255, 0.09);
}

.cx-login .modal-header .close {
  color: var(--cx-text);
  opacity: 0.6;
  text-shadow: none;
}

.cx-login .modal-body label {
  color: var(--cx-text-dim);
  font-weight: 500;
}

.cx-login .modal-body input.form-control {
  height: 44px;
  color: var(--cx-text);
  background: var(--cx-input-bg);
  border: 1px solid var(--cx-input-border);
  border-radius: 11px;
  box-shadow: none;
}

.cx-login .modal-body input.form-control:focus {
  border-color: var(--cx-accent-1);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18);
}

.cx-login .modal-footer .btn {
  border-radius: 10px;
  border: 0;
}

.cx-login .modal-footer .btn-success {
  background: linear-gradient(135deg, var(--cx-accent-1), var(--cx-accent-2));
}

/* ---------- Responsive ---------- */

@media (max-width: 480px) {
  .cx-login .login-box {
    padding: 30px 22px 24px;
    border-radius: 18px;
  }

  .cx-brand h1 {
    font-size: 19px;
  }
}

/* Respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
  .cx-orb,
  .cx-login .login-box {
    animation: none;
  }
}
