@import "src/styles/_fonts.css";

/* style.css */
:root {
    --red: #A5331A;
    --gray: #f4f4f4;
    --font: 'Montserrat', sans-serif;
}

html,
body {
    min-height: 100%;
    margin: 0;
    padding: 0;
    height: fit-content;
    -webkit-tap-highlight-color: transparent;
}

/*input:-webkit-autofill,
input:-webkit-autofill:focus,
input:-internal-autofill-selected {
    transition: background-color 5000s ease-in-out 0s, color 5000s ease-in-out 0s!important;
}*/

.agreement-wrap {
    scrollbar-width: thin;
    scrollbar-color: rgba(128, 128, 128, 0.78) transparent; /* цвет плашки и дорожки */
    max-width: 100%;
}

/* Для Webkit (Chrome, Safari) */
.agreement-wrap::-webkit-scrollbar {
    width: 8px; /* Толщина скроллбара */
    border-radius: 10px;
}


.agreement-wrap::-webkit-scrollbar-track {
    background: transparent; /* Цвет дорожки */
    border-radius: 10px;
}

.agreement-wrap::-webkit-scrollbar-thumb {
    background-color: gray; /* Цвет плашки */
    border-radius: 10px;
    transition: background-color 0.3s ease;
}

/* Анимация при наведении */
.agreement-wrap::-webkit-scrollbar-thumb:hover {
    background-color: gray;
}

body {
    font-family: var(--font);
    background: url("./src/img/form-background.webp") no-repeat center center / cover;
}

.form-section {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    gap: 16px;
    padding: 56px 20px;
}

.form {
    position: relative;
    border-radius: 8px;
    max-width: 600px;
    width: 100%;
    color: #333333;
}

.form__logo {
    position: relative;
    display: block;
    width: 194px;
}

.form__title {
    position: relative;
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    margin: 0;
}

.form__grid {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin:56px 0 32px;
    
}

.form__field-wrap {
    position: relative;
    display: flex;
    flex-direction: row;
    gap: 16px;
}

.form__field-wrap .form__field {
    flex: 1;
}

.form__field {
    position: relative;
    display: flex;
    flex-direction: column;
    font-size: 16px;
    gap: 6px;
}

.form__field input,
.select-wrapper {
    position: relative;
    padding: 17px 20px;
    border-radius: 8px;
    background: white;
    appearance: none;
    font-size: 18px;
    box-sizing: border-box;
    border: 1px solid #DBDEE2;
    max-height: 56px;
    font-weight: 500;
    transition: max-height 0.3s ease-in;
    line-height: 22px;
}

.select-wrapper {
    padding: 0;
    box-sizing: border-box;
}

.form__field input:hover,
.select-wrapper:hover {
    border-color: #A5331A;
}

.form__field input:active {
    border: 2px solid #A5331A;
}

.form__field input:focus-visible {
    outline: none;
    border: 2px solid #A5331A;
}


.arrow {
    transition: transform 0.3s ease-in;
}

.select-wrapper.active .arrow {
    transform: rotate(180deg);
}

.select-input-wrapper {
    display: flex;
    cursor: pointer;
    padding: 17px 20px;
}

.select-input-wrapper input {
    width: 100%;
    padding: 0;
    border: none;
    pointer-events: none;
    background: transparent;
    user-select: none;
    caret-color: transparent;
    outline: none;
    font: inherit;
}

.select-list {
    display: flex
;
    flex-direction: column;
    gap: 4px;
    list-style: none;
    padding: 10px;
    position: absolute;
    left: -2px;
    width: calc(100% + 4px);
    box-sizing: border-box;
    bottom: 47px;
    border-radius: 8px 8px 0 0;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in;
    z-index: 5;
    background-color: white;
}

.select-item {
    box-sizing: border-box;
    width: 100%;
    cursor: pointer;
    padding: 17px 24px;
    background-color: #EDE8E7;
    border-radius: 6px;
}

.select-item:hover {
    background-color: #E6E0DF;
}

.select-wrapper.active .select-list {
    display: flex !important;
    margin: 0;
    opacity: 1;
    max-height: 491px;
    transition: max-height 0.3s ease-in;
    border: 1px solid #A5331A;
    border-bottom: none;

}

.select-wrapper.active {
    border-radius: 0 0 8px 8px;
    border-color: transparent;
}

.form__field:has(.select-wrapper.active) {
    border-radius: 8px;
    border: 1px solid #A5331A;
}

.btn {
    width: 100%;
    background-color: var(--red);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    line-height: 24px;
    font-size: 18px;
    font-weight: 500;
    padding: 16px;
}

.btn:hover {
    background-color: #912D17;
}

.btn:disabled {
    color: #d86e5b87;
    background-color: #e7d0cc;
}

.required:after {
    content: '*';
    color: #E31616;
    display: inline;
    margin-left: 6px;
}

.error-message {
    display: inline-flex;
    gap: 4px;
    font-weight: 400;
    font-size: 12px;
    line-height: 117%;

    color: #A5331A;
}

.error-message:before {
    display: block;
    content: url("./src/img/info.svg");
    width: 14px;
    height: 14px;
}

.success-send {
    display: none;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
    background: transparent;
    flex-direction: column;
    align-items: center;
    line-height: 39px;
    justify-content: center;
    text-align: center;
    border-radius: 8px;
    font-weight: 700;
    color: #333;
    margin-top: 25dvh;
}

.success-title {
    font-size: 32px;
    font-weight: 700;
    margin: 20px;
}

.dark-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    -webkit-transition: 0.5s all;
    transition: 0.5s all;
    z-index: 10;
}

.form__field:has(.select-wrapper.active) {
    border: 1px solid #A5331A;
    border-top: none;
}

.checkbox {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox__visible {
    position: relative;
    width: 21px;
    height: 21px;
    min-width: 21px;
    border: 1px solid #A5331A;
    border-radius: 0.3125rem;
    background-color: transparent;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    cursor: pointer;
}

.checkbox__icon {
    display: none;
    width: inherit;
    height: inherit;
    background-color: #A5331A;
    border-radius: 0.3125rem;
    transform: scale(0);
    transition: transform 0.2s ease-in-out;
}

.checkbox input {
    -webkit-appearance: none;
    position: absolute;
    width: 21px;
    height: 21px;
    z-index: 1;
    cursor: pointer;
}

input:checked ~ .checkbox__visible {
    background-color: #A5331A;
    border-color: #A5331A;
}

input:checked ~ .checkbox__visible .checkbox__icon {
    display: block;
    transform: scale(1);
}

.checkbox__confirm {
    margin: 0;
    font-size: 12px;
}

.checkbox__confirm > button {
    border: none;
    color: #A5331A;
    border-bottom: 1px solid #A5331A;
    padding: 0;
    font-family: var(--font);
    font-size: inherit;
    cursor: pointer;
    background-color: transparent;
}

.agreement__close {
    position: absolute;
    right: 1.5%;
    top: 8px;
    cursor: pointer;
}

.agreement-wrap {
    display: none;
    position: absolute;
    width: 50dvh;
    padding: 1.25rem;
    -webkit-box-sizing: border-box;
    box-sizing: border-box;
    top: 50%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%) scale(1);
    transform: translate(-50%, -50%) scale(1);
    -webkit-transition: 0.4s all;
    transition: 0.4s all;
    margin: 0 auto;
    border-radius: 8px;
    background-color: #FFFFFF;
}

.modal-bg.active .agreement-wrap.active {
    display: block;
    max-height: 50dvh;
    -webkit-transform: translate(-50%, -50%) scale(1);
    transform: translate(-50%, -50%) scale(1);
    -webkit-transition: 0.5s all;
    transition: 0.5s all;
    overflow-y: scroll;
    overflow-x: hidden;
}

.agreement__content {
    margin-top: 10px;
    display: block;
    position: relative;
    width: 100%;
    text-align: justify;
}

.agreement__content ul {
    padding-left: 20px;
}

.agreement__title {
    margin: 0;
}

.agreement__content h2, .agreement__content h3 {
    text-align: center;
}


.modal-bg {
   
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    -webkit-transition: 0.5s all;
    transition: 0.5s all;
    z-index: 10;
    pointer-events: none;
}

.modal-bg.active {
    opacity: 1;
    pointer-events: all;
    -webkit-transition: 0.5s all;
    transition: 0.5s all;
}

.btn__back {
    max-width: 256px;
    padding: 16px;
}

@media (max-width: 767px) {
    
    html, body {
        margin: 0;
        padding: 0;
    }
    
    .form-section {
        padding: 40px 16px;
    }
    
    .form__logo {
        width: 150px;
    }
    
    .form {
        padding: 0 10px;
    }
    
    .form__title {
        font-size: 26px;
        margin-bottom: 24px;
    }
    
    .form__grid {
        margin-top: 40px;
        display: flex;
        flex-direction: column;
    }

    .form__field input, .select-wrapper {
        font-size: 16px;
    }
    
    .form__field-wrap {
        flex-direction: column;
    }
    
    .success-send {
        padding: 0;
    }

    .success-title {
        font-size: 20px;
        margin-bottom: 12px;
    }

    .btn__back {
        font-size: 14px;
        font-weight: 500;
        max-width: 170px;
        padding: 10px;
    }

    .checkbox__confirm {
        font-size: 12px;
    }
    
    .agreement__title {
        font-size: 22px;
    }
    
    .agreement__content  {
        font-size: 14px;
    }
}