/*
 * Copyright ©  2026 Thomas J Collinson
 * All rights reserved
 */

:root {
    --nb-colour-white: 255, 255, 255;
    --nb-colour-black: 0, 0, 0;

    --nb-border-radius: 4px;
    --nb-shadow-raised: 0 8px 16px 0 rgba(var(--nb-colour-black), 0.2);
}

/* Page chrome */

div#head {
    height: 0;
}

iframe#booking-widget {
    height: 465px;
    width: 600px;

    &.guest-widget {
        height: 490px;
    }
}

div#booking-container {
    position: absolute;
    top: 0;
    margin-top: 160px;
    z-index: 100;
    width: 100%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    justify-content: space-between;
    max-width: 1400px;
}

div#content {
    position: relative;
    box-sizing: content-box;
    min-height: 800px;
}

div#map-canvas {
    width: 100%;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
    margin: 0;
}

div#booking-widget-outer {
    margin-left: 50px;
    display: flex;
    flex-direction: column;
}

div#return-and-save {
    margin-right: 50px;

    img {
        max-width: 200px;
    }
}

div#upgrade-your-vehicle {
    background-color: var(--header-color);
    padding: 15px;
    position: relative;

    img {
        position: absolute;
        height: 125px;
        right: 10px;
        top: -10px;
    }

    h2 {
        color: rgb(var(--nb-colour-white));
        text-transform: uppercase;
    }

    a {
        color: var(--light-blue-2);
    }
}

#book-again {
    display: flex;
    flex-direction: column;
    align-items: center;

    a {
        color: rgb(var(--nb-colour-white));
        line-height: 40px;
        margin-bottom: 10px;
        background-color: transparent;
        transition: all .5s;

        &.link-button {
            display: block;
            text-align: center;
            min-width: 50%;

            &.track-button {
                flex-basis: 75%;
                width: 75%;
            }
        }

        &:hover {
            background-color: rgba(var(--nb-colour-white), .3);
        }
    }

    div#link-holder {
        display: flex;
        justify-content: space-evenly;
    }

    #link-holder {
        flex-basis: 75%;
        width: 75%;
    }
}

@media screen and (max-width: 768px) {
    iframe#booking-widget {
        position: static;
        width: 100%;
    }

    div#map-canvas {
        display: none;
    }

    div#return-and-save {
        display: none;
    }

    div#booking-widget-outer {
        margin-left: 0;
        width: 100%;
    }

    div#booking-container {
        margin-top: 75px;
    }

    div#content {
        min-height: 637px;
    }

    div#upgrade-your-vehicle img {
        height: 50px;
        top: 55px;
    }
}

iframe#booking-widget.minimised {
    width: 175px;
    height: 37px !important;
    overflow: hidden;
}

/*
 * Single-screen layout. `:where()` holds the body class at zero specificity, so each selector below
 * weighs exactly what it did as an inline block and still loses to `arrow.css` and the per-brand
 * overrides wherever it did before.
 */
:where(body.single-screen) {
    iframe#booking-widget {
        width: 1000px;
        height: 500px;

        &.has-flight-no {
            height: 560px;

            &.has-return-flight-no {
                height: 600px;
            }
        }
    }

    div#content {
        min-height: 800px;
    }

    /* Site selector */

    form.site-selection {
        display: flex;
        flex-direction: column;
        padding: 20px;
        width: 100%;
        align-items: center;

        [type="radio"]:checked,
        [type="radio"]:not(:checked) {
            position: absolute;
            left: -9999px;
            width: 0;
            height: 0;
            visibility: hidden;
        }
    }

    .site-selection {
        input:checked + label,
        input:not(:checked) + label {
            position: relative;
            display: inline-block;
            padding: 20px;
            width: 100%;
            font-size: 35px;
            line-height: 35px;
            font-weight: 700;
            letter-spacing: 1px;
            margin: 0 0 15px 0;
            text-align: center;
            border-radius: var(--nb-border-radius);
            overflow: hidden;
            cursor: pointer;
            text-transform: uppercase;
            transition: all 300ms linear;
            color: var(--light-blue-2);

            /* Sits behind the label so the selected-state text can slide over it. */
            &::before {
                position: absolute;
                content: '';
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                border-radius: var(--nb-border-radius);
                background-color: rgb(var(--nb-colour-white));
                z-index: -1;
            }

            span {
                position: relative;
                display: block;

                &::before {
                    position: absolute;
                    content: attr(data-selected);
                    top: 0;
                    left: 0;
                    width: 100%;
                    overflow: hidden;
                    color: rgb(var(--nb-colour-white));
                    transition: max-height 0.3s;
                }
            }
        }

        input:not(:checked) + label {
            box-shadow: 0 2px 4px 0 rgba(var(--nb-colour-black), 0.1);

            &:hover {
                box-shadow: var(--nb-shadow-raised);
            }

            span::before {
                max-height: 0;
            }
        }

        input:checked + label {
            background-color: transparent;
            box-shadow: var(--nb-shadow-raised);
            background: var(--light-blue-2);

            span::before {
                max-height: 100%;
            }
        }
    }

    div#site-switcher {
        position: absolute;
        bottom: 20px;
        left: 20px;
        display: flex;
        flex-direction: column;
        min-width: 250px;
        justify-content: space-between;
        background: var(--light-blue-2);
        color: rgb(var(--nb-colour-white));
        height: 100px;
        align-items: center;
        padding: 15px;
        border-radius: var(--nb-border-radius);
        box-shadow: var(--nb-shadow-raised);
        font-size: 20px;
    }

    /* Left flat: nesting under `div#site-switcher` would add that type selector's weight. */
    #site-switcher a {
        color: rgb(var(--nb-colour-white));
        font-size: 80%;
        background: var(--light-blue-3);
        padding: 8px;
        border-radius: var(--nb-border-radius);
        margin-top: 5px;
    }
}

/*
 * Editing a booking never offers the return-and-save panel the new booking page reserves room for,
 * so the widget takes the width to itself and sits centred.
 */
:where(body.edit-booking) {
    div#booking-widget-outer {
        margin-left: 0;
    }

    div#booking-container {
        justify-content: center;
    }
}
