/* Base styles and resets */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Brand colors */
  --primary: #BE983D;
  --primary-hover: #A67C36;
  --primary-light: #D5AE54;
  --primary-ultra-light: rgba(190, 152, 61, 0.1);
  
  /* UI colors */
  --secondary: #3b82f6;
  --secondary-hover: #2563eb;
  --success: #22c55e;
  --error: #ef4444;
  --warning: #f59e0b;
  
  /* Text colors */
  --text-primary: #0D2122;
  --text-secondary: #555555;
  --text-muted: #717171;
  
  /* Background colors */
  --bg-light: #f8f9fa;
  --bg-dark: #1a1a1a;
  --card-light: #ffffff;
  --card-dark: #262626;
  
  /* Border & Shadow */
  --border: #e5e7eb;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.1);
  
  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 200ms ease;
  --transition: 300ms ease;
  --transition-slow: 500ms ease;
  
  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
}

html {
  font-size: 16px;
  height: 100%;
}

body {
  font-family: "Poppins", sans-serif;
  background-color: var(--bg-light);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
}

/* Layout containers */
.container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-md);
}

.logo {
  display: block;
  max-width: 200px;
  margin-bottom: var(--space-xl);
  transition: transform var(--transition);
}

.logo:hover {
  transform: scale(1.03);
}

/* Form elements */
.login-wrapper {
  background-color: var(--card-light);
  padding: clamp(1.5rem, 5vw, 2.5rem);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 450px;
  animation: fadeIn 0.5s ease forwards;
  transition: transform var(--transition), box-shadow var(--transition);
}

.login-wrapper:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.form-header {
  margin-bottom: var(--space-lg);
  text-align: center;
}

.form-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
  color: var(--text-primary);
}

.form-subtext {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.input-group {
  margin-bottom: var(--space-md);
  text-align: left;
  position: relative;
}

.input-label {
  display: block;
  font-weight: 500;
  margin-bottom: var(--space-xs);
  font-size: 0.9rem;
  color: var(--text-primary);
}

input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  background-color: var(--card-light);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

input[type="email"]::placeholder,
input[type="password"]::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

input[type="email"]:focus,
input[type="password"]:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-ultra-light);
}

/* Buttons */
.btn-primary,
.btn-secondary {
  display: inline-block;
  width: 100%;
  padding: 0.9rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(190, 152, 61, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: var(--bg-light);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background-color: var(--primary-ultra-light);
  transform: translateY(-2px);
}

/* Button shine effect */
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: var(--transition-slow);
}

.btn-primary:hover::after {
  left: 100%;
}

/* Links */
.forgot-password,
.back-to-login {
  margin-top: var(--space-sm);
  text-align: center;
}

.forgot-password a, 
.back-to-login a {
  text-decoration: none;
  color: var(--primary);
  font-size: 0.875rem;
  transition: color var(--transition-fast);
  font-weight: 500;
}

.forgot-password a:hover, 
.back-to-login a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Success message */
.success-message {
  text-align: center;
  padding: var(--space-xl) var(--space-md);
}

.success-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--success);
  color: white;
  margin: 0 auto var(--space-md);
  animation: scaleIn 0.5s ease forwards;
}

.success-message h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.success-message p {
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

/* Footer */
.app-footer {
  text-align: center;
  padding: var(--space-md);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
}

.toast-notification {
  min-width: 300px;
  margin-bottom: 10px;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: slideIn 0.3s ease, fadeOut 0.5s ease 3.5s forwards;
  color: #fff;
}

.toast-notification.success { background-color: var(--success); }
.toast-notification.error { background-color: var(--error); }
.toast-notification.info { background-color: var(--secondary); }
.toast-notification.warning { background-color: var(--warning); }

.toast-message {
  flex-grow: 1;
  font-size: 0.875rem;
  font-weight: 500;
}

.toast-close {
  background: transparent;
  border: none;
  color: white;
  font-size: 1rem;
  cursor: pointer;
  margin-left: 10px;
  opacity: 0.8;
}

.toast-close:hover {
  opacity: 1;
}

/* MFA Modal */
.mfa-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

.mfa-modal-content {
  background-color: var(--card-light);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 450px;
  animation: slideIn 0.4s ease;
}

.mfa-modal-header {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.mfa-modal-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.mfa-modal-header p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.email-sent-icon {
  display: flex;
  justify-content: center;
  margin: var(--space-md) 0;
  animation: scaleIn 0.5s ease forwards;
}

.verification-message {
  text-align: center;
  margin-bottom: var(--space-md);
}

.verification-message p {
  margin-bottom: var(--space-xs);
  color: var(--text-secondary);
}

.user-email {
  background-color: var(--primary-ultra-light);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  margin: var(--space-xs) 0;
  font-weight: 500;
  color: var(--primary);
  word-break: break-all;
}

.verification-instructions {
  font-size: 0.8125rem;
  font-style: italic;
  margin-top: var(--space-sm);
  color: var(--text-muted);
}

.verification-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

/* Loading state */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

.btn-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.2);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s infinite linear;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes scaleIn {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

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

/* Accessibility improvements */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  body {
    background-color: var(--bg-dark);
    color: #f0f0f0;
  }
  
  .login-wrapper,
  .mfa-modal-content {
    background-color: var(--card-dark);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  }
  
  .input-label {
    color: #e0e0e0;
  }
  
  input[type="email"],
  input[type="password"] {
    background-color: #333;
    border-color: #444;
    color: #fff;
  }
  
  input[type="email"]:focus,
  input[type="password"]:focus {
    border-color: var(--primary);
    background-color: #3a3a3a;
  }
  
  .btn-secondary {
    background-color: #333;
    color: #e0e0e0;
    border-color: #444;
  }
  
  .btn-secondary:hover {
    background-color: #404040;
  }
  
  .form-header h2,
  .mfa-modal-header h2,
  .success-message h2 {
    color: #e0e0e0;
  }
  
  .form-subtext,
  .success-message p,
  .mfa-modal-header p {
    color: #aaa;
  }
  
  .verification-instructions {
    color: #777;
  }
  
  .app-footer {
    color: #777;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .container {
    padding: var(--space-sm);
  }
  
  .login-wrapper {
    max-width: 100%;
    padding: var(--space-md);
  }
  
  .logo {
    max-width: 180px;
    margin-bottom: var(--space-lg);
  }
}

@media (max-width: 480px) {
  html {
    font-size: 15px;
  }
  
  .verification-actions {
    flex-direction: column;
    gap: var(--space-xs);
  }
  
  .toast-notification {
    min-width: auto;
    width: calc(100% - 30px);
    margin-left: 15px;
    margin-right: 15px;
  }
}