/*
 * The redesigned signing page, step 1 (print_new/step1.php, step1_minor.php, smartSearch.php, email_password_auth.php): what only this step has, on top of ../tokens.css and
 * ../components.css. Scoped to #step1.wk-sign-v2, which the step gets for text editor Version 2 waivers
 * (Waiver::usesTiptapEditor()); Version 1 waivers keep waiverprint_new.css alone.
 */

/* ---------------------------------------------------------------- landing (.selectaction) */

/* The legacy page floats a 300px logo column beside a 660px content column (waiverprint_new.css
   .fn-logo-container / .fn-content with .fn-pull-left), which no longer fit the 960px column side
   by side, so the choices dropped ~450px down. Here: the logo centered on top, then a card with the
   question and the choices in one centered column. .selectaction itself is hidden and shown by
   the page JS, so only its spacing is set. */
#step1.wk-sign-v2 .selectaction {
    padding-top: 40px;
    padding-bottom: 10px; /* + the step's 30px (components.css): as much room under the card as above it */
}

#step1.wk-sign-v2 .selectaction .fn-logo-container {
    float: none !important; /* .fn-pull-left is !important */
    width: auto;
    height: auto;
    margin: 0 0 22px;
    padding: 0;
}

/* No logo uploaded: the view prints background-image: none; no empty space for it. */
#step1.wk-sign-v2 .selectaction .fn-logo-container:has(.fn-logo[style*="background-image: none"]) {
    display: none;
}

#step1.wk-sign-v2 .selectaction .fn-logo-container a {
    display: block;
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
}

#step1.wk-sign-v2 .selectaction .fn-logo {
    width: 240px;
    max-width: 100%;
    height: 96px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

/* The card: step 4's .fn-adult-content look. */
#step1.wk-sign-v2 .selectaction .fn-content {
    float: none !important; /* .fn-pull-left is !important */
    width: auto;
    max-width: 480px;
    margin: 0 auto;
    padding: 34px clamp(20px, 5vw, 40px) 40px;
    box-sizing: border-box;
    text-align: center;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
}

#step1.wk-sign-v2 .selectaction .fn-content .fn-row {
    margin-left: 0;
    margin-right: 0;
}

#step1.wk-sign-v2 .selectaction .fn-content .fn-col-12 {
    float: none;
    padding-left: 0;
    padding-right: 0;
}

/* The question ("Sign Waiver"), or the "currently not available" notice: the title bar's type. */
#step1.wk-sign-v2 .selectaction .fn-content h2 {
    margin: 0;
    font-family: var(--font);
    font-size: 22px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--ink);
    overflow-wrap: anywhere;
}

/* The choices: one full-width column with a steady gap, not the legacy floats with
   margin 19px 12px 0 0. The buttons' own display is left alone (the view may hide the first one
   with an inline display: none). */
#step1.wk-sign-v2 .selectaction .fn-btn-group {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin: 24px 0 0;
}

#step1.wk-sign-v2 .selectaction .fn-btn-group:after {
    display: none;
}

#step1.wk-sign-v2 .selectaction .fn-btn-group .fn-btn {
    float: none;
    width: 100% !important; /* the view's inline width: 100% / max-width: 400px on long labels */
    max-width: none !important;
    margin: 0;
    padding: 13px 22px;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* "Go back to landing page" (?linkpage=): print.waiver.new.js appends it with an inline width of
   230px, too narrow for its label at the tablet zoom. */
#step1.wk-sign-v2 .selectaction > .fn-btn[style*="width"] {
    width: auto !important; /* the inline width */
}

/* ---------------------------------------------------------------- search form (.findwaiver) */

/* The field rows: one centered column of fields (the legacy 50% .fn-col-6 inside rows with
   negative margins), a steady gap between them. */
#step1.wk-sign-v2 .findwaiver .fn-adult-content .fn-form-group {
    min-height: 0;
    margin: 0 0 16px;
}

#step1.wk-sign-v2 .findwaiver .fn-adult-content .fn-form-group .fn-row {
    margin-left: 0;
    margin-right: 0;
}

#step1.wk-sign-v2 .findwaiver .fn-adult-content .fn-form-group .fn-col-6 {
    float: none;
    width: 100%;
    max-width: 440px;
    padding-left: 0;
    padding-right: 0;
}

#step1.wk-sign-v2 .findwaiver .fn-adult-content .fn-input {
    width: 100%;
}

/* "Nothing found" and the other messages above the fields: a quiet alert box. */
#step1.wk-sign-v2 .findwaiver #nothingfound {
    max-width: 440px;
    margin: 0 auto 20px;
    padding: 12px 16px;
    box-sizing: border-box;
    font-size: 14.7px;
    background: rgba(214, 69, 69, .07);
    border: 1px solid rgba(214, 69, 69, .22);
    border-radius: 10px;
}

#step1.wk-sign-v2 .findwaiver #nothingfound:empty {
    padding: 0;
    border: 0;
}

/* The links under the fields (email_password_auth.php's "Reset or Create Your Password",
   smartSearch.php's "If you know your login credentials, click here."). */
#step1.wk-sign-v2 .findwaiver .fn-adult-content a {
    color: var(--accent-strong);
}

#step1.wk-sign-v2 .findwaiver .fn-adult-content a:hover {
    opacity: 1;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---------------------------------------------------------------- captcha */

/* Google's widget is a fixed 304px frame: centered in the field column, as the fields are in the
   card. #captchaSmart's own display is set by the page JS. */
#step1.wk-sign-v2 .findwaiver .g-recaptcha {
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
}

#step1.wk-sign-v2 .findwaiver .g-recaptcha + .reqfield,
#step1.wk-sign-v2 .findwaiver .g-recaptcha ~ .reqfield {
    text-align: center;
}

/* ---------------------------------------------------------------- search results */

/* #finded_clients: display_users() sets its parent to display: table-caption and the grandparent
   to text-align: -webkit-center. The legacy fixed 660px width (.list_of_clients) overflowed
   phones; here the table fills the card's width and its parent is held to it. */
#step1.wk-sign-v2 .findwaiver .fn-row:has(> #finded_clients),
#step1.wk-sign-v2 .findwaiver .fn-col-12:has(> #finded_clients) {
    float: none;
    width: 100%;
    width: 100cqw; /* see the container below */
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
}

/* A display: table-caption box sizes to its content, so width: 100% above resolves against that,
   not the card. Its parent is made a size container, and the caption above takes that
   container's width in cqw units (browsers without them keep the 100%). */
#step1.wk-sign-v2 .findwaiver :is(.fn-col-12:has(> .fn-row > #finded_clients), .fn-row:has(> .fn-col-12 > #finded_clients)) {
    container-type: inline-size;
}

#step1.wk-sign-v2 .findwaiver #finded_clients {
    float: none;
    width: 100%;
    max-width: 100%;
    margin: 8px 0 0;
    padding: 0 !important; /* waiverprint_new.css: .list_of_clients padding !important */
    box-sizing: border-box;
    font-size: 14px;
    font-weight: 400;
    color: var(--ink);
    text-align: left;
}

/* The name. */
#step1.wk-sign-v2 .findwaiver #finded_clients td:nth-child(2) {
    font-weight: 600;
}

/* Birth date, email, phone. */
#step1.wk-sign-v2 .findwaiver #finded_clients td:nth-child(n+3) {
    color: var(--ink-muted);
}

/* Select: under the table, centered as the rest of the form. Its display is set by the page JS. */
#step1.wk-sign-v2 .findwaiver #selectbutton {
    float: none;
    width: auto;
    min-width: 180px;
    margin: 18px auto 0 !important; /* the view's inline margin-top / margin-right */
}

/* ---------------------------------------------------------------- smart search verification */

/* smartSearch.php's #otp / #otp_verify blocks bring their own inline <style> (near-black borders
   and buttons, #id selectors); the selectors here are one ID more specific, so the blocks take
   the redesign's tokens. Their display stays with the page JS. */
#step1.wk-sign-v2 #otp .otp-title {
    font-family: var(--font);
    font-size: 18px;
    color: var(--ink);
}

#step1.wk-sign-v2 #otp .otp-card {
    max-width: 440px;
    padding: 20px 16px;
    font-family: var(--font);
    background: var(--surface);
    border: 1.5px solid var(--border-strong);
    border-radius: 10px;
}

#step1.wk-sign-v2 #otp .otp-card:hover {
    border-color: var(--accent);
}

#step1.wk-sign-v2 #otp .otp-card.selected {
    background: var(--accent-soft);
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent) inset;
}

#step1.wk-sign-v2 #otp .otp-icon {
    color: var(--accent-strong);
}

#step1.wk-sign-v2 #otp .otp-text .title {
    font-weight: 600;
    color: var(--ink);
}

#step1.wk-sign-v2 #otp .otp-text .subtitle {
    color: var(--ink-muted);
}

#step1.wk-sign-v2 #otp .otp-radio {
    accent-color: var(--accent);
}

#step1.wk-sign-v2 #otp #send_otp_code,
#step1.wk-sign-v2 #otp_verify .v-actions .fn-btn {
    float: none !important; /* .fn-pull-right is !important */
    width: 100%;
    max-width: 440px;
    height: auto;
}

#step1.wk-sign-v2 #otp_verify .v-title {
    font-family: var(--font);
    font-size: 24px;
    font-weight: 700;
    color: var(--ink);
}

#step1.wk-sign-v2 #otp_verify .v-sub,
#step1.wk-sign-v2 #otp_verify .v-help {
    font-family: var(--font);
    color: var(--ink-muted);
}

#step1.wk-sign-v2 #otp_verify .v-code input {
    font-family: var(--font);
    color: var(--ink);
    background: var(--surface-2);
    border: 1.5px solid var(--border-strong);
    border-radius: 10px;
    box-shadow: none;
}

#step1.wk-sign-v2 #otp_verify .v-code input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    background: var(--surface);
    border-color: var(--accent);
}

#step1.wk-sign-v2 #otp_verify .v-actions {
    max-width: 440px;
}

/* ---------------------------------------------------------------- MBO login (allow_autorize) */

/* table.autorizeaction: labels in a list on the left, the two inputs on the right, then the
   error, the spinner and Submit. A small card of its own, with the fields' look. */
#step1.wk-sign-v2 table.autorizeaction {
    width: calc(100% - 48px);
    max-width: 480px;
    margin: 30px auto 0;
    border-collapse: separate;
    border-spacing: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
}

#step1.wk-sign-v2 table.autorizeaction td {
    padding: 0;
    vertical-align: top;
}

#step1.wk-sign-v2 table.autorizeaction td.left {
    width: 1%;
    padding: 28px 0 0 28px;
}

#step1.wk-sign-v2 table.autorizeaction td.left ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

#step1.wk-sign-v2 table.autorizeaction td.left li {
    height: 48px;
    margin: 0 0 12px;
    font-size: 14.7px;
    font-weight: 600;
    line-height: 48px;
    white-space: nowrap;
}

#step1.wk-sign-v2 table.autorizeaction td.middle {
    width: 16px;
}

#step1.wk-sign-v2 table.autorizeaction td.right {
    padding: 28px 28px 0 0;
}

#step1.wk-sign-v2 table.autorizeaction td.right br {
    display: none;
}

#step1.wk-sign-v2 table.autorizeaction td.right input {
    width: 100%;
    height: 48px;
    margin: 0 0 12px;
    padding: 0 14px;
    box-sizing: border-box;
    font-family: var(--font);
    font-size: 16px;
    color: var(--ink);
    background: var(--surface-2);
    border: 1.5px solid var(--border-strong);
    border-radius: 10px;
}

#step1.wk-sign-v2 table.autorizeaction td.right input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    background: var(--surface);
    border-color: var(--accent);
}

#step1.wk-sign-v2 table.autorizeaction td.bottom {
    padding: 6px 28px 28px;
    text-align: right;
}

#step1.wk-sign-v2 table.autorizeaction #loginerror {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--danger);
    text-align: left;
}

#step1.wk-sign-v2 table.autorizeaction #autorizebutton {
    padding: 11px 22px;
    font-family: var(--font);
    font-size: 14.7px;
    font-weight: 600;
    line-height: 1.6;
    color: var(--on-accent);
    background: var(--accent);
    border: 1px solid transparent;
    border-radius: 9px;
    cursor: pointer;
}

#step1.wk-sign-v2 table.autorizeaction #autorizebutton:hover {
    background: var(--accent-strong);
}

/* ---------------------------------------------------------------- small screens */

@media (max-width: 600px) {
    #step1.wk-sign-v2 .selectaction {
        padding-top: 22px;
        padding-bottom: 4px; /* + the step's 18px */
    }

    #step1.wk-sign-v2 .selectaction .fn-logo-container {
        margin-bottom: 16px;
    }

    #step1.wk-sign-v2 .selectaction .fn-logo {
        height: 80px;
    }

    #step1.wk-sign-v2 .selectaction .fn-content {
        padding: 26px 18px 28px;
    }

    #step1.wk-sign-v2 .selectaction .fn-content h2 {
        font-size: 19px;
    }

    #step1.wk-sign-v2 .selectaction .fn-btn-group {
        margin-top: 20px;
    }

    /* The matches as stacked rows: the box on the left, the name over the details. The table
       keeps display: table (display_users() shows it with .show()). */
    #step1.wk-sign-v2 .findwaiver #finded_clients :is(.tabrow, .tabrow-even) {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        column-gap: 12px;
        padding: 12px 14px;
    }

    #step1.wk-sign-v2 .findwaiver #finded_clients :is(.tabrow, .tabrow-even) + :is(.tabrow, .tabrow-even) {
        border-top: 1px solid var(--border);
    }

    #step1.wk-sign-v2 .findwaiver #finded_clients td {
        display: block;
        width: auto;
        padding: 0;
        border-top: 0;
    }

    #step1.wk-sign-v2 .findwaiver #finded_clients td:first-child {
        grid-row: 1 / span 4;
        padding: 1px 0 0;
    }

    #step1.wk-sign-v2 .findwaiver #finded_clients td:nth-child(n+3) {
        font-size: 13px;
    }

    #step1.wk-sign-v2 .findwaiver #selectbutton {
        width: 100%;
    }

    #step1.wk-sign-v2 table.autorizeaction {
        width: calc(100% - 28px);
    }

    #step1.wk-sign-v2 table.autorizeaction td.left {
        padding: 22px 0 0 18px;
    }

    #step1.wk-sign-v2 table.autorizeaction td.middle {
        width: 12px;
    }

    #step1.wk-sign-v2 table.autorizeaction td.right {
        padding: 22px 18px 0 0;
    }

    #step1.wk-sign-v2 table.autorizeaction td.bottom {
        padding: 6px 18px 22px;
    }

    #step1.wk-sign-v2 table.autorizeaction #autorizebutton {
        width: 100%;
    }
}

/* Tablet zoom (body.wk-zoom-tablet): ~1.3x, as components.css does for the shared parts. */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
    body.wk-zoom-tablet #step1.wk-sign-v2 .selectaction .fn-content {
        max-width: 560px;
    }

    body.wk-zoom-tablet #step1.wk-sign-v2 .selectaction .fn-content h2 {
        font-size: 28px;
    }

    body.wk-zoom-tablet #step1.wk-sign-v2 .selectaction .fn-btn-group {
        gap: 16px;
    }

    body.wk-zoom-tablet #step1.wk-sign-v2 .selectaction .fn-btn-group .fn-btn {
        padding: 16px 28px;
    }

    body.wk-zoom-tablet #step1.wk-sign-v2 .findwaiver .fn-adult-content .fn-form-group .fn-col-6,
    body.wk-zoom-tablet #step1.wk-sign-v2 .findwaiver #nothingfound {
        max-width: 520px;
    }

    body.wk-zoom-tablet #step1.wk-sign-v2 .findwaiver #nothingfound {
        font-size: 18px;
    }

    body.wk-zoom-tablet #step1.wk-sign-v2 .findwaiver #finded_clients {
        font-size: 18px;
    }

    /* Five columns at the zoomed type break the dates and emails mid-word: the stacked rows of
       the small screens instead. */
    body.wk-zoom-tablet #step1.wk-sign-v2 .findwaiver #finded_clients :is(.tabrow, .tabrow-even) {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        column-gap: 14px;
        padding: 14px 18px;
    }

    body.wk-zoom-tablet #step1.wk-sign-v2 .findwaiver #finded_clients :is(.tabrow, .tabrow-even) + :is(.tabrow, .tabrow-even) {
        border-top: 1px solid var(--border);
    }

    body.wk-zoom-tablet #step1.wk-sign-v2 .findwaiver #finded_clients td {
        display: block;
        width: auto;
        padding: 0;
        border-top: 0;
    }

    body.wk-zoom-tablet #step1.wk-sign-v2 .findwaiver #finded_clients td:first-child {
        grid-row: 1 / span 4;
        padding: 1px 0 0;
    }

    body.wk-zoom-tablet #step1.wk-sign-v2 .findwaiver #finded_clients td:nth-child(n+3) {
        font-size: 16px;
    }


    body.wk-zoom-tablet #step1.wk-sign-v2 table.autorizeaction td.right input {
        font-size: 19px;
        height: 56px;
    }

    body.wk-zoom-tablet #step1.wk-sign-v2 table.autorizeaction td.left li {
        height: 56px;
        font-size: 19px;
        line-height: 56px;
    }

    body.wk-zoom-tablet #step1.wk-sign-v2 table.autorizeaction #autorizebutton {
        padding: 14px 28px;
        font-size: 19px;
    }
}
