/*
 * Login / register page (index.php and the Laravel auth views): only what is
 * specific to this Bootstrap-based page. The shared look (plates, buttons, tabs,
 * background, popup, tokens) lives in css/lyr-ui.css, which every pre-login page
 * loads, so a restyle happens in one place.
 */

html, body {
    width: 100%;
    overflow-x: hidden;
}

/* Starts at the top of the window, like the privacy / terms pages (same 12px inset). */
body {
    margin: 0;
    padding: 12px 0;
    font-family: Helvetica, Arial, sans-serif;
}

/* Same column and gutters as the privacy / terms pages (.legal-wrap), so moving
 * between them does not shift the layout. */
.container {
    color: var(--lyr-text, #fff);
    width: 100%;
    max-width: calc(var(--lyr-page-width, 1080px) + 2 * var(--lyr-page-gutter, 12px));
    padding-left: var(--lyr-page-gutter, 12px);
    padding-right: var(--lyr-page-gutter, 12px);
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.text-shadow {
    text-shadow: 1px 1px 2px #000, 1px 1px 2px #000, 1px 1px 2px #000;
}

h1.gametitle {
    font-size: 40px;
}

.centered {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* ---- Forms ---------------------------------------------------------- */

input {
    color: var(--lyr-text, #fff) !important;
    background-color: #08090b !important;
}

.lyr-window .form-control {
    border: 1px solid #6e5937; /* dark brass, from the icon border */
    border-radius: 2px;
}

.lyr-window .form-control:focus {
    border-color: var(--lyr-accent, #d4a24c);
    box-shadow: 0 0 0 2px rgba(212, 162, 76, 0.28);
}

.custom-radio .custom-control-input:checked~.custom-control-label::before,
.custom-checkbox .custom-control-input:checked~.custom-control-label::before {
    background-color: var(--lyr-accent-lo, #8a6a2a) !important;
    border-color: var(--lyr-accent, #d4a24c) !important;
}

.custom-control-input:focus~.custom-control-label::before {
    box-shadow: 0 0 0 2px rgba(212, 162, 76, 0.28) !important;
}

/* Labels sit above their fields. Bootstrap's 4/12 + 8/12 columns left labels
 * about 90px wide inside a plate, so "Confirm Password" and the checkbox
 * captions wrapped awkwardly. */
.lyr-window .form-group.row > .col-4:empty {
    display: none;
}

.lyr-window .form-group.row > .col-4,
.lyr-window .form-group.row > .col-8,
.lyr-window .form-group.row > .col-12 {
    flex: 0 0 100%;
    max-width: 100%;
    margin-left: 0;
}

/* a tighter form, so the login window is not taller than it has to be */
.lyr-window .form-group {
    margin-bottom: 0.7rem;
}

.lyr-window .form-group.row > label.col-form-label,
.lyr-window .form-group.row > label.col-4 {
    padding-top: 0;
    padding-bottom: 2px;
    color: var(--lyr-muted, #bbb);
    font-size: 0.9rem;
}

.text-muted {
    color: var(--lyr-muted, #999) !important;
}

a {
    color: var(--lyr-link, #c4ad78);
}

.lyr-window a:not(.lyr-btn):hover,
.lyr-window a:not(.lyr-btn):focus-visible {
    color: var(--lyr-link-hover, #fff);
}

/* "Forgot your password?" / "Back to login" under the form. */
.lyr-forgot {
    margin: 12px 0 0;
    font-size: 0.9rem;
    text-align: center;
}

.lyr-forgot a {
    text-decoration: underline;
}

/* ---- News pane ------------------------------------------------------- */

.lyr-news-scroll .panel + .panel {
    margin-top: 1.1rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--lyr-line-soft, #444);
}

.lyr-news-scroll .panel-heading h4 {
    margin-top: 0;
    color: var(--lyr-accent-hi, #fff);
    font-size: 1rem;
    text-transform: uppercase;
}

/* ---- Scrollbars: thin and dark (the old global track was solid white) -- */

* {
    scrollbar-width: thin;
    scrollbar-color: #6a7078 #14161a;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-thumb {
    background: #6a7078;
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--lyr-accent, #d4a24c);
}

::-webkit-scrollbar-track {
    background: #14161a;
}

/* ---- Status messages -------------------------------------------------------
 * The sign-up, login and reset code answers with bare <font color='red'> text (and the
 * login security-question prompt). Pure red is harsh on the dark plates, so soften it
 * to a readable coral and give the message line some air. */
#logoutput,
#regoutput,
#resoutput,
#resetoutput {
    margin: 0 0 14px;
    font-size: 0.95rem;
    line-height: 1.5;
}

#logoutput:empty,
#regoutput:empty,
#resoutput:empty,
#resetoutput:empty {
    display: none;
}

#logoutput font[color="red"],
#regoutput font[color="red"],
#resoutput font[color="red"],
#resetoutput font[color="red"] {
    color: #ff8f7e;
}

/* Fit the screen (same frame as the privacy / terms pages): the news and the form scroll inside
 * their window instead of the page growing past the bottom edge. */
@media (min-width: 760px) and (min-height: 560px) {
    html, body {
        height: 100%;
        overflow: hidden;
    }

    body {
        height: 100vh;
        height: 100dvh;
    }

    .container {
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .container > .lyr-window {
        flex: 0 0 auto;
    }

    .container > .lyr-split {
        flex: 1 1 auto;
        min-height: 0;
        /* the row is as tall as the window leaves, never as tall as the form: a taller form scrolls in its pane */
        grid-template-rows: minmax(0, 1fr);
    }

    .container > .lyr-window:last-child {
        margin-bottom: 0;
    }

    /* The visible screen (login / register / forgot) fills the pane, so the form can be centred in it.
     * When the window is short there is no spare height and the pane scrolls. */
    .lyr-pane-auth {
        display: flex;
        flex-direction: column;
        min-height: 0;
        overflow-y: auto;
        scrollbar-width: thin;
    }

    .lyr-pane-auth > #login:not(.d-none),
    .lyr-pane-auth > #register:not(.d-none),
    .lyr-pane-auth > #forgot:not(.d-none) {
        display: flex;
        flex-direction: column;
        flex: 0 0 auto;
    }

    /* The Login / Register tabs, the form under them and the forgot / back link are one block, centred vertically in the
     * pane. Auto margins centre it while there is spare height and fall back to top-aligned, scrolling, when the block is
     * taller than the pane (a plain justify-content:center would cut the top off). */
    .lyr-pane-auth > .lyr-tabs {
        margin-top: auto;
    }

    .lyr-pane-auth > #login:not(.d-none),
    .lyr-pane-auth > #register:not(.d-none),
    .lyr-pane-auth > #forgot:not(.d-none) {
        margin-bottom: auto;
    }

    .lyr-pane-auth form {
        flex: 0 0 auto;
        display: flex;
        flex-direction: column;
    }

    .lyr-pane-auth form > p:empty {
        display: none;
    }
}

/* Login: the two checkboxes stacked on the left, the Login button to their right. */
.lyr-login-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 16px;
}

.lyr-login-checks {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.lyr-login-checks .custom-control {
    margin-right: 0;
}
