/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

/* Body */
body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #4facfe, #00f2fe);
  transition: background 0.5s ease, color 0.5s ease;
}

/* Theme toggle button */
#theme-toggle {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 5px;
  background: #fff;
  color: #333;
  cursor: pointer;
  font-size: 0.9rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: background 0.5s ease, color 0.5s ease, transform 0.3s ease, box-shadow 0.3s ease;
  opacity: 0;
  transform: translateY(-30px);
  animation: slideIn 0.8s ease-out forwards;
  animation-delay: 0.3s;
}

#theme-toggle:hover {
  transform: scale(1.05) translateY(-3px);
  box-shadow: 0 6px 14px rgba(79, 172, 254, 0.7), 0 0 20px rgba(0, 242, 254, 0.5);
  animation: pulseToggle 1.2s infinite;
}

/* Animations */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-30px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulseToggle {
  0%   { transform: scale(1.05) translateY(-3px); box-shadow: 0 6px 14px rgba(79,172,254,0.7), 0 0 20px rgba(0,242,254,0.5); }
  50%  { transform: scale(1.08) translateY(-3px); box-shadow: 0 8px 18px rgba(79,172,254,0.8), 0 0 24px rgba(0,242,254,0.6); }
  100% { transform: scale(1.05) translateY(-3px); box-shadow: 0 6px 14px rgba(79,172,254,0.7), 0 0 20px rgba(0,242,254,0.5); }
}

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

/* Container */
.login-container {
  background: #fff;
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 400px;
  transition: background 0.5s ease, color 0.5s ease, box-shadow 0.5s ease;
  animation: fadeIn 0.8s ease-out;
}

.login-container h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: #333;
  transition: color 0.5s ease;
}

/* Form groups */
.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #555;
  transition: color 0.5s ease;
}

.form-group input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 1rem;
  transition: background 0.5s ease, border-color 0.5s ease, color 0.5s ease;
}

.form-group input:focus {
  border-color: #4facfe;
  outline: none;
}

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

.password-wrapper input {
  width: 100%;
  padding-right: 2.5rem;
}

.toggle-pass {
  position: absolute;
  right: 10px;
  cursor: pointer;
  font-size: 1.2rem;
  color: #555;
  transition: transform 0.2s ease, color 0.3s ease;
}

.toggle-pass:hover {
  transform: scale(1.2);
  color: #4facfe;
}

/* Buttons */
.btn {
  width: 100%;
  padding: 0.75rem;
  background: #4facfe;
  border: none;
  border-radius: 5px;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.5s ease, color 0.5s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.btn:hover {
  background: #00c6fb;
  transform: scale(1.03) translateY(-3px);
  box-shadow: 0 6px 14px rgba(79, 172, 254, 0.7), 0 0 20px rgba(0, 242, 254, 0.5);
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  0%   { transform: scale(1.03) translateY(-3px); box-shadow: 0 6px 14px rgba(79,172,254,0.7), 0 0 20px rgba(0,242,254,0.5); }
  50%  { transform: scale(1.07) translateY(-3px); box-shadow: 0 8px 18px rgba(79,172,254,0.8), 0 0 24px rgba(0,242,254,0.6); }
  100% { transform: scale(1.03) translateY(-3px); box-shadow: 0 6px 14px rgba(79,172,254,0.7), 0 0 20px rgba(0,242,254,0.5); }
}

/* Extra links */
.extra-links {
  text-align: center;
  margin-top: 1rem;
}

.extra-links a {
  color: #4facfe;
  text-decoration: none;
  margin: 0 0.5rem;
  transition: color 0.5s ease;
}

.extra-links a:hover { text-decoration: underline; }

/* Error messages */
.error {
  color: red;
  font-size: 0.85rem;
  margin-top: 0.3rem;
  display: block;
}

/* Password strength indicator */
#strengthWrapper {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

#strengthValue { font-weight: bold; }

/* Ripple effect */
button {
  position: relative;
  overflow: hidden;
}

button .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  transform: scale(0);
  animation: rippleAnim 0.6s linear;
  pointer-events: none;
}

@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}

/* Dark mode styles */
body.dark-mode {
  background: linear-gradient(135deg, #1f1f1f, #3a3a3a);
  color: #eee;
}

body.dark-mode #theme-toggle {
  background: #333;
  color: #fff;
}

body.dark-mode .login-container {
  background: #2a2a2a;
  color: #eee;
  box-shadow: 0 4px 10px rgba(255,255,255,0.1);
}

body.dark-mode .form-group label { color: #ccc; }

body.dark-mode .form-group input {
  background: #444;
  border: 1px solid #666;
  color: #eee;
}

body.dark-mode .btn {
  background: #555;
}

body.dark-mode .btn:hover {
  background: #777;
  box-shadow: 0 0 12px rgba(0, 242, 254, 0.7), 0 0 20px rgba(79, 172, 254, 0.5);
  animation: pulse 1.2s infinite;
}

/* Responsive tweaks */
@media (max-width: 480px) {
  .login-container {
    padding: 1.5rem;
    max-width: 90%;
  }
  #theme-toggle {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }
  .form-group input {
    font-size: 0.9rem;
    padding: 0.6rem;
  }
  .btn {
    font-size: 0.9rem;
    padding: 0.6rem;
  }
}

@media (max-width: 360px) {
  .login-container {
    padding: 1rem;
    max-width: 95%;
  }
  .login-container h2 {
    font-size: 1.2rem;
  }
  .form-group label {
    font-size: 0.85rem;
  }
  .form-group input {
    font-size: 0.85rem;
    padding: 0.5rem;
  }
  .btn {
    font-size: 0.85rem;
    padding: 0.5rem;
  }
  #theme-toggle {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
  }
}

.message {
  text-align: center;
  margin-top: 50px;
  padding: 20px;
  border-radius: 10px;
  width: 60%;
  margin-left: auto;
  margin-right: auto;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.message.success {
  background: #e6ffed;
  color: #2d7a2d;
  border: 1px solid #2d7a2d;
}

.message.error {
  background: #ffe6e6;
  color: #a12d2d;
  border: 1px solid #a12d2d;
}

.message h2 {
  margin-bottom: 20px;
}

.message .btn {
  display: inline-block;
  padding: 10px 20px;
  background: #4facfe;
  color: #fff;
  text-decoration: none;
  border-radius: 5px;
  transition: background 0.3s ease, transform 0.2s ease;
}

.message .btn:hover {
  background: #00c6fb;
  transform: scale(1.05);
}

.message #countdown {
  margin-top: 15px;
  font-size: 14px;
  font-style: italic;
  text-align: center;
  animation: fadeInMessage 0.8s ease-out forwards;
}

/* Success countdown text (green) */
.message.success #countdown {
  color: #2d7a2d;   /* matches success green */
}

/* Error countdown text (red) */
.message.error #countdown {
  color: #a12d2d;   /* matches error red */
}

.progress {
  width: 60%;
  height: 8px;
  background: #ddd;
  border-radius: 5px;
  margin: 10px auto;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 100%; /* start full */
}

.progress-bar.success {
  background: #2d7a2d; /* green bar for success */
  animation: shrinkBar 5s linear forwards;
}

.progress-bar.error {
  background: #a12d2d; /* red bar for error */
  animation: shrinkBar 5s linear forwards;
}

/* Smooth shrink animation */
@keyframes shrinkBar {
  from { width: 100%; }
  to   { width: 0%; }
}