@font-face {
    font-family: "Moderustic-Regular";
    src: url("../fonts/Moderustic-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

body{
  background-color: #f5f5f5;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Moderustic-Regular", monospace, sans-serif;
}

header{
    width: 100%;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;

    .logo {
        display: flex;
        align-items: center;

        h1{
            font-size: 20px;
            padding: 0;
        }
    }

    .logo img {
        height: 28px;
        margin-right: 8px;
        border-radius: 50%;
    }
}

.btn{
  margin-bottom: 20px;

  button{
    color: #333;
  }
}

/* Определяем анимацию тряски */
@keyframes shake {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-5px);
  }
  50% {
    transform: translateX(5px);
  }
  75% {
    transform: translateX(-5px);
  }
  100% {
    transform: translateX(0);
  }
}

.reg_form{
  height: calc(100dvh - 70px);
  align-content: center;

  article{
    display: flex;
    flex-direction: column;
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
    background-color: white;
    border-radius: 28px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    font-family: sans-serif;
    gap: 16px;

    :where(div).regField{
      display: flex;
      flex-direction: column;
      gap: 12px;
      position: relative;
      margin-bottom: 18px;

      &::after {
        content: attr(data-hint);
        position: absolute;
        left: 2px;
        bottom: -18px;
        font-size: 12px;
        color: #888;
        opacity: 0;
        transform: translateY(-5px);
        transition: all 0.2s ease;
      }

      &:focus-within::after {
        opacity: 1;
        transform: translateY(0);
      }
    }

    :where(div,select).regField label, label.regField{
    position:absolute;
    left: 15px;
    top: 15px;
    font-size: 16px;
    color: #999;
    transition: all 0.3s ease;
    pointer-events: none;
    background-color: transparent;
    }

    label[for="gender"] {
      position: relative;
      left: 0;
      top: 0;
      color: black;
    }

    .regField :where(input,select):focus {
    border-color: #667eea;
    }

    input:focus + label,
    input:not(:placeholder-shown) + label {
    top: -10px;
    left: 10px;
    font-size: 12px;
    color: #667eea;
    background-color: white;
    padding: 0 5px;
    }

    .regField input {
      display: block;
      width: 100%;
      padding: 12px 10px;
      font-size: 16px;
      border: 2px solid #ccc;
      border-radius: 5px;
      transition: border-color 0.3s ease, box-shadow 0.3s ease;
      box-sizing: border-box;
      outline: none;
    }

    /* select использует глобальный шаблон из style.css */
    
    /* Стили для кастомного select внутри regField */
    .regField .custom-select-wrapper {
        display: block !important;
        width: 100%;
        margin-bottom: 0;
        flex-direction: row !important;
        position: relative !important;
    }
    
    /* Адаптируем кастомный select под стиль формы регистрации - используем стандартные стили из style.css */
    .regField .custom-select-wrapper .custom-select {
        padding: 12px 40px 12px 16px;
        font-size: 16px;
        font-family: "Moderustic-Regular", monospace, sans-serif;
        font-weight: 500;
        color: var(--theme-text-primary, #3e3e3e);
        border: 2px solid var(--theme-input-border, rgba(0, 0, 0, 0.2));
        border-radius: 10px;
        background-color: var(--theme-input-bg, #ffffff);
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 14px center;
        background-size: 12px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .regField .custom-select-wrapper .custom-select:hover {
        border-color: var(--theme-select-arrow, #667eea);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.08);
    }
    
    .regField .custom-select-wrapper .custom-select.open {
        border-color: var(--theme-select-focus, #667eea);
        box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.06), 0 4px 12px rgba(102, 126, 234, 0.1);
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 3l5 5H1z'/%3E%3C/svg%3E");
    }
    
    /* Скрываем опции по умолчанию - используем стандартные стили из style.css */
    .regField .custom-select-wrapper .custom-select-options {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        border: 2px solid var(--theme-select-focus, #667eea);
        border-radius: 10px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(102, 126, 234, 0.1);
        margin-top: 4px;
        position: absolute !important;
        top: calc(100% + 4px) !important;
        left: 0 !important;
        z-index: 1000 !important;
        max-height: 300px !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        background-color: var(--theme-input-bg, #ffffff) !important;
        opacity: 0 !important;
        visibility: hidden !important;
        transform: translateY(-10px);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        pointer-events: none !important;
        box-sizing: border-box;
    }
    
    /* Показываем опции только при открытии */
    .regField .custom-select-wrapper .custom-select-options.open {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateY(0) !important;
        pointer-events: auto !important;
    }
    
    .regField .custom-select-wrapper .custom-select-option {
        padding: 4px 16px;
        font-size: 15px;
        font-family: "Moderustic-Regular", monospace, sans-serif;
        font-weight: 500;
        color: var(--theme-text-primary, #3e3e3e);
        background-color: transparent;
        cursor: pointer;
        transition: all 0.2s ease;
        border-bottom: 1px solid var(--theme-border, rgba(0, 0, 0, 0.1));
        min-height: 36px;
        display: flex;
        align-items: center;
        line-height: 1.4;
    }
    
    .regField .custom-select-wrapper .custom-select-option:first-child {
        border-top-left-radius: 8px;
        border-top-right-radius: 8px;
    }
    
    .regField .custom-select-wrapper .custom-select-option:last-child {
        border-bottom: none;
        border-bottom-left-radius: 8px;
        border-bottom-right-radius: 8px;
    }
    
    .regField .custom-select-wrapper .custom-select-option:hover:not(.disabled):not(.selected) {
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.06) 0%, rgba(118, 75, 162, 0.06) 100%);
        padding-left: 16px;
    }
    
    .regField .custom-select-wrapper .custom-select-option.selected {
        background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
        color: var(--theme-select-focus, #667eea);
    }
    
    .regField .custom-select-wrapper .custom-select-option.disabled {
        opacity: 0.5;
        cursor: not-allowed;
        background-color: var(--theme-bg-tertiary, #f3f4f6);
    }
    
    .regField .custom-select-wrapper .custom-select-option.disabled:hover {
        background-color: var(--theme-bg-tertiary, #f3f4f6);
        color: var(--theme-text-primary, #3e3e3e);
        font-weight: 500;
        padding-left: 16px;
    }
    
    /* Скрываем нативный select внутри custom-select-wrapper */
    .regField .custom-select-wrapper select {
        display: none !important;
        position: absolute !important;
        opacity: 0 !important;
        pointer-events: none !important;
        width: 1px !important;
        height: 1px !important;
    }
    
    /* Убираем flex для select внутри regField */
    .regField select {
        display: block !important;
        width: 100%;
    }

    input:user-invalid {
      border: 2px solid #ff00006e;
      animation: shake 0.3s ease;
    }

    .toggle input:user-invalid{
      border: none;
    }

    #reg_btn{
      display: block;
      width: 100%;
      padding: 14px 12px;
      font-size: 16px;
      color: #fff;
      background-color: #667eea;
      border: none;
      border-radius: 8px;
      cursor: pointer;
      transition: background-color 0.3s ease;
      margin-top: 18px;
    }

    #reg_btn:hover {
      background-color: #5568d3;
    }

    button#btn_login,
    button#btn_signup {
      display: block;
      width: 100%;
      padding: 14px 12px;
      font-size: 16px;
      font-family: inherit;
      color: #fff;
      background-color: #667eea;
      border: none;
      border-radius: 8px;
      cursor: pointer;
      transition: background-color 0.3s ease;
      margin-top: 18px;
    }

    button#btn_login:hover,
    button#btn_signup:hover {
      background-color: #5568d3;
    }
  }
}

.wrapper .toggle-password {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: #333;
  cursor: pointer;
  user-select: none;
}

.wrapper .toggle-password i.hide-btn::before {
  content: "\f070";
}

/**/
:root {
  --on-color: #667eea;
  --off-color:#ccc;
  --toggle-bg: #f5f5f5;
  --toggle-gap: 4px;
  --toggle-width: 42px;
  --transition-color: var(--off-color);
}

.toggle {
  position: relative;
  cursor: pointer;
  background: var(--toggle-bg);
  width: var(--toggle-width);
  height: calc(var(--toggle-width) / 2);
  border-radius: 160px;
  overflow: hidden;
  display: flex;
  align-items: center;
  box-shadow: inset 0 0 4px #7c7e8855;
  -webkit-tap-highlight-color: transparent;
}

.toggle input {
  appearance: none;
  margin: 0;
  padding: 0;
}

.toggle input:checked ~ svg .outline {
  --transition-color: var(--on-color);
}

.off-knob,
.on-knob {
  position: absolute;
  height: calc(100% - var(--toggle-gap) * 2);
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: 0px 1px 1px rgba(10, 19, 39, 0.1),
    0px 4px 12px rgba(10, 19, 39, 0.03), 0px 4px 20px rgba(10, 19, 39, 0.04);
  transform-origin: center center;
  will-change: transform;
}

.off-knob {
  left: var(--toggle-gap);
  background: var(--off-color);
}

.on-knob {
  right: var(--toggle-gap);
  background: var(--on-color);
  transform: scale(0.1) translateX(430px);
}

.toggle input:checked ~ .on-knob {
  animation-delay: 1.1s;
}

svg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.outline {
  width: 100%;
  height: 100%;
  stroke: var(--transition-color);
  stroke-dasharray: 2 125;
  stroke-dashoffset: 32.5;
  stroke-opacity: 0;
}

.outline--blur {
  filter: blur(0.8px);
}

/**/

#auto{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 16px;

  button{
    background: none;
    border: none;
    outline: none;
    font-size: 16px;
    color: #5568d3;
    cursor: pointer;
    transition: color 0.3s ease;
  }

  button:hover {
    color: #5568d3;
  }
}

@media (max-width: 456px){
  body{
    background-color: white;
  }
  .reg_form{
    form{
      background: none;
      box-shadow: none;
    }

    article {
      box-shadow: none;
    }
  }
}

@media (max-width: 0px){
  body{
    padding-top: 80px;
    padding-bottom: 12px;
  }
}

/**/


.container {
    position: relative;
    overflow: hidden;
}
.btn {
    height: 60px;
    width: 100%;
    border-radius: 50px;
    display: flex;
    justify-content: space-around;
    align-items: center;
}
.login,
.signup {
    font-size: 22px;
    border: none;
    outline: none;
    background-color: transparent;
    position: relative;
    cursor: pointer;
}
.slider {
    height: 60px;
    width: 100px;
    border-bottom: 2px solid #667eea;
    position: absolute;
    transition: all 0.5s ease-in-out;
    top: 0;
    left: 12.5%;
}
.moveslider {
    left: 62.5%;
}
.form-section {
    max-width: 800px;
    padding: 0;
    padding-top: 20px;
    display: flex;
    position: relative;
    transition: all 0.5s ease-in-out;
    left: 0px;
}
.form-section-move {
    left: -100%;
}
.login-box,
.signup-box {
    display: flex;
    gap: 16px;
    flex-direction: column;
    width: 400px;
    justify-content: center;
    padding: 0 2px;
    transition: opacity 0.3s ease;
}

.signup-box{
  display: none;
}

.login-box.active,
.signup-box.active {
  display: flex;
}

.form-section.signup-active {
  width: 200%;
}

.hidden {
    display: none !important;
}

.line{
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
  padding: 0 20px;
  padding-bottom: 20px;


  div{
    position: relative;
      height: 1px;
      max-width: 440px;
      width: 100%;
      margin: 36px 0;
      background-color: #d4d4d4;
  }

  article{
    background: none;
    box-shadow: none;
    max-width: 440px;
    width: 100%;
    padding: 0;

    ul{
      margin: 0;
      padding: 0 20px;
      display: flex;
      justify-content: space-around;

      li{
          list-style-type: none;

        a{
          display: flex;
          justify-content: center;
          align-content: center;
          width: 40px;
          aspect-ratio: 1/1;
          border-radius: 50%;
          border: 2px solid #ccc;
          align-items: center;
          box-sizing: border-box;

            img{
              width: 20px;
              object-fit: cover;
          }
        }

        /* Стили для Telegram Login Widget */
        #telegram-login-widget {
          display: flex;
          justify-content: center;
          align-items: center;
          width: 40px;
          height: 40px;
          border-radius: 50%;
          border: 2px solid #ccc;
          box-sizing: border-box;
          overflow: hidden;
        }

        #telegram-login-widget iframe {
          border: none !important;
          border-radius: 50% !important;
          width: 100% !important;
          height: 100% !important;
        }
      }

      li:nth-child(1) a img{
        width: 9px;
      }

      a:hover{
        background-color: #cccccc3b;
      }
    }
  }
}

.line div::before {
    content: 'или с помощью';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #f5f5f5;
    color: #8b8b8b;
    padding: 0 15px;
}

@media(max-width: 456px){
  .line div{
      max-width: 400px;

      &::before{
        background-color: white;
      }
  }
}

/**/

.code{
  height: calc(100dvh - 70px);
  align-content: center;

  article{
    display: flex;
    flex-direction: column;
    max-width: 443px;
    margin: 0 auto;
    box-sizing: border-box;
    flex:0 1 443px;
    height: 726px;
    border-radius: 36px;
    background-color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 127px 36px 36px;

    h1 {
      font-size: 22px;
      font-weight: 700;
      margin-bottom: 15px;
    }
    p {
      max-width: 260px;
      font-weight: 500;
      font-size: 18px;
      color: #b6b6b6;
      margin-bottom: 48px;
    }

    form > div {
      display: flex;
      gap: 10px;
      justify-content: space-between;
      margin-bottom: 40px;
    }

    input {
      width: 71px;
      height: 71px;
      font-size: 24px;
      text-align: center;
      border: 2px solid #ddd;
      border-radius: 20px;
      padding: 6px;
      outline: none;
      box-sizing: border-box;
    }
    input.active {
      border: 2px solid #667eea;
    }
    button {
      background-color: #667eea;
      font-weight: 700;
      font-size: 18px;
      color: #fff;
      border-radius: 50px;
      border: none;
      padding: 22px 45px;
      width: 100%;
      cursor: pointer;
      transition: background-color 0.3s ease;
      
    }

    button:hover {
      background-color: #5568d3;
    }
  }
}

@media screen and (max-width: 680px){
  .code article{
    box-shadow: none;
    height: auto;
    padding: 30px;
  }
}

#bm {
  margin-bottom: 32px;
}