/* Base Styles */
body {
  font-family: Arial, sans-serif;
  background-color: #f3f3f3;
  /* Using flexbox for centering the container */
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 1rem; /* Use rem for responsive padding */
  box-sizing: border-box;
}

.container {
  background-color: white;
  padding: 2rem; /* Use rem for responsive padding */
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px; /* Increased max-width for better desktop appearance */
  text-align: center;
  /* Added a bit of margin for small screens to prevent it from touching edges */
  margin: 0 1rem;
}

.logo img {
  width: 100px; /* Fixed width for the logo */
  height: auto; /* Ensure aspect ratio is maintained */
  margin-bottom: 1.5rem; /* Use rem for responsive spacing */
}

form input[type="text"],
form input[type="email"],
.password-wrapper input { /* Combined input styles for consistency */
  width: 100%;
  padding: 0.75rem; /* Use rem for responsive padding */
  margin: 0.5rem 0; /* Use rem for responsive spacing */
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
  font-size: 1rem; /* Ensure readable font size */
}

.password-wrapper {
  display: flex;
  align-items: center;
  margin: 0.5rem 0; /* Use rem for responsive spacing */
  width: 100%; /* Ensure wrapper takes full width */
}

/* Specific styling for the password input within the wrapper */
.password-wrapper input {
  flex: 1;
  border-right: none;
  border-radius: 6px 0 0 6px;
  outline: none;
}

.toggle-btn {
  padding: 0.75rem 1rem; /* Use rem for responsive padding */
  border: 1px solid #ccc;
  border-left: none;
  background-color: #eee;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  font-size: 1rem; /* Ensure readable font size */
  flex-shrink: 0; /* Prevent the button from shrinking on smaller screens */
}

.toggle-btn:hover {
  background-color: #ddd;
}

form button[type="submit"] {
  width: 100%;
  padding: 0.75rem; /* Use rem for responsive padding */
  background-color: #007BFF;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1.1rem; /* Slightly larger font for prominence */
  cursor: pointer;
  margin-top: 1rem; /* Use rem for responsive spacing */
  transition: background-color 0.3s ease; /* Smooth hover effect */
}

form button[type="submit"]:hover {
  background-color: #0056b3;
}

.login-link {
  margin-top: 1.2rem; /* Use rem for responsive spacing */
  font-size: 0.9rem; /* Use rem for responsive font size */
}

.login-link a {
  color: #007BFF;
  text-decoration: none;
  transition: text-decoration 0.3s ease; /* Smooth hover effect */
}

.login-link a:hover {
  text-decoration: underline;
}

.alert {
  padding: 0.8rem; /* Use rem for responsive padding */
  margin-bottom: 1rem; /* Use rem for responsive spacing */
  border-radius: 6px;
  font-size: 0.9rem; /* Use rem for responsive font size */
  text-align: center;
  line-height: 1.4; /* Improve readability of text within alerts */
}

.alert.success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert.error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* --- Media Queries --- */

/* Responsive adjustments for screens smaller than 768px (common tablet breakpoint) */
@media (max-width: 768px) {
  .container {
    padding: 1.5rem; /* Slightly reduced padding for tablets */
  }
}

/* Responsive adjustments for screens smaller than 480px (common phone breakpoint) */
@media (max-width: 480px) {
  body {
    padding: 0.5rem; /* Further reduced padding for very small screens */
  }

  .container {
    padding: 1rem; /* Reduced padding to fit smaller screens better */
    margin: 0 0.5rem; /* Small margin to prevent sticking to edges */
  }

  .logo img {
    width: 80px; /* Slightly smaller logo on very small screens */
    margin-bottom: 1rem;
  }

  form input[type="text"],
  form input[type="email"],
  .password-wrapper input {
    padding: 0.6rem; /* Slightly smaller input padding */
    font-size: 0.95rem; /* Slightly smaller font for inputs */
  }

  .toggle-btn {
    padding: 0.6rem 0.8rem; /* Adjusted padding for toggle button */
    font-size: 0.95rem; /* Slightly smaller font for toggle button */
  }

  form button[type="submit"] {
    padding: 0.6rem; /* Reduced button padding */
    font-size: 1rem; /* Adjusted button font size */
  }

  .login-link {
    font-size: 0.85rem; /* Smaller font for login link */
  }

  .alert {
    padding: 0.7rem; /* Adjusted alert padding */
    font-size: 0.85rem; /* Adjusted alert font size */
  }
}

/* Landscape mode for small phones (e.g., iPhone SE) */
@media (max-height: 400px) and (orientation: landscape) {
  body {
    padding: 0.5rem;
    align-items: flex-start; /* Adjust alignment for better fit in landscape */
  }

  .container {
    padding: 1rem;
    max-width: 300px; /* Reduce max-width for very short landscape screens */
    margin-top: 1rem; /* Add some top margin */
  }
}