.translations-editor {
    height: 100%;
    overflow: auto;
    scrollbar-width: thin;
}

.translation-editor {
    padding: 1.5rem 1.25rem 2rem;
}

/** One group of fields (consent modal, preferences modal) **/

.editor {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;

    + .editor {
        margin-top: 2.25rem;
        padding-top: 2rem;
        border-top: .0625rem solid var(--line);
    }

    input,
    textarea {
        width: 100%;
        padding: .6rem .8rem;
        font-size: .875rem;
        color: var(--heading);
        background: var(--bg);
        border: .0625rem solid var(--line);
        border-radius: var(--radius);
        transition: border-color .15s ease;

        &::placeholder {
            color: #6b737d;
        }

        &:hover {
            border-color: var(--line-strong);
        }

        &:focus {
            border-color: var(--accent-line);
            outline: none;
        }
    }

    textarea {
        display: block;
        min-height: 5.5rem;
        max-height: 20rem;
        line-height: 1.5;
        resize: vertical;
        scrollbar-width: thin;
    }

    .small-textarea {
        min-height: 2.6rem;
        height: 2.6rem;
    }
}

.editor__header,
.editor-field--wide {
    grid-column: 1 / -1;
}

.editor__header {
    margin-bottom: .25rem;

    h3 {
        font-size: 1.05rem;
    }

    p {
        margin-top: .15rem;
        font-size: .875rem;
        color: var(--muted);
    }
}

.editor-field {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    min-width: 0;
}

.editor-field__label {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--heading);
}

.editor-field__hint {
    margin-top: -.2rem;
    font-size: .8125rem;
    color: var(--muted);
}

p.editor-field__hint {
    margin-top: -.5rem;
}

/** Preferences modal sections **/

.pm-sections {
    margin-top: .75rem;
}

.pm-sections__header {
    margin-bottom: .75rem;
}

.pm-sections-title {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0;
    font-size: .95rem;
}

#sections-counter {
    display: inline-grid;
    place-items: center;
    min-width: 1.4rem;
    height: 1.4rem;
    padding: 0 .35rem;
    font-size: .75rem;
    color: var(--muted);
    background: var(--raised);
    border-radius: 1rem;
}

.pm-sections-hint {
    margin-top: .2rem;
    font-size: .8125rem;
    color: var(--muted);
}

#pm-sections {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: pm-section;
}

.pm-section {
    background: var(--bg);
    border: .0625rem solid var(--line);
    border-radius: .625rem;
    transition: border-color .15s ease;

    &:hover {
        border-color: var(--line-strong);
    }

    &:has(details[open]) {
        border-color: var(--line-strong);
    }
}

.pm-section__summary {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem .9rem;
    list-style: none;
    border-radius: .625rem;
    cursor: pointer;
    user-select: none;

    &::-webkit-details-marker {
        display: none;
    }

    /* chevron */
    &::after {
        content: "";
        flex: none;
        width: .4rem;
        height: .4rem;
        margin: -.2rem .2rem 0 0;
        border: solid var(--muted);
        border-width: 0 .125rem .125rem 0;
        transform: rotate(45deg);
        transition: transform .15s ease;
    }

    &:hover {
        background: var(--raised);
    }
}

details[open] > .pm-section__summary {
    border-bottom: .0625rem solid var(--line);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;

    &::after {
        margin-top: .2rem;
        transform: rotate(225deg);
    }
}

.pm-section__number {
    flex: none;
    display: grid;
    place-items: center;
    width: 1.5rem;
    height: 1.5rem;
    font-size: .75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    border: .0625rem solid var(--line-strong);
    border-radius: 100%;

    &::before {
        counter-increment: pm-section;
        content: counter(pm-section);
    }
}

.pm-section__title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .9rem;
    font-weight: 600;
    color: var(--heading);
}

.pm-section__category {
    flex: none;
    padding: .1rem .5rem;
    font-size: .75rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 1rem;

    &:empty {
        display: none;
    }
}

.pm-section__body {
    display: flex;
    flex-direction: column;
    gap: .9rem;
    padding: 1rem .9rem .9rem;
}

.pm-section-label-btn-container {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;

    .select-label {
        max-width: 18rem;
        margin: 0;

        > span:first-child {
            min-width: 0;
        }
    }
}

.pm-section__delete-btn:hover {
    color: var(--danger);
}

#add-section-btn {
    margin-top: .75rem;
}

@media screen and (max-width: 640px) {
    .translation-editor {
        padding: 1.25rem 1rem 1.5rem;
    }

    .editor {
        grid-template-columns: minmax(0, 1fr);
    }
}
