@import url("../../shared/assets/styles/reset.css");

@font-face {
    font-family: "Bazcofe";
    src: url("./assets/font/Bazcofe.woff2");
    font-weight: 400;
}

@font-face {
    font-family: "Kumula Script";
    src: url("./assets/font/KumalaScript.ttf");
    font-weight: 400;
}

@font-face {
    font-family: "Roboto Mono";
    src: url("../../shared/assets/fonts/RobotoMono-Thin.ttf");
    font-weight: 100;
}

@font-face {
    font-family: "Roboto Mono";
    src: url("../../shared/assets/fonts/RobotoMono-ExtraLight.ttf");
    font-weight: 200;
}

@font-face {
    font-family: "Roboto Mono";
    src: url("../../shared/assets/fonts/RobotoMono-Light.ttf");
    font-weight: 300;
}

@font-face {
    font-family: "Roboto Mono";
    src: url("../../shared/assets/fonts/RobotoMono-Regular.ttf");
    font-weight: 400;
}

@font-face {
    font-family: "Roboto Mono";
    src: url("../../shared/assets/fonts/RobotoMono-Medium.ttf");
    font-weight: 500;
}

@font-face {
    font-family: "Roboto Mono";
    src: url("../../shared/assets/fonts/RobotoMono-SemiBold.ttf");
    font-weight: 600;
}

@font-face {
    font-family: "Roboto Mono";
    src: url("../../shared/assets/fonts/RobotoMono-Bold.ttf");
    font-weight: 700;
}

:root {
    --font-primary: "Roboto Mono";
    --font-secondary: "Bazcofe";
    --font-tartiary: "Kumula Script";
    --color-background: #F5F2EC;
    --color-dark: #2B2B2B;
    --color-light: white;
    --color-brown: #6E6353;
    --color-light-grey: #D1D0CB;
    --color-yellow: #EAEC19;
    --color-pink: #CE7BD3;
    --border-radius-s: 0.2rem;
    --border-radius-m: 1rem;
    --transition-regular: 0.2s ease-in-out;
    --box-shadow-regular: 0px 0px 10px 2px rgba(0,0,0,0.025);
    --mobile-content-width: 90%;
}

#custom-shop {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    min-height: 100dvh;

    @media screen and (min-width: 768px) {
        min-height: 100dvh;
        width: 100dvw;
        padding: 2rem 0;
    }

    & > .foreground {
        display: flex;
        flex-direction: column;
        gap: 2rem;
        margin: auto;
        position: relative;
        z-index: 1;
        padding-top: 2rem;

        @media screen and (min-width: 768px) {
            width: min(1200px, 90vw);
            height: unset;
            padding-top: unset;
        }

        & h1, h2, h3, h4, h5, h6 {
            font-family: var(--font-secondary) !important;
            margin-top: unset;
            margin-bottom: 2rem;
            text-transform: uppercase;
        }

        & h2 {
            font-size: 2rem;

            @media screen and (min-width: 768px) {
                font-size: 3rem;
            }
        }

        input[type="radio"], input[type="checkbox"] {
            appearance: auto;
            accent-color: var(--color-pink);
        }

        & button {
            background-color: var(--color-yellow);
            border: 1px solid var(--color-yellow) !important;
            color: var(--color-dark);
            padding: 0.5rem 2rem;
            border-radius: var(--border-radius-s);
            font-family: var(--font-secondary);
            border: unset;
            transition: background-color var(--transition-regular), opacity var(--transition-regular);

            &[disabled] {
                opacity: 0.5;
                background-color: transparent;
                color: white;
            }
        }

        & .description {
            line-height: 1;
        }

        & > .header {
            color: white;
            margin: 0 calc((100% - var(--mobile-content-width)) / 2);

            @media screen and (min-width: 768px) {
                margin: unset;
            }

            & .headline {
                display: flex;
                flex-direction: column;
                gap: 2rem;
                margin-bottom: 2rem;
                text-align: center;

                @media screen and (min-width: 768px) {
                    text-align: unset;
                    display: grid;
                    grid-template-columns: auto 1fr;
                    grid-template-rows: repeat(2, auto);

                    & .information {
                        grid-column: 1 / -1;
                        grid-row: 2;
                    }
                }

                /* the picture is the flex/grid item, the img inside keeps the logo size */
                & .logo {
                    display: flex;
                    justify-content: center;

                    @media screen and (min-width: 768px) {
                        justify-content: start;
                    }

                    & img {
                        height: 6rem;
                        width: auto;
                        max-width: 100%;
                        object-fit: contain;
                    }
                }

                & h1 {
                    font-size: 2.5rem;
                    margin-bottom: unset;

                    @media screen and (min-width: 768px) {
                        font-size: 4rem;
                    }

                    & > div:first-child {
                        font-size: 1.5rem;
                        margin-bottom: 1rem;
                    }
                }

                & .information {
                    display: flex;
                    flex-direction: row;
                    flex-wrap: wrap;
                    justify-content: center;
                    font-size: 0.8rem;

                    @media screen and (min-width: 768px) {
                        justify-content: unset;
                    }

                    & > *:not(:last-child)::after {
                        content: "//";
                        display: inline-block;
                        margin: 0 1rem;
                    }
                }
            }

            & .description {
                text-align: center;
                font-size: 0.8rem;
                line-height: 1.5;

                @media screen and (min-width: 768px) {
                    text-align: unset;
                }
            }
        }

        & > #tab-toggles {
            display: flex;
            flex-direction: row;
            justify-content: center;
            gap: 1rem;

            @media screen and (min-width: 768px) {
                justify-content: start;
            }

            & .tab-toggle {
                padding: 0.5rem 2rem;
                border-radius: var(--border-radius-m);
                border: 1px solid var(--color-yellow);
                color: var(--color-light);
                font-family: var(--font-secondary);
                cursor: pointer;
                transition: background-color var(--transition-regular), color var(--transition-regular);

                &.active {
                    background-color: var(--color-yellow);
                    color: var(--color-dark);
                }
            }
        }

        & > #tabs {
            @media screen and (min-width: 768px) {
                --content-max-height: max(60dvh, 28rem);
            }

            & > .tab:not(.active) {
                display: none;
            }

            /* the animation restarts whenever a tab switches from display: none to visible */
            & > .tab.active {
                animation: tab-fade-in var(--transition-regular);
            }

            & > .tab[data-tab-identifier="info"] {
                display: flex;
                flex-direction: column;
                gap: 2rem;
                padding: 1rem;
                border-radius: var(--border-radius-m);
                background-color: var(--color-light);
                box-shadow: var(--box-shadow-regular);
                margin: 0 calc((100% - var(--mobile-content-width)) / 2);

                @media screen and (min-width: 768px) {
                    display: grid;
                    grid-template-columns: repeat(2, 1fr);
                    align-items: start;
                    padding: 2rem;
                    max-height: var(--content-max-height);
                    overflow-y: auto;
                    margin: unset;
                }

                &:not(.active) {
                    display: none;
                }

                & > * {
                    padding: unset;
                    width: unset;
                    float: unset;
                }

                & .list-eventinfos {
                    color: inherit;
                }
            }
        }

        & > #tabs > .tab > .content {
            display: flex;
            flex-direction: column;
            gap: 1rem;

            @media screen and (min-width: 768px) {
                gap: 2rem;
                display: grid;
                grid-template-columns: 2fr 1fr;
                align-items: start;
                max-height: var(--content-max-height);
            }

            & > * {
                box-shadow: var(--box-shadow-regular);

                @media screen and (min-width: 768px) {
                    overflow-y: auto;
                    max-height: var(--content-max-height);
                }
            }

            & #slides {
                border-radius: var(--border-radius-m);
                overflow: hidden;
                position: relative;
                background-color: white;
                margin: 0 calc((100% - var(--mobile-content-width)) / 2);
                scroll-margin-top: 2rem;

                @media screen and (min-width: 768px) {
                    /* no padding: the active slide is in the flow and has its own padding */
                    margin: unset;
                }

                & #tickets {
                    /* the seat plan has no intrinsic height, so this slide always uses the full height */
                    @media screen and (min-width: 768px) {
                        height: var(--content-max-height);

                        & > .content {
                            flex: 1 1 0;
                        }
                    }

                    & #ticket-selection {
                        height: 60dvh;

                        @media screen and (min-width: 768px) {
                            height: 100%;
                        }

                        & #seatplan {
                            width: unset;
                            height: inherit !important;
                            box-shadow: unset;
                            margin: unset;
                            padding: unset;
                        }
                    }
                }

                & #meals {
                    & .meal-selection {
                        display: flex;
                        flex-direction: column;
                        gap: 2rem;

                        & h4 {
                            margin-bottom: 1rem;
                        }
                        
                        & .meal-select {
                            display: grid;
                            grid-template-rows: repeat(2, 4rem);
                            border-radius: var(--border-radius-m);
                            border: 2px solid var(--color-dark);
                            overflow: hidden;
                            position: relative;

                            &::after {
                                content: "";
                                background-color: var(--color-yellow);
                                position: absolute;
                                top: 0%;
                                left: 0%;
                                height: 50%;
                                width: 100%;
                                transition: all var(--transition-regular);
                                border: 1px solid var(--color-dark);
                            }

                            &:has(.meal:nth-child(2).active)::after {
                                top: 50%;
                                left: 0%;
                            }

                            @media screen and (min-width: 768px) {
                                grid-template-columns: repeat(2, 1fr);
                                grid-template-rows: unset;

                                &::after {
                                    height: 100%;
                                    width: 50%;
                                }

                                &:has(.meal:nth-child(2).active)::after {
                                    top: 0;
                                    left: 50%;
                                }
                            }

                            & .meal {
                                display: flex;
                                flex-direction: row;
                                align-items: center;
                                gap: 1rem;
                                padding: 1rem;
                                z-index: 1;

                                & .icon {
                                    height: 2rem;
                                }

                                & .name {
                                    font-family: var(--font-secondary);
                                    font-weight: bold;
                                }
                            }
                        }

                    }
                }

                & #drinks {
                    & .tickets {
                        display: flex;
                        flex-direction: column;
                        list-style-type: none;
                        padding: unset;

                        & .ticket-type {
                            display: flex;
                            flex-direction: column;
                            gap: 0.5rem;
                            align-items: center;
                            text-align: center;

                            &::after {
                                content: "";
                                display: block;
                                grid-column: 1 / -1;
                                margin: 1rem 0;
                                height: 1px;
                                width: 100%;
                                background-color: var(--color-background);
                            }

                            & .title {
                                & .name {
                                    font-size: 1.2rem;
                                    font-family: var(--font-secondary);
                                }

                                & details {
                                    font-size: 0.8rem;

                                    & summary {
                                        cursor: pointer;
                                    }
                                }
                            }


                            & .ticket-amount-input {
                                display: grid;
                                grid-template-columns: 1fr auto 1fr;
                                grid-row: 2;
                                grid-column: 1 / -1;
                                gap: 0.5rem;

                                & button {
                                    color: inherit !important;
                                    border-color: var(--color-brown) !important;
                                    background-color: var(--color-yellow);

                                    &[disabled] {
                                        background-color: var(--color-background);
                                    }
                                }

                                & select {
                                    border: unset;
                                    padding: 0.25rem 1rem;
                                    appearance: none;
                                    text-align: center;
                                    text-align-last: center;
                                }

                                & > * {
                                    line-height: 1;
                                }
                            }
                        }

                        @media screen and (min-width: 768px) {
                            display: grid;
                            grid-template-columns: 1fr auto;

                            & .ticket-type {
                                display: grid;
                                grid-template-columns: subgrid;
                                grid-template-rows: repeat(2, auto);
                                align-items: start;
                                grid-column: 1 / -1;
                                text-align: unset;
                            }
                        }
                    }
                }

                & #customer-data {
                    & #page3 {
                        & h2 {
                            display: none;
                        }
                    }

                    & .help-block {
                        line-height: 1;
                        font-size: 0.8rem;
                        color: var(--color-brown);
                    }

                    & .tio-has-error .help-block {
                        color: red;
                    }

                    & textarea {
                        background-color: unset;
                    }

                    & .form-horizontal:has(.transferPeopleData) {
                        display: none;
                    }

                    & .persRowPeopleData {
                        & .form-group:has(input[type="email"]) {
                            display: none;
                        }
                    }

                    & .form-group .col-xs-12 > div:not(.checkbox) {
                        font-size: 0.8rem;
                    }
                }

                & .slide {
                    display: flex;
                    flex-direction: column;
                    width: 100%;
                    transition: opacity var(--transition-regular);
                    padding: 1rem;

                    /* mobile: only the active slide takes up space */
                    &:not(.active) {
                        display: none;
                    }

                    @media screen and (min-width: 768px) {
                        &:not(.active) {
                            display: flex;
                        }

                        max-height: var(--content-max-height);
                        padding: 2rem;

                        /* the active slide stays in the flow and defines the height of #slides */
                        &.active {
                            position: relative;
                            opacity: 1;
                        }

                        /* inactive slides lie on top of it, so they can still fade */
                        &:not(.active) {
                            position: absolute;
                            top: 0;
                            left: 0;
                            opacity: 0;
                            pointer-events: none;
                        }

                        & > .content {
                            display: flex;
                            flex-direction: column;
                            gap: 2rem;
                            flex: 0 1 auto;
                            min-height: 0;
                            overflow-y: auto;
                        }
                    }

                    & > h2 {
                        font-size: 2rem;
                        margin-bottom: unset;
                    }

                    & > h3 {
                        font-size: 1rem !important;
                        font-family: var(--font-tartiary) !important;
                    }
                }
            }

            /* last slide: full cart, no longer sticky (matches the desktop rules, so no media query needed) */
            &[data-active-slide="customer-data"] #cart {
                position: unset;
                border-radius: var(--border-radius-m);

                & > h2, & .sumOfPurchase {
                    display: block;
                }

                & .price-preview {
                    display: none;
                }
            }

            & #cart {
                display: flex;
                flex-direction: column;
                gap: 1rem;
                padding: 1rem calc((100% - var(--mobile-content-width)) / 2);
                border-radius: var(--border-radius-m) var(--border-radius-m) 0 0;
                background-color: var(--color-dark);
                color: var(--color-light);
                /* mobile: total and navigation always stay visible at the bottom */
                position: sticky;
                bottom: 0;
                z-index: 2;

                @media screen and (min-width: 768px) {
                    display: block;
                    padding: 2rem;
                    border-radius: var(--border-radius-m);
                    position: relative;
                }

                & h2 {
                    font-size: 1rem;
                }

                /* mobile: the full cart is only shown on the last slide, before that only the total */
                & > h2, & .sumOfPurchase {
                    display: none;

                    @media screen and (min-width: 768px) {
                        display: block;
                    }
                }

                & .price-preview {
                    display: flex;
                    flex-direction: row;
                    justify-content: space-between;
                    align-items: baseline;
                    gap: 1rem;

                    & .description {
                        font-size: 0.8rem;
                    }

                    & .price {
                        font-family: var(--font-secondary);
                        font-size: 1.2rem;
                    }

                    @media screen and (min-width: 768px) {
                        display: none;
                    }
                }

                & .sumOfPurchase {
                    font-size: 0.8rem;
                    position: unset;

                    & input, button {
                        border-radius: var(--border-radius-s) !important;
                    }

                    & table {
                        display: grid;
                        grid-template-columns: repeat(2, 1fr);

                        @media screen and (min-width: 768px) {
                            grid-template-columns: repeat(3, 1fr);
                        }

                        thead th:nth-child(2) {
                            display: none;

                            @media screen and (min-width: 768px) {
                                display: unset;
                            }
                        }

                        & thead, tbody, tr {
                            display: grid;
                            grid-template-columns: subgrid;
                            grid-column: 1 / -1;
                        }

                        & tr[style="display: table-row;"] {
                            display: grid !important;
                            grid-template-columns: subgrid;
                        }

                        & td {
                            border: unset;
                            font-size: inherit;
                        }

                        & tbody tr {
                            border-top: 1px solid var(--color-light-grey);

                            &:not([style*="none"]) {
                                display: flex !important;
                                flex-direction: column;

                                @media screen and (min-width: 768px) {
                                    display: grid !important;
                                }
                            }
                        }

                        & tr:is(.tio-fee, .discount-coupons) {
                            & .hidden-xs {
                                display: none !important;
                            }
                            & td.right {
                                grid-column: 1 / span 2;
                            }
                        }

                        & .dynCalc {
                            grid-column: 3;
                        }

                        tr:last-child:has(.dynCalc) {
                            border-top: 2px solid white !important;

                            & td:empty.hidden-xs {
                                display: none;
                            }

                            &  td[colspan] {
                                grid-column: 1 / span 2;
                            }
                        }
                    }

                    & .tioNotOrganizer {
                        font-size: 0.8em;
                        line-height: 1.2;
                    }
                }

                & #slide-actions {
                    display: grid;
                    grid-template-columns: repeat(2, 1fr);
                    grid-template-rows: repeat(2, auto);
                    gap: 0.5rem 1rem;
                    position: sticky;
                    bottom: 1rem;
                    left: 0;
                    background-color: var(--color-dark);

                    @media screen and (min-width: 768px) {
                        bottom: 0;
                        padding: 1rem 0;
                    }

                    & button {
                        grid-row: 1;
                    }

                    & progress {
                        grid-row: 2;
                        grid-column: 1 / -1;
                        width: 100%;
                        appearance: none;
                        width: 100%;
                        height: 0.5rem;
                        border: none;
                        border-radius: var(--border-radius-s);
                        overflow: hidden;
                        background-color: var(--color-light-grey);   /* Firefox: Hintergrund */
                        color: var(--color-yellow);                  /* altes Edge */

                        &::-webkit-progress-bar {
                            background-color: var(--color-light-grey);
                        }

                        &::-webkit-progress-value {
                            background-color: var(--color-yellow);
                            transition: width var(--transition-regular);   /* animiert nur in Chrome/Safari/Edge */
                        }

                        &::-moz-progress-bar {
                            background-color: var(--color-yellow);          /* Firefox: keine Animation möglich */
                        }
                    }
                }
            }

        }

        &#purchase-complete {
            margin-bottom: 2rem;

            @media screen and (min-width: 768px) {
                margin: unset;
            }

            & .logo {
                height: 4rem;
                display: block;
                margin: auto;

                @media screen and (min-width: 768px) {
                    margin: unset;
                }
            }

            & .content {
                background-color: white;
                padding: 1rem;
                border-radius: var(--border-radius-m);
                margin: 0 calc((100% - var(--mobile-content-width)) / 2);

                & p, a {
                    font-family: inherit;
                    font-size: inherit;
                }

                & .list-eventinfos {
                    font-family: inherit;
                }

                & h3 {
                    margin-bottom: unset;
                }

                @media screen and (min-width: 768px) {
                    padding: 2rem;
                    margin: unset;
                }
            }
        }
    }

    &[data-view="event-overview"] {
        place-content: center;
        align-items: center;

        & .foreground {
            display: flex;
            flex-direction: column;
            gap: 2rem;
            overflow-y: scroll;
            scrollbar-width: none;

            color: var(--color-light);

            & .header {
                display: flex;
                flex-direction: column;
                gap: 1rem;
                text-align: center;

                @media screen and (min-width: 768px) {
                    flex-direction: row;
                    align-items: center;
                    gap: 2rem;
                    text-align: unset;
                }

                & .logo {
                    display: block;
                    height: 4rem;

                    & img {
                        height: 100%;
                        width: 100%;
                        object-fit: contain;
                    }
                }

                & h1 {
                    margin: unset;
                    font-size: 2rem;
                }
            }



            & #eventoverview {
                margin: 0 calc((100% - var(--mobile-content-width)) / 2);

                @media screen and (min-width: 768px) {
                    margin: unset;
                }

                & .container {
                    margin: unset;
                    padding: unset;
                    color: inherit;
                    width: unset;

                    & .alert-mobile {
                        line-height: 1;
                        font-size: 0.8rem !important;
                    }

                    & .event-available {
                        background-color: var(--color-yellow) !important;
                        color: var(--color-dark) !important;
                        border: unset !important;
                        font-family: inherit !important;

                        & .fc-content {
                            color: inherit !important;
                            font-family: inherit !important;

                            & .fc-title {
                                font-family: inherit !important;
                            }
                        }
                    }

                    & .fc-day[style*="background-color"] {
                        background-color: var(--color-brown) !important;
                    }

                    & .fc-view {
                        border-radius: var(--border-radius-m);
                        border: 1px solid var(--color-light);
                        overflow: hidden;
                    }

                    & .fc-day-header, .fc-day-header * {
                        font-size: 1rem;
                        font-weight: bold;
                    }

                    & .fc-basicDay-view .fc-day-grid {
                        & .fc-event-container {
                            background-color: var(--color-yellow);
                            padding: 1rem;
                                border-bottom: 1px solid var(--color-brown) !important;

                            & .fc-content {

                                & .fc-title {
                                    text-decoration: none !important;
                                }
                            }
                        }
                    }

                    & .fc-unthemed .fc-content, .fc-unthemed .fc-divider, .fc-unthemed .fc-list-heading td, .fc-unthemed .fc-list-view, .fc-unthemed .fc-popover, .fc-unthemed .fc-row, .fc-unthemed tbody, .fc-unthemed td, .fc-unthemed th, .fc-unthemed thead {
                        border-color: var(--color-background) !important;
                        font-family: inherit !important;
                    }

                    & .fc-toolbar {
                        display: grid;
                        grid-template-columns: auto 1fr;
                        gap: 2rem;
                        align-items: center;

                        & .fc-clear {
                            display: none;
                            clear: unset;
                        }

                        & .fc-left {
                            grid-column: 1;
                        }

                        & .fc-center {
                            grid-column: 2;
                            margin-left: auto;
                        }

                        & .fc-right {
                            display: none;
                        }

                        & h2 {
                            color: inherit;
                            margin: unset;
                            font-size: 1rem;
                        }

                        & .fc-button-group {
                            display: flex;
                            flex-direction: row;
                            gap: 1rem;

                            & button {
                                margin: unset;
                                text-shadow: unset;
                                color: inherit;
                                line-height: 1;
                                float: unset;
                                width: unset;
                                height: unset;

                                &.fc-state-active {
                                    border: unset;
                                    background-color: var(--color-yellow);
                                    border-radius: var(--border-radius-m);
                                    padding: 0.5rem 1rem;
                                }
                            }
                        }

                    }

                }
            }
        }
    }

    & > .background {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        overflow: hidden;
        background-color: var(--color-brown);

        & img {
            display: block;
            width: 100%;
            height: 100%;
            object-fit: cover;
            /* scaled up so the blurred edges stay outside the clipped area */
            scale: 1.05;
            filter: blur(20px) brightness(0.8);
        }
    }
}

@keyframes tab-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.font-tertiary {
    font-family: var(--font-tartiary);
}

body {
    color: var(--color-dark);
    
    & > footer {
        font-size: 0.8rem;
    }
}

ul.unset {
    list-style-type: none;
    padding: unset;
}

details {
    border-radius: var(--border-radius-regular);

    @supports selector(::details-content) {
        &::details-content {
            margin-top: 0;
            block-size: 0;
            opacity: 0;
            transition: all 0.2s;
            transition-behavior: allow-discrete;
        }

        &[open]::details-content {
            margin-top: 1rem;
            block-size: auto;
            opacity: 1;
        }
    }

    @supports not selector(::details-content) {
        &[open] p {
            margin-top: 1rem;
        }
    }

    &[open] summary span::before {
        rotate: 90deg;
    }

    & summary::-webkit-details-marker {
        display: none;
    }

    &::marker {
        content: "";
        display: none;
    }
}