:root {
  --primary-purple: #471EFF;
  --secondary-magenta: #C30EFF;
  --dark-bg: #040711;
  --panel-dark: rgba(17, 21, 51, 0.7);
  --text-primary: #FFFFFF;
  --text-secondary: #B8B8B8;
  --success-green: #00E676;
  --error-red: #FF3B30;
  --border-color: rgba(255, 255, 255, 0.1);
  --font-title: 'Manrope', sans-serif;
  --font-body: 'Poppins', sans-serif;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--dark-bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Background Gradients */
.auth-bg-glow {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 150vw;
  height: 150vh;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: -2;
  background: 
    radial-gradient(circle at 30% 30%, rgba(0, 217, 255, 0.2) 0%, transparent 60%),
    radial-gradient(circle at 70% 30%, rgba(255, 0, 230, 0.2) 0%, transparent 60%),
    radial-gradient(circle at 50% 70%, rgba(124, 0, 255, 0.2) 0%, transparent 60%);
  filter: blur(60px);
  animation: spin-auth-bg 20s linear infinite;
}

.auth-bg-glow::after {
  content: '';
  position: absolute;
  inset: -50%;
  border-radius: 50%;
  background: 
    radial-gradient(circle at 50% 50%, 
      transparent 0%, 
      rgba(0, 217, 255, 0.4) 15%, 
      transparent 30%, 
      rgba(255, 0, 230, 0.4) 45%, 
      transparent 60%, 
      rgba(124, 0, 255, 0.4) 75%, 
      transparent 90%
    );
  filter: blur(25px);
  transform: scale(0.1);
  opacity: 0;
  animation: water-ripple-expand-auth 6s cubic-bezier(0.2, 0.6, 0.4, 1) infinite;
  will-change: transform, opacity;
}

@keyframes spin-auth-bg {
  0% { transform: translate(-50%, -50%) rotate(0deg) scale(1); }
  33% { transform: translate(-50%, -50%) rotate(120deg) scale(1.1); }
  66% { transform: translate(-50%, -50%) rotate(240deg) scale(0.9); }
  100% { transform: translate(-50%, -50%) rotate(360deg) scale(1); }
}

@keyframes water-ripple-expand-auth {
  0% { transform: scale(0.2); opacity: 0; }
  10% { opacity: 0.8; }
  80% { opacity: 0.5; }
  100% { transform: scale(1.5); opacity: 0; }
}

.auth-wrapper {
  width: 100%;
  max-width: 480px;
  padding: 24px;
  z-index: 10;
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-header h1 {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 2.5rem;
  margin: 0 0 8px 0;
  background: linear-gradient(90deg, #fff, var(--secondary-magenta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-header p {
  color: var(--text-secondary);
  margin: 0;
  font-size: 1rem;
}

.auth-card {
  background: var(--panel-dark);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  padding: 48px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

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

.form-group label {
  /* display: block; */
  font-family: var(--font-title);
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

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

.input-wrapper svg.input-icon {
  position: absolute;
  left: 16px;
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
}

.input-wrapper input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 16px 14px 48px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  transition: all 0.3s ease;
  outline: none;
}

.input-wrapper input:focus {
  border-color: var(--primary-purple);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 2px rgba(71, 30, 255, 0.2);
}

.input-wrapper input.valid {
  border-color: var(--success-green);
}

.input-wrapper input.error {
  border-color: var(--error-red);
}

.password-toggle, .status-icon {
  position: absolute;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-toggle svg, .status-icon svg {
  width: 20px;
  height: 20px;
}

.error-text {
  color: var(--error-red);
  font-size: 12px;
  font-weight: 500;
  margin-top: 8px;
  margin-bottom: 0;
  padding: 6px 0;
  display: none !important;
  width: 100%;
  animation: slideInError 0.2s ease;
  letter-spacing: 0.2px;
  line-height: 1.4;
}

@keyframes slideInError {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-group.has-error .error-text {
  display: block !important;
}

.form-row-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-group input {
  accent-color: var(--primary-purple);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.checkbox-group span {
  font-size: 14px;
  color: var(--text-secondary);
}

.forgot-password {
  color: var(--secondary-magenta);
  font-size: 14px;
  text-decoration: none;
  transition: opacity 0.2s;
}

.forgot-password:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.auth-submit-btn {
  width: 100%;
  background: var(--primary-purple);
  color: #fff;
  border: none;
  padding: 16px;
  border-radius: 100px;
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-submit-btn:hover:not(:disabled) {
  background: #3914cc;
  box-shadow: 0 4px 15px rgba(71, 30, 255, 0.4);
}

.auth-submit-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.auth-submit-btn:disabled,
.auth-submit-btn.disabled {
  background: linear-gradient(135deg, rgba(71, 30, 255, 0.2) 0%, rgba(195, 14, 255, 0.1) 100%) !important;
  color: rgba(255, 255, 255, 0.4);
  cursor: not-allowed !important;
  opacity: 0.6;
  box-shadow: none !important;
  border: 1px solid rgba(71, 30, 255, 0.2);
  transform: none !important;
  pointer-events: none;
}

.auth-submit-btn.loading {
  opacity: 0.7;
  cursor: not-allowed;
}

.auth-submit-btn .btn-text {
  transition: opacity 0.3s;
}

.auth-submit-btn.loading .btn-text {
  opacity: 0;
}

.btn-loader {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s linear infinite;
  display: none;
}

.auth-submit-btn.loading .btn-loader {
  display: block;
}

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

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

.auth-link {
  color: var(--secondary-magenta);
  text-decoration: none;
  font-weight: 500;
}

.auth-link:hover {
  text-decoration: underline;
}

#messageContainer {
  margin-bottom: 24px;
}

.success-message, .error-message {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease;
}

.success-message {
  background: rgba(0, 230, 118, 0.15);
  color: var(--success-green);
  border: 1px solid var(--success-green);
}

.error-message {
  background: rgba(255, 59, 48, 0.15);
  color: var(--error-red);
  border: 1px solid var(--error-red);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Connection Status */
.connection-status {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  padding: 8px 16px;
  border-radius: 100px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-color);
  font-size: 12px;
  z-index: 100;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FFA500;
}

.status-dot.connected {
  background: var(--success-green);
  box-shadow: 0 0 8px var(--success-green);
}

.status-dot.error {
  background: var(--error-red);
  box-shadow: 0 0 8px var(--error-red);
}

/* Password Strength */
.password-strength {
  margin-top: 10px;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.strength-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.strength-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  transition: all 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
  box-shadow: 0 0 8px rgba(0, 230, 118, 0.3);
}

.strength-fill.weak {
  background: linear-gradient(90deg, #FF6B6B 0%, #FF8E72 100%);
  box-shadow: 0 0 8px rgba(255, 107, 107, 0.4);
}

.strength-fill.fair {
  background: linear-gradient(90deg, #FFA500 0%, #FFB84D 100%);
  box-shadow: 0 0 8px rgba(255, 165, 0, 0.4);
}

.strength-fill.good {
  background: linear-gradient(90deg, #FFD700 0%, #FFED4E 100%);
  box-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

.strength-fill.strong {
  background: linear-gradient(90deg, #00E676 0%, #1DE9B6 100%);
  box-shadow: 0 0 12px rgba(0, 230, 118, 0.6);
}

.strength-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 6px;
  text-align: right;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: color 0.3s ease;
}

/* Media Queries */
@media (max-width: 768px) {
  .auth-card {
    padding: 32px 24px;
  }
}

/* Override User Agent checkbox styles */
.checkbox-group input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  
  border: 2px solid var(--border-color);
  border-radius: 4px;
  background-color: transparent;
  cursor: pointer;
  
  margin-top: 4px;
  padding: 0;
  
  transition: all 0.2s ease;
}

.checkbox-group input[type="checkbox"]:hover {
  border-color: var(--primary-purple);
  background-color: rgba(71, 30, 255, 0.1);
}

.checkbox-group input[type="checkbox"]:checked {
  background-color: var(--primary-purple);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='white'%3E%3Cpath fill-rule='evenodd' d='M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px;
  border-color: var(--primary-purple);
}

.checkbox-group input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(71, 30, 255, 0.2);
}
