/*
 * Поля ввода: input, textarea, select, поиск, checkbox, radio, switch.
 * Радиус 10–12px (ТЗ §5), высота как у кнопок — формы собираются в одну линию.
 */

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field__label {
    color: var(--text-primary);
    font-size: var(--fs-small);
    font-weight: var(--fw-bold);
}

.field__hint {
    color: var(--text-muted);
    font-size: var(--fs-xs);
}

.field__error {
    color: var(--danger-text);
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
}

.input,
.textarea,
.select {
    width: 100%;
    height: var(--control-height);
    padding: 0 14px;
    border: 1px solid var(--border-card);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: var(--fs-small);
    transition: border-color var(--t-base) var(--ease),
                box-shadow var(--t-base) var(--ease),
                background var(--t-base) var(--ease);
}

.input::placeholder,
.textarea::placeholder {
    color: var(--text-muted);
}

.input:hover,
.textarea:hover,
.select:hover {
    border-color: var(--border-strong);
}

.input:focus,
.textarea:focus,
.select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.input:disabled,
.textarea:disabled,
.select:disabled {
    background: var(--bg-soft);
    color: var(--text-muted);
    cursor: not-allowed;
}

.input--invalid,
.input[aria-invalid="true"] {
    border-color: var(--danger);
}

.textarea {
    height: auto;
    min-height: 120px;
    padding: 12px 14px;
    line-height: var(--lh-body);
    resize: vertical;
}

.select {
    appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23626B80' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    cursor: pointer;
}

/* ---------- Поле с иконкой и поиск ---------- */

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

.field-icon .input {
    padding-left: 42px;
}

.field-icon__icon {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: 6px 6px 6px 16px;
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    box-shadow: var(--shadow-xs);
    transition: border-color var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}

.search:focus-within {
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.search__icon {
    flex-shrink: 0;
    display: inline-flex;
    color: var(--text-muted);
}

.search__input {
    flex: 1;
    min-width: 0;
    height: 36px;
    border: 0;
    background: none;
    color: var(--text-primary);
    font-size: var(--fs-small);
}

.search__input::placeholder {
    color: var(--text-muted);
}

.search__input:focus {
    outline: none;
}

.search__submit {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: var(--text-invert);
    cursor: pointer;
    transition: background var(--t-base) var(--ease);
}

.search__submit:hover {
    background: var(--primary-hover);
}

.search--lg {
    padding: 8px 8px 8px 20px;
    border-radius: var(--radius-lg);
}

.search--lg .search__input {
    height: 44px;
    font-size: var(--fs-body);
}

.search--lg .search__submit {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
}

/* ---------- Флажки, радио, переключатель ---------- */

.check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: var(--fs-small);
    cursor: pointer;
}

.check__box {
    flex-shrink: 0;
    appearance: none;
    width: 20px;
    height: 20px;
    margin: 0;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: var(--bg-card);
    cursor: pointer;
    transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}

.check__box:checked {
    border-color: var(--primary);
    background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center no-repeat;
}

.check__box--radio {
    border-radius: 50%;
}

.check__box--radio:checked {
    background: var(--bg-card);
    border: 6px solid var(--primary);
}

.check:hover .check__box {
    border-color: var(--primary);
}

.switch {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: var(--fs-small);
    cursor: pointer;
}

.switch__control {
    appearance: none;
    position: relative;
    flex-shrink: 0;
    width: 42px;
    height: 24px;
    margin: 0;
    border-radius: var(--radius-pill);
    background: var(--border-strong);
    cursor: pointer;
    transition: background var(--t-base) var(--ease);
}

.switch__control::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg-card);
    box-shadow: var(--shadow-xs);
    transition: transform var(--t-base) var(--ease);
}

.switch__control:checked {
    background: var(--primary);
}

.switch__control:checked::after {
    transform: translateX(18px);
}

/* ---------- Ползунок диапазона ---------- */

.range {
    width: 100%;
    height: 6px;
    appearance: none;
    border-radius: var(--radius-pill);
    background: var(--primary-soft-2);
    cursor: pointer;
}

.range::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 4px rgba(91, 92, 246, .16);
}

.range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: 0;
    border-radius: 50%;
    background: var(--primary);
}
