@font-face {
    font-family: "JetBrainsMono";
    src: url("../fonts/JetBrainsMono-Regular.woff2") format("woff2");
}

@font-face {
    font-family: "Quicksand";
    src: url("../fonts/Quicksand-Regular.ttf");
}

@font-face {
    font-family: "Quicksand";
    font-weight: bold;
    src: url("../fonts/Quicksand-SemiBold.ttf");
}

:root {
    --dark: #233239;
    --gray: #949ea4;
    --white: white;
    --blue: #1a7d8e;
    --green: #7faa6c;
    --yellow: #e2a32d;
    --red: #ba5912;
    --error: #ff3e3e;
}

body {
    font-family: "Quicksand";
    color: var(--dark);
}

#output {
    border: 1px solid var(--dark);
    padding: 8px;
    border-radius: 8px;

    width: 100%;
    box-sizing: border-box;
    min-height: 64px;
    display: flex;
    justify-content: center;
    align-items: center;

    transition: max-height 1s;

    color: initial;
}

textarea {
    border: 1px solid var(--dark);
    padding: 0.5rem;
    font-family: "JetBrainsMono", monospace;
    font-size: 16px;

    display: block;
    width: 100%;
    box-sizing: border-box;
    resize: none;
    overflow-y: hidden;
    overflow-x: auto;
    padding: 8px;
    border: 1px solid var(--dark);
    border-radius: 8px;
    outline: none;

    margin: 0px;
    color: var(--dark);
}

.column {
    max-width: 512px;
    margin: 0px auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
}

.buttons {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;

    .button {
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 4px;
        font-size: 14px;
        outline: 1px solid var(--dark);
        outline-offset: 2px;
        background-color: var(--blue);
        color: white;
        border-radius: 5px;
        padding: 6px;
        cursor: pointer;

        &.copy,
        &.download {
            padding-right: 10px;
        }

        &::before {
            content: '';
            display: block;
            width: 24px;
            height: 24px;
            background-position: center;
            background-size: 16px;
            background-repeat: no-repeat;
            filter: invert(1.0);
        }

        &.copy::before {
            background-image: url('../img/copy.png');
        }

        &.download::before {
            background-image: url('../img/download.png');
        }

        &.settings {
            background-color: var(--yellow);
        }

        &.settings::before {
            background-image: url('../img/settings.png');
        }

        &.history {
            background-color: var(--red);
        }

        &.history::before {
            background-image: url('../img/clock.png');
        }

        &.disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }
    }
}

.title {
    font-size: 24px;
}

canvas {
    display: none;
}

#messages {
    margin-bottom: -16px;

    &>div {
        color: var(--white);
        background-color: var(--green);
        padding: 8px;
        border-radius: 8px;
        animation: fade-in-left 0.5s ease, fade-out-right 0.5s ease 2s forwards;
        margin-bottom: 16px;

        &.error {
            background-color: var(--red);
        }
    }
}

@keyframes fade-in-left {
    0% {
        transform: translateX(-16px);
        opacity: 0.0;
        margin-bottom: -32px;
    }

    100% {
        transform: translateX(0px);
        opacity: 1.0;
        margin-bottom: 16px;
    }
}

@keyframes fade-out-right {
    0% {
        transform: translateX(0px);
        opacity: 1.0;
        margin-bottom: 16px;
    }

    100% {
        transform: translateX(16px);
        opacity: 0.0;
        margin-bottom: -32px;
    }
}

@keyframes fade-in-bottom {
    0% {
        transform: translateY(16px);
        opacity: 0.0;
    }

    100% {
        transform: translateY(0px);
        opacity: 1.0;
    }
}

@keyframes fade-out-bottom {
    0% {
        transform: translateY(0px);
        opacity: 1.0;
    }

    100% {
        transform: translateY(16px);
        opacity: 0.0;
    }
}

#macros {
    width: 100%;
    border-radius: 8px;
    padding: 8px;
    border: 1px solid var(--yellow);
    background-color: color-mix(in srgb, var(--yellow) 10%, transparent);
    box-sizing: border-box;

    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;

    .header {
        text-align: center;
        font-weight: bold;
        color: color-mix(in srgb, var(--yellow) 67%, black);
    }

    >div {
        display: flex;
        justify-content: center;
    }

    input {
        border: 1px solid black;
        text-align: center;
        padding: 4px;
        border-radius: 8px;
        outline: none;
        width: 100%;
        font-size: 14px;
        font-family: "JetBrainsMono", monospace;
        color: var(--dark);
        background-color: white;
        height: 32px;
        box-sizing: border-box;

        &.invalid {
            color: #ff3e3e;
        }
    }

    textarea {
        font-size: 14px;
        line-height: 16px;
        width: 100%;
    }

    #button-add-macro {
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        outline: 1px solid #233239;
        outline-offset: 2px;
        background-color: #e2a32d;
        color: white;
        border-radius: 5px;
        cursor: pointer;
        font-size: 14px;
        margin: 3px 0px;
        box-sizing: border-box;
        padding: 5px;
    }
}

#history {
    width: 100%;
    border-radius: 8px;
    padding: 8px;
    border: 1px solid var(--red);
    background-color: color-mix(in srgb, var(--red) 10%, transparent);
    box-sizing: border-box;

    display: grid;
    grid-template-columns: 1fr 32px;
    align-items: center;
    justify-content: center;
    gap: 8px;

    .header {
        text-align: center;
        font-weight: bold;
        grid-column: 1 / span 2;
        color: color-mix(in srgb, var(--red) 67%, black);
    }

    .entry {
        border: 1px solid var(--gray);
        color: var(--gray);
        border-radius: 8px;
        padding: 6px;
        background-color: white;
        font-family: "JetBrainsMono", monospace;
        font-size: 14px;
        height: 32px;
        box-sizing: border-box;

        cursor: pointer;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
    }

    .button-delete {
        width: 26px;
        height: 26px;
        margin-left: auto;
        margin-right: 3px;
        outline: 1px solid black;
        outline-offset: 2px;
        border-radius: 5px;
        background-color: var(--red);
        cursor: pointer;

        &::after {
            content: '';
            display: block;
            width: 100%;
            height: 100%;
            background-image: url("../img/trash.png");
            background-position: center;
            background-size: 16px;
            background-repeat: no-repeat;
            filter: invert(1.0);
        }
    }
}

#macros,
#history {
    display: none;

    &.visible {
        display: grid;
        animation: fade-in-bottom 0.5s ease 0s 1 forwards;
    }
}