.convtitle {
    text-align: center;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

.convcat {
    width: 100%;
    max-width: var(--maxpage);
    border-radius: var(--br);
    background-color: var(--bg2);
}

.page.pconv.active {
    height: calc(100% - 20px);
}

.fantikconv {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 10px 0 0 0;
    overflow-y: scroll;
    height: 95%;
    padding: 5%;
}

.convgrid {
    display: none
}

.convgrid.active {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-columns: repeat(auto-fill, 150px);
    justify-content: space-evenly;
    justify-items: center;
    column-gap: 1vw;
    row-gap: 3vw;
    padding: 2vw;
    padding-bottom: 3vw;
}

.converter {
    width: 100%;
    aspect-ratio: 1;
    background-color: var(--color-btn);
    border-radius: var(--br);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    transition: background-color var(--tr);
    cursor: pointer;

    &:hover {
        background-color: var(--color-btn-hover);
    }
    &:active {
        background-color: var(--color-btn-active);
    }
}

.convnamelist {
    padding: 0;
    bottom: 0;
    margin: 0 var(--dss);
    padding-bottom: 2vw;
}

.convnamelist {
    text-align: center;
}

img {
    flex: 1;
    width: 15vw;
    height: 15vw;
    border: 0;
}

.cdElement {
    display: none;
}

.cdElement.active {
    display: block;
}

.cdElement.active.buttonsplace {
    display: grid;
    height: 100%;
}

.cdElement.active.convVars {
    display: flex;
}

.convdown {
    width: 100%;
    height: 100%;
}

.cdElement {
}

.convVars {
    max-height: calc(100dvh - 4rem - 2vh - 40px - 35vh - 32px);
    overflow-y: auto;
    padding: 0 10px 0 0;
}

.place {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between; 
    width: 100%;
    cursor: pointer;
    background-color: var(--bg2);
    border-radius: var(--brr);
    transition: background var(--tr);

    input, button {
        color: white;
        background: none;
    }

    input {
        width: 75%;
        border-radius: 0 var(--brr) var(--brr) 0;
    }

    button {
        border: 0;
        width: 25%;
        border-radius: 8px 0 0 8px;
        cursor: pointer;
    }

    &:hover {
        background-color: var(--bg3);
    }

    &.active {
        background-color: var(--bg4);
    }
}

.place.active button {
    cursor: default;
}

#convChoseValues {
    cursor: pointer;
    /*background-color: var(--bg2);*/
    border-radius: var(--br);
    display: flex;
    flex-direction: column;
    gap: 0;
}

.convVarsList {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.unitStringDelete {
    width: 100%;
    padding: 0;
    margin-bottom: 1rem;
}

.unitStringDelete button {
    width: 100%;
    padding: 12px 16px;
    background-color: #c41c3b;
    color: white;
    border: none;
    border-radius: var(--br);
    cursor: pointer;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85em;
    transition: background var(--tr);
}

.unitStringDelete button:hover {
    background-color: #a01729;
}

/* Группировка единиц по категориям */
.unitCategoryHeader {
    width: 100%;
    padding: 0;
}

.unitCategoryHeader button {
    width: 100%;
    background: linear-gradient(135deg, #1d2443 0%, #2b1b3a 100%);
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85em;
    letter-spacing: 0.5px;
    border: none;
    border-radius: var(--br);
    padding: 12px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background var(--tr);
}

.unitCategoryHeader button:hover {
    background: linear-gradient(135deg, #2a3560 0%, #3a2a4a 100%);
}

.unitRow {
    width: 100%;
    padding: 0;
}

.unitRow.collapsed {
    display: none;
}

.unitRow button {
    width: 100%;
    padding: 8px 16px;
    background-color: var(--bg3);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    transition: background var(--tr);
    text-align: left;
    font-size: 0.9em;
}

.unitRow button:hover {
    background-color: var(--color-btn-hover);
}

.unitButton {
    display: flex !important;
    gap: 12px;
}

.unit-name {
    flex: 1;
    font-weight: 500;
}

.unit-text {
    min-width: 60px;
    text-align: center;
    opacity: 0.8;
}

.unit-value {
    min-width: 100px;
    text-align: right;
    opacity: 0.7;
    font-size: 0.85em;
}

/* Кнопка выбора единицы */
.unit-btn {
    min-width: 80px;
    justify-content: space-between;
}

/* Адаптивность для мобильных */
@media (max-width: 480px) {
    .place {
        flex-wrap: wrap;
    }
    
    .unitRow button {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .unit-text {
        min-width: auto;
        text-align: left;
    }
    
    .unit-value {
        min-width: auto;
        text-align: left;
    }
}

/* 🔽 Стрелочка сворачивания */
.category-toggle {
    display: inline-block;
    width: 20px;
    text-align: center;
    margin-right: 4px;
    transition: transform var(--tr);
}
.unitRow.collapsed {
    display: none; /* 🎯 Скрываем свёрнутые элементы */
}

#convplaces {
    width: calc(100% - 10px);
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: var(--dss);
    height: 35vh;
    overflow-y: auto;
    padding: 0 10px 0 0;
}

#addPlace {
    width: 100%;
    min-height: 40px;
    background-color: var(--color-btn);
    border: 0;
    height: 40px;
    border-radius: var(--brr);
    color: white;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;

    &:hover {
        background-color: var(--color-btn-hover);
    }
}