/* ===================================
   KyberLink VPN - Authentication Pages
   Professional + Futuristic Login/Register
   =================================== */

/* Auth Page Variables */
:root {
  /* Professional Colors */
  --auth-bg-primary: #f8fafc;
  --auth-bg-secondary: #ffffff;
  --auth-text-primary: #1e293b;
  --auth-text-secondary: rgba(30, 41, 59, 0.7);
  --auth-text-muted: rgba(30, 41, 59, 0.5);
  
  /* KyberLink Brand Gradients */
  --primary-gradient: linear-gradient(135deg, #1e3a8a 0%, #0ea5e9 50%, #0284c7 100%);
  --secondary-gradient: linear-gradient(135deg, #1e40af 0%, #0284c7 50%, #0ea5e9 100%);
  --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --error-gradient: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  
  /* Glass Effects */
  --glass-bg: rgba(255, 255, 255, 0.95);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  --glass-shadow-hover: 0 25px 50px rgba(0, 0, 0, 0.15);
  
  /* Interactive States */
  --focus-glow: 0 0 0 3px rgba(30, 58, 138, 0.2);
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Base Auth Layout */
.auth-page {
  min-height: 100vh;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
}

.auth-background {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #ffffff;
}

.auth-background::before {
  display: none;
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes gridFloat {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-30px, -15px); }
}

/* Auth Container */
.auth-container {
  width: 100%;
  max-width: 460px;
  padding: 20px;
  position: relative;
  z-index: 2;
}

/* Logo Section */
.auth-logo-section {
  text-align: center;
  margin-bottom: 30px;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 auto 16px;
  transition: var(--transition-smooth);
}

.auth-logo img {
  height: 44px;
  width: auto;
  max-width: 200px;
  filter: invert(27%) sepia(93%) saturate(1352%) hue-rotate(200deg) brightness(80%) contrast(96%);
}

.auth-logo:hover {
  transform: scale(1.02);
}

.auth-brand {
  font-size: 32px;
  font-weight: 800;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  display: none;
}

.auth-tagline {
  font-size: 16px;
  color: var(--auth-text-secondary);
  font-weight: 500;
}

/* Main Auth Card */
.auth-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 40px;
  box-shadow: var(--glass-shadow);
  transition: var(--transition-smooth);
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 3px;
  background: var(--primary-gradient);
  transition: left 0.5s ease;
}

.auth-card:hover::before {
  left: 0;
}

.auth-card:hover {
  box-shadow: var(--glass-shadow-hover);
  transform: translateY(-2px);
}

/* Tab Navigation */
.auth-tabs {
  display: flex;
  background: rgba(248, 250, 252, 0.5);
  border-radius: 16px;
  padding: 4px;
  margin-bottom: 32px;
  position: relative;
}

.auth-tab {
  flex: 1;
  padding: 12px 24px;
  text-align: center;
  background: transparent;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--auth-text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
  position: relative;
  z-index: 2;
}

.auth-tab.active {
  color: white;
  background: var(--primary-gradient);
  box-shadow: 0 4px 15px rgba(30, 58, 138, 0.3);
}

.auth-tab:not(.active):hover {
  color: var(--auth-text-primary);
}

/* Form Styles */
.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
  animation: formSlideIn 0.4s ease-out;
}

@keyframes formSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-group {
  margin-bottom: 24px;
  position: relative;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--auth-text-primary);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.8);
  border: 2px solid rgba(226, 232, 240, 0.8);
  border-radius: 12px;
  font-size: 16px;
  color: var(--auth-text-primary);
  transition: var(--transition-smooth);
  outline: none;
}

.form-input:focus {
  border-color: #00d4ff;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--focus-glow);
}

.form-input:hover {
  border-color: rgba(139, 92, 246, 0.4);
}

.form-input.error {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
}

.form-input.success {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.05);
}

/* Password Strength Meter */
.password-strength {
  margin-top: 8px;
  display: flex;
  gap: 4px;
  height: 4px;
}

.strength-bar {
  flex: 1;
  background: rgba(226, 232, 240, 0.8);
  border-radius: 2px;
  transition: var(--transition-smooth);
}

.strength-bar.filled {
  background: var(--primary-gradient);
}

.strength-text {
  font-size: 12px;
  margin-top: 6px;
  color: var(--auth-text-muted);
  font-weight: 500;
}

/* Input Icons */
.input-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--auth-text-muted);
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.input-icon:hover {
  color: var(--auth-text-primary);
}

/* MFA Input */
.mfa-container {
  display: none;
  animation: formSlideIn 0.4s ease-out;
}

.mfa-container.active {
  display: block;
}

.mfa-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--auth-text-primary);
  margin-bottom: 8px;
  text-align: center;
}

.mfa-description {
  font-size: 14px;
  color: var(--auth-text-secondary);
  text-align: center;
  margin-bottom: 24px;
}

.mfa-input-group {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}

.mfa-digit {
  width: 50px;
  height: 60px;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(226, 232, 240, 0.8);
  border-radius: 12px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--auth-text-primary);
  transition: var(--transition-smooth);
  outline: none;
}

.mfa-digit:focus {
  border-color: #00d4ff;
  box-shadow: var(--focus-glow);
  background: rgba(255, 255, 255, 1);
}

.mfa-digit:hover {
  border-color: rgba(139, 92, 246, 0.4);
}

/* Error Messages */
.error-message {
  font-size: 14px;
  color: #ef4444;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.error-message i {
  font-size: 12px;
}

/* Success Messages */
.success-message {
  font-size: 14px;
  color: #10b981;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.success-message i {
  font-size: 12px;
}

/* Premium Buttons */
.auth-button {
  width: 100%;
  padding: 16px 24px;
  background: var(--primary-gradient);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-smooth);
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.auth-button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.auth-button:hover::before {
  width: 300px;
  height: 300px;
}

.auth-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 212, 255, 0.4);
}

.auth-button:active {
  transform: translateY(0);
}

.auth-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.auth-button span {
  position: relative;
  z-index: 1;
}

/* Loading State */
.auth-button.loading {
  pointer-events: none;
}

.auth-button.loading span {
  opacity: 0;
}

.auth-button.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: buttonSpin 1s linear infinite;
}

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

/* Demo Credentials */
.demo-info {
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  position: relative;
}

.demo-info::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--secondary-gradient);
  border-radius: 12px 12px 0 0;
}

.demo-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--auth-text-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.demo-title i {
  color: #8b5cf6;
}

.demo-credentials {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.demo-credential {
  background: rgba(255, 255, 255, 0.8);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Courier New', monospace;
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.demo-label {
  font-size: 12px;
  color: var(--auth-text-muted);
  font-weight: 500;
  margin-bottom: 4px;
  font-family: 'Inter', sans-serif;
}

/* Footer Links */
.auth-footer {
  text-align: center;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(226, 232, 240, 0.5);
}

.auth-link {
  color: var(--auth-text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition-smooth);
  margin: 0 12px;
}

.auth-link:hover {
  color: #00d4ff;
}

.auth-link.primary {
  color: #00d4ff;
  font-weight: 600;
}

/* Back to Landing */
.back-link {
  position: absolute;
  top: 30px;
  left: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--auth-text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition-smooth);
  z-index: 10;
}

.back-link:hover {
  color: var(--auth-text-primary);
  transform: translateX(-5px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .auth-container {
    max-width: 100%;
    padding: 15px;
  }
  
  .auth-card {
    padding: 30px 24px;
  }
  
  .auth-logo {
    width: 70px;
    height: 70px;
    font-size: 32px;
  }
  
  .auth-brand {
    font-size: 28px;
  }
  
  .mfa-input-group {
    gap: 8px;
  }
  
  .mfa-digit {
    width: 45px;
    height: 55px;
    font-size: 22px;
  }
  
  .demo-credentials {
    grid-template-columns: 1fr;
  }
  
  .back-link {
    top: 20px;
    left: 20px;
  }
}

@media (max-width: 480px) {
  .auth-card {
    padding: 24px 20px;
    border-radius: 20px;
  }
  
  .auth-logo {
    width: 60px;
    height: 60px;
    font-size: 28px;
  }
  
  .auth-brand {
    font-size: 24px;
  }
  
  .mfa-digit {
    width: 40px;
    height: 50px;
    font-size: 20px;
  }
}

/* Dark Theme Support */
@media (prefers-color-scheme: dark) {
  :root {
    --auth-bg-primary: #0a0a1f;
    --auth-bg-secondary: #1a1a2e;
    --auth-text-primary: #ffffff;
    --auth-text-secondary: rgba(255, 255, 255, 0.8);
    --auth-text-muted: rgba(255, 255, 255, 0.6);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
  }
  
  .auth-tabs {
    background: rgba(255, 255, 255, 0.05);
  }
  
  .form-input {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--auth-text-primary);
  }
  
  .form-input:focus {
    background: rgba(255, 255, 255, 0.12);
  }
  
  .mfa-digit {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--auth-text-primary);
  }
  
  .demo-info {
    background: rgba(139, 92, 246, 0.15);
  }
  
  .demo-credential {
    background: rgba(255, 255, 255, 0.08);
    color: var(--auth-text-primary);
  }
}