:root {
    --accent-color: #5c2580; /* ff6f00 */
    --accent-color-darker: #512072; /* ff6f00 */
    --accent-color-darkest: #431b5e; /* ff6f00 */
    --background-color: #e9e9e9;
    --drop-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    --drop-shadow-darker: 0 0 15px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--background-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
}

main {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    width: 100vw;
    height: 100vh;
}

#canvas {
    background-color: white;
    flex-grow: 1;
    height: 100vh;
    box-shadow: var(--drop-shadow);
}

/* UI Elements */
.ui-element {
    border-radius: 10rem;
    background-color: white;
    padding: .75rem;
    z-index: 99;
}

.ui-element-big {
    border-radius: 1.5rem!important;
}

#toolbar {
    margin-right: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    filter: drop-shadow(0 0 15px rgba(0, 0, 0, 0.2));
    gap: .75rem;
    border-radius: 10rem;
    padding: 1rem 1rem 2rem 1rem;
}

.toolbar-item {
    font-size: 2rem;
    background-color: transparent;
    width: 4.75rem;
    height: 4.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin: 0.1rem;
    border: none;
    color: var(--accent-color); /* #4f4f4f */
}

.toolbar-item:hover {
    background-color: #e6e6e6;
}

.toolbar-item:active {
    background-color: #dddddd;
}

.toolbar-item:has(.toolbar-more) > span {
    position: relative;
}

.toolbar-more {
    font-size: 1.25rem;
    opacity: .7;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: -1.1rem;
}

.hidden {
    display: none !important;
}

.ui-expand-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.toolbar-item-title {
    margin: -0.3rem 0 0 0;
    font-size: .9rem;
    text-align: center;
    user-select: none;
}

.ui-expand {
    position: absolute;
    top: 50%;
    transform: translateY(-50%) translateX(100%);
    right: -1.5rem;
}

.ui-expand-top {
    transform: translateY(-20%) translateX(100%);
}

.ui-expand-bottom {
    transform: translateY(-70%) translateX(100%);
}

#shape-dropdown {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border-radius: 10rem;
}

#alwan-color-picker {
    border-radius: .25rem;
    max-width: 250px;
}

#alwan-color-picker > .alwan__palette{
    border-radius: .5rem .5rem 0 0;
}

#alwan-color-picker > .alwan__swatches {
    border-radius: 0 0 .5rem .5rem;
    max-height: unset;
}

#trash {
    color: rgb(200, 70, 70);
}

#confirm-delete {
    display: flex;
    flex-direction: row;
    gap: .5rem;
}

/* Images */
#image-dropdown {
    width: 336px;
    max-height: 65vh;
    overflow-y: auto;
}

.gallery-title {
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
}

.gallery-header {
    position: relative;
    padding: .5rem;
    /* background-color: #f7f7f7; */
    border-radius: 1rem;
    margin-bottom: 1rem;
}

.gallery-buttons {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
}

.gallery-buttons > button {
    cursor: pointer;
    border: none;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background-color: transparent;
}

.gallery-buttons > button:hover {
    background-color: #e6e6e6;
}

.gallery-buttons > button:active {
    background-color: #dddddd;
}

#qrcode-container {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

#qrcode-title{
    font-size: .95rem;
    margin-top: .25rem
}

#qrcode-container > a {
    font-size: .75rem;
    margin-bottom: 1rem;
}

#qrcode-container > a::after {
    content: attr(href);
}

#qrcode {
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

#images-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .5rem;
}

.image-button {
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
    line-height: 0;
}

.image-button::after {
    content: "";
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0);
    transition: background-color 0.15s ease;
}

.image-button:hover::after {
    background-color: rgba(0, 0, 0, 0.1);
}

.image-single {
    width: 150px;
    height: 125px;
    object-fit: cover;
}

/* Stickers */
#sticker-dropdown {
    height: 30rem;
    overflow-y: scroll;
    overflow-x: hidden;
}

#sticker-container {
    column-count: 3;
    column-gap: .5rem;
}

#sticker-container > button {
    margin: .25rem 0;
}

#sticker-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: .5rem;
    text-align: center;
}

.sticker-single {
    width: 100px;
    object-fit: contain;
}

/* Alignment */
#align span {
    font-weight: 1000!important;
    font-size: 1.75rem;
}

.align-btn span {
    font-weight: 500!important;
}

#align-dropdown {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#align-dropdown > div {
    display: flex;
    flex-direction: row;
    justify-content: center;
}

.clickable {
    cursor: pointer;
}

/* Page previews */
#pages-container {
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--drop-shadow);
    padding: 0;
    flex-direction: column;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

#pages-container button {
    background-color: transparent;
    transition: filter 0.1s ease;
    cursor: pointer;
}

#pages-container button:hover {
    filter: brightness(.5);
}

#preview-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: .1rem;
    flex-direction: column;
}

.preview-button {
    position: relative;
    outline: 1px solid #bdbdbd;
}

.preview-button::after {
    content: attr(data-tooltip);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    text-align: center;
    line-height: 2.5rem;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0);
    transition:
        background-color 0.15s ease,
        outline-color 0.05s ease-in-out;
}

.preview-button::after span {
    padding-bottom: 5px;
}

.preview-button:hover {
    cursor: pointer;
}

.preview-button:hover::after {
    background-color: rgba(0, 0, 0, 0.1);
}

.active {
    outline: var(--accent-color) solid 2px;
    outline-offset: -1px;
    z-index: 1;
    transition: outline-color 0.05s ease-in-out;
}

#right-container {
    position: relative;
    height: 100%;
    margin-left: 1.5rem;
}

#save-btn {
    position: absolute;
    bottom: 3rem;
    font-size: .9rem;
    width: 200px;
}

.btn-alt {
    background-color: var(--accent-color);
    color: white;
    border-radius: 10rem;
    border: none;
    padding: 1.25rem 2rem;
    font-family: inherit;
    user-select: none;
    box-shadow: var(--drop-shadow-darker);
    transition: transform 0.15s ease;
    cursor: pointer;
}

.btn-alt:hover {
    background-color: var(--accent-color-darker);
    transform: translateY(-2px);
}

.btn-alt:active {
    background-color: var(--accent-color-darkest);
}

#color span {
    outline: 2px solid black;
    outline-offset: -2px;
    border-radius: 50%;
}

#confirm-save-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    backdrop-filter: blur(10px);
    z-index: 999;
}

#confirm-save {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
    background-color: white;
    color: black;
    border-radius: 1rem;
    border: none;
    padding: 1.25rem 2rem;
    box-shadow: var(--drop-shadow-darker);
    font-size: .9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

#confirm-save-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: row;
    margin-top: .5rem;
}

/* Loading screen */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--background-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

#loading-container {
    width: 200px;
    height: 150px;
    display: flex;
    justify-content: center;
    flex-direction: column;
}

/* Loading animation adapted from https: //cssloaders.github.io/ */ 
.loader {
    position: relative;
    height: 200px;
    width: 300px;
    border-bottom: 3px solid var(--accent-color);
    box-sizing: border-box;
    animation: drawLine 5s linear infinite;
    display: inherit;
}

#loading-text {
    margin-top: 1rem;
    text-align: center;
    align-self: center;
    font-size: 1.08rem;
}

.loader:before {
    content: "";
    position: absolute;
    left: calc(100% + 14px);
    bottom: -6px;
    width: 16px;
    height: 100px;
    border-radius: 20px 20px 50px 50px;
    background-repeat: no-repeat;
    background-image: linear-gradient(var(--accent-color) 6px, transparent 0),
        linear-gradient(45deg, rgba(0, 0, 0, 0.02) 49%, var(--accent-color-darkest) 51%),
        linear-gradient(315deg, rgba(0, 0, 0, 0.02) 49%, var(--accent-color-darkest) 51%),
        linear-gradient(to bottom, var(--accent-color-darkest) 10%, var(--accent-color) 10%, var(--accent-color) 90%, var(--accent-color-darkest) 90%);
    background-size: 3px 3px, 8px 8px, 8px 8px, 16px 88px;
    background-position: center bottom, left 88px, right 88px, left top;
    transform: rotate(25deg);
    animation: pencilRot 5s linear infinite;
    display: inherit;
}

@keyframes drawLine {

    0%,
    90%,
    100% {
        width: 0px
    }

    45%,
    50%,
    55% {
        width: 200px
    }
}

@keyframes pencilRot {

    5%,
    45% {
        bottom: -6px;
        left: calc(100% + 14px);
        transform: rotate(25deg);
    }

    55%,
    80%,
    90% {
        bottom: -12px;
        left: calc(100% + 16px);
        transform: rotate(220deg);
    }

    100% {
        bottom: -6px;
        left: calc(100% + 14px);
        transform: rotate(25deg);
    }
}

/* On card completed */
#completion-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#completion-text-container {
    margin: 2rem 0;
}

#completion-text {
    font-size: 1.25rem;
    text-align: center;
}

#completion-buttons .btn-alt {
    font-size: 1.25rem;
    padding: 1rem 1.75rem;
}

#completion-buttons {
    display: flex;
    gap: 1rem;
}

#card-preview-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.preview-img {
    width: 300px;
    background-color: white;
    transform: rotate(var(--rotation));
    margin: 0 -2rem;
    box-shadow: var(--drop-shadow);
    user-select: none;
    -webkit-user-drag: none;
    opacity: 0;
    transform: translateY(10%) rotate(calc(var(--rotation) / 2));
    animation: slideIn .5s ease-out forwards;
}

@keyframes slideIn {
    0% {
        opacity: 0;
        transform: translateY(10%) rotate(calc(var(--rotation) / 2));
    }

    100% {
        opacity: 1;
        transform: translateX(0) rotate(var(--rotation));
    }
}

#completion-logo-container {
    position: absolute;
    top: 2rem;
    user-select: none;
    -webkit-user-drag: none;
}

#completion-logo {
    width: 200px;
}