/* Модальное окно - оверлей с блюром */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

/* Активное состояние оверлея */
.modal-overlay.active {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    visibility: visible;
    display: flex !important;
}

/* Модальное окно */
.modal {
    background-color: rgba(26, 26, 26, 1);
    width: 90%;
    max-width: 580px;
    padding: 48px;
    border-radius: 48px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    position: relative;
    opacity: 0;
    transform: scale(0.7) translateY(-50px);
    transition: all 0.5s cubic-bezier(0.34, 1.2, 0.64, 1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-overlay.active .modal {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.modal_header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 47px;
    margin-bottom: 15px;
}

/* Кнопка закрытия */
.modal-close {
    font-size: 40px;
    background: none;
    border: none;
    cursor: pointer;
    color: rgba(203, 213, 225, 0.6);
    transition: all 0.3s ease;
    line-height: 1;
    font-weight: 300;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #F20D0D;
    transform: rotate(90deg);
}

/* Заголовок модального окна */
.modal h2 {
    color: #F1F5F9;
    font-family: Inter;
    font-size: 25px;
    font-style: normal;
    font-weight: 900;
    line-height: 44px;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.4s ease 0.1s;
}

.modal-overlay.active .modal h2 {
    opacity: 1;
    transform: translateY(0);
}

.modal h2 span {
    color: #F20D0D;
}

/* Стили формы */
.modal form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Группа полей (имя и телефон) */
.modal_input_group {
    display: flex;
    gap: 20px;
}

.modal_input_group .modal_lable_input {
    flex: 1;
}

/* Стили для label и input */
.modal_lable_input {
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transform: translateX(-20px);
    transition: all 0.4s ease;
}

.modal-overlay.active .modal_lable_input {
    opacity: 1;
    transform: translateX(0);
}

/* Индивидуальные задержки для каждого поля */
.modal-overlay.active .modal_input_group .modal_lable_input:first-child {
    transition-delay: 0.15s;
}

.modal-overlay.active .modal_input_group .modal_lable_input:last-child {
    transition-delay: 0.25s;
}

.modal_lable_input label {
    margin-left: 4px;
    color: rgba(203, 213, 225, 0.80);
    font-family: Inter;
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
    line-height: 16px;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.modal_lable_input input {
    display: flex;
  width: 100%;
  padding: 17px 48px 16px 24px;
  justify-content: center;
  align-items: flex-start;
  border-radius: 85px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: #676767;
  color: #F1F5F9;
  font-family: Inter;
  font-size: 16px;
  transition: all 0.4s ease;
  box-sizing: border-box;
}

.modal_lable_input input:hover {
    border: 1px solid rgba(242, 13, 13, 0.5);
    background: rgba(255, 255, 255, 0.08);
}

.modal_lable_input input:focus {
    outline: none;
    border: 1px solid #F20D0D;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(242, 13, 13, 0.1);
}

.modal_lable_input input::placeholder {
    color: rgba(203, 213, 225, 0.4);
    font-family: Inter;
    font-size: 16px;
}

.modal_lable_input:first-of-type:after {
  content: "";
  width: 6px;
  height: 6px;
  color: red;
  position: absolute;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6' viewBox='0 0 6 6' fill='none'%3E%3Cpath d='M2.35427 6.00027L2.43761 3.7085L0.500022 4.93772L0 4.06268L2.04176 3.00013L0 1.93759L0.500022 1.06255L2.43761 2.29177L2.35427 0H3.35432L3.27098 2.29177L5.20856 1.06255L5.70859 1.93759L3.66683 3.00013L5.70859 4.06268L5.20856 4.93772L3.27098 3.7085L3.35432 6.00027H2.35427Z' fill='%23FF8287'/%3E%3C/svg%3E");
  right: 25px;
  top: 50%;
  transform: translateY(-50%);
  background-repeat: no-repeat;
}

/* Кнопка отправки */
.submit_form {
    display: flex;
  padding: 15px 0;
  justify-content: center;
  align-items: center;
  align-self: stretch;
  border-radius: 50px;
  background: #F23840;
  border: none;
  color: white;
  font-family: Inter;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.4s ease;
    transition-delay: 0s;
  margin-top: 8px;
  opacity: 0;
  transform: translateY(20px);
}

.modal-overlay.active .submit_form {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.55s;
}

.submit_form:hover {
    background: #d40c0c;
    box-shadow: 0 20px 25px -5px rgba(242, 13, 13, 0.3), 0 8px 10px -6px rgba(242, 13, 13, 0.3);
    transform: translateY(-2px);
}

.submit_form:active {
    transform: translateY(0);
}

/* Текст согласия */
.modal span {
    color: rgba(203, 213, 225, 0.80);
    text-align: center;
    font-family: Inter;
    font-size: 10px;
    font-style: normal;
    font-weight: 400;
    line-height: 15px;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s ease;
}

.modal-overlay.active .modal span {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.65s;
}

/* Блокировка скролла */
body.modal-open {
    overflow: hidden;
}

/* Контейнер чекбоксов */
.modal_checkbox {
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.4s ease;
}

.modal-overlay.active .modal_checkbox {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.45s;
}

/* Стили для каждого чекбокса */
.modal_checkbox label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: rgba(203, 213, 225, 0.70);
    font-family: Inter;
    font-size: 11px;
    font-style: normal;
    font-weight: 400;
    line-height: 1.4;
    cursor: pointer;
    opacity: 0;
    transform: translateX(-15px);
    transition: all 0.4s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

.modal-overlay.active .modal_checkbox label:nth-child(1) {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.5s;
}

.modal-overlay.active .modal_checkbox label:nth-child(2) {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.55s;
}

.modal-overlay.active .modal_checkbox label:nth-child(3) {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.6s;
}

.modal_checkbox label:hover {
    color: rgba(203, 213, 225, 0.90);
}

.modal_checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: #F20D0D;
}

.modal_checkbox p {
    margin: 0;
    display: inline;
}

.modal_checkbox a {
    color: #F20D0D;
    text-decoration: none;
    transition: color 0.3s ease;
}

.modal_checkbox a:hover {
    color: #ff4444;
    text-decoration: underline;
}

/* Сброс анимации при закрытии - ВАЖНО! */
.modal-overlay:not(.active) .modal h2,
.modal-overlay:not(.active) .modal_lable_input,
.modal-overlay:not(.active) .submit_form,
.modal-overlay:not(.active) .modal span,
.modal-overlay:not(.active) .modal_checkbox,
.modal-overlay:not(.active) .modal_checkbox label {
    transition-delay: 0s !important;
}

/* Фикс для прокрутки внутри модального окна */
.modal {
    max-height: 90vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #F20D0D rgba(255, 255, 255, 0.1);
}

.modal::-webkit-scrollbar {
    width: 6px;
}

.modal::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.modal::-webkit-scrollbar-thumb {
    background: #F20D0D;
    border-radius: 3px;
}

/* Адаптивность */
@media (max-width: 640px) {
    .modal {
        padding: 24px;
        /* width: 100%; */
        max-height: 100vh;
        /* border-radius: 0; */
    }

    .field-error-message{
        animation: fadeInUp 0.3s ease;
        position: absolute;
        bottom: -17px;
        font-size: 12px;
        color: #f20d0d;
        text-wrap: nowrap;
    }
    
    .modal h2 {
        font-size: 19px;
        line-height: 28px;
        margin-top: 0;
    }
    
    .modal_input_group {
        flex-direction: column;
        gap: 16px;
    }
    
    .modal_lable_input input {
        padding: 14px 20px;
        font-size: 14px;
    }
    
    .submit_form {
        padding: 16px 0;
        font-size: 16px;
    }
    
    .modal_checkbox label {
        font-size: 10px;
        gap: 10px;
    }
    
    .modal_checkbox input[type="checkbox"] {
        width: 16px;
        height: 16px;
        min-width: 16px;
    }
}

/* Для очень маленьких экранов */
@media (max-width: 480px) {
    .modal {
        padding: 20px;
        max-height: 85vh;
    }
    
    .modal form {
        gap: 16px;
    }
    
    .modal_lable_input input {
        padding: 12px 16px;
    }
    
    .modal_checkbox {
        gap: 10px;
    }
    
    .modal_checkbox label {
        font-size: 9px;
        gap: 8px;
    }
}