:root {
  --primary-color: #00ffbc;
  --primary-hover: #00e6a8;
  --primary-dark: #004d40;
  --primary-light: rgba(0, 255, 188, 0.1);
  --primary-gradient: linear-gradient(135deg, #00ffbc 0%, #00b386 100%);
  --accent-color: #00ffbc;
  --bg-dark: #050505;
  --text-white: #ffffff;
  --bg: #ffffff;
  --text: #0A0A0A;
  --medium-gray: #e9ecef;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  --shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.15);
}

body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background-color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow-x: hidden;
  min-height: 50vh;
  color: var(--text);
  padding: 10px 0;
}

.topp {
  margin-top: -25px;
}

header {
  display: flex;
  align-items: center;
  padding: 15px 40px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: 70px;
}

.logo {
  display: inline-flex;
  margin-left: -18px;
  margin-top: -10px;
}

.logo a {
  position: relative;
  display: flex;
  align-items: center;
  height: 35px;
  overflow: hidden;
  color: inherit;
}

.logo img {
  height: 35px;
  width: auto;
  display: block;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

header h1 {
  margin-left: 40px;
  margin-top: 26.5px;
  color: var(--primary-dark);
  text-decoration: none;
  font-size: 24px;
}

header a {
  text-decoration: none;
  font-weight: 700;
  font-size: 24px;
  color: var(--primary-dark);
  flex-shrink: 0;
}

.topp {
  margin-top: -30px;
}

.form-container {
  background-color: var(--bg);
  padding: 1.5rem;
  border-radius: 1.2rem;
  box-shadow: 0 2rem 3rem rgba(1, 68, 33, 0.18);
  max-width: 520px;
  width: 100%;
  margin-top: 20px;
}

.form-container h2 {
  color: var(--primary-dark);
  font-size: 1.8rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  margin-top: 20px;
  background: linear-gradient(
    135deg,
    var(--primary-dark),
    var(--primary-light)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 0.75rem;
  margin: 0.5rem 0;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 14px;
  box-sizing: border-box;
}

input:focus {
  border-color: #00ff88;
  box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.25);
  outline: none;
}

input.error:focus,
input.input-error:focus {
  border-color: var(--primary-red) !important;
  box-shadow: none !important;
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #fff;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 0.65rem;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 1rem;
  transition: background-color 0.2s ease;
  width: 100%;
}

.google-btn:hover {
  background-color: #ffffff;
}

.google-btn img {
  width: 20px;
  height: 20px;
  margin-right: 0.5rem;
}

input:hover,
select:hover,
.google-btn:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.staff-login-notice {
  margin: 0.75rem 0 1.25rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid #e5e7eb;
  border-left: 3px solid #014421;
  border-radius: 6px;
  font-size: 13px;
  color: #4b5563;
  background: #f9fafb;
}

.staff-login-notice i {
  color: #014421;
  margin-right: 0.4rem;
}

.or-divider {
  text-align: center;
  margin: 1.5rem 0;
  position: relative;
  font-size: 14px;
  color: #9ca3af;
  font-weight: 500;
}

.or-divider::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent,
    #e5e7eb 20%,
    #e5e7eb 80%,
    transparent
  );
  z-index: 1;
}

.or-divider span {
  background: var(--bg);
  padding: 0 1rem;
  position: relative;
  z-index: 2;
}

.submit-btn {
  background: #014421; /* Émeraude profond */
  color: white !important;
  border: none;
  padding: 0.75rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(1, 68, 33, 0.2);
}

.submit-btn:hover {
  background: #013315; /* Plus sombre pour le hover */
  box-shadow: 0 8px 25px rgba(1, 68, 33, 0.3);
}

.submit-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: left 0.5s;
}

.submit-btn:hover::before {
  left: 100%;
}

.submit-btn:hover {
  box-shadow: 0 8px 25px rgba(1, 68, 33, 0.3);
}

.submit-btn:active {
  transform: translateY(-1px);
}

.signup-redirect {
  text-align: center;
  margin-top: 1rem;
  font-size: 14px;
}

.signup-redirect a {
  color: #014421; /* Émeraude profond */
  text-decoration: none;
  font-weight: 600;
  position: relative;
}

.signup-redirect a::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 2px;
  bottom: -2px;
  left: 0;
  background-color: #014421;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.signup-redirect a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.signup-redirect a:hover {
  color: #014421;
}

/* Flash Messages Styling */
.alert {
  padding: 10px;
  margin-bottom: 5px;
  border: 1px solid transparent;
  border-radius: 4px;
  position: relative; /* For positioning the close button */
  opacity: 0; /* Initially hidden for fade-in */
  transition: opacity 0.5s ease-out; /* Animate opacity only */
}

.alert-success {
  color: #155724;
  background-color: #d4edda;
  border-color: #c3e6cb;
}

.alert-danger {
  color: #721c24;
  background-color: #f8d7da;
  border-color: #f5c6cb;
}

.alert-info {
  color: #0c5460;
  background-color: #d1ecf1;
  border-color: #bee5eb;
}

.alert-warning {
  color: #856404;
  background-color: #fff3cd;
  border-color: #ffeeba;
}

.btn-close {
  position: absolute;
  top: 10px;
  right: 15px;
  background-color: transparent;
  border: none;
  font-size: 1.2rem;
  font-weight: bold;
  color: inherit; /* Inherits color from parent .alert-* */
  opacity: 0.7;
  cursor: pointer;
}

.btn-close:hover {
  opacity: 1;
}

.alert-visible {
  opacity: 1;
}

.alert.show {
  opacity: 1;
}

/* Styles for password toggle - Added from login2.css logic */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

/* Assuming WTForms renders the input directly inside password-wrapper */
.password-wrapper input[type="password"],
.password-wrapper input[type="text"] {
  /* Handles when type changes */
  padding-right: 45px; /* Make space for the icon button */
  width: 100%; /* Ensure it takes full width of its container */
  box-sizing: border-box; /* Important if padding/border are added */
}

.toggle-password {
  position: absolute;
  right: 10px; /* Adjust as needed */
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px; /* Adjust for better click area */
  color: #777;
  display: flex; /* To center icon if needed */
  align-items: center;
  justify-content: center;
  font-size: 1rem; /* Adjust icon size if needed */
}

.toggle-password:hover {
  color: var(--primary-dark);
}

/* New alert in bottom right for weak password */
.password-weakness-alert {
  position: fixed;
  bottom: 80px; /* Remonté de 20px à 80px */
  right: 20px;
  background: linear-gradient(135deg, #34495e, #2c3e50);
  color: #ecf0f1;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  max-width: 320px;
  display: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: translateY(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.password-weakness-alert.show {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.password-weakness-alert .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #ecf0f1;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.password-weakness-alert .close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.password-weakness-alert h4 {
  margin-top: 0;
  margin-bottom: 15px;
  font-size: 16px;
  font-weight: 600;
  color: #ffffff;
}

.password-weakness-alert ul {
  padding-left: 0;
  margin: 0;
  list-style-type: none;
}

.password-weakness-alert li {
  font-size: 0.9em;
  color: #bdc3c7;
  margin-bottom: 8px;
  transition: color 0.3s ease;
  display: flex;
  align-items: center;
}

.password-weakness-alert li .req-icon {
    margin-right: 10px;
    width: 16px;
    text-align: center;
    color: #e74c3c;
    transition: color 0.3s ease;
}

.password-weakness-alert li.valid {
  color: #2ecc71;
}

.password-weakness-alert li.valid .req-icon {
    color: #2ecc71;
}

.password-weakness-alert p {
    color: #bdc3c7;
    margin: 5px 0 15px;
    font-size: 0.9em;
}

/* Animation de chargement */
.loading {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 1s linear infinite;
  margin-right: 8px;
}

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

/* Validation des champs */
.input-group {
  position: relative;
  margin-bottom: 1rem;
}

.input-group label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 500;
  color: var(--text);
}

.input-error {
  border-color: #dc3545 !important;
  box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}

.error-message {
  color: #dc3545;
  font-size: 12px;
  margin-top: 0.25rem;
  display: none;
}

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

/* Animation pour l'alerte qui slide */
@keyframes slideInUp {
  from {
    transform: translateX(100%) translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateX(0) translateY(0);
    opacity: 1;
  }
}

@keyframes slideOutDown {
  from {
    transform: translateX(0) translateY(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%) translateY(20px);
    opacity: 0;
  }
}

/* Styling for Remember Me checkbox */
.form-group.checkbox {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1rem 0;
  gap: 0.5rem;
}

/* Login custom checkbox (same system as signup pages) */
.form-group.checkbox .custom-checkbox {
  position: relative;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.form-group.checkbox .custom-checkbox input[type="checkbox"] {
  opacity: 0;
  position: absolute;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.form-group.checkbox .custom-checkbox .checkmark {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 3px;
}

.form-group.checkbox .custom-checkbox .checkmark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -60%) rotate(45deg) scale(0);
}

.form-group.checkbox .custom-checkbox input[type="checkbox"]:checked + .checkmark {
  background: #014421;
  border-color: #014421;
}

.form-group.checkbox .custom-checkbox input[type="checkbox"]:checked + .checkmark::after {
  transform: translate(-50%, -60%) rotate(45deg) scale(1);
}

.form-group.checkbox label {
  display: flex;
  align-items: center;
  margin: 0;
  font-size: 14px;
  color: #555;
  font-weight: normal;
  gap: 0.5rem;
}

.form-group.checkbox a {
  color: #014421;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  position: relative;
  display: inline-block;
  padding-bottom: 2px;
}

/* Ultra-specific animation for forgot password link */
.form-group.checkbox a[href$="forgot-password"],
.form-group.checkbox a[href*="forgot_password"] {
  position: relative !important;
  display: inline-block !important;
  padding-bottom: 2px !important;
}

.form-group.checkbox a::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
}

.form-group.checkbox a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.form-group.checkbox a:hover {
  text-decoration: none;
  opacity: 0.9;
}

/* Error states for form fields */
.form-group.error input,
.form-group.error select {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

/* Password Strength Indicator Styles */
#passwordStrengthBar {
  width: 100%;
  height: 8px;
  background-color: #fff;
  border-radius: 4px;
  margin-top: 0.5rem;
  overflow: hidden;
}

#passwordStrengthFill {
  height: 100%;
  width: 0%;
  background-color: #dc3545;
  border-radius: 4px;
  transition: width 0.3s, background-color 0.3s;
}

#passwordStrengthContainer {
  margin-top: 0.5rem;
  background: white;
  border-radius: 4px;
  height: 4px;
  overflow: hidden;
}

/* End Password Strength Indicator Styles */

/* Screen-reader only */
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border-width:0; }

@media (max-width: 768px) {
  header {
    padding: 15px 20px;
  }
}
