@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');

:root {
    --bg-color: #E1E1E1;
    --primary-color: #FAFAFA;
    --secondary-color: #2C3333;
    --success-color: green;
    --error-color: red;
    --invalid-color: orange;
}

body {
    background-color: var(--bg-color);
    font-family: 'Roboto', sans-serif;
}

button {
    background-color: var(--secondary-color);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    min-width: 8rem;
}

main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 2rem;
}

.toast-container {
    position: fixed;
    right: 50%;
    transform: translateX(50%);
    bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: hidden;
    max-height: 100vh;
    min-width: clamp(20rem, 25vw, 25rem);
    padding: 2rem;
    z-index: 1000;
}

.toast {
    background-color: var(--primary-color);
    box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
    animation: appear 500ms forwards ease-out;
    position: relative;
}

@keyframes appear {
    from {
        right: -100%;
    }

    to {
        right: 0%;
    }
}

.tile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wrapper {
    position: relative;
    padding: 0.25rem 1rem;
}

.progress-bar {
    height: 0.25rem;
    width: 100%;
    position: absolute;
    bottom: 0;
    left: 0;
    background-color: var(--_bg-color);
    animation: progress 3s 500ms forwards linear;
}

@keyframes progress {
    to {
        width: 0;
    }
}

.success-toast {
    --_bg-color: var(--success-color);
}

.error-toast {
    --_bg-color: var(--error-color);
}

.invalid-toast {
    --_bg-color: var(--invalid-color);
}

.icon {
    height: 1.75rem;
    width: 1.75rem;
    background-color: var(--_bg-color);
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--primary-color);
}

.icon span {
    font-size: 1rem;
}

@media screen and (min-width: 30rem) {
    main {
        flex-direction: row;
    }

    .toast-container {
        right: 0;
        transform: none;
    }
}