@import url('https://fonts.googleapis.com/css2?family=Funnel+Display:wght@300..800&family=Google+Sans+Code:ital,wght@0,300..800;1,300..800&family=Montserrat+Alternates:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Mozilla+Text:wght@200..700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* font-family: "Mozilla Text", sans-serif; */
    /* font-family: "Montserrat Alternates", sans-serif; */
    font-family: "Funnel Display", sans-serif;
    /* font-family: "Google Sans Code", monospace; */
}

.gradient-background {
    background: linear-gradient(300deg, #000000, #070707, #000000);
    background-size: 180% 180%;
    animation: gradient-animation 18s ease infinite;
}

@keyframes gradient-animation {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

:root {
    --primary-color: #eeecff;
    --secondary-color: rgba(200, 200, 200, 0.05);
    --background-color: #000000;
    --foreground-color: rgba(20, 20, 20, 0.7);
}

body {
    width: 100dvw;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    color: var(--primary-color);
    background-color: hsla(0, 0%, 0%, 1);
    background-image:
        radial-gradient(at 40% 20%, hsla(0, 0%, 4%, 1) 0px, transparent 50%),
        radial-gradient(at 80% 0%, hsla(0, 0%, 9%, 1) 0px, transparent 50%),
        radial-gradient(at 0% 50%, hsla(0, 0%, 0%, 1) 0px, transparent 50%),
        radial-gradient(at 80% 50%, hsla(338, 0%, 0%, 1) 0px, transparent 50%),
        radial-gradient(at 0% 100%, hsla(0, 0%, 7%, 1) 0px, transparent 50%),
        radial-gradient(at 80% 100%, hsla(0, 3%, 6%, 1) 0px, transparent 50%),
        radial-gradient(at 0% 0%, hsla(341, 0%, 7%, 1) 0px, transparent 50%);
}

canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100dvw;
    height: 100dvh;
    z-index: -1;
}

.root {
    padding-top: 10dvh;
    width: 500px;
    height: 100%;
    display: flex;
    justify-content: start;
    align-items: center;
    flex-direction: column;
    gap: 10px;
}

header {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 20px;
}

input {
    width: 100%;
    height: 45px;
    padding: 15px;
    border: 1px solid var(--secondary-color);
    background: transparent;
    color: var(--primary-color);
    border-radius: 10px;
    font-size: 1rem;
    outline: none;
}

input::placeholder {
    color: var(--primary-color);
    opacity: 0.7;
}

input[type="file"] {
    width: 100%;
    height: max-content;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    padding-left: 8px;
    cursor: pointer;
    border: none;
}

input[type="file"]::-webkit-file-upload-button {
    background: var(--primary-color);
    color: var(--background-color);
    border: none;
    padding: 7.5px 15px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    margin-right: 10px;
    transition: all 0.3s ease;
}

.title {
    font-family: "Funnel Display", sans-serif;
    font-size: 7rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 50px;
}

.models {
    width: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.models .model {
    padding: 10px 20px;
    width: 100%;
    border: 1px solid var(--secondary-color);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-transform: none;
    font-weight: 600;
    background: rgba(20, 20, 20, 0.3);
    box-shadow: 20px 20px 40px -6px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(13.9px);
    -webkit-backdrop-filter: blur(13.9px);
}

.models .model.selected {
    border: 1px solid var(--primary-color);
    background: var(--primary-color);
    color: var(--background-color);
}

.output-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 10px;
}

.output-wrapper div {
    width: 100%;
    display: flex;
    justify-content: end;
    align-items: center;
    margin-top: 15px;
    gap: 10px;
}

.gen-section {
    transition: all 0.3s ease;
    width: 300px;
    height: max-content;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 20px;
    border-radius: 10px;
    padding: 20px 20px;
    border: 1px solid var(--secondary-color);
    background: rgba(20, 20, 20, 0.3);
    box-shadow: 20px 20px 40px -6px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(13.9px);
    -webkit-backdrop-filter: blur(13.9px);

}

.gen-section .inputs {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 10px;
}

.gen-section .input-group {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;

}

.gen-section .input-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: start;
    flex-direction: column;
    gap: 5px;
}

.gen-section .input-wrapper label {
    font-size: 0.9rem;
    font-weight: 500;
    padding: 5px 10px;
}

#query-input-wrapper,
#file-input-wrapper {
    transition: all 0.3s ease;
    opacity: 1;
}

#query-input-wrapper {
    max-height: 200px;
}

#file-input-wrapper {
    max-height: 150px;
}

.checkbox-input-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 5px 10px;
}

.checkbox-input-wrapper input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    color: var(--background-color);
    accent-color: var(--primary-color);
}

.checkbox-input-wrapper label {
    cursor: pointer;
}

#query-input-wrapper.hidden,
#file-input-wrapper.hidden {
    max-height: 0px;
    opacity: 0;
    pointer-events: none;
}

#gen-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    border: none;
}

.gen-section button {
    width: 100%;
    padding: 10px 15px;
    border: none;
    background: var(--primary-color);
    color: var(--background-color);
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;

    &:active {
        scale: 0.98;
    }
}

#key-display {
    width: 100%;
    white-space: normal;
    word-wrap: break-word;
    text-align: center;
    cursor: pointer;
}


.warn {
    color: rgba(255, 80, 80, 1);
    font-weight: 500;
}

#key-len.invalid {
    border: 2px solid rgba(255, 80, 80, 1);
    color: rgb(255, 80, 80);
    font-weight: 600;
}

#key-len.disabled {
    cursor: not-allowed;
}

.popover-wrapper {
    position: fixed;
    width: 100dvw;
    height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    top: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.popover-wrapper .popover {
    max-height: 500px;
    transition: all 0.5s ease;
    width: 300px;
    height: max-content;
    display: flex;
    justify-content: start;
    align-items: center;
    flex-direction: column;
    gap: 10px;
    border-radius: 10px;
    padding: 10px 0;
    border: 1px solid var(--secondary-color);
    background: rgba(20, 20, 20, 0.7);
    box-shadow: 20px 20px 40px -6px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(13.9px);
    -webkit-backdrop-filter: blur(13.9px);
}

.popover-wrapper .popover .popover-nav {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px 0 20px ;
    
}

.popover-wrapper .popover .popover-nav div {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.popover-wrapper .popover #popover-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    font-family: "Funnel Display", sans-serif;
    text-overflow: ellipsis;
    width: 150px;
}

.popover-wrapper .popover #popover-body {
    overflow: hidden;
    width: 100%;
    max-height: 400px;
    overflow-y: auto;
    font-size: 1rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    padding: 10px 20px;
    border-top: 1px solid var(--secondary-color);
}

.popover-wrapper .popover #popover-body::-webkit-scrollbar {
    display: none;
    width: 0px;
}

.popover-wrapper .popover .popover-actions {
    width: 100%;
    display: flex;
    justify-content: end;
    align-items: center;
    gap: 10px;
}

.popover-wrapper .popover button,
.popover-wrapper .popover a,
.output-wrapper span {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    color: var(--primary-color);
    border: none;
    border-radius: 50%;
    background: rgba(40, 40, 40, 0.9);
    backdrop-filter: blur(15px);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.15rem;
    cursor: pointer;
    transition: all 0.4s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    
    &:hover {
        background: var(--primary-color);
        color: var(--background-color);
    }

    &:active {
        scale: 0.9;
    }
}

.output-wrapper span {
    background: rgba(30, 30, 30, 0.9);
}

.popover-wrapper.hidden {
    opacity: 0;
    pointer-events: none;
}

.popover-wrapper.hidden .popover {
    max-height: 0px;
    opacity: 0;
    pointer-events: none;
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

@media screen and (max-width: 500px) {
    .root {
        width: 100%;
        padding-top: 50px;
        padding-inline: 20px;
    }

    .title {
        font-size: 4rem;
        margin-bottom: 30px;
    }

    .gen-section {
        width: 100%;
        padding: 15px 15px;
    }

    .models {
        width: 100%;
    }

}