/* TODO make it cooler! */

body {
  font-family: sans-serif;
  color: #333;
}

main {
  margin: 0 auto;
}

/* Page header with markdown-style hierarchical titles */
.page-header {
  text-align: center;
  margin-bottom: 2.5em;
  margin-top: 2em;
  border-bottom: 2px solid #e9ecef;
  padding-bottom: 1rem;
}

.page-header h1 {
  font-size: 2.2em;
  margin: 0 0 0.5rem 0;
  color: #2c3e50;
  font-weight: 600;
  text-align: center;
}

.page-header h2 {
  font-size: 1.4em;
  margin: 0;
  color: #6c757d;
  font-weight: 400;
  font-style: italic;
  text-align: center;
}

h1 {
  font-size: 2em;
  margin-bottom: 2.5em;
  margin-top: 2em;
  text-align: center;
}

form {
  border-radius: 0.2rem;
  border: 1px solid #CCC;
  margin: 0 auto;
  max-width: 16rem;
  padding: 2rem 2.5rem 1.5rem 2.5rem;
}

/* Two-phase layout styles */
.phase-container {
  transition: opacity 0.3s ease-in-out;
}

.phase-container h2 {
  font-size: 1.3em;
  margin-bottom: 1em;
  color: #2c3e50;
  text-align: center;
}

.user-info {
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
  border-radius: 0.3rem;
  padding: 1rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.user-info p {
  margin: 0 0 0.5rem 0;
  color: #155724;
}

.logout-btn {
  background-color: #6c757d;
  color: white;
  border: none;
  padding: 0.3rem 0.8rem;
  border-radius: 0.2rem;
  font-size: 0.8em;
  cursor: pointer;
  transition: background-color 0.2s;
}

.logout-btn:hover {
  background-color: #5a6268;
}

.info-text {
  margin-top: 1rem;
  padding: 0.8rem;
  background-color: #e7f3ff;
  border: 1px solid #bee5eb;
  border-radius: 0.3rem;
}

.info-text p {
  margin: 0;
  font-size: 0.9em;
  color: #0c5460;
  text-align: center;
}

input {
  background-color: #FAFAFA;
  border-radius: 0.2rem;
  border: 1px solid #CCC;
  box-shadow: inset 0 1px 3px #DDD;
  box-sizing: border-box;
  display: block;
  font-size: 1em;
  padding: 0.4em 0.6em;
  width: 100%;
}

input:focus {
  background-color: #FFF;
  border-color: #51A7E8;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075) inset, 0 0 5px rgba(81, 167, 232, 0.5);
  outline: 0;
}

label {
  color: #666;
  display: block;
  font-size: 0.9em;
  font-weight: bold;
  margin: 1em 0 0.25em 0;
}

button {
  background-color: #60B044;
  background-image: linear-gradient(#8ADD6D, #60B044);
  border-radius: 0.2rem;
  border: 1px solid #5CA941;
  box-sizing: border-box;
  color: #fff;
  cursor: pointer;
  display: block;
  font-size: 0.9em;
  font-weight: bold;
  margin: 2em 0 0.5em 0;
  padding: 0.5em 0.7em;
  text-align: center;
  text-decoration: none;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
  user-select: none;
  white-space: nowrap;
}

button:focus,
button:hover {
  background-color: #569E3D;
  background-image: linear-gradient(#79D858, #569E3D);
  border-color: #4A993E;
}

.alerts {
  margin: 2rem auto 0 auto;
  max-width: 30rem;
}

.alert {
  border-radius: 0.2rem;
  border: 1px solid;
  color: #fff;
  padding: 0.7em 1.5em;
}

.alert.error {
  background-color: #E74C3C;
  border-color: #C0392B;
}

.alert.success {
  background-color: #60B044;
  border-color: #5CA941;
}


@media only screen and (max-width: 480px) {

  form {
    border: 0;
  }
}

/* Password Strength Meter Styles */
.password-strength-container {
  margin-top: 0.5em;
  margin-bottom: 1em;
}

.password-strength-meter {
  background-color: #e0e0e0;
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 0.5em;
}

.strength-bar {
  height: 100%;
  transition: width 0.3s ease, background-color 0.3s ease;
  border-radius: 4px;
}

.strength-bar.strength-weak {
  background-color: #e74c3c;
}

.strength-bar.strength-fair {
  background-color: #f39c12;
}

.strength-bar.strength-good {
  background-color: #3498db;
}

.strength-bar.strength-strong {
  background-color: #27ae60;
}

.strength-text {
  font-size: 0.8em;
  font-weight: bold;
  margin-bottom: 0.5em;
}

.strength-text.strength-weak {
  color: #e74c3c;
}

.strength-text.strength-fair {
  color: #f39c12;
}

.strength-text.strength-good {
  color: #3498db;
}

.strength-text.strength-strong {
  color: #27ae60;
}

.strength-requirements {
  font-size: 0.75em;
  line-height: 1.3;
}

.strength-requirements ul {
  margin: 0;
  padding-left: 1.2em;
}

.strength-requirements li {
  margin-bottom: 0.2em;
}

.requirement-error {
  color: #e74c3c;
}

.requirement-success {
  color: #27ae60;
  font-weight: bold;
}

/* Disabled button styling */
button:disabled {
  background-color: #bdc3c7;
  background-image: none;
  border-color: #95a5a6;
  cursor: not-allowed;
  opacity: 0.6;
}

button:disabled:hover {
  background-color: #bdc3c7;
  background-image: none;
  border-color: #95a5a6;
}

/* Password confirmation validation styles */
input:invalid {
  border-color: #e74c3c;
  box-shadow: inset 0 1px 3px #DDD, 0 0 5px rgba(231, 76, 60, 0.3);
}

input:invalid:focus {
  border-color: #c0392b;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075) inset, 0 0 5px rgba(192, 57, 43, 0.5);
}

/* Password confirmation container and indicator */
.password-confirm-container {
  position: relative;
  display: block;
}

.password-match-indicator {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2em;
  pointer-events: none;
}

.password-match-indicator.match {
  color: #27ae60;
}

.password-match-indicator.no-match {
  color: #e74c3c;
}

/* Modal Popup Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s ease-in-out;
}

.modal-content {
  background-color: #fff;
  margin: 15% auto;
  padding: 0;
  border: none;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s ease-out;
}

.modal-header {
  background-color: #f8f9fa;
  padding: 15px 20px;
  border-bottom: 1px solid #dee2e6;
  border-radius: 8px 8px 0 0;
}

.modal-header h3 {
  margin: 0;
  color: #333;
  font-size: 1.25em;
  text-align: center;
}

.modal-header.success {
  background-color: #d4edda;
  color: #155724;
  border-bottom-color: #c3e6cb;
}

.modal-header.error {
  background-color: #f8d7da;
  color: #721c24;
  border-bottom-color: #f5c6cb;
}

.modal-body {
  padding: 20px;
  line-height: 1.5;
}

.modal-footer {
  padding: 15px 20px;
  text-align: right;
  border-top: 1px solid #dee2e6;
  border-radius: 0 0 8px 8px;
}

.modal-btn {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1em;
  min-width: 80px;
  transition: background-color 0.3s;
}

.modal-btn:hover {
  background-color: #0056b3;
}

.modal-btn.success {
  background-color: #28a745;
}

.modal-btn.success:hover {
  background-color: #1e7e34;
}

.modal-btn.error {
  background-color: #dc3545;
}

.modal-btn.error:hover {
  background-color: #bd2130;
}

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

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

/* Turnstile CAPTCHA Styling */
.cf-turnstile {
  margin: 1rem 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Submit button states for CAPTCHA interaction */
button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transition: opacity 0.3s ease;
}

button[type="submit"]:not(:disabled) {
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* Responsive adjustments for Turnstile */
@media (max-width: 480px) {
  .cf-turnstile {
    margin: 0.8rem 0;
  }
}
