/* * * * * * * *
    Credits:
    Code is original by alexberen.
    Some insipration taken from (or at times copy/pasted from):
    * https://www.youtube.com/watch?v=dUQQEpOZPBg&list=PLFoezrhIhRD5-IaBmSjIWw24qQ0d2bi_M&index=1 (beer hover/click and popping number animations)
 * * * * * * * */

/* * * * * * * *
    Color Variables
 * * * * * * * */
 :root {
    --brown: #964B00;
    --orange: #FF8B17;
    --purple: #4B0096;
    --red: red;
    --semi-transparent-bg: rgba(0, 0, 0, 0.5);
 }

/* * * * * * * *
    Defaults
 * * * * * * * */
body {
    overflow: hidden;
    user-select: none;
    background-color: var(--brown); /* fallback color */
    background-image: url(assets/wood-2045379_1920.jpg);
    background-size: cover;
}
button, .store-item, .nav-item, #barNameWrapper, #bandNameWrapper, #beerButton, .pointer {cursor: pointer; -webkit-tap-highlight-color: transparent;}
p {font-size: 0.8rem;}
li {font-size: 0.75rem;}

h2 {
    font-size: 1.5rem;
    font-weight: bold;
}

h3 {
    margin: 0;
    padding-top: 0.25em;
    padding-left: 0.25em;
    text-align: left;
    font-size: 1rem;
}

h4 {
    margin: 0;
    font-size: 1.3rem;
}

h5 {
    margin: 0;
    font-size: 1.1rem;
}

li {
    font-size: 0.8rem;
    margin-bottom: 10px;
    margin-top: 10px;
}

.text-align-center { text-align: center; }

/* * * * * * * *
    Buttons
 * * * * * * * */
 button {
    background-color: white;
    width: 100%;
    border: 4px solid black;
    height: 50px;
    margin-bottom: 20px;
}

button:hover {background-color: var(--orange);}

/* Reset Buttons */
#resetButton {background-color: var(--red);}
#resetButton:hover, #cancelButton:hover, .modal-button:hover {
    font-weight: bold;
    text-shadow: 0 0 30px white;
}

/* * * * * * * *
    Section Wrappers
 * * * * * * * */
#wrapper {
    display: flex;
    margin: 0;
    padding: 0;
}

#storeWrapper, #rightPanelWrapper {
    width: 210px;
    padding: 0;
    margin: 0;
}

#storeWrapper {
    border-right: 2px black solid;
    background-color: var(--semi-transparent-bg);
}
#rightPanelWrapper {border-left: 2px black solid; background-color: transparent;}
.stats-upper-wrapper, .stats-bottom-wrapper {
    padding: 5px;
    background-color: white;
    border-bottom: 2px solid black
}

#gameWrapper {
    width: calc(100vw - 420px);
    border-left: 2px black solid;
    border-right: 2px black solid;
    text-align: center;
}

/* * * * * * * *
    Borders & Dividers
 * * * * * * * */
.border {
    width: 100%;
    height: 4px;
    background-color: black;
}

.divider {
    width: 100%;
    height: 2px;
    background-color: black;
}

.right-panel .divider {margin-bottom: 15px;}

/* * * * * * * *
    Game Section
 * * * * * * * */
/* Bar Name */
 #barNameWrapper {
    border: 4px solid black;
    background-color: var(--semi-transparent-bg);
    color: white;
    border-radius: 15px;
    width: 90%;
    margin: 8px auto;
    padding: 0;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#barNameWrapper h1 {
    font-size: 1.6rem;
}

/* Band Name */
#bandNameWrapper {
    border: 4px solid black;
    background-color: var(--semi-transparent-bg);
    color: white;
    min-width: 100%;
    margin: 8px auto;
    padding: 0;
    height: 30px;
    display: none;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    padding: 0;
    font-weight: 500;
    overflow: hidden;
    white-space: nowrap;
    --gap: 1rem;
    gap: var(--gap);
}

#barNameWrapper:hover, #bandNameWrapper:hover {
    text-shadow: 0 0 10px white;
}

.strong {
    font-weight: 900;
}

#bandNameWrapper p {
    max-width: 100%;
    white-space: nowrap;
    animation: scroll-left 15s linear infinite;
}

@keyframes scroll-left {
    0% {
        transform: translateX(130%)
    }
    100% {
        transform: translateX(-115%)
    }
}

#songInput {margin-bottom: 10px;}

/* Bank */
#beersInBankWrapper {
    width: 100%;
    height: 90px;
    border-top: 4px solid black;
    border-bottom: 4px solid black;
    background-color: var(--semi-transparent-bg);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
#beersInBankWrapper h2 {margin: 0;}
#beersInBankWrapper p {margin: 0; font-size: 0.6rem;}

 /* Beer Button */
#beerButtonWrapper {
    height: calc(100vh - 156px);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

#beerButton {
    border: 0;
    width: 10rem;
    height: auto;
    margin: auto;
    padding: 0;
    background-image: url('assets/beer-3804654_1280.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-color: rgba(0, 0, 0, 0);
    position: absolute;
    top: 12%;
    aspect-ratio: 965 / 1280;

    transform: scale(1);
    transition: transform 0.2s ease;
}

#beerButton:hover {
    background-color: rgba(0, 0, 0, 0);

    transform: scale(1.15);
    opacity: 0.95;
}
#beerButton:active {
    transform: scale(1.3);
    opacity: 0.8;
}

.fade-up {
    animation: fade-up 1s;
}

@keyframes fade-up {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    20% {
        transform: translateY(-5px);
        opacity: 0.8;
    }
    40% {
        transform: translateY(-13px);
        opacity: 0.6;
    }
    60% {
        transform: translateY(-25px);
        opacity: 0.4;
    }
    80% {
        transform: translateY(-42px);
        opacity: 0.2;
    }
    100% {
        transform: translateY(-62px);
        opacity: 0;
    }
}

/* * * * * * * *
    Store & Right Panel stuff
 * * * * * * * */
.panel-heading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 40px;
    background-color: white;
}

.icons-wrapper {
    height: 40px;
    display: flex;
    align-items: center;
    margin-inline: 0;
    background-color: white;
}

#storeIconsWrapper a, #rightPanelIconsWrapper a {color: black;}

.nav-item {
    display: block;
    flex-grow: 1;
    aspect-ratio: 1/1;
    text-align: center;
    height: 40px;
}

.icon {
    font-size: 1.8rem;
    position: relative;
    top: 50%;
    transform: translateY(-50%);
}

.active {background-color: var(--orange);}
.display-none {display: none;}

#statsPanelWrapper, #optionsPanelWrapper, #infoPanelWrapper {
    padding-inline: 0;
    margin: 0;
}

#optionsContentWrapper {
    padding-top: 5px;
    padding-inline: 10px;
    margin: 0;
    background-color: white;
    max-height: fit-content;
}

#versionWrapper {
    background-color: white;
    padding-top: 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid black;
}

#statsContentWrapper, #infoContentWrapper {padding: 0; background-color: var(--semi-transparent-bg)}

/* * * * * * * *
    Store Panel
 * * * * * * * */
#buildingsStoreWrapper {
    margin: 0;
    padding: 0;
}

.worker-item {background-image: url(assets/paper-1074131_1280.jpg);}
.building-item {
    background-image: url(assets/texture-2068283_1280.jpg);
    background-size: contain;
}
.upgrade-item {background-image: url(assets/texture-1647380_1280.jpg);}

.building-item, .worker-item {
    border: 0;
    height: 90px;
    margin: 0;
    padding: 0;
    /* background-color: white; */
}

.cost-p {
    margin-top: 1.75em;
    margin-left: 0.25em;
    text-align: left;
    font-size: 0.7rem;
}

.building-lvl-div, .worker-owned-div {
    position: absolute;
    right: 0.25em;
    top: 1.1em;
    font-size: 1rem;
}

.right-panel-content {
    height: calc(100vh - 88px);
    padding: 0;
    overflow-y: scroll;
    scrollbar-width: thin;
}

.store-panel {
    height: calc(100vh - 88px);
    overflow-y: scroll;
    scrollbar-width: thin;
}

.disabled {
    opacity: 0.5;
    cursor: auto;
}

.disabled > * {opacity: 0.5;}

.store-item {
    position: relative;
    height: 60px;
    margin: 0;
    padding: 0;
    border-bottom: 4px solid black;
}

.buy-button:hover {
    box-shadow: inset 0 0 10px white;
}

.store-item-data {
    position: absolute;
    left: 210px;
    border: 2px solid gold;
    border-radius: 2px;
    background-color: black;
    color: white;
    z-index: 5;
    width: 275px;
    padding: 5px;
    padding-inline: 10px;
    font-size: 0.9rem;
    margin: 0;
}

.locked {
    visibility: hidden;
    opacity: 0;
    transition: opacity 1s ease-in, visibility 0ms ease-in 0ms;
}

.unlocked {
    visibility: visible;
    opacity: 1;
}

.upgrade-data-div {
    position: absolute;
    border: 2px solid gold;
    background-color: black;
    color: white;
    z-index: 5;
    width: 250px;
    padding: 5px;
    padding-inline: 10px;
    font-size: 0.9rem;
    margin: 0;
}
.left {left: 210px;}
.right {right: 210px;}

.purchased-upgrade {
    right: 210px;
}

.purchased {
    cursor: default;
    background-image: url(assets/texture-1647380_1280.jpg);
}

/* Upgrades attention seeker */
.upgrades-blink {
    animation-name: upgrades-attention-seeker;
    animation-duration: 1s;
    animation-iteration-count: 2;
    animation-timing-function: ease-in-out;
}

@keyframes upgrades-attention-seeker {
    0% {background-color: rgba(0, 0, 0, 0); color: black;}
    50% {background-color: var(--purple); color: white;}
    100% {background-color: rgba(0, 0, 0, 0); color: black;}
}

/* * * * * * * *
    Toast
 * * * * * * * */
#toastContainer {
    position: fixed;
    bottom: -5px;
    left: 294px;
    z-index: 4;
}

.toast-wrapper {
    visibility: hidden;
    width: calc(100vw - 568px);
    background-color: var(--orange);
    background: repeating-linear-gradient(
        225deg,
        var(--orange),
        var(--orange) 10px,
        black 10px,
        black 20px
    );
    position: relative;
    margin-bottom: 5px;
    text-align: left;
    padding-top: 4px;
    padding-bottom: 4px;
}

.toast-content-wrapper {
    background-color: white;
    color: black;
    margin: 4px;
    padding: 0 5px;
}

.toast-title {
    font-weight: bold;
    margin: 0;
    padding-top: 5px;
    padding-bottom: 5px;
}

.toast-message {
    margin: 0;
    padding-top: 5px;
    padding-bottom: 5px;
}

.show {visibility: visible;}

.ease-out {
    animation-duration: 1s;
    animation-timing-function: ease-out;
    animation-name: fadeout;
}

@-webkit-keyframes fadeout {
    from { opacity: 1; }
    to { opacity: 0; }
}
@keyframes fadeout {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* * * * * * * *
    Modals (including versioning)
 * * * * * * * */
.scrim {
    height: 100vh;
    width: 100vw;
    background-color: rgba(0,0,0,0.75);
    position: absolute;
    top: 0;
    left: 0;
    z-index: 50;
}

#modalWrapperEl, #versionInfo {
    background-color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 52%;
    transform: translate(-50%, -50%);
    border: 4px black solid;
    padding-top: 0;
    z-index: 99;
    text-align: center;
    border-radius: 10px;
}

#versionInfo {
    text-align: left;
    max-height: 67vh;
}

#versionModalVersionNumberWrapper {
    height: 25px;
    line-height: 21px;
    border-bottom: 2px solid black;
}

#versionModalVersionNumberWrapper .version-number-p {
    margin-top: 1px;
    margin-bottom: 0;
}

#versionModalContentWrapper{
    max-height: calc(67vh - 78px);
    overflow-y: scroll;
    scrollbar-width: thin;
}

#versionInfo p {
    font-size: 0.85rem;
    margin-bottom: 10px;
}

#versionInfo li {
    font-size: 0.85rem;
    margin-bottom: 4px;
}

#versionInfo ul { margin-bottom: 20px;}

#versionInfo h4 {
    text-align: center;
    margin-top: 10px;
}

#versionInfo #betaNote {margin: 10px;}

#versionModalCloseBtn:disabled {
    cursor: not-allowed;
}

#versionModalCloseBtn:disabled:hover {
    background-color: lightgray;
}

#modalContentWrapperEl {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#modalButtonsWrapperEl {display: flex; flex-direction: row;}

#modalWrapperEl h3 {
    text-align: center;
    padding-top: 10px;
}

#newNameTitle {
    text-align: center;
    text-decoration: underline;
}

#newNameInput {
    margin: 15px auto;
    padding: 10px;
    height: 15px;
    border-radius: 20px;
    text-align: center;
    width: 50%;
    display: block;
    margin-top: 0;
}

.modal-button {
    text-align: center;
    width: 50%;
    height: 50px;
    margin-bottom: 0;
    background-color: white;
    border-top: 4px black solid;
    border-bottom: 0;
    border-left: 0;
    border-right: 0;
}

.random-name-button {
    border: 1px solid black;
    border-radius: 50px;
    width: 25%;
    font-size: 0.5rem;
    margin-bottom: 15px;
    height: 20px;
}

.modal-reset-button {background-color: var(--red);}

#exportCode {
    margin: 15px auto;
    padding: 10px;
    overflow-wrap: break-word;
    overflow-y: auto;
    scrollbar-width: thin;
    width: 50%;
    height: 100px;
    border: 2px black solid;
}

.modal-confirm {
    border-right: 2px solid black;
    border-radius: 0 0 0 6px;
}

.modal-cancel {
    border-left: 2px solid black;
    border-radius: 0 0 6px 0;
}
.modal-cancel:hover {background-color: var(--red);}

.ok-button {
    width: 100%;
    margin-bottom: 0;
    border-radius: 0 0 6px 6px;
}

#modalContentDiv {
    margin-bottom: 20px;
    padding-inline: 5px;
}

#importFileInput {
    appearance: none;
    display: none;
}

/* * * * * * * *
    Right Panel
 * * * * * * * */
.version-number-p {
    text-decoration: underline;
    text-align: center;
    font-size: 0.8rem;
    margin: auto;
    width: 67%;
    padding: 2px;
    border-radius: 5px;
    transition: background 0.5s;
}

.version-number-p:hover {
    background-color: var(--red);
}

p.top {
    margin-top: 10px;
}

#betaNote {
    border: 4px solid var(--red);
    border-radius: 10px;
    padding-inline: 10px;
    margin: 5px;
}

/* * * * * * * *
    Details
 * * * * * * * */
/* details {
    background-color: white;
    border-bottom: 2px solid black;
} */

summary {
    font-weight: bold;
    border-bottom: 1px solid black;
    padding: 10px 5px;
    background-color: white;
}

details[open] {
    background-color: white;
    padding-bottom: 10px;
    /* padding-right: 15px; */
}

details[open] h5 {
    padding: 10px;
}

details[open] ul {
    margin-left: 20px;
    padding-inline: 10px;
}

details[open] p {
    margin: 10px;
}

.copy {
    padding-inline: 10px;
    padding-bottom: 10px;
    margin-bottom: 0;
}

/* summary::after {
    margin-left: 74px;
    display: inline-block;
    content: '>';
    transition: 0.2s;
    font-weight: 900;
} */

/* .upgrades-summary::after {
    margin-left: 27px;
    display: inline-block;
    content: '>';
    transition: 0.2s;
    font-weight: 900;
    
} */

/* details[open] > summary:before {transform: rotate(90deg);} */

/* * * * * * * *
    Mobile
 * * * * * * * */
@media screen and (width <= 650px) {
    #storeWrapper, #rightPanelWrapper {display: none;}
    #gameWrapper {
        width: 100%;
        border: none;
    }
    #mobileNav {
        display: flex;
        align-items: center;
        justify-items: center;
        position: fixed;
        bottom: 0;
        width: 100%;
        border-top: 4px solid black;
        background-color: white;
        z-index: 3;
    }
    a {color: black;}
    #beerButton {
        position: absolute;
        top: 12vh;
        width: 15rem;
    }
    #storeWrapper, #rightPanelWrapper {
        position: absolute;
        top: 114px;
        bottom:0;
        width: 100%;
        height: calc(100vh - 149px);
        z-index: 2;
        border: none;
    }
    .store-panel, .right-panel-content {
        height: calc(100vh - 300px);
        border: none;
    }
    .store-panel {touch-action: manipulation;}
    #beersInBankWrapper {
        height: 75px;
        touch-action: manipulation;
    }
    .version-number-p {background-color: var(--red);}
    #toastContainer {
        bottom: 44px;
        left: 25vw;
        width: 50vw;
    }
    .toast-wrapper {
        width: 50vw;
        margin: auto;
    }
    #modalWrapperEl {width: 75%;}
}

@media screen and (pointer:coarse) {
    .mobile-modal-buttons {
        position: absolute;
        top: 0;
        right: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 60px;
    }
    .mobile-button {
        height: 50%;
        border: 2px solid black;
        background-color: var(--orange);
        display: flex;
        align-items: center;
        width: 100px;
        justify-content: center;
    }
    .mobile-data {
        position: relative;
        top: 0;
        left: 0;
        right: 0;
        margin-inline: auto;
    }
    .building-lvl-div, .worker-owned-div {
        left: 0;
        padding-left: 5px;
    }
}