/* ============================================
   AUTH.CSS - Modern Authentication Styles
   ============================================ */

/* ============================================
   1. CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   ============================================ */
:root {
  /* Colors */
  --auth-primary: #1f005a;
  --auth-primary-light: #3d1a7a;
  --auth-primary-dark: #150040;

  /* Gradients */
  --auth-gradient-bg: linear-gradient(135deg, #1f005a 0%, #3d1a7a 50%, #5a2d9a 100%);
  --auth-gradient-card: linear-gradient(180deg, rgba(31, 0, 90, 0.03) 0%, rgba(31, 0, 90, 0.01) 100%);

  /* Grays */
  --auth-gray-50: #f9fafb;
  --auth-gray-100: #f3f4f6;
  --auth-gray-200: #e5e7eb;
  --auth-gray-300: #d1d5db;
  --auth-gray-400: #9ca3af;
  --auth-gray-500: #6b7280;
  --auth-gray-600: #4b5563;
  --auth-gray-700: #374151;
  --auth-gray-800: #1f2937;
  --auth-gray-900: #111827;

  /* Status Colors */
  --auth-success: #10b981;
  --auth-error: #ef4444;
  --auth-warning: #f59e0b;
  --auth-info: #3b82f6;

  /* Typography */
  --auth-font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --auth-font-size-base: 16px;
  --auth-font-size-sm: 14px;
  --auth-font-size-xs: 12px;
  --auth-font-size-lg: 18px;
  --auth-font-size-xl: 20px;
  --auth-font-size-2xl: 24px;
  --auth-font-size-3xl: 30px;

  /* Spacing (8px grid) */
  --auth-space-1: 8px;
  --auth-space-2: 16px;
  --auth-space-3: 24px;
  --auth-space-4: 32px;
  --auth-space-5: 40px;
  --auth-space-6: 48px;

  /* Border Radius */
  --auth-radius-sm: 6px;
  --auth-radius: 8px;
  --auth-radius-lg: 12px;
  --auth-radius-xl: 16px;

  /* Shadows */
  --auth-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --auth-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --auth-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --auth-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Transitions */
  --auth-transition-fast: 150ms ease;
  --auth-transition: 200ms ease;
  --auth-transition-slow: 300ms ease;

  /* Z-index */
  --auth-z-dropdown: 1000;
  --auth-z-modal: 1050;
  --auth-z-tooltip: 1100;
}

/* ============================================
   2. BASE RESETS & GLOBAL STYLES
   ============================================ */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--auth-font-family);
  font-size: var(--auth-font-size-base);
  line-height: 1.5;
  color: var(--auth-gray-900);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   3. LAYOUT - CONTAINER & CARD
   ============================================ */
.auth-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--auth-space-3);
  background: var(--auth-gradient-bg);
  background-attachment: fixed;
}

.auth-card {
  background: white;
  border-radius: var(--auth-radius-xl);
  box-shadow: var(--auth-shadow-xl);
  padding: var(--auth-space-6);
  width: 100%;
  max-width: 500px;
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--auth-primary) 0%, #5a2d9a 100%);
}

/* ============================================
   4. HEADER SECTION
   ============================================ */
.auth-header {
  text-align: center;
  margin-bottom: var(--auth-space-5);
}

.auth-logo {
  display: inline-block;
  margin-bottom: var(--auth-space-3);
}

.auth-logo img {
  height: 48px;
  width: auto;
}

.auth-heading {
  font-size: var(--auth-font-size-3xl);
  font-weight: 700;
  color: var(--auth-gray-900);
  margin: 0 0 var(--auth-space-1);
  letter-spacing: -0.02em;
}

.auth-subheading {
  font-size: var(--auth-font-size-base);
  color: var(--auth-gray-500);
  margin: 0;
  font-weight: 400;
}

/* ============================================
   5. FORM ELEMENTS
   ============================================ */

/* Form Group */
.auth-form-group {
  margin-bottom: var(--auth-space-3);
}

/* Labels */
.auth-label {
  display: block;
  font-size: var(--auth-font-size-sm);
  font-weight: 600;
  color: var(--auth-gray-700);
  margin-bottom: var(--auth-space-1);
}

.auth-label-required::after {
  content: ' *';
  color: var(--auth-error);
}

/* Input Base Styles */
.auth-input {
  display: block;
  width: 100%;
  padding: 12px 16px;
  font-size: var(--auth-font-size-base);
  font-family: var(--auth-font-family);
  line-height: 1.5;
  color: var(--auth-gray-900);
  background-color: white;
  border: 2px solid var(--auth-gray-300);
  border-radius: var(--auth-radius);
  transition: all var(--auth-transition);
  min-height: 48px;
}

.auth-input::placeholder {
  color: var(--auth-gray-400);
}

/* Input States */
.auth-input:hover {
  border-color: var(--auth-gray-400);
}

.auth-input:focus {
  outline: none;
  border-color: var(--auth-primary);
  box-shadow: 0 0 0 3px rgba(31, 0, 90, 0.1);
}

.auth-input:disabled {
  background-color: var(--auth-gray-100);
  color: var(--auth-gray-500);
  cursor: not-allowed;
  opacity: 0.6;
}

.auth-input.filled {
  border-color: var(--auth-gray-400);
  background-color: var(--auth-gray-50);
}

/* Input Error State */
.auth-input.error,
.auth-input.is-invalid {
  border-color: var(--auth-error);
  background-color: #fef2f2;
}

.auth-input.error:focus,
.auth-input.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Input Success State */
.auth-input.success {
  border-color: var(--auth-success);
}

.auth-input.success:focus {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Password Input Wrapper */
.auth-password-wrapper {
  position: relative;
}

.auth-password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--auth-gray-500);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--auth-transition);
  min-width: 44px;
  min-height: 44px;
}

.auth-password-toggle:hover {
  color: var(--auth-gray-700);
}

.auth-password-toggle svg,
.auth-password-toggle i {
  font-size: 20px;
  width: 20px;
  height: 20px;
}

/* Error Messages */
.auth-error-message {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: var(--auth-space-1);
  font-size: var(--auth-font-size-sm);
  color: var(--auth-error);
  font-weight: 500;
}

.auth-error-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

/* Help Text */
.auth-help-text {
  margin-top: var(--auth-space-1);
  font-size: var(--auth-font-size-sm);
  color: var(--auth-gray-500);
}

/* ============================================
   6. BUTTONS
   ============================================ */

/* Base Button */
.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: var(--auth-font-size-base);
  font-weight: 600;
  font-family: var(--auth-font-family);
  line-height: 1.5;
  text-align: center;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--auth-radius);
  cursor: pointer;
  transition: all var(--auth-transition);
  min-height: 48px;
  width: 100%;
  position: relative;
}

.auth-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Primary Button */
.auth-btn-primary {
  background-color: var(--auth-primary);
  color: white;
  border-color: var(--auth-primary);
}

.auth-btn-primary:hover:not(:disabled) {
  background-color: var(--auth-primary-dark);
  border-color: var(--auth-primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--auth-shadow-lg);
}

.auth-btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--auth-shadow);
}

/* Secondary Button */
.auth-btn-secondary {
  background-color: white;
  color: var(--auth-gray-700);
  border-color: var(--auth-gray-300);
}

.auth-btn-secondary:hover:not(:disabled) {
  background-color: var(--auth-gray-50);
  border-color: var(--auth-gray-400);
}

/* Loading State */
.auth-btn.loading {
  color: transparent;
  pointer-events: none;
}

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

.auth-btn-secondary.loading::after {
  border: 3px solid var(--auth-gray-300);
  border-top-color: var(--auth-gray-700);
}

@keyframes auth-spinner {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================
   7. SOCIAL LOGIN
   ============================================ */
.auth-social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 24px;
  font-size: var(--auth-font-size-base);
  font-weight: 500;
  background-color: white;
  color: var(--auth-gray-700);
  border: 2px solid var(--auth-gray-300);
  border-radius: var(--auth-radius);
  cursor: pointer;
  transition: all var(--auth-transition);
  text-decoration: none;
  min-height: 48px;
}

.auth-social-btn:hover {
  background-color: var(--auth-gray-50);
  border-color: var(--auth-gray-400);
  box-shadow: var(--auth-shadow);
}

.auth-social-btn svg {
  flex-shrink: 0;
}

.auth-social-help {
  text-align: center;
  margin-top: var(--auth-space-1);
  font-size: var(--auth-font-size-xs);
  color: var(--auth-gray-500);
}

/* ============================================
   8. DIVIDER
   ============================================ */
.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: var(--auth-space-4) 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--auth-gray-300);
}

.auth-divider-text {
  padding: 0 var(--auth-space-2);
  font-size: var(--auth-font-size-sm);
  color: var(--auth-gray-500);
  font-weight: 500;
}

/* ============================================
   9. CHECKBOX & TERMS
   ============================================ */
.auth-checkbox-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.auth-checkbox {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border: 2px solid var(--auth-gray-300);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--auth-transition);
}

.auth-checkbox:checked {
  background-color: var(--auth-primary);
  border-color: var(--auth-primary);
}

.auth-checkbox:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(31, 0, 90, 0.1);
}

.auth-checkbox-label {
  font-size: var(--auth-font-size-sm);
  color: var(--auth-gray-700);
  line-height: 1.6;
  cursor: pointer;
}

.auth-checkbox-label a {
  color: var(--auth-primary);
  text-decoration: none;
  font-weight: 600;
}

.auth-checkbox-label a:hover {
  text-decoration: underline;
}

/* ============================================
   10. PASSWORD STRENGTH INDICATOR
   ============================================ */
.auth-password-strength {
  margin-top: var(--auth-space-2);
}

.auth-strength-meter {
  display: flex;
  gap: 6px;
  margin-bottom: var(--auth-space-1);
}

.auth-strength-bar {
  flex: 1;
  height: 4px;
  background-color: var(--auth-gray-200);
  border-radius: 2px;
  transition: background-color var(--auth-transition);
}

.auth-strength-bar.active {
  background-color: var(--auth-gray-400);
}

.auth-strength-bar.active.weak {
  background-color: var(--auth-error);
}

.auth-strength-bar.active.fair {
  background-color: var(--auth-warning);
}

.auth-strength-bar.active.good {
  background-color: var(--auth-info);
}

.auth-strength-bar.active.strong {
  background-color: var(--auth-success);
}

.auth-strength-text {
  font-size: var(--auth-font-size-sm);
  font-weight: 600;
  color: var(--auth-gray-600);
}

.auth-strength-text.weak {
  color: var(--auth-error);
}

.auth-strength-text.fair {
  color: var(--auth-warning);
}

.auth-strength-text.good {
  color: var(--auth-info);
}

.auth-strength-text.strong {
  color: var(--auth-success);
}

/* ============================================
   11. FOOTER & LINKS
   ============================================ */
.auth-footer {
  margin-top: var(--auth-space-5);
  padding-top: var(--auth-space-4);
  border-top: 1px solid var(--auth-gray-200);
}

.auth-footer-text {
  text-align: center;
  font-size: var(--auth-font-size-sm);
  color: var(--auth-gray-600);
}

.auth-footer-link {
  color: var(--auth-primary);
  text-decoration: none;
  font-weight: 600;
}

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

.auth-security-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: var(--auth-space-3);
  padding: var(--auth-space-2);
  background-color: var(--auth-gray-50);
  border-radius: var(--auth-radius);
  font-size: var(--auth-font-size-xs);
  color: var(--auth-gray-600);
}

.auth-security-icon {
  color: var(--auth-success);
  font-size: 16px;
}

/* ============================================
   12. ALERTS & NOTIFICATIONS
   ============================================ */
.auth-alert {
  padding: var(--auth-space-2) var(--auth-space-3);
  border-radius: var(--auth-radius);
  margin-bottom: var(--auth-space-3);
  font-size: var(--auth-font-size-sm);
  border: 1px solid;
}

.auth-alert-success {
  background-color: #d1fae5;
  border-color: #6ee7b7;
  color: #065f46;
}

.auth-alert-error {
  background-color: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

.auth-alert-info {
  background-color: #dbeafe;
  border-color: #93c5fd;
  color: #1e3a8a;
}

/* ============================================
   13. RESPONSIVE DESIGN
   ============================================ */

/* Mobile (<640px) */
@media (max-width: 639px) {
  .auth-container {
    padding: var(--auth-space-2);
  }

  .auth-card {
    padding: var(--auth-space-4);
  }

  .auth-heading {
    font-size: var(--auth-font-size-2xl);
  }

  .auth-logo img {
    height: 40px;
  }
}

/* Tablet (640px - 1024px) */
@media (min-width: 640px) and (max-width: 1024px) {
  .auth-card {
    max-width: 500px;
  }
}

/* Desktop (>1024px) */
@media (min-width: 1025px) {
  .auth-card {
    max-width: 500px;
  }
}

/* ============================================
   14. ACCESSIBILITY
   ============================================ */

/* Focus Indicators */
.auth-input:focus,
.auth-btn:focus,
.auth-checkbox:focus,
.auth-social-btn:focus,
.auth-password-toggle:focus {
  outline: 3px solid var(--auth-primary);
  outline-offset: 2px;
}

/* Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .auth-input,
  .auth-btn,
  .auth-social-btn {
    border-width: 3px;
  }

  .auth-input:focus,
  .auth-btn:focus {
    outline-width: 4px;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Touch Target Optimization */
@media (pointer: coarse) {
  .auth-btn,
  .auth-input,
  .auth-social-btn,
  .auth-password-toggle {
    min-height: 48px;
    min-width: 48px;
  }
}

/* ============================================
   15. UTILITY CLASSES
   ============================================ */
.text-center {
  text-align: center;
}

.mt-1 { margin-top: var(--auth-space-1); }
.mt-2 { margin-top: var(--auth-space-2); }
.mt-3 { margin-top: var(--auth-space-3); }
.mt-4 { margin-top: var(--auth-space-4); }

.mb-1 { margin-bottom: var(--auth-space-1); }
.mb-2 { margin-bottom: var(--auth-space-2); }
.mb-3 { margin-bottom: var(--auth-space-3); }
.mb-4 { margin-bottom: var(--auth-space-4); }

.fw-bold { font-weight: 700; }
.fw-semibold { font-weight: 600; }
.fw-medium { font-weight: 500; }
.fw-normal { font-weight: 400; }
