/* Elegant Minimalist Auth UI */

/* CSS Variables for consistent theming */
:root {
  --auth-primary: #667eea;
  --auth-primary-hover: #5a67d8;
  --auth-primary-light: rgba(102, 126, 234, 0.1);
  --auth-success: #10b981;
  --auth-success-dark: #059669;
  --auth-error: #ef4444;
  --auth-error-dark: #dc2626;
  --auth-warning: #f59e0b;
  --auth-bg-primary: #0f0f23;
  --auth-bg-secondary: #1a1a2e;
  --auth-bg-tertiary: #16213e;
  --auth-bg-card: rgba(26, 26, 46, 0.95);
  --auth-text-primary: #ffffff;
  --auth-text-secondary: #a0a0a0;
  --auth-text-muted: #6b7280;
  --auth-border: rgba(255, 255, 255, 0.08);
  --auth-border-focus: var(--auth-primary);
  --auth-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  --auth-shadow-lg: 0 30px 60px rgba(0, 0, 0, 0.4);
  --auth-radius: 16px;
  --auth-radius-lg: 20px;
  --auth-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --auth-spacing: 1.5rem;
  --auth-spacing-sm: 1rem;
  --auth-spacing-xs: 0.75rem;
  /* Animation timings */
  --auth-anim-fast: 180ms;
  --auth-anim-medium: 300ms;
  --auth-anim-slow: 500ms;
}

/* User Section (top-right) - More compact and elegant */
.user-section {
  position: fixed;
  top: calc(var(--spacing-lg) + var(--spacing-lg));
  right: var(--spacing-lg);
  z-index: 1000;
}

.user-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  color: var(--auth-text-primary);
  border: 1px solid var(--auth-border);
  cursor: pointer;
  transition: var(--auth-transition);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.user-trigger::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.6s ease;
}

.user-trigger:hover {
  background: rgba(15, 23, 42, 0.98);
  border-color: var(--auth-primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(59, 130, 246, 0.2);
}

.user-trigger:hover::before {
  left: 100%;
}

.user-trigger:active {
  transform: translateY(0);
}

.user-trigger .chevron { 
  opacity: 0.7; 
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.user-trigger[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
  opacity: 1;
}

.user-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8, #1e40af);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  color: white;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.4), 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.user-avatar::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
  transform: rotate(45deg) translateX(-100%);
  transition: transform 0.6s ease;
}

.user-trigger:hover .user-avatar {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(59, 130, 246, 0.5), 0 4px 8px rgba(0, 0, 0, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
}

.user-trigger:hover .user-avatar::before {
  transform: rotate(45deg) translateX(100%);
}

.user-name {
  font-size: 14px;
  opacity: 0.9;
  font-weight: 500;
  transition: opacity 0.3s ease;
}

.user-trigger:hover .user-name {
  opacity: 1;
}

.user-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 260px;
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(20px);
  color: var(--auth-text-primary);
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius-lg);
  box-shadow: var(--auth-shadow-lg);
  padding: 16px;
  display: none;
  opacity: 0;
  transform: translateY(-10px) scale(0.95);
  transition: var(--auth-transition);
}

.user-menu.open { 
  display: block; 
  opacity: 1;
  transform: translateY(0) scale(1);
}

.user-menu-header {
  padding: 12px 16px;
  font-size: 13px;
  color: var(--auth-text-muted);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 12px;
  font-weight: 500;
}

.user-menu .menu-item {
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: 10px;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: var(--auth-transition);
  position: relative;
  overflow: hidden;
}

.user-menu .menu-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
  transition: left 0.4s ease;
}

.user-menu .menu-item:hover {
  background: rgba(255,255,255,0.08);
  color: var(--auth-text-primary);
  transform: translateX(4px);
}

.user-menu .menu-item:hover::before {
  left: 100%;
}

/* Enhanced Auth Overlay and Modals */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 35, 0.9);
  backdrop-filter: blur(20px);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-overlay:not([hidden]) {
  opacity: 1;
}

.auth-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  width: min(400px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  background: var(--auth-bg-card);
  backdrop-filter: blur(30px);
  border-radius: var(--auth-radius-lg);
  box-shadow: var(--auth-shadow-lg);
  border: 1px solid var(--auth-border);
  opacity: 0;
  transition: var(--auth-transition);
  overflow: hidden;
  z-index: 1001;
}

.auth-modal.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Subtle gradient border effect */
.auth-modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, 
    transparent, 
    var(--auth-primary), 
    transparent
  );
  opacity: 0.6;
}

/* Auth Modal Header - Clean and minimal */
.auth-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--auth-spacing) var(--auth-spacing) var(--auth-spacing-sm);
  border-bottom: 1px solid var(--auth-border);
}

.auth-title {
  display: flex;
  align-items: center;
  gap: var(--auth-spacing-xs);
}

.auth-logo {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  filter: drop-shadow(0 2px 8px rgba(102, 126, 234, 0.3));
}

/* Ensure the image fills the logo container without extra padding */
.auth-logo img {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  object-fit: contain;
}

.auth-heading h3 {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 600;
  color: var(--auth-text-primary);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.auth-subtitle {
  margin: 2px 0 0;
  font-size: 0.8125rem;
  color: var(--auth-text-secondary);
  line-height: 1.4;
  font-weight: 400;
}

.auth-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: var(--auth-radius);
  color: var(--auth-text-muted);
  cursor: pointer;
  transition: var(--auth-transition);
  flex-shrink: 0;
}

.auth-close:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--auth-text-primary);
  transform: scale(1.05);
}

.auth-close:active {
  transform: scale(0.95);
}

/* Enhanced Form Styles - Minimalist approach */
.auth-form {
  padding: var(--auth-spacing-sm) var(--auth-spacing) var(--auth-spacing);
}

.auth-field-group {
  margin-bottom: var(--auth-spacing-sm);
}

.auth-field-group:last-of-type {
  margin-bottom: var(--auth-spacing);
}

.auth-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--auth-text-primary);
  margin-bottom: var(--auth-spacing-xs);
  letter-spacing: 0.01em;
}

.auth-form input[type="email"],
.auth-form input[type="password"] {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius);
  font-size: 0.9375rem;
  background: rgba(255, 255, 255, 0.02);
  color: var(--auth-text-primary);
  transition: var(--auth-transition);
  box-sizing: border-box;
  font-family: inherit;
  font-weight: 400;
}

.auth-form input[type="email"]:focus,
.auth-form input[type="password"]:focus {
  outline: none;
  border-color: var(--auth-border-focus);
  box-shadow: 0 0 0 3px var(--auth-primary-light);
  background: rgba(255, 255, 255, 0.04);
}

.auth-form input[type="email"]::placeholder,
.auth-form input[type="password"]::placeholder {
  color: var(--auth-text-muted);
  font-weight: 400;
}

/* Enhanced Password Field */
.auth-password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-password-field input {
  padding-right: 2.75rem !important;
}

.auth-password-toggle {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0.375rem;
  cursor: pointer;
  color: var(--auth-text-muted);
  border-radius: 6px;
  transition: var(--auth-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  width: 1.75rem;
  height: 1.75rem;
  opacity: 0.7;
}

.auth-password-toggle:hover {
  color: var(--auth-primary);
  background-color: var(--auth-primary-light);
  opacity: 1;
  transform: translateY(-50%) scale(1.05);
}

.auth-password-toggle:focus {
  outline: 2px solid var(--auth-primary);
  outline-offset: 2px;
  opacity: 1;
}

.auth-password-toggle:active {
  transform: translateY(-50%) scale(0.95);
}

/* Smooth icon transitions */
.auth-password-toggle svg {
  transition: all 0.2s ease;
  width: 16px;
  height: 16px;
}

.auth-password-toggle:hover svg {
  stroke-width: 2.2;
}

/* Enhanced Password Strength Meter */
.auth-strength-meter {
  margin-top: 0.5rem;
}

.auth-strength-bar {
  width: 100%;
  height: 3px;
  background-color: var(--auth-border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.375rem;
}

.auth-strength-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ef4444, #f59e0b, #10b981);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.auth-strength-text {
  font-size: 0.75rem;
  color: var(--auth-text-muted);
  font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
  .auth-overlay {
    padding: var(--auth-spacing-sm);
  }
  
  .auth-modal {
    width: 100%;
    max-width: none;
    margin: 0;
    border-radius: var(--auth-radius);
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
  }
  
  .auth-modal-header {
    padding: var(--auth-spacing-md) var(--auth-spacing-md) var(--auth-spacing-sm);
  }
  
  .auth-form {
    padding: 0 var(--auth-spacing-md) var(--auth-spacing-md);
  }
  
  .auth-title {
    gap: var(--auth-spacing-xs);
  }
  
  .auth-logo {
    width: 42px;
    height: 42px;
  }
  
  .auth-heading h3 {
    font-size: 1.25rem;
  }
  
  .auth-subtitle {
    font-size: 0.8125rem;
  }
}

@media (max-width: 480px) {
  .auth-overlay {
    padding: var(--auth-spacing-xs);
  }
  
  .auth-modal {
    max-height: calc(100vh - 1rem);
  }
  
  .auth-modal-header {
    padding: var(--auth-spacing-sm);
  }
  
  .auth-form {
    padding: 0 var(--auth-spacing-sm) var(--auth-spacing-sm);
  }
  
  .auth-field-group {
    margin-bottom: var(--auth-spacing-sm);
  }
  
  .auth-input {
    padding: 0.75rem;
    font-size: 1rem; /* Prevent zoom on iOS */
  }
  
  .auth-submit {
    padding: 0.875rem 1rem;
    font-size: 1rem;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .auth-modal {
    border: 2px solid var(--auth-text-primary);
  }
  
  .auth-input {
    border-width: 2px;
  }
  
  .auth-input:focus {
    border-width: 3px;
  }
  
  .auth-submit {
    border: 2px solid var(--auth-primary);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .auth-submit::before {
    display: none;
  }
}

/* Dark mode enhancements */
@media (prefers-color-scheme: dark) {
  :root {
    --auth-bg: rgba(15, 23, 42, 0.95);
    --auth-modal-bg: rgba(30, 41, 59, 0.98);
    --auth-text-primary: #f1f5f9;
    --auth-text-secondary: #cbd5e1;
    --auth-text-muted: #94a3b8;
    --auth-border: rgba(71, 85, 105, 0.3);
    --auth-input-bg: rgba(51, 65, 85, 0.5);
    --auth-primary-light: rgba(99, 102, 241, 0.15);
  }
  
  .auth-modal::before {
    background: linear-gradient(135deg, 
      rgba(99, 102, 241, 0.1) 0%, 
      rgba(139, 92, 246, 0.05) 50%, 
      rgba(59, 130, 246, 0.1) 100%);
  }
}

/* Primary Submit Button - Elegant design */
.auth-submit {
  width: 100%;
  padding: 0.875rem 1.5rem;
  background: linear-gradient(135deg, var(--auth-primary), var(--auth-primary-hover));
  color: white;
  border: none;
  border-radius: var(--auth-radius);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--auth-transition);
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25);
  margin-bottom: var(--auth-spacing-sm);
  letter-spacing: 0.01em;
  will-change: transform, box-shadow;
}

.auth-submit::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.6s ease;
}

.auth-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
}

.auth-submit:hover::before {
  left: 100%;
}

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

.auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Loading state for submit button */
.auth-submit.loading {
  cursor: wait;
  opacity: 0.85;
}
.auth-submit.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  animation: auth-spin var(--auth-anim-slow) linear infinite;
}
@keyframes auth-spin {
  to { transform: rotate(360deg); }
}

/* Utility animation classes for auth flows */
.anim-fade-in { animation: fadeIn var(--auth-anim-medium) ease-out both; }
.anim-slide-up { animation: slideInUp var(--auth-anim-medium) ease-out both; }
.pressable:active { transform: scale(0.98); transition: transform var(--auth-anim-fast) ease; }
.focus-glow:focus { box-shadow: 0 0 0 3px var(--auth-primary-light); border-color: var(--auth-border-focus); }

/* Ripple effect utility (lightweight) */
.ripple {
  position: relative;
  overflow: hidden;
}
.ripple::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.2) 10%, transparent 11%);
  transform: scale(10);
  opacity: 0;
  transition: transform var(--auth-anim-slow), opacity var(--auth-anim-medium);
  pointer-events: none;
}
.ripple:active::after {
  transform: scale(0);
  opacity: 1;
  transition: 0s;
}

/* Secondary Button */
.auth-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: transparent;
  color: var(--auth-text-secondary);
  border: 1px solid var(--auth-border);
  border-radius: var(--auth-radius);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--auth-transition);
  text-decoration: none;
}

.auth-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--auth-text-primary);
  border-color: var(--auth-primary);
}

/* Auth Links */
.auth-link {
  background: none;
  border: none;
  color: var(--auth-primary);
  cursor: pointer;
  font-size: inherit;
  font-weight: 500;
  text-decoration: none;
  transition: var(--auth-transition);
  padding: 0;
}

.auth-link:hover {
  color: var(--auth-primary-hover);
  text-decoration: underline;
}

/* Auth Actions and Switch */
.auth-actions {
  display: flex;
  justify-content: center;
  margin-bottom: var(--auth-spacing-sm);
}

.auth-switch {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--auth-text-secondary);
  margin-top: var(--auth-spacing-xs);
}

.auth-switch .auth-link {
  margin-left: 0.25rem;
}

.auth-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  color: var(--auth-text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  transition: var(--auth-transition);
  font-weight: 500;
}

.auth-secondary:hover {
  color: var(--auth-text-secondary);
  background: rgba(255, 255, 255, 0.05);
}

/* Enhanced Switch Section */
.auth-switch {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid var(--auth-border);
  font-size: 0.875rem;
  color: var(--auth-text-secondary);
}

.auth-link {
  background: none;
  border: none;
  color: var(--auth-primary);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  margin-left: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: var(--auth-transition);
}

.auth-link:hover {
  color: var(--auth-primary-hover);
  background: rgba(59, 130, 246, 0.1);
  text-decoration: underline;
}

/* Enhanced Input States */
.auth-form input.invalid {
  border-color: var(--auth-error);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
  animation: auth-shake 0.4s ease-in-out;
}

.auth-form input.valid {
  border-color: var(--auth-success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

@keyframes auth-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Enhanced Form States */
.auth-form.success .auth-submit {
  background: linear-gradient(135deg, var(--auth-success), var(--auth-success-dark));
  transform: scale(0.98);
}

.auth-form.error .auth-submit {
  background: linear-gradient(135deg, var(--auth-error), var(--auth-error-dark));
  animation: auth-shake 0.4s ease-in-out;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .user-section {
    top: calc(var(--spacing-md) + var(--spacing-md));
    right: var(--spacing-md);
  }
  
  .user-name, .user-trigger .chevron { 
    display: none; 
  }
  
  .user-trigger { 
    padding: 8px; 
    border-radius: var(--radius-lg);
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  }
  
  .user-avatar {
    width: 36px;
    height: 36px;
    font-size: 15px;
    box-shadow: 0 3px 16px rgba(59, 130, 246, 0.4), 0 1px 4px rgba(0, 0, 0, 0.1);
  }
  
  .auth-modal {
    width: 95vw;
    max-width: none;
    margin: 0 2.5vw;
  }
  
  .auth-modal-header {
    padding: 1.5rem 1.5rem 1rem;
  }
  
  .auth-form {
    padding: 1.25rem 1.5rem 1.5rem;
  }
  
  .auth-heading h3 {
    font-size: 1.25rem;
  }
  
  .auth-logo {
    width: 42px;
    height: 42px;
  }
}

@media (max-width: 480px) {
  .user-section {
    top: calc(var(--spacing-sm) + var(--spacing-sm));
    right: var(--spacing-sm);
  }
  
  .user-trigger {
    padding: 6px;
    border-radius: var(--radius-lg);
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  }
  
  .user-avatar {
    width: 36px;
    height: 36px;
    font-size: 15px;
    box-shadow: 0 3px 14px rgba(59, 130, 246, 0.35), 0 1px 3px rgba(0, 0, 0, 0.1);
  }
}

/* Enhanced Animations */
@keyframes fadeIn { 
  from { opacity: 0; transform: translateY(10px); } 
  to { opacity: 1; transform: translateY(0); } 
}

@keyframes slideInUp {
  from { 
    opacity: 0; 
    transform: translate(-50%, -40%) scale(0.9); 
  }
  to { 
    opacity: 1; 
    transform: translate(-50%, -50%) scale(1); 
  }
}

.auth-modal.show {
  animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reduced motion: disable nonessential animations */
@media (prefers-reduced-motion: reduce) {
  .anim-fade-in,
  .anim-slide-up,
  .auth-modal.show,
  .auth-submit.loading::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Focus Management */
.auth-form input:focus-visible {
  outline: none;
}

.auth-submit:focus-visible,
.auth-secondary:focus-visible,
.auth-link:focus-visible,
.auth-close:focus-visible {
  outline: 2px solid var(--auth-primary);
  outline-offset: 2px;
}

/* Field Error Messages */
.auth-field-error {
  display: block;
  font-size: 0.75rem;
  color: var(--auth-error);
  margin-top: 0.375rem;
  min-height: 1rem;
  opacity: 0;
  transform: translateY(-0.25rem);
  transition: var(--auth-transition);
}

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

/* Password strength meter */
.auth-password-strength {
  margin-top: 8px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.auth-password-strength-bar {
  height: 100%;
  transition: all 0.3s ease;
  border-radius: 2px;
}

.auth-password-strength-bar.weak {
  width: 25%;
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.auth-password-strength-bar.fair {
  width: 50%;
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.auth-password-strength-bar.good {
  width: 75%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.auth-password-strength-bar.strong {
  width: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
}

/* Signout Confirmation Modal - Matching App Theme */
.signout-confirmation-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.signout-confirmation-overlay.show {
  opacity: 1;
  visibility: visible;
}

.signout-confirmation-modal {
  background: var(--auth-bg-secondary);
  backdrop-filter: blur(20px);
  border-radius: var(--auth-radius-lg);
  padding: 2rem;
  max-width: 420px;
  width: min(420px, calc(100vw - 2rem));
  margin: 20px;
  box-shadow: var(--auth-shadow-lg);
  border: 1px solid var(--auth-border);
  transform: scale(0.95) translateY(20px);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
}

.signout-confirmation-modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent, 
    var(--auth-error), 
    transparent
  );
  transition: left 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.signout-confirmation-overlay.show .signout-confirmation-modal {
  transform: scale(1) translateY(0);
}

.signout-confirmation-overlay.show .signout-confirmation-modal::before {
  left: 100%;
}

.signout-confirmation-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 2rem;
}

.signout-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--auth-error), var(--auth-error-dark));
  border-radius: var(--auth-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  position: relative;
  overflow: hidden;
}

.signout-icon::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.2), transparent);
  transform: rotate(45deg);
  animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
  0% { transform: rotate(45deg) translate(-100%, -100%); }
  50% { transform: rotate(45deg) translate(0%, 0%); }
  100% { transform: rotate(45deg) translate(100%, 100%); }
}

.signout-content {
  flex: 1;
}

.signout-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--auth-text-primary);
  margin: 0 0 8px 0;
  line-height: 1.3;
}

.signout-message {
  font-size: 0.875rem;
  color: var(--auth-text-secondary);
  margin: 0;
  line-height: 1.5;
}

.signout-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.signout-cancel,
.signout-confirm {
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: var(--auth-transition);
  min-width: 100px;
  position: relative;
  overflow: hidden;
}

.signout-cancel {
  background: var(--auth-bg-tertiary);
  color: var(--auth-text-secondary);
  border: 1px solid var(--auth-border);
}

.signout-cancel::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
  transition: left 0.4s ease;
}

.signout-cancel:hover {
  background: var(--auth-bg-hover);
  color: var(--auth-text-primary);
  border-color: var(--auth-border-focus);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.signout-cancel:hover::before {
  left: 100%;
}

.signout-confirm {
  background: linear-gradient(135deg, var(--auth-error), var(--auth-error-dark));
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.signout-confirm::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.4s ease;
}

.signout-confirm:hover {
  background: linear-gradient(135deg, var(--auth-error-dark), #b91c1c);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

.signout-confirm:hover::before {
  left: 100%;
}

.signout-confirm:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

/* Enhanced Notification Styles */
.auth-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: var(--auth-radius);
  color: white;
  font-weight: 500;
  font-size: 14px;
  z-index: 10000;
  transform: translateX(100%);
  transition: var(--auth-transition);
  box-shadow: var(--auth-shadow);
  backdrop-filter: blur(10px);
}

.auth-notification--success {
  background: linear-gradient(135deg, var(--auth-success), var(--auth-success-dark));
}

.auth-notification--error {
  background: linear-gradient(135deg, var(--auth-error), var(--auth-error-dark));
}

.auth-notification--info {
  background: linear-gradient(135deg, var(--auth-primary), var(--auth-primary-hover));
}

/* iOS and Mobile Optimizations */
@supports (-webkit-touch-callout: none) {
  /* iOS-specific styles */
  .auth-modal {
    /* Prevent iOS Safari from adding rounded corners */
    -webkit-appearance: none;
    /* Improve text rendering on iOS */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  
  .auth-input {
    /* Prevent iOS zoom on input focus */
    font-size: 16px !important;
    /* Disable iOS input styling */
    -webkit-appearance: none;
    -webkit-border-radius: 0;
    /* Improve touch response */
    -webkit-tap-highlight-color: transparent;
  }
  
  .auth-submit {
    /* Disable iOS button styling */
    -webkit-appearance: none;
    /* Improve touch feedback */
    -webkit-tap-highlight-color: transparent;
  }
}

/* Enhanced Mobile Input Handling */
.auth-input {
  /* Prevent zoom on iOS devices */
  font-size: max(16px, 0.875rem);
  /* Improve mobile keyboard handling */
  -webkit-user-select: text;
  /* Better touch response */
  touch-action: manipulation;
}

.auth-input:focus {
  /* Ensure proper focus behavior on mobile */
  -webkit-user-select: text;
  /* Prevent iOS from adding blue highlight */
  -webkit-tap-highlight-color: transparent;
}

/* Mobile-Optimized Touch Targets */
.auth-password-toggle {
  /* Minimum touch target size for accessibility */
  min-width: 44px;
  min-height: 44px;
  /* Better touch response */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.auth-close {
  /* Ensure close button is easily tappable */
  min-width: 44px;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.auth-link {
  /* Improve link touch targets */
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* iOS Keyboard and Viewport Handling */
@media screen and (max-height: 600px) {
  /* Adjust modal for landscape mobile or when keyboard is open */
  .auth-modal {
    max-height: 90vh;
    margin: 5vh auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .auth-modal-header {
    padding: var(--auth-spacing-sm) var(--auth-spacing-md);
  }
  
  .auth-form {
    padding: 0 var(--auth-spacing-md) var(--auth-spacing-sm);
  }
}

/* iOS Safari Specific Fixes */
@supports (-webkit-appearance: none) and (stroke-color: transparent) {
  .auth-overlay {
    /* Fix iOS Safari viewport issues */
    min-height: 100vh;
    min-height: -webkit-fill-available;
  }
  
  .auth-modal {
    /* Prevent iOS Safari from adding unwanted margins */
    margin-top: env(safe-area-inset-top, 0);
    margin-bottom: env(safe-area-inset-bottom, 0);
  }
}

/* Enhanced Mobile Performance */
.auth-submit {
  /* Optimize button animations for mobile */
  will-change: transform, box-shadow;
  /* Better touch feedback */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.auth-submit:active {
  /* Immediate visual feedback on touch */
  transform: scale(0.98);
  transition: transform 0.1s ease;
}

/* Mobile Keyboard Optimization */
.auth-input[type="email"] {
  /* Optimize email input for mobile keyboards */
  autocomplete: email;
  autocapitalize: none;
  autocorrect: off;
  spellcheck: false;
  inputmode: email;
}

.auth-input[type="password"] {
  /* Optimize password input */
  autocomplete: current-password;
  autocapitalize: none;
  autocorrect: off;
  spellcheck: false;
}

/* iOS Face ID / Touch ID Integration Hints */
.auth-submit[data-biometric="true"] {
  position: relative;
}

.auth-submit[data-biometric="true"]::after {
  content: '👤';
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.125rem;
  opacity: 0.7;
}

/* Mobile Gesture Support */
.auth-modal {
  /* Enable smooth scrolling on mobile */
  -webkit-overflow-scrolling: touch;
  /* Prevent overscroll bounce */
  overscroll-behavior: contain;
}

/* Enhanced Mobile Responsive Design */
@media (max-width: 480px) and (orientation: portrait) {
  .auth-overlay {
    padding: var(--auth-spacing-xs);
  }
  
  .auth-modal {
    width: calc(100vw - 1rem);
    max-width: none;
    margin: 0.5rem auto;
    border-radius: 16px;
  }
  
  .auth-input {
    padding: 1rem 0.875rem;
    font-size: 16px; /* Prevent iOS zoom */
  }
  
  .auth-submit {
    padding: 1rem;
    font-size: 16px;
    font-weight: 600;
  }
}

@media (max-width: 480px) and (orientation: landscape) {
  .auth-modal {
    max-height: 85vh;
    overflow-y: auto;
  }
  
  .auth-modal-header {
    padding: var(--auth-spacing-xs) var(--auth-spacing-sm);
  }
  
  .auth-form {
    padding: 0 var(--auth-spacing-sm) var(--auth-spacing-xs);
  }
  
  .auth-field-group {
    margin-bottom: var(--auth-spacing-xs);
  }
}

/* PWA and Standalone App Support */
@media (display-mode: standalone) {
  .auth-overlay {
    /* Account for status bar in PWA mode */
    padding-top: calc(var(--auth-spacing-md) + env(safe-area-inset-top, 0));
  }
}

/* High DPI Mobile Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .auth-modal::before {
    /* Sharper gradients on retina displays */
    background-size: 200% 200%;
  }
}

/* Enhanced Animations */
@keyframes fadeIn { 
  from { opacity: 0; transform: translateY(10px); } 
  to { opacity: 1; transform: translateY(0); } 
}

@keyframes slideInUp {
  from { 
    opacity: 0; 
    transform: translate(-50%, -40%) scale(0.9); 
  }
  to { 
    opacity: 1; 
    transform: translate(-50%, -50%) scale(1); 
  }
}

.auth-modal.show {
  animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Focus Management */
.auth-form input:focus-visible {
  outline: none;
}

.auth-submit:focus-visible,
.auth-secondary:focus-visible,
.auth-link:focus-visible,
.auth-close:focus-visible {
  outline: 2px solid var(--auth-primary);
  outline-offset: 2px;
}

/* Field Error Messages */
.auth-field-error {
  display: block;
  font-size: 0.75rem;
  color: var(--auth-error);
  margin-top: 0.375rem;
  min-height: 1rem;
  opacity: 0;
  transform: translateY(-0.25rem);
  transition: var(--auth-transition);
}

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

/* Password strength meter */
.auth-password-strength {
  margin-top: 8px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.auth-password-strength-bar {
  height: 100%;
  transition: all 0.3s ease;
  border-radius: 2px;
}

.auth-password-strength-bar.weak {
  width: 25%;
  background: linear-gradient(90deg, #ef4444, #dc2626);
}

.auth-password-strength-bar.fair {
  width: 50%;
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

.auth-password-strength-bar.good {
  width: 75%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
}

.auth-password-strength-bar.strong {
  width: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
}

/* Signout Confirmation Modal - Matching App Theme */
.signout-confirmation-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.signout-confirmation-overlay.show {
  opacity: 1;
  visibility: visible;
}

.signout-confirmation-modal {
  background: var(--auth-bg-secondary);
  backdrop-filter: blur(20px);
  border-radius: var(--auth-radius-lg);
  padding: 2rem;
  max-width: 420px;
  width: min(420px, calc(100vw - 2rem));
  margin: 20px;
  box-shadow: var(--auth-shadow-lg);
  border: 1px solid var(--auth-border);
  transform: scale(0.95) translateY(20px);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
}

.signout-confirmation-modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, 
    transparent, 
    var(--auth-error), 
    transparent
  );
  transition: left 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.signout-confirmation-overlay.show .signout-confirmation-modal {
  transform: scale(1) translateY(0);
}

.signout-confirmation-overlay.show .signout-confirmation-modal::before {
  left: 100%;
}

.signout-confirmation-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 2rem;
}

.signout-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--auth-error), var(--auth-error-dark));
  border-radius: var(--auth-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  position: relative;
  overflow: hidden;
}

.signout-icon::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent, rgba(255,255,255,0.2), transparent);
  transform: rotate(45deg);
  animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
  0% { transform: rotate(45deg) translate(-100%, -100%); }
  50% { transform: rotate(45deg) translate(0%, 0%); }
  100% { transform: rotate(45deg) translate(100%, 100%); }
}

.signout-content {
  flex: 1;
}

.signout-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--auth-text-primary);
  margin: 0 0 8px 0;
  line-height: 1.3;
}

.signout-message {
  font-size: 0.875rem;
  color: var(--auth-text-secondary);
  margin: 0;
  line-height: 1.5;
}

.signout-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.signout-cancel,
.signout-confirm {
  padding: 12px 24px;
  border-radius: 10px;
  font-weight: 500;
  font-size: 14px;
  border: none;
  cursor: pointer;
  transition: var(--auth-transition);
  min-width: 100px;
  position: relative;
  overflow: hidden;
}

.signout-cancel {
  background: var(--auth-bg-tertiary);
  color: var(--auth-text-secondary);
  border: 1px solid var(--auth-border);
}

.signout-cancel::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
  transition: left 0.4s ease;
}

.signout-cancel:hover {
  background: var(--auth-bg-hover);
  color: var(--auth-text-primary);
  border-color: var(--auth-border-focus);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.signout-cancel:hover::before {
  left: 100%;
}

.signout-confirm {
  background: linear-gradient(135deg, var(--auth-error), var(--auth-error-dark));
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.signout-confirm::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.4s ease;
}

.signout-confirm:hover {
  background: linear-gradient(135deg, var(--auth-error-dark), #b91c1c);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.4);
  transform: translateY(-1px);
}

.signout-confirm:hover::before {
  left: 100%;
}

.signout-confirm:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

/* Enhanced Notification Styles */
.auth-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: var(--auth-radius);
  color: white;
  font-weight: 500;
  font-size: 14px;
  z-index: 10000;
  transform: translateX(100%);
  transition: var(--auth-transition);
  box-shadow: var(--auth-shadow);
  backdrop-filter: blur(10px);
}

.auth-notification--success {
  background: linear-gradient(135deg, var(--auth-success), var(--auth-success-dark));
}

.auth-notification--error {
  background: linear-gradient(135deg, var(--auth-error), var(--auth-error-dark));
}

.auth-notification--info {
  background: linear-gradient(135deg, var(--auth-primary), var(--auth-primary-hover));
}