@keyframes search-indicator {
    0% {
        width: 20%;
        left: 0%;
        transform: translate(-200%, 0);
    }

    33% {
        width: 50%;
        left: 20%;
        transform: translate(0%, 0);
    }

    66% {
        width: 40%;
        left: 60%;
        transform: translate(0%, 0);
    }

    100% {
        width: 10%;
        left: 100%;
        transform: translate(100%, 0);
    }
}

.searching {
    padding: 2rem 0 1rem;
    position: relative;
    overflow: hidden;
    transition: 200ms var(--cubic-ease-out);
}

.searching::after {
    content: "";
    position: absolute;
    bottom: 0;
    background-color: var(--background-text-color);
    height: 0.3rem;
    opacity: 1;
    transition: 100ms;
    animation: search-indicator 1s linear infinite;
}

.searching.hidden {
    padding: 0;
    font-size: 0;
}

.searching.hidden::after {
    opacity: 0;
    height: 0;
}

.error {
    background-color: var(--error-color);
    color: var(--error-text-color);
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 2rem;
    text-align: center;
    font-size: 0.9rem;
    transition: 250ms var(--cubic-ease-out);
}

.error.hidden {
    margin-top: 0;
    padding: 0;
    font-size: 0;
    transition: 150ms var(--cubic-ease-out);
}

/**
 * Screens
 */
.lyrics-image-screen {
    width: 100%;
    overflow: hidden;
    opacity: 1;
    transition: width 500ms ease-in-out, opacity 300ms ease-in-out 200ms;
}

.lyrics-image-screen.hidden {
    opacity: 0;
    width: 0%;
    transition: width 500ms ease-in-out, opacity 300ms;
}

.screen-wrapper {
    width: 100vw;
    min-height: calc(100vh - 8rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: transform 500ms ease-in-out;
}

.hidden.left .screen-wrapper {
    transform: translate(-100%, 0);
}

/* Screen 1: Search form */
.search-form header {
    text-align: center;
}

.search-form form {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.search-form form > input {
    padding: 1rem;
    border: none;
    border-radius: 0.5rem;
    outline: none;
    width: 80%;
    max-width: 25rem;
}

.search-form form > button {
    text-align: center;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    outline: none;
    font-weight: 600;
    opacity: 1;
    transition: 200ms var(--cubic-ease-out);
}

.search-form form > button:hover {
    cursor: pointer;
    padding: 1rem 3rem;
}

.search-form form > button:disabled {
    font-size: 0;
    padding: 0;
    opacity: 0;
}

/* Screen 2: Song selection */
.search-results .song-selection {
    display: flex;
    justify-content: space-between;
    row-gap: 2rem;
    max-width: 50rem;
    padding: 2rem;
    flex-wrap: wrap;
}

.select-song {
    width: 30%;
    padding: 1rem;
    background-color: var(--surface-light-color);
    border-radius: 0.5rem;
    transition: scale 200ms var(--cubic-ease-out),
        background-color 200ms var(--cubic-ease-out);
}

.select-song:hover {
    cursor: pointer;
    background-color: var(--surface-color);
    scale: 1.05;
}

.select-song img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    object-position: center 0;
    opacity: 1;
    border-radius: 0.5rem;
    transition: scale 150ms var(--cubic-ease-out),
        aspect-ratio 400ms var(--cubic-ease-out),
        opacity 600ms var(--cubic-ease-out);
}

.header-actions {
    position: absolute;
    top: calc(50% + 0.2rem);
    right: -1rem;
    transform: translate(100%, -50%);
    display: flex;
    gap: 0.5rem;
}

.header-actions button {
    border: 0;
    border-radius: 0.5rem;
    padding: 0.5rem;
    background-color: var(--surface-light-color);
    color: var(--surface-text-color);
    transition: 150ms var(--cubic-ease-out);
}

.header-actions button:hover {
    cursor: pointer;
    background-color: var(--surface-color);
}

/* Update the existing download button style */
#download {
    position: static;
    transform: none;
}

.select-song:hover img {
    scale: 1.05;
}

.hidden .select-song img {
    aspect-ratio: 10;
    opacity: 0;
    transition: aspect-ratio 400ms var(--cubic-ease-out) 100ms,
        opacity 400ms var(--cubic-ease-out) 100ms;
}

.select-song .name {
    font-weight: 700;
    padding-top: 0.5rem;
    transition: 300ms var(--cubic-ease-out);
}

.hidden .select-song .name {
    font-size: 0;
    padding-top: 0;
    transition: 300ms var(--cubic-ease-out) 100ms;
}

.select-song .authors {
    font-weight: 600;
    font-size: 0.8rem;
    transition: 300ms var(--cubic-ease-out);
}

.hidden .select-song .authors {
    font-size: 0;
    transition: 300ms var(--cubic-ease-out) 100ms;
}

/* Screen 3: Lines selection */
.lines-selection {
    padding-top: 1.5rem;
    width: 80%;
    max-width: 30rem;
}

.select-line {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0.5rem;
    background-color: var(--surface-light-color);
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    width: 100%;
    margin: 0 auto 1rem;
    transition: padding 400ms var(--cubic-ease-out),
        margin-bottom 400ms var(--cubic-ease-out),
        font-size 400ms var(--cubic-ease-out),
        width 400ms var(--cubic-ease-out),
        background-color 200ms var(--cubic-ease-out),
        scale 200ms var(--cubic-ease-out);
}

.select-line:hover {
    cursor: pointer;
    background-color: var(--surface-color);
    scale: 1.05;
}

.hidden .select-line,
.select-line.hidden {
    padding: 0;
    margin-bottom: 0;
    font-size: 0;
    width: 0;
}

.select-line.selected {
    background-color: var(--primary-color);
    color: var(--primary-text-color);
}

/* Screen 4: Final options and download */
.final-options header {
    margin-bottom: 1rem;
}

.final-options .searching {
    margin-bottom: 2rem;
}

.final-options .searching.hidden {
    margin-bottom: 0;
}

.color-selection {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    row-gap: 0.8rem;
    max-width: 15rem;
    width: 80%;
    padding: 2rem 1rem;
    transition: 200ms var(--cubic-ease-out);
}

.hidden .color-selection {
    padding: 0 1rem;
}

.color-selection > div {
    width: 21%;
    aspect-ratio: 1;
    border-radius: 50%;
    color: transparent;
    transition: 150ms var(--cubic-ease-out);
}

.color-selection > div:hover {
    cursor: pointer;
    scale: 1.1;
}

.hidden .color-selection > div {
    width: 0;
}

#custom-color {
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--background-text-color);
    border: 1px solid var(--background-text-color);
}

#custom-color > input {
    height: 0;
    width: 0;
    padding: 0;
    border: none;
}

#custom-color > label:hover {
    cursor: pointer;
}

.switch-container {
    display: flex;
    align-items: center;
    max-width: 15rem;
    width: 80%;
    padding: 0rem 1rem 1rem;
    transition: 200ms var(--cubic-ease-out);
}

.switch-container:hover {
    cursor: pointer;
}

.hidden .switch-container {
    font-size: 0;
    padding: 0;
}

.switch {
    position: relative;
    width: 4rem;
    height: 2rem;
    border-radius: 1rem;
    border: 1px solid var(--background-text-color);
    margin-right: 1rem;
    transition: 200ms var(--cubic-ease-out);
}

.hidden .switch {
    height: 0;
}

.switch::after {
    content: "";
    display: block;
    position: absolute;
    top: 50%;
    left: 0.25rem;
    transform: translate(0, -50%);
    height: 1.5rem;
    aspect-ratio: 1;
    background-color: var(--background-text-color);
    border-radius: 50%;
    transition: 200ms var(--cubic-ease-out);
}

.light-text #light-text .switch::after {
    left: calc(100% - 1.75rem);
}

.spotify-tag #spotify-tag .switch::after {
    left: calc(100% - 1.75rem);
}

.additional-bg #additional-bg .switch::after {
    left: calc(100% - 1.75rem);
}

@media screen and (max-width: 450px) {
    .select-song {
        width: 45%;
    }
}

.custom-cover-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

#custom-cover-preview {
    width: 200px;
    height: 200px;
    border-radius: 0.5rem;
    background-color: var(--surface-light-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#custom-cover-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#cover-upload {
    display: none;
}

.custom-button {
    text-align: center;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    outline: none;
    font-weight: 600;
    opacity: 1;
    transition: 200ms var(--cubic-ease-out);
}

/* Custom Song Screen (Screen 5) */
.custom-song-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    width: 90%;
    max-width: 25rem;
    padding: 1.5rem 0;
}

.custom-cover-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

#custom-cover-preview {
    width: 10rem;
    height: 10rem;
    border-radius: 0.5rem;
    background-color: var(--surface-light-color);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: background-color 200ms var(--cubic-ease-out);
}

#custom-cover-preview:hover {
    background-color: var(--surface-color);
    cursor: pointer;
}

#custom-cover-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#cover-upload {
    display: none;
}

label[for="cover-upload"] {
    padding: 0.8rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    text-align: center;
    font-weight: 600;
    transition: 200ms var(--cubic-ease-out);
}

label[for="cover-upload"]:hover {
    padding: 0.8rem 2.5rem;
}

.song-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.song-details input {
    padding: 1rem;
    border: none;
    border-radius: 0.5rem;
    outline: none;
}

#custom-lyrics {
    min-height: 8rem;
    padding: 1rem;
    border: none;
    border-radius: 0.5rem;
    outline: none;
    resize: vertical;
    font-family: inherit;
}

#create-custom-song {
    text-align: center;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    outline: none;
    font-weight: 600;
    transition: 200ms var(--cubic-ease-out);
}

#create-custom-song:hover {
    cursor: pointer;
    padding: 1rem 3rem;
}
.search-form .separator {
    position: relative;
    width: 80%;
    max-width: 25rem;
    height: 1px;
    background-color: var(--surface-light-color);
    margin: 0.5rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-form .separator span {
    background-color: var(--background-color);
    padding: 0 0.8rem;
    font-size: 0.9rem;
    color: var(--surface-text-color);
    font-weight: 500;
}

label[for="cover-upload"] {
    padding: 0.8rem 1.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    text-align: center;
    font-weight: 600;
}

.song-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

#custom-lyrics {
    min-height: 150px;
    padding: 1rem;
    border: none;
    border-radius: 0.5rem;
    outline: none;
    resize: vertical;
    font-family: inherit;
}

#back-to-search {
    position: absolute;
    top: calc(50% + 0.2rem);
    left: -1rem;
    transform: translate(-100%, -50%);
    border: 0;
    border-radius: 0.5rem;
    padding: 0.5rem;
    background-color: var(--surface-light-color);
    color: var(--surface-text-color);
    transition: 150ms var(--cubic-ease-out);
}

#back-to-search:hover {
    cursor: pointer;
    background-color: var(--surface-color);
}
