input[type="checkbox"] {
    appearance: auto;
}

input[type="checkbox"]:checked + span {
    font: var(--semiblod-title-3);
}

input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 16px;
    min-width: 16px;
    max-width: 16px;
    height: 16px;
    border: 1px solid rgba(194, 206, 220, 1);
    border-radius: 4px;
    background-color: white;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 8px;
}

input[type="checkbox"]:hover {
    border-color: rgba(29, 98, 211, 1);
}

input[type="checkbox"]:checked {
    background-color: rgba(29, 98, 211, 1);
    border-color: rgba(29, 98, 211, 1);
}

input[type="checkbox"]:checked::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 5px;
    border-left: 2px solid white;
    border-bottom: 2px solid white;
    transform: translate(-50%, -50%) rotate(-45deg);
}

.dropdown-container select,
.select-dropdown select {
    display: none;
}

.dropdown-menu .dropdown-list-container {
    border-radius: 25px;
    border: 1px solid rgba(214, 222, 239, 1);
    padding: 16px;

    position: absolute;
    width: 100%;
    background-color: var(--background);
    z-index: 999;
}

.dropdown-menu .dropdown-list {
    max-height: 295px;
    overflow-y: auto;
    &::-webkit-scrollbar {
        width: 8px;
    }

    &::-webkit-scrollbar-track {
        background-color: transparent;
        border-radius: 12px;
    }
    &::-webkit-scrollbar-thumb {
        background-color: var(--secondary);
        border-radius: 12px;
    }
}

/* 1-й уровень (верхняя категория) */
.dropdown-list > li {
    padding: 5px;
    margin-bottom: 5px;
    font-size: 14px;
}

/* 2-й уровень */
.group-list {
    list-style: none;
    padding-left: 15px;
}

.group-list > li {
    padding-left: 24px;
}

/* 3-й уровень */
.sub-list {
    list-style: none;
    padding-left: 30px;
}

.sub-list > li {
    padding-left: 24px;
}

/* Контейнер тегов под input */
.dropdown-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    row-gap: 12px;
    z-index: 1; /* Теги будут под дропдауном */
    max-width: 586px;
    width: 100%;
    margin-bottom: 10px;
}

.dropdown-tags--hidden {
    height: 78px;
    overflow: hidden;
}

/* Дропдаун */
.dropdown-menu {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 586px;
    background: white;
    display: none;
    padding: 0;
    z-index: 999;
    display: flex;
    flex-direction: column;
}

.dropdown-search-container {
    position: relative;
    width: 100%;
    margin-bottom: 8px; /* Отступ между полем поиска и списком */
    height: 48px;
    border: 1px solid rgba(214, 222, 239, 1);
    border-radius: 100px;
    padding: 0 20px 1px;
    background-color: rgba(255, 255, 255, 1);
}

.search-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px; /* Размер иконки */
    height: 20px; /* Размер иконки */
}

.dropdown-search {
    width: 100%;
    height: 100%;
    padding-left: 26px; /* Отступ для иконки */
}

/* Теги */
.tag-down {
    background: rgba(218, 229, 248, 1);
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-family: "Inter";
    font-weight: 400;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.tag-down .remove-tag {
    margin-left: 10px;
    cursor: pointer;
    color: rgba(20, 20, 20, 1);
    width: 16px;
    height: 16px;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dropdown-selected {
    position: relative;
    display: flex;
    align-items: center;
    font: var(--regular-text);
    color: var(--text-gray-menu);
    cursor: pointer;
}

.dropdown-selected::placeholder,
.dropdown-search::placeholder {
    font: var(--regular-text);
    color: var(--text-gray-menu);
}

.dropdown-search, .dropdown-selected {
    font: var(--regular-text);
    color: var(--dark-text);
}

.dropdown-arrow {
    position: absolute;
    right: 20px;
    top: 16px;
    width: 16px;
    height: 16px;
    background-image: url('../../icons/ic-arrow-down.svg');
    z-index: 3;
}

.dropdown-menu {
    display: none; /* Скрываем меню по умолчанию */
}

.dropdown-menu.open {
    display: block; /* Меню показывается, когда добавлен класс .open */
}

.dropdown-menu.open ~ .dropdown-selected .dropdown-arrow {
    transform: rotate(-135deg); /* Стрелка вверх, когда меню открыто */
}

.dropdown-container {
    width: 100%;
    max-width: 586px;
    position: relative;
}

.dropdown-selected {
    height: 48px;
    border: 1px solid rgba(214, 222, 239, 1);
    border-radius: 100px;
    padding: 0 20px 1px;
    background-color: rgba(255, 255, 255, 1);
}

.select__clear-btn {
    display: none;
    position: absolute;
    background-image: url('../../icons/ic-close/16.svg');
    right: 40px;
    width: 16px;
    height: 16px;
    max-width: 16px;
    min-width: 16px;
    cursor: pointer;
}

.select__clear-btn.visible {
    display: block;
}

.dropdown-list label {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    cursor: pointer;
}

.dropdown-list label span {
    font-family: 'Inter';
    font-size: 14px;
    font-weight: 400;
    color: rgba(19, 19, 19, 1);
}

.dropdown-container--disabled .dropdown-selected {
    cursor: auto;
    background-color: var(--disabled-text);
    border-color: var(--disabled-text);
}

.dropdown-container--disabled .dropdown-input {
    color: var(--grey-icons);
    background-color: var(--disabled-text);
}


/* SELECT STYLES */
.select-wrapper {
    display: flex;
    flex-direction: column;
    width: 446px;
}

.custom-select {
    position: relative;
    /*height: 100%;*/
    height: 48px;
}

.select-selected {
    height: 100%;
    background: #fff;
    padding: 0 20px 1px;
    border: 1px solid rgba(214, 222, 239, 1);
    border-radius: 100px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: rgba(124, 132, 150, 1); /* Исходный цвет */
    font-family: "Inter";
    font-size: 14px;
    font-weight: 400;
}

.select-selected.active {
    color: rgba(19, 19, 19, 1); /* Новый цвет после закрытия */
}

.select-dropdown-container {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid rgba(214, 222, 239, 1);
    border-radius: 25px;
    padding: 16px;
    z-index: 999;
    height: fit-content;
}

.select-dropdown {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;

    &::-webkit-scrollbar {
        width: 8px;
    }

    &::-webkit-scrollbar-track {
        background-color: transparent;
        border-radius: 12px;
    }
    &::-webkit-scrollbar-thumb {
        background-color: var(--secondary);
        border-radius: 12px;
    }
}

.select-dropdown div {
    cursor: pointer;
    font-family: "Inter";
    font-weight: 400;
    font-size: 14px;
    color: rgba(19, 19, 19, 1);
    padding-top: 10px;
    padding-bottom: 10px;
}

.select-dropdown div:hover {
    font-weight: 600;
}

div.selected-option {
    font-weight: 600;
}

.arrow {
    display: flex;
    text-align: center;
    transition: transform 0.3s;
}

.rotate {
    transform: rotate(180deg);
}

.custom-select--disabled .select-selected {
    cursor: auto;
    background-color: var(--disabled-text);
    border-color: var(--disabled-text);
}

.custom-select--disabled .selected-text {
    color: var(--grey-icons);
    background-color: var(--disabled-text);
}

.selected-text {
    max-width: calc(100% - 38px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.select-dropdown-container.select-dropdown-container--top {
    bottom: 64px;
    top: auto;
}

.dropdown-button-container .button {
    flex: 1;
}

.ui-timepicker-standard .ui-state-hover {
    background-color: var(--primary)!important;
    color: var(--background) !important;
    border: 1px solid rgba(214, 222, 239, 1) !important;
    border-radius: 25px;
}

.ui-menu-item {
    font: var(--regular-body);
}

.ui-timepicker-container {
    background: #fff;
    border: 1px solid rgba(214, 222, 239, 1);
    border-radius: 25px;
    padding: 16px;
    z-index: 999;
    height: fit-content;
}

.tz-input-item {
    min-width: 215px;
    max-width: 295px;
}

@media (min-width: 768px) {
    .dropdown-list-container.select-dropdown-container--top {
        /*position: absolute;*/
        /*width: inherit;*/
        /*background-color: inherit;*/
        /*z-index: inherit;*/
        bottom: 64px;
        will-change: auto;
    }

    .dropdown-button-container {
        display: flex;
        width: calc(100% + 30px);
        transform: translate(-15px, 15px);
        gap: 8px;
        padding: 15px;
        box-shadow: var(--shadow-2);
        border-radius: 0 0 25px 25px;
    }
}

.step-component {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px 16px;
}

@media (max-width: 768px) {
    .select-wrapper {
        width: 100%;
        max-width: 100%;
    }

    .custom-select {

        height: 36px;
    }

    .selected-text {
        font: var(--mobile-text);
        white-space: nowrap;
    }

    .select-selected {
        font: var(--mobile-text);
    }

    .select-dropdown div {
        font: var(--mobile-text);

        &.selected-option {
            font-weight: 600;
        }
    }

    .select-dropdown-container {
        top: 45px;
    }

    .dropdown-selected {
        height: 40px;
        font: var(--mobile-text);
    }

    .dropdown-arrow {
        top: calc(50% - 8px);
    }

    .dropdown-tags {
        margin: 8px 0 0 0;
        gap: 8px 4px;
    }

    body:has(.dropdown-container.open)::before {
        content: '';
        position: fixed;
        inset: 0;
        z-index: 200;
        background-color: var(--backdrop);
        pointer-events: auto;
    }

    /* transform and inset - fix for modal bottom sheet */
    .field-item:has(.dropdown-container.open) {
        width: 100vw;
        /*transform: translate(-15px, -15px);*/
        background-color: var(--background);
        padding: 29px 15px 25px;
        border-radius: 22px 22px 0 0;
        margin-bottom: 0;
        z-index: 1001;
        min-height: calc(100dvh - 64px);
        max-height: calc(100dvh - 64px);
        height: 100%;
        overflow: hidden;
        position: fixed;
        bottom: -15px;
        gap: 0;

        inset: auto 0 0 0;

        &::after {
            position: absolute;
            content: '';
            top: 8px;
            left: calc(50% - 17px);
            background-color: #E3E4E7;
            width: 34px;
            height: 4px;
            border-radius: 2px;
        }

        & .field-item__title {
            font: var(--mobile-title-3);
            text-align: center;
        }

        & .dropdown-search-container,
        & .dropdown-selected {
            height: 40px;
            margin: 0;
        }

        & .search-icon {
            height: 18px;
            width: 18px;
        }

        & .dropdown-search {
            padding-left: 22px;
            z-index: 1000;
            position: relative;
            background-color: transparent;
        }

        & .dropdown-search, & .dropdown-search::placeholder {
            font: var(--mobile-text);
        }

        & .dropdown-search-container::before {
            position: absolute;
            width: calc(100% + 30px);
            height: calc(100% + 12px);
            left: -15px;
            content: '';
            box-shadow: 0px 3px 6px 0px #9FA9BA33;
        }

        & .dropdown-tags {
            display: none;
        }
    }

    .dropdown-container.open {
        width: calc(100% + 6px);
        transform: translateX(-15px);
        background-color: var(--background);
        margin: 12px;

        & .dropdown-list-container {
            border: none;
            padding: 0 15px;
            border-radius: 0;
            margin-top: 24px;
            position: static;
        }

        & .dropdown-menu .dropdown-list {
            /*max-height: calc(100dvh - 191px);*/
            max-height: calc(100dvh - 255px);
            min-height: calc(100dvh - 255px);
            scrollbar-width: none;
        }
        & .dropdown-list > li {
            padding: 0;
            margin: 0;
        }
        & .dropdown-list label {
            margin-bottom: 20px;
        }

        & .dropdown-list label span {
            font: var(--mobile-text);
        }
        & input[type="checkbox"]:checked + span {
            font: var(--mobile-title-4)
        }

    }

    .dropdown-button-container {
        display: flex;
        width: calc(100% + 60px);
        gap: 8px;
        padding: 15px;
        transform: translateX(-27px);
        box-shadow: var(--shadow-2);
    }

    .dropdown-button-container .button {
        height: 40px;
        min-height: 40px;
        font: var(--mobile-title-4);
    }

    .select-dropdown-container.select-dropdown-container--top {
        bottom: 46px;
    }

    .dropdown-tags--hidden {
        height: 100px;
    }

    .step-component {
        display: flex;
        flex-direction: column;
        gap: 24px 16px;
    }

    .tz-input-item {
        max-width: none !important;
    }
}
