/* ========================================
   AUTHENTICATION PAGES - PREMIUM ENHANCED
   With Glowing Effects & Smooth Animations
   ======================================== */

/* CSS Variables for Glowing Effects */
:root {
  --glow-primary: 0 0 20px rgba(102, 126, 234, 0.4);
  --glow-secondary: 0 0 20px rgba(118, 75, 162, 0.35);
  --glow-white: 0 0 25px rgba(255, 255, 255, 0.5);
  --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Fix Navbar Overlap - Add spacing for navbar */
.container.mt-5,
section.py-5 {
  margin-top: 100px !important;
  padding-top: 40px !important;
  min-height: calc(100vh - 100px);
}

/* Section Styling - White background to match website */
section.py-5 {
  background: #ffffff;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1;
}

/* Subtle decorative background elements - ENHANCED GLOW */
section.py-5::before {
  content: '';
  position: absolute;
  top: -100px;
  left: -100px;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.08) 0%, transparent 70%);
  border-radius: 50%;
  animation: float 8s ease-in-out infinite;
  filter: blur(40px);
}

section.py-5::after {
  content: '';
  position: absolute;
  bottom: -150px;
  right: -150px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(118, 75, 162, 0.06) 0%, transparent 70%);
  border-radius: 50%;
  animation: float 10s ease-in-out infinite reverse;
  filter: blur(40px);
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(30px, -30px);
  }
}

.container {
  position: relative;
  z-index: 2;
  animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Card Styling - Distinct from white background - ENHANCED */
.card {
  border: 2px solid #e2e8f0;
  border-radius: 24px;
  background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
  box-shadow: 
    0 20px 60px rgba(102, 126, 234, 0.15),
    0 8px 20px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition: all var(--transition-smooth);
  overflow: hidden;
  position: relative;
  animation: cardEntrance 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s backwards;
}

/* Gradient border effect - ENHANCED GLOW */
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #667eea 100%);
  background-size: 200% 100%;
  animation: gradientShift 3s ease-in-out infinite;
  box-shadow: var(--glow-primary);
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* Subtle inner glow - ENHANCED */
.card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at top left, rgba(102, 126, 234, 0.05) 0%, transparent 50%);
  pointer-events: none;
}

@keyframes cardEntrance {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.card:hover {
  transform: translateY(-8px);
  border-color: #cbd5e0;
  box-shadow: 
    var(--glow-primary),
    0 30px 80px rgba(102, 126, 234, 0.22),
    0 12px 30px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 1);
}

/* Heading Styles - ENHANCED GLOW */
h2.text-center {
  font-weight: 700;
  color: #2d3748;
  font-size: 2.25rem;
  margin-bottom: 2rem;
  position: relative;
  display: inline-block;
  width: 100%;
  animation: slideDown 0.6s ease-out 0.3s both;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 2px 10px rgba(102, 126, 234, 0.2));
}

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

h2.text-center::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  border-radius: 4px;
  animation: expandWidth 0.6s ease-out 0.5s both;
  box-shadow: var(--glow-primary);
}

@keyframes expandWidth {
  from {
    width: 0;
  }
  to {
    width: 80px;
  }
}

/* Form Groups Animation */
.mb-3 {
  animation: fadeInLeft 0.5s ease-out both;
  position: relative;
}

.mb-3:nth-child(2) { animation-delay: 0.4s; }
.mb-3:nth-child(3) { animation-delay: 0.5s; }
.mb-3:nth-child(4) { animation-delay: 0.6s; }
.mb-3:nth-child(5) { animation-delay: 0.7s; }

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Form Labels - ENHANCED */
.form-label {
  font-weight: 600;
  color: #4a5568;
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
  display: block;
  transition: all var(--transition-smooth);
  letter-spacing: 0.3px;
}

.mb-3:focus-within .form-label {
  color: #667eea;
  transform: translateX(2px);
}

/* Password Input Wrapper */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

/* Form Controls - ENHANCED GLOW */
.form-control {
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.875rem 1.125rem;
  font-size: 1rem;
  transition: all var(--transition-smooth);
  background: #ffffff;
  color: #2d3748;
  width: 100%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.form-control::placeholder {
  color: #a0aec0;
  font-size: 0.95rem;
  transition: all var(--transition-smooth);
}

.form-control:hover {
  border-color: #cbd5e0;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.08);
}

.form-control:focus {
  border-color: #667eea;
  background: #ffffff;
  box-shadow: 
    0 0 0 4px rgba(102, 126, 234, 0.15),
    var(--glow-primary);
  outline: none;
  transform: translateY(-2px);
}

.form-control:focus::placeholder {
  opacity: 0.5;
  transform: translateX(5px);
}

/* Password Toggle Button - ENHANCED GLOW */
.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border: 1px solid #e2e8f0;
  color: #718096;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-smooth);
  border-radius: 8px;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.password-toggle:hover {
  color: #ffffff;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-color: #667eea;
  transform: translateY(-50%) scale(1.05);
  box-shadow: var(--glow-primary);
}

.password-toggle:hover svg {
  stroke: #ffffff;
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.8));
}

.password-toggle:active {
  transform: translateY(-50%) scale(0.95);
}

.password-toggle svg {
  width: 20px;
  height: 20px;
  transition: all var(--transition-smooth);
}

/* Adjust input padding when password toggle is present */
.password-wrapper .form-control {
  padding-right: 50px;
}

/* Button Styles - ENHANCED GLOW */
.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 12px;
  padding: 1rem 1.75rem;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.5px;
  color: #ffffff;
  transition: all var(--transition-smooth);
  position: relative;
  overflow: hidden;
  box-shadow: 
    0 8px 20px rgba(102, 126, 234, 0.4),
    0 2px 6px rgba(0, 0, 0, 0.1);
  animation: fadeIn 0.6s ease-out 0.8s both;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 
    var(--glow-primary),
    0 12px 30px rgba(102, 126, 234, 0.5),
    0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-primary:active {
  transform: translateY(-1px);
  box-shadow: 
    0 6px 15px rgba(102, 126, 234, 0.4),
    0 2px 6px rgba(0, 0, 0, 0.1);
}

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

/* Alert Messages - ENHANCED */
.alert {
  border: 2px solid;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  animation: slideInDown 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.alert-success {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  color: #166534;
  border-color: #86efac;
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.15);
}

.alert-danger {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  color: #991b1b;
  border-color: #fca5a5;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
}

.alert-warning {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  color: #92400e;
  border-color: #fcd34d;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
}

.alert-info {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  color: #1e40af;
  border-color: #93c5fd;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

/* Links - ENHANCED GLOW */
a {
  color: #667eea;
  text-decoration: none;
  font-weight: 600;
  transition: all var(--transition-smooth);
  position: relative;
  display: inline-block;
}

a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  transition: width var(--transition-smooth);
  box-shadow: 0 0 8px rgba(102, 126, 234, 0.5);
}

a:hover {
  color: #764ba2;
  transform: translateX(3px);
  text-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

a:hover::after {
  width: 100%;
}

/* Bottom Links Section */
.d-flex.justify-content-between,
.text-center.mt-4.register-link {
  animation: fadeIn 0.8s ease-out 0.9s both;
  margin-top: 2rem !important;
}

.d-flex.justify-content-between p,
.text-center.mt-4.register-link p {
  color: #718096;
  font-size: 0.95rem;
  margin-bottom: 0;
}

/* Decorative corner accents on card */
.card .p-4 {
  position: relative;
}

/* Responsive Design */
@media (max-width: 768px) {
  .container.mt-5,
  section.py-5 {
    margin-top: 120px !important;
    padding-top: 20px !important;
  }

  h2.text-center {
    font-size: 1.85rem;
  }

  .card {
    margin: 0 1rem;
    border-radius: 20px;
  }

  .btn-primary {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
  }

  .d-flex.justify-content-between {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .form-control {
    font-size: 16px; /* Prevent zoom on iOS */
  }

  section.py-5::before,
  section.py-5::after {
    display: none;
  }
}

@media (max-width: 576px) {
  .col-lg-5,
  .col-lg-6 {
    padding: 0;
  }

  .card {
    margin: 0 0.75rem;
  }

  h2.text-center {
    font-size: 1.65rem;
  }
}

/* Loading State - ENHANCED */
form.loading {
  pointer-events: none;
  opacity: 0.7;
}

form.loading .btn-primary {
  position: relative;
}

form.loading .btn-primary::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-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

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

/* Focus Visible for Accessibility - ENHANCED */
*:focus-visible {
  outline: 3px solid rgba(102, 126, 234, 0.5);
  outline-offset: 3px;
  border-radius: 4px;
  box-shadow: var(--glow-primary);
}

/* Smooth Transitions */
* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Input Validation States - ENHANCED GLOW */
.form-control.is-invalid {
  border-color: #ef4444;
  animation: shake 0.5s;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
}

.form-control.is-valid {
  border-color: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
  20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Print Styles */
@media print {
  section.py-5::before,
  section.py-5::after {
    display: none;
  }

  .card {
    box-shadow: none;
    border: 1px solid #e2e8f0;
  }

  .btn-primary {
    background: #667eea;
  }
}

/* ============================================
   ALERT MESSAGES - CENTERED & AUTO-DISMISS
   ============================================ */

.messages-container {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    width: 80%;
    max-width: 400px;
    pointer-events: none; /* Allow clicks through empty space */
}

.alert {
    pointer-events: all; /* But allow clicks on alerts */
    padding: 16px 20px;
    margin-bottom: 12px;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideDown 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    font-size: 15px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    
}

/* Success Alert */
.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border-left: 5px solid #28a745;
}

/* Error Alert */
.alert-error,
.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border-left: 5px solid #dc3545;
}

/* Warning Alert */
.alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
    border-left: 5px solid #ffc107;
}

/* Info Alert */
.alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    color: #0c5460;
    border-left: 5px solid #17a2b8;
}

/* Alert Content */
.alert span {
    flex: 1;
    padding-right: 10px;
}

/* Close Button */
.alert-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    padding: 0;
    line-height: 1;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.alert-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.05);
    transform: scale(1.1);
}

/* Slide Down Animation */
@keyframes slideDown {
    from {
        transform: translateY(-100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Fade Out Animation */
@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-30px);
    }
}

.alert.fade-out {
    animation: fadeOut 0.4s ease-out forwards;
}

/* Responsive */
@media (max-width: 768px) {
    .messages-container {
        top: 60px;
        width: 95%;
    }
    
    .alert {
        font-size: 14px;
        padding: 14px 16px;
    }
}


/* Remove default bullets & black text */
.errorlist {
    list-style: none; /* remove bullet */
    margin: 0 0 8px 0;
    padding: 0;
}

.errorlist li {
    color: #ef4444; /* red */
    font-weight: 500;
    position: relative;
    padding-left: 16px; /* space for custom dot */
}

/* Optional red dot */
.errorlist li::before {
    content: '•';
    color: #ef4444;
    position: absolute;
    left: 0;
}

/* Professional soft warning for live validation */
.warning-text {
    color: #fb923c; /* soft orange, premium look */
    font-size: 0.85rem;
    margin-top: 4px;
    display: block;
    opacity: 0.9;
    transition: color 0.3s ease, opacity 0.3s ease;
    text-shadow: 0 0 2px rgba(251,146,60,0.4);
}

.warning-text.show {
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-2px); }
    to { opacity: 0.9; transform: translateY(0); }
}


.btn-primary:focus,
.password-toggle:focus,
a:focus {
    outline: 3px solid var(--glow-primary);
    outline-offset: 3px;
    box-shadow: var(--glow-primary);
}
