/* static/css/users_style.css */

/* CSS Variables for Navy Blue Theme */
:root {
  --navy-primary: #001f3f;
  --navy-secondary: #003366;
  --navy-light: #004080;
  --navy-dark: #000c1a;
  --accent-blue: #007bff;
  --accent-light: #4d94ff;
  --text-primary: #ffffff;
  --text-secondary: #e0e7ff;
  --text-muted: #8ca0d7;
  --bg-light: #f8f9fa;
  --border-color: #d1d7e0;
  --error-color: #dc3545;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
  --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  --border-radius: 12px;
  --border-radius-sm: 8px;
}

/* Base Reset for Auth Pages */
body.auth-page {
  background: linear-gradient(135deg, var(--navy-primary) 0%, var(--navy-dark) 100%);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  margin: 0;
}

/* Alert Messages */
.auth-messages {
  margin-bottom: 1.5rem;
}

/* Card Styles */
.auth-card {
  background: rgba(255, 255, 255, 0.98);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  transition: var(--transition);
}

.auth-card:hover {
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
}

.auth-card.wide {
  max-width: 900px;
}

/* Card Header */
.auth-header {
  background: linear-gradient(135deg, var(--navy-primary), var(--navy-secondary));
  color: var(--text-primary);
  padding: 2.5rem 2rem;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: 1px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.brand-subtitle {
  font-size: 0.9rem;
  font-weight: 400;
  margin-top: 0.5rem;
  opacity: 0.9;
  line-height: 1.4;
}

.form-title {
  font-size: 1.75rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
}

.form-subtitle {
  font-size: 1rem;
  opacity: 0.85;
  margin: 0;
  font-weight: 300;
}

/* Card Body */
.auth-body {
  padding: 2.5rem;
}

/* Form Elements */
.form-group {
  margin-bottom: 1.75rem;
}

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

.form-control {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 0.875rem 1rem;
  font-size: 1rem;
  transition: var(--transition);
  background: #fff;
  color: var(--navy-dark);
  width: 100%;
}

.form-control:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 0.25rem rgba(0, 123, 255, 0.15);
  outline: none;
}

.form-control.is-invalid {
  border-color: var(--error-color);
  background-image: none;
}

.invalid-feedback {
  color: var(--error-color);
  font-size: 0.875rem;
  margin-top: 0.5rem;
  display: block;
  font-weight: 500;
}

/* Input Group */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group .form-control {
  padding-left: 2.75rem;
}

.input-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-muted);
  pointer-events: none;
  z-index: 10;
  font-size: 1rem;
}

/* Password Toggle */
.password-toggle {
  position: absolute;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  transition: var(--transition);
  z-index: 10;
  font-size: 1rem;
}

.password-toggle:hover {
  color: var(--accent-blue);
  transform: scale(1.1);
}

/* Checkboxes */
.form-check {
  margin-bottom: 1rem;
  padding-left: 1.75rem;
}

.form-check-input {
  border-radius: 4px;
  border: 1px solid var(--border-color);
  transition: var(--transition);
  width: 1.25rem;
  height: 1.25rem;
  margin-left: -1.75rem;
  margin-top: 0.125rem;
}

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

.form-check-label {
  color: var(--navy-secondary);
  font-weight: 500;
  cursor: pointer;
  padding-left: 0.5rem;
}

/* Buttons */
.btn {
  padding: 0.875rem 1.5rem;
  border-radius: var(--border-radius-sm);
  font-weight: 600;
  border: none;
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), var(--navy-light));
  color: var(--text-primary);
  width: 100%;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--navy-light), var(--navy-secondary));
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--border-color);
  color: var(--navy-secondary);
  width: 100%;
}

.btn-secondary:hover {
  background: #c4cbd7;
  color: var(--navy-dark);
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

/* Links */
.auth-link {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
}

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

/* Divider */
.divider {
  text-align: center;
  margin: 2rem 0;
  position: relative;
}

.divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-color);
  z-index: 1;
}

.divider span {
  background: #fff;
  padding: 0 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  position: relative;
  z-index: 2;
  font-weight: 500;
}

/* Multi-step Form Specific Styles */
.multi-step-form .form-step {
  display: none;
}

.multi-step-form .form-step.active {
  display: block;
  animation: fadeIn 0.4s ease-in-out;
}

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

/* Step Progress Indicator */
.step-progress {
  margin-bottom: 2.5rem;
}

.step-indicator {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.step {
  flex: 1;
  text-align: center;
  position: relative;
}

.step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 1rem;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--border-color);
  z-index: 1;
}

.step.completed:not(:last-child)::after {
  background: linear-gradient(90deg, var(--success-color), var(--accent-blue));
}

.step-number {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: var(--border-color);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 1rem;
  position: relative;
  z-index: 2;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.step.active .step-number {
  background: linear-gradient(135deg, var(--accent-blue), var(--navy-light));
  color: var(--text-primary);
  transform: scale(1.15);
  box-shadow: var(--shadow-md);
}

.step.completed .step-number {
  background: var(--success-color);
  color: var(--text-primary);
}

.step-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  font-weight: 500;
  display: block;
  line-height: 1.2;
}

.step.active .step-label {
  color: var(--navy-secondary);
  font-weight: 600;
}

/* Progress Bar */
.progress-bar {
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue), var(--navy-light));
  transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  width: 0%;
}

/* Step Navigation */
.step-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2.5rem;
  gap: 1rem;
}

.step-navigation .btn {
  flex: 1;
}

/* Form Rows */
.form-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 0;
}

.form-row .form-group {
  flex: 1;
}

/* File Input */
input[type="file"].form-control {
  padding: 0.5rem;
  cursor: pointer;
}

input[type="file"].form-control::file-selector-button {
  background: linear-gradient(135deg, var(--accent-blue), var(--navy-light));
  color: var(--text-primary);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  margin-right: 1rem;
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
}

input[type="file"].form-control::file-selector-button:hover {
  background: linear-gradient(135deg, var(--navy-light), var(--navy-secondary));
}

/* Terms Link */
.terms-link {
  color: var(--accent-blue);
  text-decoration: underline;
  font-weight: 600;
  transition: var(--transition);
}

.terms-link:hover {
  color: var(--navy-light);
  text-decoration: none;
}

/* Responsive Design */
@media (max-width: 768px) {
  .auth-header {
    padding: 2rem 1.5rem;
  }
  
  .auth-body {
    padding: 1.5rem;
  }
  
  .brand-title {
    font-size: 2rem;
  }
  
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  
  .form-row .form-group:last-child {
    margin-bottom: 0;
  }
  
  .step-indicator {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  
  .step:not(:last-child)::after {
    display: none;
  }
  
  .step-label {
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  body.auth-page {
    padding: 0;
    background: #fff;
  }
  
  .auth-card {
    border-radius: 0;
    min-height: 100vh;
    box-shadow: none;
    max-width: 100%;
  }
  
  .auth-card:hover {
    box-shadow: none;
  }
  
  .step-number {
    width: 2rem;
    height: 2rem;
    font-size: 0.9rem;
  }
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--navy-primary), var(--navy-dark));
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease;
}

.spinner {
  width: 4rem;
  height: 4rem;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top: 4px solid var(--accent-blue);
  border-radius: 50%;
  animation: spin 1s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Alert Overrides */
.alert {
  border: none;
  border-radius: var(--border-radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid transparent;
}

.alert-success {
  background: #e8f5e9;
  color: #155724;
  border-left-color: var(--success-color);
}

.alert-error, .alert-danger {
  background: #fce8e8;
  color: #721c24;
  border-left-color: var(--error-color);
}

.alert-dismissible .btn-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  padding: 0.75rem;
  filter: invert(0.3);
}

/* Select2 Customization */
.select2-container--bootstrap-5 .select2-selection {
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 0.5rem 1rem;
  min-height: calc(1.5em + 0.75rem + 2px);
}

.select2-container--bootstrap-5.select2-container--focus .select2-selection,
.select2-container--bootstrap-5.select2-container--open .select2-selection {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 0.25rem rgba(0, 123, 255, 0.15);
}

.select2-container--bootstrap-5 .select2-results__option--highlighted {
  background-color: var(--accent-blue);
  color: #fff;
}
/* Login link on registration page */
.form-footer {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border-color);
}

.form-footer .divider {
  margin: 0 0 1.5rem 0;
}

.form-footer .divider span {
  background: #fff;
  padding: 0 1.5rem;
  font-size: 1rem;
  font-weight: 500;
}

/* Enterprise-grade error styling */
.error-container {
  margin-top: 0.5rem;
  display: none;
}

.error-container.show {
  display: block;
}

.enterprise-error {
  background: linear-gradient(135deg, #fee, #ffe6e6);
  border: 1px solid #fcc;
  border-left: 4px solid #dc3545;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: #721c24;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 4px rgba(220, 53, 69, 0.1);
  transition: all 0.3s ease;
}

.enterprise-error::before {
  content: '\f06a';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 1rem;
}

.form-control.is-invalid {
  border-color: #dc3545;
  background-image: none;
  box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.1);
}

.form-control.is-invalid:focus {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

.form-select.is-invalid {
  border-color: #dc3545;
  box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.1);
}

.form-check-input.is-invalid {
  border-color: #dc3545;
}

.form-check-input.is-invalid ~ .form-check-label {
  color: #dc3545;
}

/* Error summary for backend validation */
.backend-error-summary {
  background: linear-gradient(135deg, #fee, #ffe6e6);
  border: 2px solid #dc3545;
  border-radius: var(--border-radius-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.15);
}

.backend-error-summary h5 {
  color: #721c24;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.backend-error-summary h5::before {
  content: '\f06a';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}

.backend-error-summary ul {
  margin: 0;
  padding-left: 1.5rem;
}

.backend-error-summary li {
  color: #721c24;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

/* Success state */
.form-control.is-valid {
  border-color: #28a745;
  background-image: none;
  box-shadow: 0 0 0 0.25rem rgba(40, 167, 69, 0.1);
}

/* Inline validation icons */
.input-group .validation-icon {
  position: absolute;
  right: 2.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  display: none;
  z-index: 10;
}

.input-group .validation-icon.valid {
  color: #28a745;
  display: block;
}

.input-group .validation-icon.invalid {
  color: #dc3545;
  display: block;
}

/* Step error alert */
#step-error-alert {
  margin-bottom: 1.5rem;
}

#step-error-alert .alert {
  border: 2px solid #dc3545;
  border-radius: var(--border-radius-sm);
  padding: 1rem 1.5rem;
  margin: 0;
}

#step-error-alert .alert-dismissible .btn-close {
  padding: 1rem;
  filter: brightness(0.5);
}

/* Password Reset specific styles */
.content-section-password-reset {
  padding: 0;
}

.password-reset-form {
  margin: 0;
}

/* Form footer spacing */
.form-footer {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

/* Button with icon spacing */
.btn i {
  margin-right: 0.5rem;
}

/* Validation icon positioning */
.input-group .validation-icon {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  display: none;
  z-index: 10;
}

.input-group .validation-icon.valid {
  color: var(--success-color);
  display: block;
}

.input-group .validation-icon.invalid {
  color: var(--error-color);
  display: block;
}

/* Enterprise error message styling */
.enterprise-error {
  background: linear-gradient(135deg, #fee, #ffe6e6);
  border: 1px solid #fcc;
  border-left: 4px solid var(--error-color);
  border-radius: var(--border-radius-sm);
  padding: 0.75rem 1rem;
  color: #721c24;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
  margin-top: 0.5rem;
  transition: all 0.3s ease;
}

.enterprise-error::before {
  content: '\f06a';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  color: var(--error-color);
}

.error-container {
  display: none;
}

.error-container.show {
  display: block;
}

/* Submit button states */
.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* Password Reset Form Enhancement */
#passwordResetForm .form-group {
  margin-bottom: 1.5rem;
}

#passwordResetForm .form-control {
  padding-left: 2.75rem;
}

/* Crispy Forms Compatibility */
.asteriskField {
  color: var(--error-color);
  font-weight: bold;
}

/* Loading overlay fix */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--navy-primary), var(--navy-dark));
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease;
}