/* ============================================================
   KAIRON — Sistema de Progressão Humana
   style.css  ·  Login Screen
   Identical design system to the main dashboard.
   ============================================================ */

/* ── CUSTOM PROPERTIES ────────────────────────────────────── */
:root {
  /* Palette — identical to dashboard */
  --bg-primary:       #0A0A0A;
  --bg-secondary:     #111827;
  --bg-card:          #161B22;
  --border:           #252B36;
  --border-hover:     #323A47;
  --border-focus:     #3B82F6;

  --text-primary:     #F8FAFC;
  --text-secondary:   #94A3B8;
  --text-muted:       #4B5563;

  --accent:           #3B82F6;
  --accent-hover:     #60A5FA;
  --accent-dim:       rgba(59, 130, 246, 0.10);
  --accent-dim-hover: rgba(59, 130, 246, 0.18);

  --success:          #22C55E;
  --danger:           #EF4444;
  --danger-dim:       rgba(239, 68, 68, 0.08);

  /* Radii */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   20px;

  /* Typography */
  --font-sans: 'Segoe UI', 'SF Pro Display', -apple-system, system-ui, sans-serif;

  /* Transitions */
  --ease:   cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 150ms;
  --t-med:  240ms;
  --t-slow: 380ms;
}


/* ── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  position: relative;
  overflow-x: hidden;
  line-height: 1.6;
}

a {
  text-decoration: none;
  color: inherit;
}

button {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  color: inherit;
}

svg {
  display: block;
  flex-shrink: 0;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


/* ── SUBTLE BACKGROUND GRID ──────────────────────────────── */
/* A very faint structural grid — not cyberpunk, just depth */
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(59, 130, 246, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 30%, transparent 100%);
}


/* ── LOGIN WRAPPER ────────────────────────────────────────── */
.login-wrapper {
  display: flex;
  width: 100%;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}


/* ── PANELS ───────────────────────────────────────────────── */
.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* LEFT — Branding panel */
.login-panel--left {
  flex: 1;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 48px 56px;
  position: relative;
  overflow: hidden;
}

/* Subtle corner accent */
.login-panel--left::before {
  content: '';
  position: absolute;
  top: -120px;
  right: -120px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.login-panel--left::after {
  content: '';
  position: absolute;
  bottom: -80px;
  left: -80px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.04) 0%, transparent 70%);
  pointer-events: none;
}

.panel-content {
  max-width: 420px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 40px;
  position: relative;
  z-index: 1;
  animation: fadeSlideUp var(--t-slow) var(--ease) both;
}

/* Brand row inside left panel */
.panel-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.panel-hex {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.panel-name {
  display: block;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--text-primary);
  line-height: 1;
}

.panel-sub {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 4px;
}

/* Tagline */
.panel-tagline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tagline-headline {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.025em;
  line-height: 1.3;
}

.tagline-body {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 340px;
}

/* Feature list */
.panel-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.panel-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.pf-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* System status pill */
.panel-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 20px;
  width: fit-content;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}


/* RIGHT — Form panel */
.login-panel--right {
  width: 480px;
  flex-shrink: 0;
  padding: 48px 40px;
  background: var(--bg-primary);
}


/* ── LOGIN CARD ───────────────────────────────────────────── */
.login-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: fadeSlideUp var(--t-slow) var(--ease) 80ms both;
}

/* Card header */
.login-card-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Logo — shown only on mobile when left panel is hidden */
.login-logo-mobile {
  display: none;
  width: 32px;
  height: 32px;
  margin-bottom: 6px;
}

.login-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.16em;
  color: var(--text-primary);
  line-height: 1;
}

.login-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Divider */
.login-divider {
  height: 1px;
  background: var(--border);
}


/* ── FORM ─────────────────────────────────────────────────── */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Field group */
.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.field-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}

.forgot-link {
  font-size: 11.5px;
  color: var(--text-muted);
  transition: color var(--t-fast);
  letter-spacing: 0.01em;
}

.forgot-link:hover {
  color: var(--accent-hover);
}

/* Input wrapper */
.field-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.field-icon {
  position: absolute;
  left: 12px;
  display: flex;
  align-items: center;
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--t-fast);
}

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

.field-input {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 40px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  outline: none;
  transition:
    border-color var(--t-fast) var(--ease),
    background var(--t-fast) var(--ease);
  caret-color: var(--accent);
}

.field-input::placeholder {
  color: var(--text-muted);
  font-size: 13px;
}

.field-input:hover {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.02);
}

.field-input:focus {
  border-color: var(--border-focus);
  background: var(--bg-card);
}

.field-input:focus + .field-icon,
.field-input-wrap:focus-within .field-icon {
  color: var(--accent);
}

/* Error state */
.field-group.has-error .field-input {
  border-color: var(--danger);
  background: var(--danger-dim);
}

.field-group.has-error .field-icon {
  color: var(--danger);
}

/* Error message */
.field-error {
  font-size: 11.5px;
  color: var(--danger);
  min-height: 16px;
  padding-left: 2px;
  letter-spacing: 0.01em;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}

.field-error.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Eye toggle button */
.field-eye {
  position: absolute;
  right: 10px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: color var(--t-fast), background var(--t-fast);
}

.field-eye:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
}

.field-eye svg {
  width: 15px;
  height: 15px;
}


/* ── REMEMBER TOGGLE ─────────────────────────────────────── */
.remember-row {
  display: flex;
  align-items: center;
}

.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.toggle-track {
  position: relative;
  width: 36px;
  height: 20px;
  background: var(--border);
  border-radius: 20px;
  border: 1px solid var(--border-hover);
  transition: background var(--t-fast), border-color var(--t-fast);
  flex-shrink: 0;
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-muted);
  transition:
    transform var(--t-med) var(--ease),
    background var(--t-fast);
}

.toggle-input:checked ~ .toggle-track {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.toggle-input:checked ~ .toggle-track .toggle-thumb {
  transform: translateX(16px);
  background: var(--accent);
}

.toggle-label {
  font-size: 12.5px;
  color: var(--text-secondary);
}


/* ── LOGIN BUTTON ─────────────────────────────────────────── */
.login-btn {
  position: relative;
  width: 100%;
  height: 46px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-md);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition:
    background var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease),
    opacity var(--t-fast);
  overflow: hidden;
  margin-top: 4px;
}

.login-btn:hover {
  background: var(--accent-hover);
}

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

.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.login-btn-text {
  position: relative;
  z-index: 1;
  transition: opacity var(--t-fast);
}

/* Loading spinner */
.login-btn-loader {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.login-btn.loading .login-btn-text {
  opacity: 0;
}

.login-btn.loading .login-btn-loader {
  display: block;
  position: absolute;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}


/* ── FOOTER LINK ─────────────────────────────────────────── */
.login-footer-text {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding-top: 4px;
}

.footer-link {
  color: var(--text-secondary);
  font-weight: 500;
  transition: color var(--t-fast);
  margin-left: 4px;
}

.footer-link:hover {
  color: var(--accent-hover);
}


/* ── TOAST ────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 12.5px;
  color: var(--text-primary);
  max-width: 280px;
  pointer-events: all;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: toastIn var(--t-med) var(--ease) forwards;
}

.toast.toast-exit {
  animation: toastOut var(--t-med) var(--ease) forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px) scale(0.96); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(20px) scale(0.96); }
}


/* ── LOAD ANIMATION ──────────────────────────────────────── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}


/* ── SCROLLBAR ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }


/* ===================== TOAST NOTIFICATIONS ===================== */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 9999;
}

.toast {
  min-width: 280px;
  background-color: #1e293b; /* Fundo escuro combinando com tema tech */
  color: #f8fafc;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  font-size: 0.875rem;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  /* Estado inicial invisível fora da tela */
  transform: translateX(120%);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55); /* Efeito elástico */
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast--error {
  border-left: 4px solid #ef4444; /* Vermelho vibrante */
}

.toast--success {
  border-left: 4px solid #10b981; /* Verde esmeralda */
}

/* Ícones do Toast */
.toast svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}


/* ── RESPONSIVE ───────────────────────────────────────────── */

/* Hide left panel on medium screens, keep it narrow */
@media (max-width: 1024px) {
  .login-panel--left {
    padding: 40px 36px;
  }

  .tagline-headline {
    font-size: 22px;
  }
}

@media (max-width: 768px) {
  /* Stack: left panel hides, right panel takes full width */
  .login-panel--left {
    display: none;
  }

  .login-panel--right {
    width: 100%;
    padding: 40px 24px;
    align-items: center;
  }

  .login-card {
    max-width: 100%;
  }

  .login-logo-mobile {
    display: block;
  }

  .bg-grid {
    background-size: 36px 36px;
  }
}

@media (max-width: 400px) {
  .login-panel--right {
    padding: 32px 18px;
  }

  .login-title {
    font-size: 20px;
  }
}