/* NotNexos · Modern Clean Login Styles */

:root {
  color-scheme: dark;
  --bg: #080b10;
  --panel: #0d1118;
  --panel-2: #111722;
  --line: #202a37;
  --line-soft: #171f2a;
  --text: #e8edf4;
  --muted: #7d8b9d;
  --faint: #566274;
  --cyan: #28d7d1;
  --green: #31d79b;
  --red: #fb5c73;

  --cyan-rgb: 40, 215, 209;
  --panel-rgb: 13, 17, 24;
  --bg-rgb: 8, 11, 16;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, Monaco, Consolas, monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --transition: 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

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

[hidden] {
  display: none !important;
}

body.login-body {
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* Ambient Canvas Background (Preserved as requested) */
.ambient-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

/* Vignette Overlay */
.vignette-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, transparent 45%, rgba(8, 11, 16, 0.8) 85%, #080b10 100%);
  z-index: 2;
  pointer-events: none;
}

/* Main Container */
.login-container {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 400px;
  padding: 20px;
  animation: cardFadeIn 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardFadeIn {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Glassmorphic Card */
.login-card {
  position: relative;
  background: rgba(13, 17, 24, 0.86);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid rgba(40, 215, 209, 0.22);
  border-radius: var(--radius-lg);
  padding: 32px 28px 30px;
  box-shadow: 
    0 24px 60px rgba(0, 0, 0, 0.75),
    0 0 35px rgba(40, 215, 209, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.login-card:hover {
  border-color: rgba(40, 215, 209, 0.32);
}

/* Subtle top glow line */
.card-glow-border {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, rgba(40, 215, 209, 0.2) 25%, var(--cyan) 50%, rgba(40, 215, 209, 0.2) 75%, transparent 100%);
  opacity: 0.85;
}

/* Header & In-Site Brand Mark */
.card-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Matching the exact in-site chart brand mark */
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: var(--cyan);
  color: #071211;
  font-weight: 900;
  font-size: 19px;
  clip-path: polygon(12% 0, 100% 0, 88% 100%, 0 100%);
  user-select: none;
  box-shadow: 0 0 14px rgba(40, 215, 209, 0.35);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-copy strong {
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

.brand-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* Inline Dynamic Alert (Hidden by default, shown only on error) */
.login-alert {
  display: none;
  align-items: center;
  gap: 10px;
  background: rgba(251, 92, 115, 0.12);
  border: 1px solid rgba(251, 92, 115, 0.4);
  color: #ffd6dc;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12.5px;
  margin-bottom: 20px;
}

.login-alert.visible {
  display: flex;
  animation: alertSlide 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.login-alert.shake {
  animation: shakeAlert 0.35s ease-in-out;
}

@keyframes alertSlide {
  0% { opacity: 0; transform: translateY(-6px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes shakeAlert {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

.alert-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--red);
}

.alert-message {
  font-weight: 500;
  line-height: 1.3;
}

/* Form Styles */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.field-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  color: var(--faint);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: color var(--transition);
}

.input-icon svg {
  width: 16px;
  height: 16px;
}

.form-input {
  width: 100%;
  background: rgba(17, 23, 34, 0.6);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 14px 11px 36px;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 13.5px;
  outline: none;
  transition: border-color var(--transition), background-color var(--transition), box-shadow var(--transition);
}

.form-input:hover {
  border-color: rgba(40, 215, 209, 0.3);
  background: rgba(17, 23, 34, 0.85);
}

.form-input:focus {
  border-color: var(--cyan);
  background: rgba(17, 23, 34, 0.95);
  box-shadow: 0 0 0 3px rgba(40, 215, 209, 0.12);
}

.form-input:focus + .input-icon,
.input-wrapper:focus-within .input-icon {
  color: var(--cyan);
}

.form-input::placeholder {
  color: var(--faint);
  font-size: 12.5px;
}

/* Password Toggle */
.password-toggle-btn {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color var(--transition);
}

.password-toggle-btn:hover {
  color: var(--cyan);
}

.password-toggle-btn svg {
  width: 16px;
  height: 16px;
}

.hidden {
  display: none;
}

/* Remember Me Checkbox */
.form-options {
  display: flex;
  align-items: center;
  margin-top: -2px;
}

.checkbox-container {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.checkbox-container input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.custom-checkbox {
  width: 15px;
  height: 15px;
  background: rgba(17, 23, 34, 0.7);
  border: 1px solid var(--line);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
}

.checkbox-container:hover .custom-checkbox {
  border-color: rgba(40, 215, 209, 0.4);
}

.checkbox-container input:checked ~ .custom-checkbox {
  background: var(--cyan);
  border-color: var(--cyan);
}

.custom-checkbox::after {
  content: "";
  display: none;
  width: 3.5px;
  height: 7px;
  border: solid #080b10;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.checkbox-container input:checked ~ .custom-checkbox::after {
  display: block;
}

.checkbox-label {
  font-size: 12px;
  color: var(--muted);
  transition: color var(--transition);
}

.checkbox-container:hover .checkbox-label {
  color: var(--text);
}

/* Submit Button */
.submit-btn {
  width: 100%;
  position: relative;
  background: var(--cyan);
  color: #071211;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-family: var(--font-sans);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(40, 215, 209, 0.22);
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
  margin-top: 6px;
}

.submit-btn:hover {
  box-shadow: 0 6px 20px rgba(40, 215, 209, 0.35);
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.submit-btn:active {
  transform: translateY(0);
}

.submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-spinner {
  display: none;
  align-items: center;
  gap: 8px;
}

.submit-btn.loading .btn-spinner {
  display: flex;
}

.submit-btn.loading .btn-text {
  display: none;
}

.spinner-svg {
  width: 15px;
  height: 15px;
  animation: rotateSpinner 0.8s linear infinite;
}

.spinner-track {
  stroke: rgba(7, 18, 17, 0.25);
}

.spinner-head {
  stroke: #071211;
  stroke-dasharray: 40;
  stroke-dashoffset: 15;
  stroke-linecap: round;
}

@keyframes rotateSpinner {
  100% { transform: rotate(360deg); }
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  .login-container {
    padding: 16px;
  }

  .login-card {
    padding: 24px 20px;
  }
}

/* Nexos identity */
.nexos-brand { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 118px; flex-shrink: 0; }
.nexos-banner { display: block; width: 118px; height: 27px; object-fit: contain; }
.nexos-brand small { color: var(--muted); font-size: 8px; line-height: 1.1; letter-spacing: .12em; }
.topbar > .nexos-brand { order: 10; margin-left: auto; }
.beta-disclaimer { color: var(--yellow); font-weight: 700; letter-spacing: .08em; }
.nexos-beta-footer { flex-shrink: 0; padding: 5px 11px; border-top: 1px solid var(--line); text-align: right; color: #f4c95d; font-size: 8px; font-weight: 700; letter-spacing: .08em; }
.login-card .nexos-brand { min-width: 148px; gap: 4px; }
.login-card .nexos-banner { width: 148px; height: 34px; }
.login-card .nexos-brand small { font-size: 9px; }
