/* ROOT LEVEL STUFF */
*{
    font-family: "Afacad", sans-serif;
}
:root {
    /* seaborn pastel palette - https://seaborn.pydata.org/tutorial/color_palettes.html */
    --red: #ff9f9b;
    --green: #8de5a1;
    --blue: #a1c9f4;
    --orange: #ffb482;
    --lightblue: #b9f2f0;
    --yellow: #fffea3;
    --pink: #fab0e4;
    --purple: #d0bbff;

    --black: #111;
    --grey: #222;
    --transparent-grey: #222c;
    --light-grey: #3a3a3a;
    --lighter-grey: #555;
    --white: #eee;
    --dark-pink: #855b78;
    --default-colour: var(--black);

    --nav-background: var(--grey);
}
body {
    background-color: var(--black);
    color: var(--white);
    margin: 0;
}
#login-container {
    height: 100%;
    width: 100%;
    display: flex;
    position: fixed;
    align-items: center;
    justify-content: center;
}
#login-link {
    font-size: x-large;
    color: var(--black);
    background-color: var(--white);
    border-radius: 100em;
    padding: 2em;
}
button {
    border-radius: 16px;
    border: solid 1px var(--white);
    background-color: var(--grey);
    color: var(--white);
    font-size: medium;
    padding: 4px 8px;
    margin: 2px 0;
}
.large-button {
    font-size: large;
}
button:hover {
    filter: invert();
}
a {
    color: var(--white);
}
a:visited {
    color: var(--white);
}
input[type=text],
input[type=search] {
    box-sizing: border-box;
    border: solid 1px var(--white);
    color: var(--white);
    background-color: var(--grey);
    font-size: large;
    padding: 0.4em;
    border-radius: 0.5em;
}
input[type=text]:focus,
input[type=search]:focus {
    outline: 3px solid var(--white);
}
.error {
    color: var(--red);
}

/* HEADER */
#header {
    background-color: var(--grey);
    border-bottom: solid 1px var(--dark-pink);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    padding: 1em;
    height: 60px;
}
#header a {
    margin: 0;
    font-size: large;
}
#mobile-fetch {
    display: none;
}
@media (max-width: 35em) {
    #header {
        display: none;
    }
}

/* LAYOUT */
#main-content-layout {
    display: grid;
    grid-template-columns: minmax(14em, 1fr) 5fr;
}
@media(min-width: 35em) { /* no header on mobile */
    #main-content-layout {
        height: calc(100dvh - 60px); /* subtract #header height :( */
    }
}

/* SHELF WITHOUT ALBUMS */
#shelf-no-albums {
    display: flex;
    height: 50dvh;
    align-items: center;
    justify-content: center;
}
#shelf-no-albums .fetch-albums-button,
#shelf-no-albums label {
    font-size: xx-large;
}
#shelf-no-albums progress {
    appearance: none;
    height: 2em;
}

/* SHELF NAVIGATION */
#shelf-scroll {
    overflow-y: auto;
    visibility: hidden;
    background-color: var(--nav-background);
}
#shelf-scroll:hover {
    visibility: visible;
}
#shelf-navigation {
    visibility: visible;
    background-color: var(--nav-background);
    padding-left: 1em;
    height: calc(100dvh - 61px); /* header height plus one required to hide scrollbar */
    /* fixes weird bug where enclosing div
    shows with different bg colour */
    padding-top: 1px;
}
#shelf-list {
    padding: initial;
    list-style-type: none;
}
#mobile-logout {
    display: none;
}
.shelf-entry {
    border-radius: 2em 0 0 2em;
    padding-left: 1em;
    position: relative;
    overflow-x: hidden;
}
.shelf-entry:hover {
    background-color: var(--light-grey);
}
.active-shelf,
.active-shelf:hover {
    background-color: var(--black);
}
.shelf-link {
    padding: 0.5em 0;
    font-size: large;
    cursor: pointer;
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}
.shelf-item-menu-button {
    border: none;
    background-color: transparent;
    color: var(--white);
    font-weight: bold;
    font-size: large;
    cursor: pointer;
}
.shelf-item-menu-button:hover {
    color: var(--pink);
    background-color: var(--lighter-grey);
    filter: none;
    border-radius: 30%;
}
.shelf-name-and-menu-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    cursor: pointer;
}
.shelf-edit-buttons {
    display: grid;
    column-gap: 1em;
    row-gap: 0.5em;
    grid-template-columns: 1fr 2em;
    grid-template-areas:
        "change-colour up"
        "rename down"
        "delete .";
}
@media(max-width: 35em) {
    .shelf-edit-buttons {
        padding-right: 0.5em;
    }
}
.arrow-button {
    border: none;
    background: transparent;
    justify-self: center;
}
.arrow-button :hover {
    background-color: var(--light-grey);
    border-radius: 1em;
}
.up {
    grid-area: up;
}
.down {
    grid-area: down;
}
.rename {
    grid-area: rename;
}
.change-colour {
    grid-area: change-colour;
}
.delete {
    grid-area: delete;
}
.delete button {
    width: 100%;
}
.arrow-button img {
    width: 1.5em;
    height: 1.5em;
    color: white;
}
#shelf-colour-picker {
    height: 3em;
    width: 8em;
    justify-self: center;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}
.shelf-colour-swatch {
    border: none;
    height: 100%;
    width: 100%;
}
.shelf-colour-swatch:hover {
    filter: none;
}
#shelf-navigation input {
    width: calc(100% - 1em);
}
#shelfname {
    margin-top: 1em;
    margin-bottom: 0.5em;
}

/* SHELF LAYOUT */
#shelf-layout {
    overflow: auto;
}
#shelf-header {
    position: sticky;
    top: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding-inline: 2em;
    backdrop-filter: blur(5px);
}
.sort-buttons.mobile {
    display: none;
}
.sort-buttons {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}
.sort-buttons p {
    margin: 1em;
    font-size: large;
    font-weight: bold;
    filter:
        drop-shadow(0 0 0.1em var(--black))
        drop-shadow(0 0 0.1em var(--black))
        drop-shadow(0 0 0.1em var(--black));
}
.sort-button {
    font-size: large;
    margin: 0 0.5em;
    background-color: var(--white);
    color: var(--black);
    border: solid 2px var(--black);
}
#shelf-albums {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-evenly;
}
#shelf-nav-open,
#shelf-nav-close {
    display: none;
}
/* SHELF NAVIGATION MOBILE */
@media (max-width: 35em) {
    button {
        font-size: medium;
    }
    #main-content-layout {
        width: 100dvw;
        display: flex;
    }
    #shelf-layout {
        height: 100dvh;
        width: 100dvw;
    }
    #shelf-header {
        padding-top: 0.5em;
        padding-inline: 1em;
    }
    #search {
        padding-right: 2em;
    }
    #shelf-navigation {
        display: none;
        background-color: var(--transparent-grey);
        backdrop-filter: blur(5px);
        position: fixed;
        border-left: solid 1px var(--dark-pink);
        right: 0;
        z-index: 100;
        overflow-y: scroll;
        height: 100dvh;
        width: 95dvw;
    }
    #mobile-logout {
        display: block;
        padding-block: 2em;
    }
    #mobile-fetch {
        display: block;
    }
    .sort-buttons.desktop {
        display: none;
    }
    .sort-buttons.mobile {
        display: flex;
        padding-top: 0.5em;
    }
    .sort-button {
        margin: 0 0.1em;
    }
    #shelf-nav-mobile-header {
        display: flex;
        align-items: baseline;
    }
    #shelf-nav-open {
        display: block;
        border: none;
        background-color: transparent;
    }
    #shelf-nav-open img {
        width: 2em;
    }
    #shelf-nav-close {
        display: block;
        font-size: large;
        font-weight: bolder;
        background-color: transparent;
        font-size: x-large;
        border: none;
        padding-top: 0.5em;
        padding-right: 1.25em;
        margin-left: auto;
    }
    .shelf-item-menu-button {
        padding-right: 1em;
    }
}

/* ALBUMS */
.album-container {
    width: 12em;
    padding: 1em;
    margin: 1em;
    border-radius: 1em;
    border: solid 1px var(--dark-pink);
    text-align: center;
    background-color: var(--grey);
}
.album-container p {
    margin-block: 0.5em;
}
.album-container:hover {
    background-color: var(--light-grey);
}
.album-cover {
    width: 100%;
    cursor: pointer;
}
#album-modal-container {
    display: none;
    justify-content: center;
    align-content: center;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: blur(5px);
}
#album-modal-content {
    background-color: var(--grey);
    border-radius: 1em;
    border: solid 4px var(--dark-pink);
    max-width: 80dvw;
    display: grid;
    grid-template-columns: 2fr 3fr;
    justify-items: center;
    overflow-y: auto;
}
@media(max-width: 35em) {
    #album-modal-content {
        grid-template-columns: none;
    }
}
.album-modal-cover-container {
    width: 90%;
    aspect-ratio: 1 / 1;
    position: relative;
    padding-block: 2em;
}
.album-modal-cover {
    max-width: 100%;
}
.album-modal-cover-container .play-button {
    position: absolute;
    bottom: 1em;
    right: 0.5em;
    font-size: xxx-large;
    height: 2em;
    width: 2em;
    border: solid 1px var(--white);
    border-radius: 100em;
    filter: drop-shadow(0 0 0.2em var(--black));
    backdrop-filter: blur(5px);
    background: hsla(0, 0%, 0%, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
}
@media(max-width: 35em) {
    .album-modal-cover-container .play-button {
        font-size: xx-large;
    }
}
.album-modal-cover-container .play-button:hover {
    filter:
        invert()
        drop-shadow(0 0 0.2em var(--black));
}
#shelf-switch-section {
    width: 100%;
    padding-inline: 1em;
    border-right: solid 1px var(--dark-pink);
}
/* bigger switch buttons on desktop */
@media(min-width: 35em) {
    #shelf-switch-buttons button {
        font-size: x-large;
        border-width: 2px;
    }
}
#modal-close {
    display: none;
}
@media(max-width: 35em) {
    #shelf-switch-section {
        border-right: none;
    }
    #album-modal-content {
        position: relative;
    }
    #modal-close {
        display: block;
        border: none;
        font-size: x-large;
        position: absolute;
        right: 0;
        top: 0;
        padding-block: 0.7em;
        padding-right: 1em;
    }
}
#shelf-switch-buttons {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1em;
}
#album-modal-content p {
    font-size: large;
    padding-inline: 2em;
}
/* ALBUMS MOBILE */
@media (max-width: 35em) {
    .album-container {
        width: 8em;
        margin: 0.5em;
    }
}

/* PRE-DEFINED COLOUR CLASSES */
.bg-red {
    background-color: var(--red);
}
.bg-green {
    background-color: var(--green);
}
.bg-blue {
    background-color: var(--blue);
}
.bg-orange {
    background-color: var(--orange);
}
.bg-lightblue {
    background-color: var(--lightblue);
}
.bg-yellow {
    background-color: var(--yellow);
}
.bg-pink {
    background-color: var(--pink);
}
.bg-purple {
    background-color: var(--purple);
}
.bg-default-colour {
    background-color: var(--default-colour);
}
.fg-red {
    color: var(--red);
}
.fg-green {
    color: var(--green);
}
.fg-blue {
    color: var(--blue);
}
.fg-orange {
    color: var(--orange);
}
.fg-lightblue {
    color: var(--lightblue);
}
.fg-yellow {
    color: var(--yellow);
}
.fg-pink {
    color: var(--pink);
}
.fg-purple {
    color: var(--purple);
}
.fg-default-colour {
    color: #eee;
}
.border-red {
    border-color: var(--red);
}
.border-green {
    border-color: var(--green);
}
.border-blue {
    border-color: var(--blue);
}
.border-orange {
    border-color: var(--orange);
}
.border-lightblue {
    border-color: var(--lightblue);
}
.border-yellow {
    border-color: var(--yellow);
}
.border-pink {
    border-color: var(--pink);
}
.border-purple {
    border-color: var(--purple);
}
.border-default-colour {
    border-color: var(--white);
}