/* ============================================
   AUTHENTICATION PAGES - CASCADE OF HOPE HMS
   Login & Registration Pages
   ============================================ */

/* IMPORTANT: Make sure this file is located at /css/pages/auth.css */

/* ============================================
   AUTH PAGE LAYOUT
   ============================================ */

.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--primary-50) 0%, var(--secondary-50) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  position: relative;
}

/* Decorative background pattern */
.auth-page::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(0, 102, 204, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(0, 168, 107, 0.05) 0%, transparent 50%);
  pointer-events: none;
}

.auth-container {
  width: 100%;
  max-width: 500px;
  position: relative;
  z-index: 1;
}

/* ============================================
   AUTH CARD
   ============================================ */

.auth-card {
  background-color: var(--bg-elevated);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: var(--space-8);
  margin-bottom: var(--space-4);
  border: 1px solid var(--border-light);
}

/* Wider card for registration */
.registration-card {
  max-width: 700px;
  margin: 0 auto var(--space-4);
}

/* ============================================
   AUTH LOGO SECTION
   ============================================ */

.auth-logo {
  text-align: center;
  margin-bottom: var(--space-8);
}

.logo-img {
  width: 5rem;
  height: 5rem;
  margin: 0 auto var(--space-4);
  display: block;
}

.hospital-name {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--primary-500);
  margin-bottom: var(--space-2);
  line-height: 1.2;
}

.hospital-tagline {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-weight: var(--font-medium);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

/* ============================================
   AUTH FORM
   ============================================ */

.auth-form {
  width: 100%;
}

.auth-title {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  text-align: center;
}

.auth-subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
  text-align: center;
}

/* ============================================
   FORM CONTROLS (Auth Specific)
   ============================================ */

.form-control {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: var(--font-normal);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.form-control:disabled {
  background-color: var(--bg-secondary);
  color: var(--text-disabled);
  cursor: not-allowed;
  opacity: 0.6;
}

.form-control::placeholder {
  color: var(--text-tertiary);
}

/* ============================================
   PASSWORD INPUT WITH TOGGLE
   ============================================ */

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrapper .form-control {
  padding-right: var(--space-12);
}

.toggle-password {
  position: absolute;
  right: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.toggle-password:hover {
  color: var(--text-primary);
  background-color: var(--bg-secondary);
}

.toggle-password:focus {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

/* ============================================
   FORM OPTIONS (Remember Me & Forgot Password)
   ============================================ */

.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  font-size: var(--text-sm);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
  color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  cursor: pointer;
  border: 2px solid var(--border-medium);
  border-radius: var(--radius-sm);
  accent-color: var(--primary-500);
}

.forgot-password-link {
  color: var(--primary-500);
  text-decoration: none;
  font-weight: var(--font-medium);
  transition: color var(--transition-fast);
}

.forgot-password-link:hover {
  color: var(--primary-600);
  text-decoration: underline;
}

/* ============================================
   ERROR MESSAGES
   ============================================ */

.error-message {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--danger);
  font-weight: var(--font-medium);
  min-height: 1.25rem;
}

.form-text {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.required {
  color: var(--danger);
  font-weight: var(--font-bold);
}

/* ============================================
   AUTH DIVIDER
   ============================================ */

.auth-divider {
  position: relative;
  text-align: center;
  margin: var(--space-6) 0;
}

.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background-color: var(--border-light);
}

.auth-divider span {
  position: relative;
  display: inline-block;
  padding: 0 var(--space-4);
  background-color: var(--bg-elevated);
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

/* ============================================
   AUTH FOOTER
   ============================================ */

.auth-footer {
  text-align: center;
  padding-top: var(--space-4);
}

.auth-footer p {
  margin-bottom: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.register-link {
  color: var(--primary-500);
  font-weight: var(--font-semibold);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.register-link:hover {
  color: var(--primary-600);
  text-decoration: underline;
}

.help-text {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-light);
}

.help-text small {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
}

/* ============================================
   AUTH PAGE FOOTER
   ============================================ */

.auth-page-footer {
  text-align: center;
  padding: var(--space-4);
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

.auth-page-footer p {
  margin: 0;
}

/* ============================================
   REGISTRATION PROGRESS STEPS
   ============================================ */

.registration-steps {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-8);
  position: relative;
}

/* Connecting line between steps */
.registration-steps::before {
  content: '';
  position: absolute;
  top: 1.25rem;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--border-light);
  z-index: 0;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
  position: relative;
  z-index: 1;
}

.step-number {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-full);
  background-color: var(--bg-secondary);
  border: 2px solid var(--border-light);
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  transition: all var(--transition-base);
}

.step-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  font-weight: var(--font-medium);
  text-align: center;
  transition: color var(--transition-base);
}

.step.active .step-number {
  background-color: var(--primary-500);
  border-color: var(--primary-500);
  color: white;
  transform: scale(1.1);
  box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.1);
}

.step.active .step-label {
  color: var(--primary-500);
  font-weight: var(--font-semibold);
}

.step.completed .step-number {
  background-color: var(--success);
  border-color: var(--success);
  color: white;
}

.step.completed .step-label {
  color: var(--success);
}

/* ============================================
   MULTI-STEP FORM
   ============================================ */

.form-step {
  display: none;
  animation: fadeIn var(--transition-base);
}

.form-step.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateX(1rem);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.step-title {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.step-description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-6);
}

.section-title {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-top: var(--space-6);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-light);
}

/* ============================================
   FORM ACTIONS (Navigation Buttons)
   ============================================ */

.form-actions {
  display: flex;
  gap: var(--space-3);
  padding-top: var(--space-6);
  margin-top: var(--space-6);
  border-top: 1px solid var(--border-light);
}

.form-actions .btn {
  flex: 1;
}

.form-actions .btn-secondary {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}

.form-actions .btn-secondary:hover {
  background-color: var(--bg-tertiary);
}

/* ============================================
   INFO BOX
   ============================================ */

.info-box {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-4);
  background-color: var(--info-light);
  border: 1px solid var(--info);
  border-left: 4px solid var(--info);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
}

.info-icon {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  color: var(--info);
}

.info-box div {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--info-dark);
  line-height: var(--leading-relaxed);
}

.info-box strong {
  font-weight: var(--font-semibold);
  display: block;
  margin-bottom: var(--space-1);
}

/* ============================================
   ALERT COMPONENT (Auth Pages)
   ============================================ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  margin-bottom: var(--space-4);
  animation: slideDown var(--transition-base);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-1rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert-icon {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 0.125rem;
}

.alert-close {
  flex-shrink: 0;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  background: none;
  border: none;
  color: currentColor;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xl);
  line-height: 1;
}

.alert-close:hover {
  opacity: 1;
}

.alert-success {
  background-color: var(--success-light);
  border-color: var(--success);
  color: var(--success-dark);
}

.alert-error {
  background-color: var(--danger-light);
  border-color: var(--danger);
  color: var(--danger-dark);
}

/* ============================================
   BUTTON STYLES (Auth Specific)
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-primary);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  line-height: 1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  outline: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--primary-500);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-600);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-loader {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.spinner {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   SUCCESS MODAL
   ============================================ */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  padding: var(--space-4);
  animation: fadeIn var(--transition-base);
}

.modal-content {
  background-color: var(--bg-elevated);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-2xl);
  animation: slideUp var(--transition-base);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(2rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.success-icon {
  width: 4rem;
  height: 4rem;
  margin: 0 auto var(--space-4);
  background-color: var(--success-light);
  color: var(--success);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: var(--font-bold);
}

.modal-content h2 {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.modal-content p {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.modal-content p strong {
  color: var(--primary-500);
  font-family: var(--font-mono);
  font-weight: var(--font-bold);
}

.modal-content .btn {
  margin-top: var(--space-6);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
  .auth-card {
    padding: var(--space-6);
  }
  
  .registration-card {
    padding: var(--space-5);
  }
  
  .auth-title {
    font-size: var(--text-2xl);
  }
  
  .hospital-name {
    font-size: var(--text-xl);
  }
  
  .registration-steps {
    margin-bottom: var(--space-6);
  }
  
  .step-label {
    font-size: 0.625rem;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .form-actions .btn {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .auth-page {
    padding: var(--space-2);
  }
  
  .auth-card {
    padding: var(--space-4);
  }
  
  .registration-card {
    padding: var(--space-4);
  }
  
  .auth-logo {
    margin-bottom: var(--space-6);
  }
  
  .logo-img {
    width: 4rem;
    height: 4rem;
  }
  
  .hospital-name {
    font-size: var(--text-lg);
  }
  
  .auth-title {
    font-size: var(--text-xl);
  }
  
  .auth-subtitle {
    font-size: var(--text-sm);
  }
  
  .registration-steps {
    overflow-x: auto;
    padding-bottom: var(--space-2);
  }
  
  .step-number {
    width: 2rem;
    height: 2rem;
    font-size: var(--text-xs);
  }
  
  .step-label {
    display: none;
  }
  
  .step.active .step-label {
    display: block;
  }
  
  .form-options {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .auth-container {
    max-width: 100%;
  }
  
  .registration-steps::before {
    display: none;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .auth-page {
    background: white;
  }
  
  .auth-card {
    box-shadow: none;
    border: 1px solid var(--border-dark);
  }
  
  .toggle-password,
  .form-actions,
  .auth-divider,
  .auth-footer {
    display: none !important;
  }
}