/* ==========================================================================
   auth.css – MODERN AUTHENTICATION FORMS (FIXED VERSION)
   ========================================================================== */

/* ===================== VARIABLES ===================== */
:root {
  /* Light Theme */
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --card-bg: rgba(255, 255, 255, 0.95);
  --card-border: rgba(255, 255, 255, 0.5);
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --border-hover: #cbd5e1;
  
  /* Colors */
  --primary: #4f46e5;
  --primary-light: #6366f1;
  --primary-dark: #4338ca;
  --primary-bg: #f5f3ff;
  --primary-gradient: linear-gradient(135deg, #4f46e5, #6366f1);
  
  --success: #10b981;
  --success-light: #34d399;
  --success-bg: #d1fae5;
  
  --danger: #ef4444;
  --danger-light: #f87171;
  --danger-bg: #fee2e2;
  
  --warning: #f59e0b;
  --warning-light: #fbbf24;
  --warning-bg: #fef3c7;
  
  --info: #3b82f6;
  --info-light: #60a5fa;
  --info-bg: #dbeafe;
  
  /* Layout */
  --radius: 1rem;
  --radius-lg: 1.5rem;
  --radius-sm: 0.75rem;
  --radius-xs: 0.5rem;
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 12px 40px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.2);
  
  /* Transitions */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
}

.dark-mode {
  --card-bg: rgba(30, 41, 59, 0.95);
  --card-border: rgba(255, 255, 255, 0.1);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-light: #64748b;
  --border: #334155;
  --border-hover: #475569;
  
  --primary-bg: rgba(79, 70, 229, 0.15);
  --primary-gradient: linear-gradient(135deg, #6366f1, #4f46e5);
  
  --success-bg: rgba(16, 185, 129, 0.15);
  --danger-bg: rgba(239, 68, 68, 0.15);
  --warning-bg: rgba(245, 158, 11, 0.15);
  --info-bg: rgba(59, 130, 246, 0.15);
}

/* ===================== GLOBAL RESET ===================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  position: relative;
}

/* Background Pattern */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
  z-index: -1;
}

/* ===================== AUTH PANEL ===================== */
.modern-auth-panel {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  animation: slideUp 0.6s ease-out;
}

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

.auth-card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-gradient);
  z-index: 1;
}

.auth-card::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  right: -50%;
  bottom: -50%;
  background: radial-gradient(circle at center, var(--primary-bg), transparent 70%);
  opacity: 0.3;
  z-index: -1;
  animation: pulse 8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.5; }
}

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

/* ===================== AUTH HEADER ===================== */
.auth-header {
  margin-bottom: 2rem;
  position: relative;
  z-index: 2;
  text-align: center;
}

.auth-header .icon-large {
  width: 80px;
  height: 80px;
  background: var(--primary-gradient);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.3);
}

.auth-header .icon-large i {
  font-size: 2.5rem;
  color: white;
}

.auth-header h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 0.5rem;
}

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

/* ===================== FORM STYLES ===================== */
.modern-form {
  position: relative;
  z-index: 2;
}

/* Form Groups - FIXED: Use mb-3 instead of .form-group */
.mb-3 {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.required {
  color: var(--danger);
  font-weight: 600;
}

/* Input Groups */
.input-group {
  display: flex;
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--border);
  transition: var(--transition);
  background: var(--card-bg);
}

.input-group:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-bg);
  transform: translateY(-1px);
}

.input-group-text {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1rem;
  background: var(--primary-bg);
  color: var(--primary);
  min-width: 48px;
  border: none;
  font-size: 1.1rem;
}

/* Form Inputs */
.form-control {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  transition: var(--transition);
}

.form-control::placeholder {
  color: var(--text-light);
  opacity: 0.7;
}

.form-control:focus {
  outline: none;
}

/* Form Errors */
.form-errors {
  margin-top: 0.5rem;
}

.errorlist {
  list-style: none;
  padding: 0;
  margin: 0;
}

.errorlist li {
  color: var(--danger);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  background: var(--danger-bg);
  border-radius: var(--radius-xs);
  border-left: 3px solid var(--danger);
  margin-top: 0.25rem;
}

.non-field-errors {
  margin-bottom: 1.5rem;
}

.non-field-errors .errorlist li {
  padding: 1rem;
  background: var(--danger-bg);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
  font-weight: 500;
}

/* Password Requirements */
.password-requirements {
  background: var(--primary-bg);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin: 1rem 0 1.5rem;
}

.requirements-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.75rem;
}

.requirements-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

@media (max-width: 480px) {
  .requirements-list {
    grid-template-columns: 1fr;
  }
}

.requirement {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.requirement-icon {
  font-size: 0.5rem;
  color: var(--text-light);
  transition: var(--transition);
}

.requirement.met .requirement-icon {
  color: var(--success);
}

.requirement.met {
  color: var(--text);
}

/* Password Strength */
.password-strength {
  margin-top: 0.5rem;
}

.strength-meter {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.strength-fill {
  height: 100%;
  border-radius: 2px;
  transition: var(--transition);
}

.strength-text {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.strength-weak .strength-fill {
  width: 33%;
  background: var(--danger);
}

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

.strength-medium .strength-fill {
  width: 66%;
  background: var(--warning);
}

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

.strength-strong .strength-fill {
  width: 100%;
  background: var(--success);
}

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

/* ===================== BUTTONS ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.btn::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: transform 0.6s ease;
}

.btn:hover::before {
  transform: translateX(100%);
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(79, 70, 229, 0.4);
}

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

.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text);
  text-decoration: none;
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
  transform: translateY(-2px);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Form Actions */
.form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* ===================== CHECKBOX ===================== */
.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.form-check-input {
  width: 1.125rem;
  height: 1.125rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--card-bg);
  cursor: pointer;
  appearance: none;
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
}

.form-check-input:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.form-check-input:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-weight: bold;
  font-size: 0.75rem;
}

.form-check-input:hover {
  border-color: var(--primary);
}

.form-check-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

/* ===================== LINKS ===================== */
.auth-links {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.875rem;
}

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

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

.divider {
  color: var(--text-muted);
  margin: 0 0.5rem;
}

/* ===================== RESPONSIVE DESIGN ===================== */
@media (max-width: 640px) {
  body {
    padding: 0.75rem;
    align-items: flex-start;
    padding-top: 2rem;
  }
  
  .auth-card {
    padding: 2rem 1.5rem;
    border-radius: var(--radius);
  }
  
  .auth-header .icon-large {
    width: 64px;
    height: 64px;
  }
  
  .auth-header .icon-large i {
    font-size: 2rem;
  }
  
  .auth-header h2 {
    font-size: 1.5rem;
  }
  
  .form-control {
    padding: 0.75rem;
    font-size: 1rem;
  }
  
  .btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }
  
  .form-row {
    flex-direction: column;
    gap: 1rem;
  }
}

@media (max-width: 380px) {
  .auth-card {
    padding: 1.5rem 1rem;
  }
  
  .auth-header .icon-large {
    width: 56px;
    height: 56px;
  }
  
  .auth-header .icon-large i {
    font-size: 1.75rem;
  }
}

/* ===================== ACCESSIBILITY ===================== */
@media (prefers-reduced-motion: reduce) {
  .auth-card,
  .btn,
  .form-control,
  .input-group,
  .form-check-input {
    transition: none !important;
    transform: none !important;
  }
  
  .btn::before {
    display: none !important;
  }
  
  @keyframes none {
    from, to { opacity: 1; transform: none; }
  }
}

/* Focus styles */
.form-control:focus-visible,
.btn:focus-visible,
.form-check-input:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Loading state */
.btn.loading {
  opacity: 0.8;
  pointer-events: none;
}

.btn.loading::after {
  content: '';
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
  margin-left: 0.5rem;
}

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

/* Success/Error states for password match */
.input-group.success {
  border-color: var(--success);
}

.input-group.error {
  border-color: var(--danger);
}

.input-group.success .input-group-text {
  background: var(--success-bg);
  color: var(--success);
}

.input-group.error .input-group-text {
  background: var(--danger-bg);
  color: var(--danger);
}