/* Container for the whole form to make it look like a floating glass card */
.auth-container {
  max-width: 480px;
  margin: 40px auto;

  /* Solid white so the green text remains easy to read */
  background: var(--white-color);

  padding: 30px 30px;
  border-radius: 20px;
  border: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);

  box-sizing: border-box;
  width: 100%;
}

.auth-header h2 {
  text-align: center;
  margin-bottom: 24px;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--logo-color);
}

.auth-header p {
  text-align: center;
  margin-bottom: 16px;
  font-size: 1rem;
  color: var(--logo-color);
}

.auth-form {
  display: flex;
  flex-direction: column;
}

/* This restores the missing gaps between the fields inside the steps */
#step-1,
#step-2 {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#step-2 {
  display: none;
}

/* Base styling for all inputs AND dropdowns */
.auth-form input,
.auth-form select,
.input-dark {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--logo-color);
  background: var(--white-color);
  color: var(--logo-color);
  font-size: 16px;
  /* Crucial: 16px prevents iOS Safari from auto-zooming on focus */
  box-sizing: border-box;
  appearance: none;
}

/* Special styling for dropdown arrows */
.auth-form select,
select.input-dark {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23278f29' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

/* Ensure the dropdown list itself is readable when opened */
.auth-form select option,
select.input-dark option {
  background-color: var(--logo-color);
  color: var(--white-color);
  padding: 8px;
}

.auth-form input:focus,
.auth-form select:focus,
.input-dark:focus {
  outline: none;
  box-shadow: 0 0 8px rgba(0, 255, 153, 0.2);
  border-color: var(--logo-color);
}

.auth-form input::placeholder {
  color: var(--logo-color);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-weight: 600;
  color: var(--black-color);
  font-size: 0.9rem;
}

/* Shared Button Styles */
.btn-submit,
.btn-cancel {
  width: 100%;
  padding: 12px;
  /* Matches the inputs perfectly and lets text breathe */
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.2s ease;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  line-height: 1.2;
}

/* Primary Green Button */
.btn-submit {
  background: var(--logo-color);
  border: 1px solid var(--logo-color);
  color: var(--white-color);
}

.btn-submit:hover {
  background: var(--logo-color);
  box-shadow: 0 4px 12px var(--logo-color);
}

/* Secondary Cancel/Back Button */
.btn-cancel {
  background: var(--logo-color);
  color: var(--white-color);
  border: 1px solid var(--logo-color);
}

.btn-cancel:hover {
  background: var(--logo-color);
}

/* Flex container for side-by-side buttons on Desktop */
.button-group-row {
  display: flex;
  gap: 12px;
  margin: 0;
}

.button-group-row button {
  margin-top: 0;
}

/* --- THE FIX: Give the longer text more room --- */
.button-group-row .btn-cancel {
  flex: 1;
  /* Back button takes up 1/3 of the space */
}

.button-group-row .btn-submit {
  flex: 2;
  /* Submit button takes up 2/3 of the space so text won't wrap! */
}

/* Form error text */
#form-error {
  color: #ff4757;
  font-size: 14px;
  margin-bottom: 10px;
  text-align: center;
  font-weight: 600;
}

/* Red box for errors */
.error-msg {
  color: #ff5252;
  margin-top: 12px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  background: rgba(255, 82, 82, 0.1);
  padding: 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 82, 82, 0.3);
}

/* Green box for success */
.success-msg {
  color: var(--white-color);
  margin-top: 12px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--logo-color);
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--logo-color);
}

.switch-link {
  text-align: center;
  margin-top: 24px;
  font-size: 0.95rem;
  color: var(--logo-color);
}

.switch-link a {
  color: var(--logo-color);
  text-decoration: none;
  font-weight: 600;
  margin-left: 4px;
}

.switch-link a:hover {
  text-shadow: 0 0 8px rgba(0, 255, 120, 0.5);
}

/* ===============================
   EULA CHECKBOX & MODAL STYLES
=============================== */

/* Checkbox Container */
.eula-container {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--black-color);
  margin: 0;
}

#eula-error {
  margin: 4px 0 0 5px;
}

#eula-error:not(.hidden) {
  display: block;
}

.eula-text-box.inline-eula {
  border: 1px solid var(--logo-color);
  border-radius: 8px;
  padding: 15px;
  margin: 0;
}

.eula-text-box.inline-eula h2 {
  color: var(--logo-color);
  font-size: 1.2rem;
  margin-bottom: 15px;
  margin-top: 0;
}

/* 1. The Custom Checkbox Base */
.eula-container input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  padding: 0 !important;
  width: 16px !important;
  height: 16px !important;
  margin-top: 3px;
  cursor: pointer;
  border: 1.5px solid var(--logo-color);
  border-radius: 3px;
  background-color: transparent;
  flex-shrink: 0;
  transition: all 0.2s ease-in-out;
}

/* 2. The Filled State with a Flawless SVG Checkmark */
.eula-container input[type="checkbox"]:checked {
  background-color: var(--logo-color);
  border-color: var(--logo-color);
  /* Using a filled SVG path instead of a stroke. It scales perfectly without clipping. */
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
  background-size: 100% 100%;
  /* Forces the tick to fill the box edge-to-edge perfectly */
  background-position: center;
  background-repeat: no-repeat;
}

.eula-container a {
  color: var(--logo-color);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

/* EULA Modal Overlay */
.eula-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

/* Modal Content Box */
.eula-modal-content {
  background-color: #ffffff;
  margin: 5% auto;
  padding: 30px;
  border-radius: 12px;
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  position: relative;
  display: flex;
  flex-direction: column;
}

.eula-modal-content h2 {
  color: var(--logo-color);
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 1.5rem;
  padding-right: 30px;
  line-height: 1.3;
}

/* Scrollable Text Area */
.eula-text-box {
  overflow-y: auto;
  padding-right: 15px;
  color: var(--black-color, #333);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* === FORMATTING FIXES (Paragraphs, Lists, Bold Text) === */
.eula-text-box p {
  margin-bottom: 16px;
}

/* Formats the <strong> tags as clear section headers */
.eula-text-box strong {
  display: inline-block;
  margin-top: 15px;
  margin-bottom: 5px;
  color: var(--logo-color);
  font-size: 1.05rem;
}

/* Inline bold text without adding line gaps */
.eula-inline-bold {
  color: var(--black-color, #000);
  font-weight: bold;
}

/* Overrides any global CSS resets blocking the list numbers */
.eula-text-box ol {
  list-style-type: decimal !important;
  padding-left: 30px !important;
  margin-bottom: 20px;
  margin-top: 10px;
}

.eula-text-box li {
  margin-bottom: 8px;
  display: list-item !important;
}

/* Close Button (X) */
.close-eula {
  color: var(--logo-color);
  position: absolute;
  top: 20px;
  right: 25px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.2s ease;
  line-height: 1;
}

.close-eula:hover {
  opacity: 0.7;
  /* Makes it fade slightly on hover so users know it's clickable */
}

/* ===============================
   MOBILE RESPONSIVE LAYOUT
=============================== */
@media screen and (max-width: 768px) {
  .eula-modal-content {
    width: 95%;
    margin: 10% auto;
    /* Centers it better on small screens */
    padding: 20px 15px 20px 20px;
    /* Reduces padding to save space */
    max-height: 80vh;
  }

  .eula-modal-content h2 {
    font-size: 1.25rem;
    /* Slightly smaller title */
    margin-bottom: 15px;
    padding-right: 25px;
    /* Adjusts clearance for the 'X' button */
  }

  .eula-text-box {
    font-size: 0.9rem;
    /* Scales text down for readability */
    padding-right: 10px;
  }

  .eula-text-box ol {
    padding-left: 20px !important;
    /* Pulls lists in tighter */
  }

  .close-eula {
    top: 15px;
    right: 15px;
    font-size: 24px;
  }

  .eula-container {
    font-size: 0.85rem;
  }
}

/* =========================================
   MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 600px) {
  .auth-container {
    width: 92%;
    margin: 20px auto;
    padding: 24px 20px;
  }

  .auth-header h2 {
    font-size: 1.5rem;
  }

  .form-group label {
    font-size: 0.9rem;
  }

  .button-group-row {
    flex-direction: column-reverse;
    gap: 12px;
  }

  .button-group-row .btn-cancel,
  .button-group-row .btn-submit {
    width: 100%;
  }
}

/* Small phones — full-bleed, no card chrome */
@media (max-width: 480px) {
  .auth-container {
    max-width: 100%;
    width: 100%;
    margin: 0;
    padding: 32px 20px 40px;
    border-radius: 0;
    box-shadow: none;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
  }

  .auth-header h2 {
    font-size: 1.6rem;
  }

  .auth-header p {
    font-size: 0.9rem;
  }

  .auth-form input,
  .auth-form select {
    font-size: 16px;
    padding: 14px 12px;
  }

  .btn-submit {
    padding: 14px;
    font-size: 16px;
    margin-top: 16px;
  }
}

/* ===== SHARED FORM UTILITY CLASSES ===== */

/* Red required asterisk */
.required-star {
  color: #ff4757;
}

/* Password field wrapper (for eye icon positioning) */
.password-wrapper {
  position: relative;
}

/* Input with room for eye icon on the right */
.password-with-icon {
  padding-right: 40px !important;
}

/* Absolutely positioned eye toggle icon */
.password-toggle-icon {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: var(--logo-color);
}

/* Forgot password link row — tighter top margin */
.forgot-password-link {
  margin-top: 5px;
}

/* Forgot password link colour (cyan) */
.forgot-link {
  color: var(--cyan, var(--logo-color));
}

/* Inline field error (e.g. duplicate email, bad username) */
.field-error {
  color: #ff4757;
  font-size: 12px;
  margin-top: 5px;
  display: block;
}

/* Inline field hint (e.g. password requirements) */
.field-hint {
  color: #a0a0a0;
  font-size: 12px;
  margin-top: 5px;
}

/* Utility: hidden element (JS will remove this class to show) */
.hidden {
  display: none;
}

/* Required field asterisk (reset_password.html uses text-required) */
.text-required {
  color: #ff4757;
}

/* ===============================
   MATH CAPTCHA STYLES
=============================== */
.captcha-group {
  margin-top: 10px;
  margin-bottom: 5px;
}

.captcha-row {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

.captcha-question-box {
  flex: 0 0 100px;
  border: 1px solid var(--logo-color);
  background: #eaf5eb;
  color: var(--logo-color);
  font-weight: bold;
  font-size: 16px;
  padding: 12px;
  border-radius: 8px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.captcha-input {
  flex: 1 !important;
  text-align: center;
  padding: 12px !important;
  font-size: 16px !important;
  border-radius: 8px !important;
  width: auto !important;
  min-width: 0;
}

.btn-refresh {
  flex: 0 0 110px;
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  color: #475569;
  padding: 12px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  box-sizing: border-box;
  margin-top: 0;
}

.btn-refresh:hover {
  background: #cbd5e1;
}

@media (max-width: 480px) {
  .captcha-row {
    flex-direction: column;
    align-items: stretch;
  }
}