@import "../theme";
@import "../shared";
@import "../options/tab-panel/tab-panel.less";

@editor-active-back: mix(@color-input-back, @color-input-active, 75%);
@editor-active-fore: mix(@color-input-fore, @color-input-fore-active, 75%);

html {
    height: 100%;
    margin: 0;
}

body {
    align-items: flex-start;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    height: 100%;
    margin: 0;
    padding: 1rem;
}

header {
    align-items: stretch;
    box-sizing: content-box;
    display: flex;
    flex: none;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-start;
}

#logo {
    display: inline-block;
    font-size: @size-text-large;
    height: @size-control-inner;
    width: 15rem;
}

#title {
    align-items: stretch;
    display: inline-flex;
    flex-direction: row;
    font-size: @size-control-inner * 4 / 3;
    font-weight: 100;
    line-height: @size-control-inner;
    height: @size-control-inner;
    margin: 0 0 0 @indent-small;
    text-transform: uppercase;
    transform: translateY(-0.0625rem);
}

.config-editor {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sub-title {
    flex: none;
    font-size: @size-text-normal;
    font-weight: normal;
    margin: 0.3rem 0 @indent-large 0;
    text-transform: uppercase;
}

.editor {
    background-color: @color-input-back;
    border: @size-border solid @color-border;
    box-sizing: border-box;
    color: @color-input-fore;
    flex: auto;
    font-family: monospace;
    font-size: @size-text-normal;
    min-width: 9rem;
    outline: none;
    padding: @size-control-inner / 2 - @size-text-normal / 2;
    resize: none;
    white-space: pre;
    width: 100%;

    &::placeholder {
        color: @color-input-fore-placeholder;
    }

    &:hover {
        background-color: @editor-active-back;

        &::-webkit-scrollbar,
        &::-webkit-scrollbar-corner {
            background-color: @editor-active-back;
        }
    }

    &:focus {
        background-color: @editor-active-back;
        color: @editor-active-fore;

        &::-webkit-scrollbar,
        &::-webkit-scrollbar-corner {
            background-color: @editor-active-back;
        }
    }
}

.error-text {
    color: @color-error;
    flex: none;
    font-family: monospace;
    white-space: pre;
}

.buttons {
    display: flex;
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    margin-top: @indent-small;
    width: 100%;

    > :not(:first-child) {
        margin-left: @indent-small;
    }

    .button {
        min-width: 3rem;
        max-width: 6rem;
        width: 100%;
    }
}

.description {
    flex: none;
    margin: @indent-large 0 0 0;
    text-align: left;
    white-space: wrap;

    a {
        color: @color-fore;
    }
}

@media screen and (max-width: 36rem) {
    #title {
        display: none;
    }
}

@media screen and (max-height: 33rem) {
    header,
    .description {
        display: none;
    }

    .sub-title {
        margin-top: @indent-small;
    }
}

.message-box {
    border: @size-border solid @color-border;
}

.preview-design-button {
    padding: 0 0.5rem;
}

.settings-tab-panel {
    height: 100%;
    overflow: hidden;
    width: 100%;

    &__tab {
        height: 100%;
    }

    &__button__icon {
        display: none;
    }

    &--vertical {
        gap: 0;
    }
}

.dynamic-mode-editor {
    height: 100%;
}

.dynamic-per-site {
    display: grid;
    gap: 0.5rem;
    grid: "search editor" @size-control-inner + 2 * @size-border
          "list   editor" auto
          / 10rem auto;
    height: 100%;
    overflow: hidden;

    &__search-wrapper {
        grid-area: search;
    }

    &__search-input {
        width: calc(100% - 2 * @size-border);
    }

    &__urls {
        grid-area: list;
        overflow: auto;

        li {
            list-style-type: none;
        }
    }

    &__url {
        border: none;
        color: @color-fore;
        height: @size-control-inner;
        text-align: left;
        width: 100%;

        &--active {
            color: @color-heading;
            font-weight: bold;
        }
    }

    .config-editor {
        grid-area: editor;
    }

    &__add-fix {
        &__button {
            padding: 0 0.5rem;
        }

        &__description {
            margin: 0.5rem 0 0 0;
        }
    }
}
