/* Overlay shown when a vehicle tag contains non-standard characters
 * (e.g. Cyrillic/Greek look-alike homoglyphs entered via a keyboard
 * long-press). Presents the typed characters enlarged, highlighting the
 * unacceptable one(s) so the visitor can delete or replace them before the
 * tag is sent to the server. */

.invalid-tag-character-dialog {
    border: none;
    border-radius: 0.5rem;
    padding: 0;
    box-sizing: border-box;
    width: 92vw;
    max-width: min(460px, 92vw);
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 0 30px rgb(0 0 0 / 0.5);
    background-color: var(--base-background-color);

    &::backdrop {
        background-color: rgb(0 0 0 / 0.6);
        backdrop-filter: blur(4px);
    }

    /* Override the global `article` sizing (base.css: width:96vw, min-width:384px)
     * so the inner box tracks the dialog instead of overflowing it. */
    .itc-content {
        display: grid;
        grid-auto-flow: row;
        gap: 0.85rem;
        padding: 1rem;
        width: auto;
        min-width: 0;
        max-width: none;
        margin: 0;
        box-sizing: border-box;
        max-height: 85vh;
        overflow-y: auto;
        scrollbar-width: thin;
    }

    header {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 1rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px solid var(--section-title-background-color);

        h2 {
            margin: 0;
            font-size: 1.25rem;
            color: var(--text-color-bright);

            i {
                margin-right: 0.5rem;
                color: rgb(80% 25% 25% / 1);
            }
        }

        .itc-close {
            width: 4ch;
            height: 4ch;
            border-radius: 50%;
            display: grid;
            place-content: center;
            background-color: var(--section-title-background-color);
            border: none;
            cursor: pointer;
            transition: background-color 0.2s;
            color: var(--text-color-bright);

            &:hover {
                background-color: rgb(80% 30% 30% / 1);
            }
        }
    }

    /* Row of enlarged character chips representing what the visitor typed. */
    .itc-characters {
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
        justify-content: center;
        padding: 0.5rem;
    }

    .itc-char {
        font-size: 2em;
        line-height: 1;
        font-family: monospace, monospace;
        min-width: 1.4em;
        padding: 0.25em 0.15em;
        text-align: center;
        border: 2px solid transparent;
        border-radius: 0.25rem;
        background-color: var(--section-title-background-color);
        color: var(--text-color-bright);

        /* whitespace/separator characters shown muted so they stay visible */
        &.itc-char--separator {
            color: var(--text-color-muted, rgb(50% 50% 50% / 1));
            opacity: 0.7;
        }

        /* the offending, unacceptable character(s) */
        &.itc-char--invalid {
            border: 2px solid rgb(85% 15% 15% / 1);
            background-color: rgb(85% 15% 15% / 0.12);
            color: rgb(85% 15% 15% / 1);
        }
    }

    .itc-explanation {
        margin: 0;
        line-height: 1.5;

        .itc-emphasis {
            color: rgb(85% 15% 15% / 1);
            font-weight: 600;
        }
    }

    footer {
        display: flex;
        justify-content: flex-end;

        .itc-fix {
            padding: 0.6rem 1.2rem;
            border: none;
            border-radius: 0.4rem;
            cursor: pointer;
            background-color: var(--section-title-darker-background-color);
            color: var(--text-color-bright);

            &:hover {
                background-color: rgb(80% 30% 30% / 1);
            }
        }
    }
}
