/* ==========================================================================
   SNFe Login - Glassmorphism Dark Theme
   ========================================================================== */

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

/* ---------- CSS Variables ---------- */
:root {
  --bg-primary: #0a1628;
  --bg-secondary: #111d35;
  --accent: #2479bd;
  --accent-light: #3b9ae8;
  --accent-glow: rgba(36, 121, 189, 0.45);
  --glass-bg: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-shadow: rgba(0, 0, 0, 0.35);
  --text-primary: #e8edf5;
  --text-secondary: #8d9bb5;
  --text-placeholder: #5a6a85;
  --input-bg: rgba(255, 255, 255, 0.06);
  --input-border: rgba(255, 255, 255, 0.10);
  --input-focus-border: var(--accent);
  --danger: #ef4444;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg-primary);
  overflow: hidden;
}

a { text-decoration: none; }

/* ---------- Scene (full-screen container) ---------- */
.login-scene {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* ---------- Animated Mesh / Wave Background ---------- */
.login-scene::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 15% 80%, rgba(36,121,189,0.18) 0%, transparent 70%),
    radial-gradient(ellipse 70% 50% at 85% 20%, rgba(59,154,232,0.12) 0%, transparent 70%),
    radial-gradient(ellipse 50% 80% at 50% 50%, rgba(17,29,53,0.9) 0%, transparent 100%);
  z-index: 0;
}

/* Animated wave SVG overlay */
.wave-container {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.wave-container svg {
  position: absolute;
  bottom: -5%;
  left: -5%;
  width: 110%;
  height: auto;
  opacity: 0.08;
}

.wave-container svg path {
  animation: waveDrift 8s ease-in-out infinite alternate;
}

@keyframes waveDrift {
  0%   { transform: translateX(0) translateY(0); }
  100% { transform: translateX(-30px) translateY(8px); }
}

/* Mesh grid overlay */
.mesh-grid {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(36,121,189,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(36,121,189,0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: meshPulse 6s ease-in-out infinite alternate;
}

@keyframes meshPulse {
  0%   { opacity: 0.3; }
  100% { opacity: 0.7; }
}

/* ---------- Floating Particles ---------- */
.particles {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  animation: particleFloat linear infinite;
}

.particle:nth-child(1)  { width: 4px;  height: 4px;  left: 10%; animation-duration: 12s; animation-delay: 0s; }
.particle:nth-child(2)  { width: 3px;  height: 3px;  left: 25%; animation-duration: 15s; animation-delay: 2s; }
.particle:nth-child(3)  { width: 5px;  height: 5px;  left: 40%; animation-duration: 10s; animation-delay: 4s; }
.particle:nth-child(4)  { width: 3px;  height: 3px;  left: 55%; animation-duration: 14s; animation-delay: 1s; }
.particle:nth-child(5)  { width: 4px;  height: 4px;  left: 70%; animation-duration: 11s; animation-delay: 3s; }
.particle:nth-child(6)  { width: 6px;  height: 6px;  left: 85%; animation-duration: 13s; animation-delay: 5s; }
.particle:nth-child(7)  { width: 3px;  height: 3px;  left: 15%; animation-duration: 16s; animation-delay: 6s; }
.particle:nth-child(8)  { width: 5px;  height: 5px;  left: 60%; animation-duration: 9s;  animation-delay: 2s; }
.particle:nth-child(9)  { width: 4px;  height: 4px;  left: 35%; animation-duration: 17s; animation-delay: 7s; }
.particle:nth-child(10) { width: 3px;  height: 3px;  left: 90%; animation-duration: 12s; animation-delay: 1s; }
.particle:nth-child(11) { width: 5px;  height: 5px;  left: 5%;  animation-duration: 14s; animation-delay: 3s; }
.particle:nth-child(12) { width: 4px;  height: 4px;  left: 78%; animation-duration: 11s; animation-delay: 8s; }

@keyframes particleFloat {
  0%   { transform: translateY(100vh) scale(0); opacity: 0; }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.6; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* ---------- Glowing Orbs (decorative) ---------- */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  z-index: 0;
  animation: orbDrift 10s ease-in-out infinite alternate;
}

.orb--1 {
  width: 350px;
  height: 350px;
  background: rgba(36,121,189,0.15);
  top: -10%;
  right: -5%;
  animation-delay: 0s;
}

.orb--2 {
  width: 250px;
  height: 250px;
  background: rgba(59,154,232,0.10);
  bottom: -8%;
  left: -3%;
  animation-delay: 3s;
}

.orb--3 {
  width: 180px;
  height: 180px;
  background: rgba(36,121,189,0.08);
  top: 40%;
  left: 60%;
  animation-delay: 6s;
}

@keyframes orbDrift {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(20px, -15px) scale(1.08); }
}

/* ---------- Glass Card ---------- */
.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 48px 40px 40px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(24px) saturate(1.4);
  -webkit-backdrop-filter: blur(24px) saturate(1.4);
  box-shadow:
    0 8px 32px var(--glass-shadow),
    inset 0 1px 0 rgba(255,255,255,0.06);
  animation: cardEnter 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardEnter {
  0%   { opacity: 0; transform: translateY(30px) scale(0.96); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Logo ---------- */
.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo img {
  height: 56px;
  width: auto;
  filter: brightness(1.1) drop-shadow(0 2px 8px rgba(36,121,189,0.25));
  transition: transform var(--transition);
}

.login-logo img:hover {
  transform: scale(1.05);
}

/* ---------- Form ---------- */
.login-form {
  width: 100%;
}

/* ---------- Input Group ---------- */
.input-group-glass {
  position: relative;
  margin-bottom: 24px;
  animation: fieldSlideIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.input-group-glass:nth-child(1) { animation-delay: 0.2s; }
.input-group-glass:nth-child(2) { animation-delay: 0.35s; }

@keyframes fieldSlideIn {
  0%   { opacity: 0; transform: translateX(20px); }
  100% { opacity: 1; transform: translateX(0); }
}

.input-group-glass .input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 16px;
  transition: color var(--transition);
  z-index: 2;
  pointer-events: none;
}

.input-glass {
  width: 100%;
  height: 52px;
  padding: 0 16px 0 48px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 400;
  outline: none;
  transition: all var(--transition);
  -webkit-appearance: none;
}

.input-glass::placeholder {
  color: var(--text-placeholder);
  font-weight: 400;
}

.input-glass:focus {
  border-color: var(--input-focus-border);
  background: rgba(255,255,255,0.09);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-glass:focus ~ .input-icon {
  color: var(--accent-light);
}

/* Floating label */
.input-group-glass .floating-label {
  position: absolute;
  left: 48px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-placeholder);
  font-size: 15px;
  font-weight: 400;
  pointer-events: none;
  transition: all var(--transition);
  z-index: 2;
}

.input-glass:focus ~ .floating-label,
.input-glass.has-value ~ .floating-label {
  top: -8px;
  left: 14px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent-light);
  background: var(--bg-secondary);
  padding: 0 6px;
  border-radius: 4px;
}

/* ---------- Password Toggle ---------- */
.password-toggle {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  transition: color var(--transition);
  z-index: 2;
}

.password-toggle:hover {
  color: var(--accent-light);
}

/* ---------- Submit Button ---------- */
.btn-glass {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  box-shadow: 0 4px 20px var(--accent-glow);
  animation: btnEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.5s;
  text-decoration: none;
}

@keyframes btnEnter {
  0%   { opacity: 0; transform: translateY(12px); }
  100% { opacity: 1; transform: translateY(0); }
}

.btn-glass::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.btn-glass:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--accent-glow);
  color: #fff;
}

.btn-glass:hover::before {
  transform: translateX(100%);
}

.btn-glass:active {
  transform: translateY(0);
  box-shadow: 0 2px 12px var(--accent-glow);
}

/* ---------- Footer Links ---------- */
.login-footer {
  text-align: center;
  margin-top: 24px;
  animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.65s;
}

.login-footer a {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 400;
  text-decoration: none;
  transition: color var(--transition);
}

.login-footer a:hover {
  color: var(--accent-light);
}

/* ---------- Divider ---------- */
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  animation: fadeInUp 0.6s ease both;
  animation-delay: 0.55s;
}

.login-divider span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--glass-border), transparent);
}

/* ---------- Loading State ---------- */
.btn-glass.is-loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn-glass.is-loading .btn-text {
  visibility: hidden;
}

.btn-glass.is-loading::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid transparent;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ---------- Validation ---------- */
.input-glass.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.2);
}

.validate-msg {
  display: none;
  color: var(--danger);
  font-size: 12px;
  margin-top: 6px;
  padding-left: 4px;
}

.input-glass.is-invalid ~ .validate-msg {
  display: block;
}

/* ---------- Copyright / Brand ---------- */
.login-brand-bottom {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  color: var(--text-secondary);
  font-size: 12px;
  opacity: 0.5;
  white-space: nowrap;
  animation: fadeInUp 1s ease both;
  animation-delay: 1s;
}

/* ---------- Animations ---------- */
@keyframes fadeInUp {
  0%   { opacity: 0; transform: translateY(16px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ---------- Autofill fix (dark bg) ---------- */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text-primary) !important;
  -webkit-box-shadow: 0 0 0 30px var(--bg-secondary) inset !important;
  border-color: var(--input-border) !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 576px) {
  .login-card {
    max-width: 100%;
    margin: 0 16px;
    padding: 36px 24px 32px;
    border-radius: var(--radius-md);
  }

  .login-logo img {
    height: 44px;
  }

  .orb--1 { width: 200px; height: 200px; }
  .orb--2 { width: 150px; height: 150px; }
  .orb--3 { display: none; }
}

@media (max-width: 380px) {
  .login-card {
    padding: 28px 18px 24px;
  }

  .input-glass {
    height: 48px;
    font-size: 14px;
  }

  .btn-glass {
    height: 48px;
    font-size: 14px;
  }
}

@media (min-width: 1600px) {
  .login-card {
    max-width: 450px;
    padding: 56px 48px 48px;
  }
}
