/* Формы: поля, выпадающие списки, галочки, переключатели, ссылки-кнопки, итог действия. */

.form { display: flex; flex-direction: column; gap: 12px; }
.form__group { display: flex; flex-direction: column; gap: 12px; min-width: 0; margin: 0; padding: 0; border: 0; }
.form > .link { align-self: flex-start; }
.form__note { color: var(--muted); font-size: 12px; line-height: 16px; text-align: center; }

.link {
    color: var(--accent-hover);
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    transition: color .2s;
}
.link:hover { color: #d48cff; }
.link--danger { color: #ff5f7e; }
.link--danger:hover { color: #ff8aa1; }

.btn--block { width: 100%; }
.btn.is-loading { position: relative; color: transparent; pointer-events: none; }
.btn.is-loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 0, 0, .25);
    border-top-color: rgba(0, 0, 0, .8);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
.btn--accent.is-loading::after,
.btn--surface.is-loading::after { border-color: rgba(255, 255, 255, .3); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- поле ---------- */

.field { position: relative; display: flex; flex-direction: column; gap: 6px; }
.field__box {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: var(--r);
    background: var(--surface);
    cursor: text;
    transition: border-color .2s, background-color .2s;
}
.field__box:focus-within { border-color: var(--accent); }
.field.is-invalid .field__box { border-color: #ff5f7e; }
.field__icon { display: flex; color: var(--muted); }
.field__icon::after { content: ""; width: 1px; height: 20px; margin-left: 12px; background: var(--line); }
.field__wrap { display: flex; flex: 1; flex-direction: column; justify-content: center; min-width: 0; }
.field__label { color: var(--muted); font-size: 12px; line-height: 16px; }
.field__box--label { min-height: 56px; }
.field__input {
    width: 100%;
    min-width: 0;
    height: 24px;
    padding: 0;
    border: 0;
    outline: 0;
    background: none;
    font-size: 16px;
    line-height: 24px;
}
.field__box:not(.field__box--label) .field__input { height: 46px; }
.field__input::placeholder { color: var(--muted); opacity: 1; }
.field__prefix { color: var(--text); font-size: 16px; }
.field__suffix { color: var(--muted); font-size: 16px; font-weight: 600; }
.field__btn { display: grid; place-items: center; width: 32px; height: 32px; margin-right: -6px; color: var(--muted); }
.field__btn:hover { color: var(--text); }
.field__btn .icon { width: 20px; height: 20px; }
.field__eye-off { display: none; }
.field__btn[aria-pressed="true"] .field__eye { display: none; }
.field__btn[aria-pressed="true"] .field__eye-off { display: block; }
.field__hint { color: var(--muted); font-size: 12px; line-height: 16px; }
.field__error { display: none; color: #ff5f7e; font-size: 12px; line-height: 16px; }
.field.is-invalid .field__error { display: block; }
.field.is-invalid .field__hint { display: none; }

.field__box--phone { padding-left: 4px; }
.flag { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.flag--code {
    display: inline-grid;
    place-items: center;
    background: var(--surface-hover);
    color: var(--text);
    font-size: 8px;
    font-weight: 700;
    line-height: 1;
}

/* ---------- выпадающий список ---------- */

.select { position: relative; }
.select__btn {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 8px;
    border-radius: var(--r-s);
    transition: background-color .2s;
}
.select__btn:hover { background: var(--surface); }
.select--country .select__btn { position: relative; padding-right: 12px; }
.select--country .select__btn::after { content: ""; position: absolute; right: 0; width: 1px; height: 20px; background: var(--line); }
.select__btn--field {
    width: 100%;
    height: 48px;
    padding: 0 12px;
    border-radius: var(--r);
    background: var(--surface);
    font-size: 15px;
    text-align: left;
}
.select__btn--field:hover { background: var(--surface-hover); }
.select__view { display: flex; flex: 1; align-items: center; gap: 10px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.select__view img { flex: none; width: 20px; height: 20px; }
.select__code { color: var(--muted); font-weight: 600; }
.select__arrow { color: var(--muted); transition: transform .2s; }
.select.is-open .select__arrow { transform: rotate(180deg); }
.select__list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 5;
    max-height: 264px;
    padding: 6px;
    overflow-y: auto;
    border-radius: var(--r);
    background: var(--panel-2);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .45);
}
.select--country .select__list { right: auto; width: 280px; }
.select__opt {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border-radius: var(--r-s);
    font-size: 14px;
    text-align: left;
    transition: background-color .2s;
}
.select__opt:hover { background: var(--surface); }
.select__opt.is-active { background: var(--surface-hover); }
.select__opt [data-select-view] { display: flex; align-items: center; gap: 10px; }
.select__opt img { width: 20px; height: 20px; }
.select__name { flex: 1; }
.select__extra { margin-left: auto; color: var(--muted); }

.select-row {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    height: 48px;
    padding: 0 12px;
    border-radius: var(--r);
    background: var(--surface);
    font-size: 15px;
    text-align: left;
}
.select-row span { flex: 1; }
.select-row > .icon:first-child { width: 20px; height: 20px; }

/* ---------- галочка ---------- */

.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check__input { position: absolute; opacity: 0; pointer-events: none; }
.check__box {
    display: grid;
    place-items: center;
    flex: none;
    width: 20px;
    height: 20px;
    border: 1.5px solid var(--muted);
    border-radius: 6px;
    color: transparent;
    transition: background-color .2s, border-color .2s;
}
.check__input:checked + .check__box { border-color: var(--accent); background: var(--accent); color: #fff; }
.check__input:focus-visible + .check__box { outline: 2px solid var(--accent); outline-offset: 2px; }
.field.is-invalid .check__box { border-color: #ff5f7e; }
.check__text { color: var(--muted); font-size: 12px; line-height: 16px; }
.check__text a { color: var(--accent-hover); font-weight: 600; }

/* ---------- переключатель ---------- */

.switch { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); cursor: pointer; }
.switch__input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track {
    position: relative;
    flex: none;
    width: 36px;
    height: 20px;
    border-radius: 999px;
    background: rgba(127, 127, 140, .35);
    transition: background-color .2s;
}
.switch__track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
    transition: transform .2s;
}
.switch__input:checked + .switch__track { background: var(--accent); }
.switch__input:checked + .switch__track::after { transform: translateX(16px); }
.switch__input:focus-visible + .switch__track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch--start { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); width: 100%; }

/* ---------- итог действия и пустые состояния ---------- */

.result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 0 8px;
    text-align: center;
}
.result--empty { justify-content: center; min-height: 320px; }
.result__icon {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    margin-bottom: 8px;
    border-radius: 50%;
    background: rgba(53, 236, 144, .16);
    color: var(--green);
}
.result__icon .icon { width: 32px; height: 32px; }
.result__big-icon { width: 40px; height: 40px; margin-bottom: 8px; color: var(--muted); opacity: .6; }
.result__title { font-family: var(--font-head); font-size: 22px; font-weight: 700; line-height: 28px; }
.result__text { max-width: 320px; color: var(--muted); font-size: 14px; line-height: 20px; }
.result .btn { min-width: 160px; margin-top: 12px; }
.field__line { display: flex; align-items: center; gap: 6px; min-width: 0; }
