/**
 * Auth Forms - Modern CSS Framework
 * Maintains the gaming aesthetic with clean, maintainable code
 */

/* ================================
   RESET & BASE
   ================================ */

.auth-page {
  font-family: 'Roboto', sans-serif;
  font-size: 14px;
  color: #000;
  line-height: 1.5;
}

.auth-page * {
  box-sizing: border-box;
}

/* ================================
   LAYOUT - PAGE HEADER
   ================================ */

.auth-header {
  display: flex;
  width: 100%;
  height: 150px;
  margin-bottom: 20px;
}

.auth-header__icon {
  flex-shrink: 0;
  width: 146px;
  height: 150px;
  background-image: url('/lay/manage.jpg');
  background-size: cover;
  background-position: center;
}

.auth-header__content {
  flex: 1;
  padding: 20px 0 0 20px;
}

.auth-header__title {
  margin: 0 0 10px 0;
  font-size: 30px;
  font-weight: 400;
}

.auth-header__divider {
  margin: 0 0 10px 0;
  border: none;
  border-bottom: 1px solid #ccc;
  display: block;
}

.auth-header__breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
  font-size: 14px;
  line-height: 19px;
}

.auth-header__breadcrumb img {
  width: 16px;
  height: auto;
}

.auth-header__breadcrumb a {
  color: #0089f6;
  text-decoration: none;
}

.auth-header__breadcrumb a:hover {
  color: #03a9f4;
}

/* ================================
   FORMS - BASE STRUCTURE
   ================================ */

.auth-form {
  width: 100%;
  margin: 0;
}

.auth-form__row {
  display: flex;
  align-items: center;
  margin-bottom: 14px;
  position: relative;
}

.auth-form__label {
  flex-shrink: 0;
  width: 180px;
  padding-left: 33px;
  font-weight: bold;
  text-align: left;
}

.auth-form__input-wrapper {
  flex: 1;
  max-width: 350px;
}

/* ================================
   FORMS - INPUT ELEMENTS
   ================================ */

.auth-input {
  width: 100%;
  padding: 8px 12px;
  height: 30px;
  border: 1px solid rgba(138, 138, 138, 0.98);
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
  background-repeat: no-repeat;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-input:focus {
  outline: none;
  border-color: #0089f6;
  box-shadow: 0 0 0 2px rgba(0, 137, 246, 0.1);
}

.auth-input::placeholder {
  color: #999;
}

/* Input validation states */
.auth-input.is-valid {
  border-color: #4caf50;
  box-shadow: 0 0 5px rgba(76, 175, 80, 0.3);
}

.auth-input.is-invalid {
  border-color: #f44336;
  box-shadow: 0 0 5px rgba(244, 67, 54, 0.3);
}

.auth-select {
  width: 100%;
  max-width: 350px;
  padding: 6px 12px;
  height: 30px;
  border: 1px solid rgba(138, 138, 138, 0.98);
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
  background-repeat: no-repeat;
}

.auth-select:focus {
  outline: none;
  border-color: #0089f6;
}

/* ================================
   FORMS - ACTIONS & BUTTONS
   ================================ */

.auth-form__actions {
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 20px 0 20px 146px;
  flex-wrap: wrap;
}

/* ================================
   BUTTONS - Reusable throughout app
   ================================ */

/* buttons: see .ui-btn in site-custom.css */

/* ================================
   FORMS - LINKS & MESSAGES
   ================================ */

.auth-links {
  margin-top: 20px;
  text-align: left;
}

.auth-link {
  display: block;
  margin: 10px 0;
  color: #0089f6;
  text-decoration: none;
  font-weight: 500;
}

.auth-link:hover {
  color: #03a9f4;
  text-decoration: underline;
}

.auth-link--centered {
  text-align: center;
}

.auth-link--spaced {
  margin-left: 150px;
}

/* Error messages */
.auth-error {
  display: none;
  margin-top: 8px;
  margin-left: 182px;
  color: #f44336;
  font-weight: bold;
  font-size: 13px;
}

.auth-error.is-visible {
  display: block;
}

/* ================================
   TABLE/BOX COMPONENT
   ================================ */

.auth-table {
  background-image: url(/template/images/table-bg.jpg);
  background-size: cover;
  font-size: 14px;
  width: 100%;
  border: 1px solid black;
  padding: 20px;
  box-shadow: 0 0 1px 1px black;
  margin-bottom: 20px;
}

.auth-table__title {
  margin: 5px 0;
  padding: 5px;
  font-size: 16px;
  font-weight: bold;
  color: #8b4513;
  text-decoration: underline;
}

.auth-table__text {
  padding: 7px;
  line-height: 1.6;
}

.auth-table__text--highlight {
  color: #8b4513;
  text-decoration: underline;
  font-weight: 300;
}

/* ================================
   RADIO GROUPS
   ================================ */

.auth-radio-group {
  margin: 15px 0;
  line-height: 1.6;
}

.auth-radio-option {
  display: block;
  margin: 12px 0;
  line-height: 1.6;
}

.auth-radio-option label {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-weight: normal;
  width: 100%;
}

.auth-radio-option input[type="radio"] {
  flex-shrink: 0;
  width: auto;
  height: auto;
  margin: 4px 0 0 0;
  cursor: pointer;
}

.auth-radio-option label span {
  flex: 1;
  display: inline-block;
}

/* ================================
   REGISTER PAGE SPECIFIC
   ================================ */

.auth-page--register {
  max-width: 800px;
  margin: 0 auto;
}

.auth-form__help {
  margin: 8px 0 0 0;
  font-size: 13px;
  color: #555;
  line-height: 1.5;
}

.auth-form__agreement {
  margin: 20px 0 20px 180px;
  font-size: 14px;
}

.auth-form__agreement a {
  color: #0089f6;
  text-decoration: none;
}

.auth-form__agreement a:hover {
  color: #03a9f4;
  text-decoration: underline;
}

.auth-form__submit {
  text-align: center;
  margin: 20px 0;
}

.auth-captcha {
  margin-bottom: 10px;
}

.auth-captcha img {
  border: 0;
  display: block;
}

.auth-input--captcha {
  text-align: center;
  max-width: 220px;
}

/* Country select with flag */
.auth-select--country {
  background-position: 304px 7px;
  background-repeat: no-repeat;
  padding-right: 50px;
}

/* ================================
   UTILITY CLASSES
   ================================ */

.auth-separator {
  clear: both;
  height: 20px;
}

.auth-text-center {
  text-align: center;
}

.auth-hidden {
  display: none;
}

/* Fake fields for browser autofill workaround */
.auth-fake-field {
  display: none !important;
  position: absolute;
  left: -9999px;
}

/* ================================
   LOADING SPINNER
   ================================ */

.auth-loader {
  display: none;
  justify-content: center;
  padding: 20px 0;
}

.auth-loader.is-active {
  display: flex;
}

.auth-loader__spinner {
  border: 10px solid #f3f3f3;
  border-radius: 50%;
  border-top: 10px solid #32cd32;
  border-bottom: 10px solid #32cd32;
  width: 60px;
  height: 60px;
  animation: auth-spin 2s linear infinite;
}

@keyframes auth-spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* ================================
   RESPONSIVE ADJUSTMENTS
   ================================ */

@media (max-width: 768px) {
  .auth-header {
    flex-direction: column;
    height: auto;
  }

  .auth-header__icon {
    width: 100%;
    height: 100px;
  }

  .auth-header__content {
    padding: 15px;
  }

  .auth-form__row {
    flex-direction: column;
    align-items: flex-start;
  }

  .auth-form__label {
    width: 100%;
    padding-left: 0;
    margin-bottom: 5px;
  }

  .auth-form__input-wrapper {
    width: 100%;
    max-width: 100%;
  }

  .auth-input,
  .auth-select {
    max-width: 100%;
  }

  .auth-form__actions {
    margin-left: 0;
    justify-content: center;
  }

  .auth-link--spaced {
    margin-left: 0;
    text-align: center;
  }

  .auth-error {
    margin-left: 0;
  }

  .auth-form__agreement {
    margin-left: 0;
  }

  .auth-form__help {
    margin-left: 0;
  }

  .auth-select--country {
    background-position: calc(100% - 10px) 7px;
  }
}

/* ================================
   LEGACY COMPATIBILITY
   ================================ */

/* Support for old .form class */
form.form .auth-form__row {
  /* Maintains compatibility if .form class is still used */
}


/* Show/hide toggle for masked fields */
.auth-form__input-wrapper {
  position: relative;
}

.auth-reveal {
  position: absolute;
  left: 318px;
  top: 0;
  width: 30px;
  height: 30px;
  border: 0;
  background: none;
  color: #777;
  cursor: pointer;
}

.auth-reveal:hover {
  color: #222;
}

/* Searchable country picker (Tom Select) sized like the other inputs */
.auth-form .ts-wrapper {
  max-width: 350px;
}

.auth-form .ts-control {
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid rgba(138, 138, 138, 0.98);
  border-radius: 4px;
  font-size: 14px;
  box-shadow: none;
}

.auth-form .ts-wrapper.focus .ts-control {
  border-color: #1f6f6a;
  box-shadow: 0 0 0 3px rgba(31, 111, 106, 0.28);
}

.auth-form .ts-control input {
  width: auto;
  height: auto;
  border: 0;
  padding: 0;
}

.auth-form .ts-dropdown {
  font-size: 14px;
}

.auth-country__option {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-country__flag {
  width: 16px;
  height: 11px;
  flex: none;
}

/* Tom Select copies the <select> classes onto its wrapper: drop the legacy select box there */
.auth-form .ts-wrapper.auth-select {
  height: auto;
  padding: 0;
  border: 0;
  background: none;
}

/* while searching, show only what is being typed */
.auth-form .ts-wrapper.single.dropdown-active .item {
  display: none;
}

/* ================================
   LOGIN PAGE (integrated with the existing game frame)
   Palette follows the account area: deep teal, gold trim, stone buttons.
   ================================ */

.auth-page--login {
  padding: 32px 20px 28px;
}

.login {
  max-width: 420px;
  margin: 0 auto;
}

/* The site's ornate content frame is the only container. */
.login__head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 24px;
  margin-bottom: 26px;
  border-bottom: 1px solid #a88a4c;
}

.login__crest {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border: 2px solid #a88a4c;
  border-radius: 50%;
  overflow: hidden;
  background: #173d3b;
  box-shadow: 0 0 0 3px rgba(168, 138, 76, 0.14);
}

.login__crest img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login__intro {
  min-width: 0;
}

.login__title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  color: #173d3b;
}

.login__subtitle {
  margin: 8px 0 0;
  font-size: 13.5px;
  color: #505b5b;
}

.auth-page--login .login__form {
  width: 100%;
  margin: 0;
  padding: 0;
}

.login__alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid #e6a5a0;
  border-radius: 4px;
  background: #fdecea;
  color: #8f1d17;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
}

.login__alert i {
  margin-top: 2px;
}

.login__field {
  margin: 0 0 16px;
}

.auth-page--login .login__label {
  display: block;
  float: none;
  width: auto;
  margin: 0 0 6px;
  padding: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #3b4a4d;
}

.login__link {
  display: block;
  width: fit-content;
  margin: 8px 0 0 auto;
  font-size: 12.5px;
  font-weight: 600;
  color: #1f6f6a;
  text-decoration: none;
}

.login__link:hover {
  text-decoration: underline;
}

.login__control {
  position: relative;
}

.login__icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #8a949a;
  font-size: 14px;
  pointer-events: none;
  transition: color 0.15s ease;
}

.login__control:focus-within .login__icon {
  color: #1f4d4a;
}

.auth-page--login .login__input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  height: 46px;
  margin: 0;
  padding: 0 44px 0 40px;
  border: 1px solid #b9b3a6;
  border-radius: 4px;
  background: #fff;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
  color: #1d2a2c;
  font-family: inherit;
  font-size: 16px;
  letter-spacing: 0.3px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-page--login .login__input:focus {
  outline: none;
  border-color: #c9a227;
  box-shadow:
    0 0 0 3px rgba(201, 162, 39, 0.3),
    inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.login__control.is-invalid .login__input {
  border-color: #c62828;
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.18);
}

.login__control.is-invalid .login__icon {
  color: #c62828;
}

.login__reveal {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #7a8488;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.login__reveal:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #1f4d4a;
}

.login__reveal:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.5);
}

.auth-page--login .login__submit {
  --btn-top: #e4c879;
  --btn-bottom: #b58b3e;
  --btn-frame: #f0dba0;
  --btn-frame-dark: #705326;
  --btn-text: #30220f;
  min-height: 50px;
  margin-top: 8px;
  border-radius: 3px;
  font-size: 15px;
  letter-spacing: 1.4px;
  box-shadow:
    0 0 0 1px var(--btn-frame-dark),
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -2px 0 rgba(87, 55, 16, 0.3),
    0 3px 5px rgba(53, 40, 18, 0.18);
}

.auth-page--login .login__submit:hover {
  filter: brightness(1.08);
}

.auth-page--login .login__submit:active {
  transform: translateY(1px);
  box-shadow: 0 0 0 1px var(--btn-frame-dark), inset 0 2px 5px rgba(53, 40, 18, 0.4);
}

.auth-page--login .login__submit:focus-visible,
.login__register:focus-visible,
.login__link:focus-visible {
  outline: 2px solid #1f4d4a;
  outline-offset: 4px;
}

.login__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 8px;
  margin-top: 20px;
}

.login__foot-text {
  font-size: 13.5px;
  color: #505b5b;
}

.login__register {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: #1f5954;
  font-size: 13.5px;
  font-weight: 700;
  text-decoration: none;
}

.login__register:hover {
  color: #173d3b;
  text-decoration: underline;
}

.login__trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  margin: 20px auto 0;
  padding: 16px 0 0;
  border-top: 1px solid rgba(31, 77, 74, 0.15);
  list-style: none;
  text-align: center;
  font-size: 12px;
  color: #505b5b;
}

.login__trust i {
  margin-right: 5px;
  color: #1f6f6a;
}

@media (max-width: 520px) {
  .auth-page--login {
    padding: 24px 12px;
  }

  .login__head {
    gap: 12px;
  }

  .login__title {
    font-size: 21px;
  }
}

/* ================================
   LOST ACCOUNT / RESET PASSWORD (reuses the login card)
   ================================ */

.recover__tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 20px;
  padding: 4px;
  border: 1px solid #cfc6b3;
  border-radius: 6px;
  background: rgba(23, 61, 59, 0.06);
}

.recover__tab {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 4px;
  color: #3b4a4d;
  font-size: 13.5px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.recover__tab:hover {
  color: #173d3b;
  background: rgba(23, 61, 59, 0.08);
}

.recover__tab[aria-selected="true"] {
  background: #173d3b;
  color: #f0dba0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.recover__tab:focus-visible {
  outline: 2px solid #c9a227;
  outline-offset: 2px;
}

.recover__lead {
  margin: 0 0 18px;
  font-size: 13.5px;
  line-height: 1.5;
  color: #505b5b;
}

.recover__help,
.recover__error {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #6b7475;
}

.recover__error {
  color: #c62828;
  font-weight: 600;
}

.recover__error:empty {
  display: none;
}

.auth-page--login .recover__key-input {
  font-family: "Courier New", monospace;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.recover__notice {
  padding: 20px;
  border: 1px solid #cfc6b3;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.6);
  text-align: center;
  font-size: 13.5px;
  line-height: 1.55;
  color: #3b4a4d;
}

.recover__notice p {
  margin: 0 0 10px;
}

.recover__notice a:not(.ui-btn) {
  color: #1f6f6a;
  font-weight: 700;
}

.recover__notice-icon {
  display: block;
  margin: 0 auto 10px;
  font-size: 30px;
  color: #1f6f6a;
}

.recover__notice-title {
  margin: 0 0 8px;
  font-size: 18px;
  color: #173d3b;
}

.login__trust a {
  color: #1f6f6a;
  font-weight: 600;
}
