@use '../globals' as *;

.ipz-exceptions {
    display: flex;
    flex-direction: column;
    gap: $spacing-lg;
    max-width: 100%;
    color: $text-primary;

    &__add-form,
    &__import {
        display: flex;
        flex-wrap: wrap;
        align-items: flex-end;
        gap: $spacing-sm;
        padding: $spacing-md;
        background: $background-light;
        border: 1px solid $border-color;
        border-radius: $border-radius-md;
    }

    &__add-form {
        > * {
            min-width: 0;
        }

        input {
            flex: 1 1 240px;
        }

        select {
            flex: 0 1 180px;
        }

        button {
            flex: 0 0 auto;
        }
    }

    &__table {
        width: 100%;
        overflow-x: auto;
        background: $background-white;
        border: 1px solid $border-color;
        border-radius: $border-radius-md;
    }

    &__row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) max-content auto;
        gap: $spacing-md;
        align-items: center;
        min-width: 520px;
        padding: $spacing-md;
        border-bottom: 1px solid $border-color;

        &:last-child {
            border-bottom: 0;
        }

        &:hover {
            background: $background-light;
        }

        > :first-child {
            min-width: 0;
            overflow-wrap: anywhere;
        }
    }

    &__import {
        align-items: stretch;
        flex-direction: column;

        textarea {
            width: 100%;
            min-height: 140px;
            box-sizing: border-box;
            resize: vertical;
        }

        button {
            align-self: flex-start;
        }
    }

    &__help {
        padding: $spacing-md;
        background: $background-light;
        border: 1px solid $border-color;
        border-radius: $border-radius-md;

        h3 {
            margin: 0 0 $spacing-sm;
            font-size: 1rem;
        }

        dt {
            font-weight: 600;
        }

        dd {
            margin: 0 0 $spacing-sm;
            color: $text-secondary;
        }
    }

    &__help-list {
        margin: 0 0 $spacing-md;
    }

    &__help-notes {
        margin: 0;
        padding-left: $spacing-lg;
        color: $text-secondary;
        list-style: disc;
    }

    &__empty {
        padding: $spacing-xl $spacing-md;
        color: $text-secondary;
        text-align: center;
        border: 1px dashed $border-color;
        border-radius: $border-radius-md;
    }

    &__add-form input,
    &__add-form select,
    &__import textarea {
        box-sizing: border-box;
        min-height: 36px;
        color: $text-primary;
        background: $background-white;
        border: 1px solid $border-color;
        border-radius: $border-radius-sm;

        &:focus {
            border-color: $primary-color;
            box-shadow: 0 0 0 1px $primary-color;
        }

        &:focus-visible {
            outline: 2px solid $primary-color;
            outline-offset: 2px;
        }
    }

    &__add-form input,
    &__add-form select {
        padding: $spacing-sm $spacing-md;
    }

    &__import textarea {
        padding: $spacing-sm $spacing-md;
        line-height: 1.5;
    }

}

@media screen and (max-width: 782px) {
    .ipz-exceptions {
        gap: $spacing-md;

        &__add-form {
            align-items: stretch;
            flex-direction: column;

            > * {
                width: 100%;
                flex-basis: auto;
            }
        }

        &__row {
            grid-template-columns: minmax(0, 1fr) auto;
            min-width: 0;
            gap: $spacing-sm;
            padding: $spacing-sm;

            > :nth-child(2) {
                grid-column: 1;
            }

            > :nth-child(3) {
                grid-column: 2;
                grid-row: 1 / span 2;
            }
        }
    }
}
