/* frontend/src/styles/auth/templates.css */
@import url('https://fonts.googleapis.com/css2?family=Iosevka+Charon+Mono:wght@400;600;700&display=swap');

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  color: #2d271b;
  background: #0d2117;
  font-family: 'Iosevka Charon Mono', Georgia, serif;
}

a {
  color: #315e20;
  font-weight: 700;
}

button,
input,
select,
textarea {
  font: inherit;
}

.page-auth {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(5, 22, 13, 0.22), rgba(5, 22, 13, 0.58)),
    url('/frontend/src/assets/images/bg.jpg') center / cover fixed no-repeat;
}

.auth-page {
  display: flex;
  width: min(100%, 1540px);
  min-height: 100vh;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 1.45vh, 18px);
  margin: 0 auto;
  padding: clamp(12px, 2vh, 28px) clamp(14px, 4vw, 64px) 16px;
}

.auth-logo {
  display: block;
  width: min(470px, 66vw);
  height: auto;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.45));
}

.auth-logo-link {
  position: relative;
  display: block;
  line-height: 0;
  border-radius: 12px;
}

.auth-logo-beta {
  position: absolute;
  right: clamp(8px, 2vw, 18px);
  bottom: clamp(4px, 0.7vw, 10px);
  display: inline-grid;
  min-width: 56px;
  min-height: 26px;
  place-items: center;
  border: 1px solid rgba(229, 199, 121, 0.9);
  border-radius: 8px;
  color: #fff3c5;
  background: linear-gradient(180deg, #7e381d, #552411);
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 177, 0.34),
    0 4px 10px rgba(0, 0, 0, 0.34);
  font-size: clamp(0.68rem, 1.1vw, 0.82rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(32, 17, 8, 0.56);
}

.auth-logo-link:focus-visible {
  outline: 2px solid rgba(240, 214, 139, 0.85);
  outline-offset: 6px;
}

.auth-card {
  width: min(100%, 570px);
  border: 2px solid #c49345;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(5, 38, 22, 0.96), rgba(5, 29, 18, 0.98));
  box-shadow:
    0 22px 48px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(244, 217, 141, 0.18);
  padding: 14px 14px 16px;
}

.auth-card--register {
  width: min(100%, 600px);
}

.auth-card--compact {
  width: min(100%, 560px);
}

.auth-card--contact {
  width: min(100%, 640px);
}

.auth-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 0 0 12px;
  color: #f7e9bd;
  font-size: clamp(1.65rem, 3.1vw, 2.25rem);
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  text-shadow: 0 3px 0 rgba(38, 23, 9, 0.7), 0 0 14px rgba(244, 221, 146, 0.24);
}

.auth-card__inner {
  display: grid;
  grid-template-columns: minmax(135px, 180px) minmax(0, 1fr);
  gap: 22px;
  border: 2px solid #d4aa65;
  border-radius: 10px;
  background: #f4e3bc;
  box-shadow:
    inset 0 0 0 1px rgba(105, 77, 36, 0.35),
    inset 0 8px 26px rgba(255, 246, 213, 0.52);
  padding: clamp(14px, 2.2vw, 22px);
}

.auth-card--compact .auth-card__inner {
  grid-template-columns: 132px minmax(0, 1fr);
}

.auth-card__inner--message {
  align-items: center;
}

.auth-illustration {
  align-self: center;
  justify-self: center;
  width: min(100%, 175px);
  max-height: 275px;
  object-fit: contain;
}

.auth-card--compact .auth-illustration {
  width: min(100%, 130px);
  max-height: 210px;
}

.auth-content {
  min-width: 0;
}

.auth-message {
  margin: 0 0 14px;
  color: #302819;
  font-size: 0.94rem;
  line-height: 1.45;
  text-align: center;
}

.auth-form {
  display: grid;
  gap: 9px;
}

.form-error {
  border: 1px solid #ad543d;
  border-radius: 8px;
  color: #7d2020;
  background: #ffe5d6;
  margin: 0 0 14px;
  padding: 10px 12px;
  font-weight: 700;
}

.form-success {
  border: 1px solid #8aa948;
  border-radius: 8px;
  color: #2d4d14;
  background: #eff8d8;
  margin: 0 0 14px;
  padding: 10px 12px;
  font-weight: 700;
  text-align: center;
}

.auth-field {
  position: relative;
  display: grid;
  gap: 5px;
  color: #2e281c;
  font-size: 0.9rem;
  font-weight: 700;
}

.auth-field::after {
  content: '';
  position: absolute;
  left: 12px;
  bottom: 11px;
  width: 18px;
  height: 18px;
  color: #5d5137;
  font-size: 1rem;
  line-height: 1;
  text-align: center;
  background-color: currentColor;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
  pointer-events: none;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}

.auth-field--user::after {
  content: '♟';
}

.auth-field--mail::after {
  content: '✉';
}

.auth-field--lock::after {
  content: '▣';
}

.auth-field--subject::after,
.auth-field--message::after {
  content: '';
}

.auth-field--user::after {
  content: '';
  mask-image: url('/frontend/src/assets/images/icons/user.svg');
  -webkit-mask-image: url('/frontend/src/assets/images/icons/user.svg');
}

.auth-field--mail::after {
  content: '';
  mask-image: url('/frontend/src/assets/images/icons/mail.svg');
  -webkit-mask-image: url('/frontend/src/assets/images/icons/mail.svg');
}

.auth-field--lock::after {
  content: '';
  mask-image: url('/frontend/src/assets/images/icons/lock.svg');
  -webkit-mask-image: url('/frontend/src/assets/images/icons/lock.svg');
}

.auth-field--subject::after {
  content: '';
  mask-image: url('/frontend/src/assets/images/icons/briefcase.svg');
  -webkit-mask-image: url('/frontend/src/assets/images/icons/briefcase.svg');
}

.auth-field--message::after {
  display: none;
}

.auth-form input[type='text'],
.auth-form input[type='email'],
.auth-form input[type='password'],
.auth-form select,
.auth-form textarea {
  width: 100%;
  min-height: 40px;
  border: 2px solid rgba(82, 62, 32, 0.58);
  border-radius: 7px;
  color: #302819;
  background: #ead3a3;
  box-shadow: inset 0 1px 4px rgba(60, 45, 21, 0.22), 0 1px 0 rgba(255, 250, 229, 0.48);
  padding: 7px 12px 7px 38px;
  outline: none;
}

.auth-form select {
  appearance: none;
  cursor: pointer;
}

.auth-form textarea {
  min-height: 132px;
  padding-left: 12px;
  resize: vertical;
  line-height: 1.45;
}

.auth-form input:focus,
.auth-form select:focus,
.auth-form textarea:focus {
  border-color: #7f9c2b;
  box-shadow: 0 0 0 3px rgba(110, 143, 40, 0.18), inset 0 1px 2px rgba(60, 45, 21, 0.18);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input[type='password'],
.password-field input[type='text'] {
  padding-right: 44px;
}

.password-field__toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  width: 28px;
  height: 28px;
  min-height: 0;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  padding: 0;
  transform: translateY(-50%);
}

.password-field__toggle::before {
  display: block;
  width: 20px;
  height: 20px;
  background-color: #5d5137;
  content: '';
  mask: url('/frontend/src/assets/images/icons/eye.svg') center / contain no-repeat;
  opacity: 0.75;
  -webkit-mask: url('/frontend/src/assets/images/icons/eye.svg') center / contain no-repeat;
}

.password-field__toggle::after {
  display: none;
}

.password-field__toggle.is-password-visible::before {
  mask-image: url('/frontend/src/assets/images/icons/eye-off.svg');
  -webkit-mask-image: url('/frontend/src/assets/images/icons/eye-off.svg');
}

.password-field__toggle:hover,
.password-field__toggle:focus-visible {
  background: rgba(78, 61, 34, 0.1);
  outline: none;
}

.checkbox-field {
  display: grid;
  align-items: center;
  gap: 10px;
  grid-template-columns: auto 1fr;
  color: #2f2a1d;
  font-size: 0.82rem;
  line-height: 1.35;
}

.checkbox-field input {
  width: 21px;
  height: 21px;
  margin: 0;
  accent-color: #4d7e16;
}

.auth-turnstile {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.auth-turnstile iframe {
  max-width: 100%;
}

.auth-submit {
  position: relative;
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border: 2px solid #2c4310;
  border-radius: 9px;
  color: #f8efd0;
  background: linear-gradient(180deg, #5c9b1b 0%, #2e650c 54%, #194905 100%);
  box-shadow:
    inset 0 0 0 1px rgba(244, 221, 129, 0.32),
    0 4px 0 #102b05,
    0 8px 12px rgba(28, 24, 12, 0.26);
  cursor: pointer;
  font-size: 1.04rem;
  font-weight: 700;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.36);
  padding: 8px 18px;
}

.auth-submit:hover {
  filter: brightness(1.07);
}

.oauth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 10px;
  color: #473b25;
  font-size: 0.86rem;
  text-align: center;
}

.oauth-divider::before,
.oauth-divider::after {
  flex: 1;
  height: 1px;
  background: rgba(90, 72, 42, 0.38);
  content: '';
}

.oauth-buttons {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
}

.oauth-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 2px solid rgba(82, 62, 32, 0.58);
  border-radius: 8px;
  color: #392e1c;
  background: #e6c994;
  box-shadow: inset 0 1px 5px rgba(255, 245, 212, 0.5), 0 2px 4px rgba(50, 35, 13, 0.16);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

.oauth-button:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.oauth-button__icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  flex: 0 0 auto;
}

.oauth-button__icon svg {
  display: block;
}

.auth-link,
.auth-note {
  margin: 12px 0 0;
  color: #302819;
  text-align: center;
}

.auth-note {
  margin-top: 6px;
  font-size: 0.82rem;
}

.auth-features {
  display: grid;
  width: min(100%, 1360px);
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-top: clamp(12px, 2.2vh, 28px);
  border: 2px solid #c49345;
  border-radius: 12px;
  background: rgba(6, 41, 23, 0.92);
  box-shadow: inset 0 0 0 1px rgba(244, 217, 141, 0.14), 0 12px 30px rgba(0, 0, 0, 0.32);
  padding: 10px 0;
}

.auth-features--wide {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.auth-features article {
  position: relative;
  display: flex;
  min-height: 78px;
  flex-direction: column;
  justify-content: center;
  color: #e8d196;
  padding: 12px 20px 12px 60px;
}

.auth-features article + article {
  border-left: 0;
}

.auth-features article::before {
  position: absolute;
  top: 50%;
  left: 16px;
  width: 34px;
  height: 34px;
  background: url('/frontend/src/assets/images/icons/step1.png') center / contain no-repeat;
  content: '';
  transform: translateY(-50%);
}

.auth-features article:nth-child(2)::before {
  background-image: url('/frontend/src/assets/images/icons/step2.png');
}

.auth-features article:nth-child(3)::before {
  background-image: url('/frontend/src/assets/images/icons/step3.png');
}

.auth-features article:nth-child(4)::before {
  background-image: url('/frontend/src/assets/images/icons/step4.png');
}

.auth-features article:nth-child(5)::before {
  background-image: url('/frontend/src/assets/images/icons/step5.png');
}

.auth-features article:nth-child(6)::before {
  background-image: url('/frontend/src/assets/images/icons/step6.png');
}

.auth-features article + article::after {
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 0;
  width: 1px;
  background: rgba(226, 194, 113, 0.5);
  content: '';
}

.auth-features strong,
.auth-features span {
  display: block;
}

.auth-features strong {
  margin-bottom: 5px;
  color: #f0d68b;
  font-size: 0.9rem;
}

.auth-features span {
  font-size: 0.73rem;
  line-height: 1.35;
}

.auth-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  color: #ddc486;
  font-size: 0.68rem;
  text-align: center;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.auth-footer a {
  color: #f0d68b;
}

.page-document {
  min-height: 100vh;
  padding: clamp(18px, 4vh, 42px) clamp(12px, 4vw, 40px);
  background:
    linear-gradient(180deg, rgba(5, 22, 13, 0.32), rgba(5, 22, 13, 0.72)),
    url('/frontend/src/assets/images/bg.jpg') center / cover fixed no-repeat;
}

.document-shell {
  width: min(100%, 980px);
  margin: 0 auto;
}

.document-panel {
  border: 2px solid #c49345;
  border-radius: 18px;
  color: #302819;
  background: #f4e3bc;
  box-shadow:
    0 22px 48px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(105, 77, 36, 0.32),
    inset 0 8px 28px rgba(255, 246, 213, 0.48);
  padding: clamp(22px, 4vw, 46px);
}

.document-panel h1 {
  margin: 0 0 24px;
  color: #17371f;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1.08;
  text-align: center;
  text-shadow: 0 1px 0 rgba(255, 246, 216, 0.8);
}

.document-panel h2 {
  margin: 28px 0 10px;
  color: #244515;
  font-size: 1.1rem;
}

.document-panel p {
  line-height: 1.55;
}

.document-panel h3 {
  color: #3f5520;
}

.document-panel a {
  color: #315e20;
}

.document-panel ol,
.document-panel ul {
  line-height: 1.5;
}

.document-panel li + li {
  margin-top: 4px;
}

.document-actions {
  margin-top: 28px;
}

@media (max-width: 1160px) {
  .auth-features,
  .auth-features--wide {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .auth-features article:nth-child(4) {
    border-left: 0;
  }

  .auth-features article:nth-child(4)::after {
    display: none;
  }
}

@media (min-width: 761px) and (max-height: 820px) {
  .auth-page {
    gap: 9px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .auth-logo {
    width: min(390px, 54vw);
  }

  .auth-card {
    width: min(100%, 530px);
    padding: 12px;
  }

  .auth-card--register {
    width: min(100%, 560px);
  }

  .auth-title {
    margin-bottom: 9px;
    font-size: 1.75rem;
  }

  .auth-card__inner {
    gap: 18px;
    grid-template-columns: 145px minmax(0, 1fr);
    padding: 14px 16px;
  }

  .auth-illustration {
    width: 140px;
    max-height: 225px;
  }

  .auth-form {
    gap: 7px;
  }

  .auth-form input[type='text'],
  .auth-form input[type='email'],
  .auth-form input[type='password'] {
    min-height: 34px;
    padding-top: 5px;
    padding-bottom: 5px;
  }

  .auth-submit {
    min-height: 42px;
  }

  .oauth-divider {
    margin: 10px 0 8px;
  }

  .oauth-button {
    min-height: 38px;
  }

  .auth-link,
  .auth-note {
    margin-top: 8px;
  }

  .auth-features article {
    min-height: 58px;
    padding: 10px 12px 9px 48px;
  }

  .auth-features article::before {
    top: 50%;
    left: 15px;
    width: 22px;
    height: 22px;
  }
}

@media (max-width: 760px) {
  .page-auth {
    background-attachment: scroll;
  }

  .auth-page {
    justify-content: flex-start;
    padding: 18px 12px 20px;
  }

  .auth-logo {
    width: min(420px, 90vw);
  }

  .auth-card,
  .auth-card--register {
    width: min(100%, 460px);
    padding: 14px;
    border-radius: 16px;
  }

  .auth-title {
    gap: 14px;
    margin-bottom: 14px;
    font-size: 2rem;
  }

  .auth-card__inner {
    display: block;
    padding: 18px;
  }

  .auth-card--compact .auth-card__inner {
    display: block;
  }

  .auth-illustration {
    display: none;
  }

  .oauth-buttons {
    gap: 10px;
  }

  .oauth-button {
    min-height: 48px;
    font-size: 0.92rem;
  }

  .auth-features,
  .auth-features--wide {
    grid-template-columns: 1fr;
  }

  .auth-features article {
    min-height: 76px;
  }

  .auth-features article + article,
  .auth-features article:nth-child(4) {
    border-top: 0;
    border-left: 0;
  }

  .auth-features article + article::after {
    top: 0;
    right: 18px;
    bottom: auto;
    left: 18px;
    width: auto;
    height: 1px;
  }
}

@media (max-width: 440px) {
  .auth-card__inner {
    padding: 14px;
  }

  .oauth-buttons {
    grid-template-columns: 1fr;
  }

  .auth-submit {
    width: 100%;
  }
}
