/* =====================================================================
 * Checkin dialog - two-panel layout.
 * Markup: Ajax::userCheckinForm() with ?checkin_layout=modern, opened in a dialog by calendar_addon.php and club.php
 * and shown in the page by the group register page (.ckm-inline, with its add / edit member cards); setup in checkin_modern.php.
 * Everything is scoped to .ckm-dialog, so the classic forms elsewhere are untouched.
 * The form keeps its legacy inline styles, which is why some properties need !important.
 * ===================================================================== */

.ckm-dialog,
.ckm-chooser-dialog {
    --ckm-primary: #0088b3;
    --ckm-primary-dark: #006b8f;
    /* Small text on white: the same blue, a little stronger, so it stays readable */
    --ckm-primary-text: #00769c;
    --ckm-primary-soft: #e0f1f8;
    --ckm-ink: #15191f;
    --ckm-text: #2b3138;
    --ckm-muted: #6b7480;
    --ckm-line: #dde2e7;
    --ckm-line-strong: #c3cbd3;
    --ckm-soft: #eff2f5;
    --ckm-red: #d12b2b;
    --ckm-red-soft: #fdf2f2;
    --ckm-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    --ckm-display: 'Barlow Condensed', 'Oswald', 'Arial Narrow', sans-serif;
    /* Space kept above and below the dialog */
    --ckm-edge-y: 72px;
}

/* ---------- Dialog shell ---------- */

.ui-dialog.ckm-dialog {
    position: fixed !important;
    top: 0 !important;
    right: 0;
    bottom: 0;
    left: 0 !important;
    width: min(1080px, calc(100vw - 64px)) !important;
    height: fit-content !important;
    max-height: calc(100vh - 2 * var(--ckm-edge-y));
    margin: auto !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 18px !important;
    background: #fff !important;
    box-shadow: 0 32px 72px -28px rgba(8, 12, 20, .6);
    overflow: hidden;
    font-family: var(--ckm-font);
}

.ui-dialog.ckm-dialog .ui-dialog-titlebar {
    display: none !important;
}

.ui-dialog.ckm-dialog .ui-dialog-content {
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: #fff;
}

.ckm-dialog .ckm {
    display: flex;
    max-height: calc(100vh - 2 * var(--ckm-edge-y));
    color: var(--ckm-text);
    font: 400 15px/1.5 var(--ckm-font);
    text-align: left;
}

/* ---------- Right column: race card and summary (_checkin_modern_side.php) ---------- */

.ckm-dialog .ckm-side {
    position: relative;
    display: flex;
    flex: 0 0 330px;
    flex-direction: column;
    gap: 14px;
    order: 2;
    min-height: 0;
    box-sizing: border-box;
    padding: 18px;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-left: 1px solid #e6ebef;
    background: #f2f9fc;
}

.ckm-dialog .ckm-side .ckm-close {
    position: absolute;
    top: 26px;
    right: 26px;
    width: 34px;
    height: 34px;
    margin: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, .75);
}

.ckm-dialog .ckm-side .ckm-close::before,
.ckm-dialog .ckm-side .ckm-close::after {
    width: 15px;
}

.ckm-dialog .ckm-side .ckm-close:hover {
    background: #fff;
}

/* Race card: calendar badge, name and place, time left to register, registrations, price period */
.ckm-dialog .ckm-race-card {
    flex: none;
    padding: 16px 16px 14px;
    border-top: 4px solid var(--ckm-primary);
    border-radius: 14px;
    background: #dff0f7;
}

.ckm-dialog .ckm-eyebrow {
    margin: 0 44px 12px 0;
    font: 600 11px/1.2 var(--ckm-font);
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--ckm-primary-text);
}

.ckm-dialog .ckm-race-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

/* Calendar sheet: month on top, big day, year and weekday below */
.ckm-dialog .ckm-cal {
    flex: none;
    width: 60px;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid #d3dfe7;
    border-radius: 10px;
    background: #fff;
    text-align: center;
}

.ckm-dialog .ckm-cal-month {
    display: block;
    padding: 3px 0 2px;
    background: var(--ckm-primary);
    font: 700 10px/1.2 var(--ckm-font);
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #fff;
}

.ckm-dialog .ckm-cal-day {
    display: block;
    padding: 4px 0 0;
    font: 700 26px/1 var(--ckm-display);
    color: var(--ckm-ink);
}

.ckm-dialog .ckm-cal-year {
    display: block;
    padding: 2px 0 5px;
    font: 500 10px/1.2 var(--ckm-font);
    color: var(--ckm-muted);
}

.ckm-dialog .ckm-race-text {
    min-width: 0;
}

.ckm-dialog .ckm-race {
    margin: 0;
    padding: 0;
    font: 700 20px/1.1 var(--ckm-display);
    letter-spacing: .005em;
    text-transform: uppercase;
    color: var(--ckm-ink);
    overflow-wrap: anywhere;
}

.ckm-dialog .ckm-race-place {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--ckm-muted);
}

.ckm-dialog .ckm-stats {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.ckm-dialog .ckm-stat {
    flex: 1 1 0;
    min-width: 0;
    padding: 9px 11px;
    border-radius: 10px;
    background: #fff;
}

.ckm-dialog .ckm-stat-label {
    display: block;
    font-size: 11px;
    line-height: 1.3;
    color: var(--ckm-muted);
}

.ckm-dialog .ckm-stat-value {
    display: block;
    margin-top: 3px;
    font: 700 15px/1.2 var(--ckm-font);
    color: var(--ckm-ink);
    white-space: nowrap;
}

.ckm-dialog .ckm-price-note {
    margin: 12px 0 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--ckm-text);
}

/* Summary card: chosen items with prices, total, discount code, submit area */
.ckm-dialog .ckm-summary {
    flex: none;
    padding: 18px;
    border: 1px solid #e6ebef;
    border-radius: 14px;
    background: #fff;
}

.ckm-dialog .ckm-summary-prices {
    display: none;
    margin-bottom: 14px;
}

.ckm-dialog .ckm-summary.has-prices .ckm-summary-prices {
    display: block;
}

.ckm-dialog .ckm-summary-title {
    margin: 0 0 10px;
    padding: 0;
    font: 600 16px/1.3 var(--ckm-font);
    color: var(--ckm-ink);
}

.ckm-dialog .ckm-summary-items {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ckm-dialog .ckm-summary-items li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
    padding: 4px 0;
    font-size: 13px;
    line-height: 1.4;
    color: var(--ckm-text);
    list-style: none;
}

.ckm-dialog .ckm-summary-items li > span:last-child {
    flex: none;
    color: var(--ckm-ink);
    white-space: nowrap;
}

.ckm-dialog .ckm-summary-items li.is-discount,
.ckm-dialog .ckm-summary-items li.is-discount > span:last-child {
    color: var(--ckm-primary-text);
    font-weight: 700;
}

/* What the discount covers, under its name */
.ckm-dialog .ckm-summary-items li small {
    display: block;
    font-size: 12px;
    font-weight: 500;
}

.ckm-dialog .ckm-summary-empty {
    margin: 0;
    font-size: 13px;
    color: var(--ckm-muted);
}

.ckm-dialog .ckm-summary-total,
.ckm-dialog .ckm-summary-note {
    display: none;
}

.ckm-dialog .ckm-summary.has-items .ckm-summary-empty {
    display: none;
}

.ckm-dialog .ckm-summary.has-items .ckm-summary-total {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--ckm-line);
    font-size: 14px;
    font-weight: 600;
    color: var(--ckm-ink);
}

.ckm-dialog .ckm-summary-amount {
    font: 700 28px/1 var(--ckm-display);
    color: var(--ckm-ink);
}

.ckm-dialog .ckm-summary.has-items .ckm-summary-note {
    display: block;
    margin: 6px 0 0;
    font-size: 11px;
    line-height: 1.4;
    color: var(--ckm-muted);
}

.ckm-dialog .ckm-discount-toggle {
    margin: 0 0 12px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ckm-primary-text);
    font: 600 13px/1.3 var(--ckm-font);
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.ckm-dialog .ckm-summary-discount {
    display: none;
    margin-bottom: 14px;
}

.ckm-dialog .ckm-summary.is-discount-open .ckm-summary-discount {
    display: block;
}

.ckm-dialog .ckm-summary .ckm-footer {
    padding-top: 0;
    border-top: 0;
}

/* In the narrow column the button text wraps instead of shrinking; sentence case reads better with the amount */
.ckm-dialog .ckm .ckm-summary .checkin-submit {
    display: block;
    height: auto;
    min-height: 48px;
    padding: 12px 16px;
    font: 700 15px/1.3 var(--ckm-font);
    letter-spacing: 0;
    text-align: center;
    text-transform: none;
}

/* reCAPTCHA is 304px wide, a little more than the column */
.ckm-dialog .ckm-summary #html_element {
    height: 70px;
    transform: scale(.88);
    transform-origin: 0 0;
}

.ckm-dialog .ckm-summary .ckm-footer > p {
    text-align: left;
}

/* ---------- Form column ---------- */

.ckm-dialog .ckm-main {
    position: relative;
    flex: 1 1 auto;
    order: 1;
    min-width: 0;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
}

.ckm-dialog .ckm-head {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 30px 36px 14px;
    background: #fff;
    transition: box-shadow .2s;
}

.ckm-dialog .ckm-main.is-scrolled .ckm-head {
    box-shadow: 0 1px 0 var(--ckm-line), 0 10px 20px -16px rgba(15, 23, 42, .35);
}

.ckm-dialog .ckm-head .ckm-eyebrow {
    margin-bottom: 6px;
    color: var(--ckm-primary-text);
}

.ckm-dialog .ckm-title {
    margin: 0;
    padding: 0;
    font: 700 34px/1 var(--ckm-display);
    letter-spacing: .01em;
    text-transform: uppercase;
    color: var(--ckm-ink);
    overflow-wrap: anywhere;
}

.ckm-dialog .ckm-close {
    position: relative;
    flex: none;
    width: 42px;
    height: 42px;
    margin: -4px -4px 0 0;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: var(--ckm-soft);
    color: var(--ckm-ink);
    font-size: 0;
    cursor: pointer;
    transition: background-color .15s;
}

.ckm-dialog .ckm-close::before,
.ckm-dialog .ckm-close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 17px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
}

.ckm-dialog .ckm-close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.ckm-dialog .ckm-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.ckm-dialog .ckm-close:hover {
    background: #e1e6eb;
}

.ckm-dialog .ckm-close:focus-visible {
    outline: 3px solid rgba(0, 136, 179, .35);
    outline-offset: 2px;
}

.ckm-dialog .ckm-body {
    padding: 6px 36px 32px;
}

/* ---------- Sections ---------- */

.ckm-dialog .ckm-section {
    margin: 0 0 26px;
}

.ckm-dialog .ckm-section--empty {
    display: none;
}

.ckm-dialog .ckm-section-title {
    margin: 0 0 14px;
    padding: 0;
    border: 0;
    background: none;
    font: 700 22px/1.1 var(--ckm-display);
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ckm-primary);
    text-align: left;
}

/* Paired fields line up on their inputs even when one label wraps */
.ckm-dialog .ckm-fields {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px;
}

/* Two fields share a row when there is room, a lone field takes the full width */
.ckm-dialog .ckm-fields > * {
    flex: 1 1 220px;
    min-width: 0;
    box-sizing: border-box;
}

.ckm-dialog .ckm-fields--stack {
    gap: 8px;
}

.ckm-dialog .ckm-fields--stack > *,
.ckm-dialog .ckm-fields > .clubic,
.ckm-dialog .ckm-fields > .show_this_line,
.ckm-dialog .ckm-fields > .popup-line:has(#check_category, .select-ruta),
.ckm-dialog .ckm-fields > .popup-line:has(.form-parameter-image) {
    flex-basis: 100%;
}

.ckm-dialog .ckm-fields > .popup-line {
    margin: 0 !important;
    padding: 0;
}

.ckm-dialog .ckm-fields > .invisible-form-field {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.ckm-dialog .ckm-fields > .show_this_line:has(#popup_status:empty) {
    display: none;
}

.ckm-dialog .ckm #popup_status {
    margin: 0 !important;
}

/* ---------- Labels ---------- */

.ckm-dialog .ckm .popup-line label {
    display: block;
    margin: 0;
    padding: 0;
    font: inherit;
    color: inherit;
}

.ckm-dialog .ckm .popup-line br {
    display: none;
}

.ckm-dialog .ckm .checkin-field-label,
.ckm-dialog .ckm .popup-line label > span:first-child,
.ckm-dialog .ckm .popup-line > label.d-block-m,
.ckm-dialog .ckm .other_club_titles,
.ckm-dialog .ckm .checkin-discount > label {
    display: block;
    margin: 0 0 6px;
    font: 600 14px/1.35 var(--ckm-font);
    color: var(--ckm-ink);
}

.ckm-dialog .ckm .ckm-required::after {
    content: ' *';
}

/* ---------- Fields ---------- */

.ckm-dialog .ckm select,
.ckm-dialog .ckm input[type=text],
.ckm-dialog .ckm input[type=number],
.ckm-dialog .ckm input:not([type]) {
    display: block;
    width: 100% !important;
    height: 44px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 14px !important;
    border-width: 1px;
    border-style: solid;
    border-color: var(--ckm-line);
    border-radius: 9px !important;
    background-color: #fff;
    color: var(--ckm-ink) !important;
    font: 400 15px/1.2 var(--ckm-font);
    box-shadow: none;
    outline: 0;
    transition: border-color .15s, box-shadow .15s;
}

.ckm-dialog .ckm select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 38px !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2315191f' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 13px;
    text-overflow: ellipsis;
    cursor: pointer;
}

.ckm-dialog .ckm select:hover,
.ckm-dialog .ckm input[type=text]:hover,
.ckm-dialog .ckm input[type=number]:hover,
.ckm-dialog .ckm input:not([type]):hover {
    border-color: var(--ckm-line-strong);
}

.ckm-dialog .ckm select:focus,
.ckm-dialog .ckm input[type=text]:focus,
.ckm-dialog .ckm input[type=number]:focus,
.ckm-dialog .ckm input:not([type]):focus {
    border-color: var(--ckm-primary) !important;
    box-shadow: 0 0 0 3px rgba(0, 136, 179, .16);
}

.ckm-dialog .ckm select:disabled,
.ckm-dialog .ckm input:disabled {
    border-color: var(--ckm-line);
    background-color: var(--ckm-soft);
    color: #9aa3ad !important;
    cursor: not-allowed;
}

/* Red border comes from restyle.css (.is-invalid) */
.ckm-dialog .ckm .is-invalid {
    box-shadow: 0 0 0 3px rgba(209, 43, 43, .12);
}

/* Validation marks stay hidden until the submit button is pressed (.checkin-pending, see restyle.css) */
.ckm-dialog .checkin-pending .ckm .is-invalid:not(:focus),
.ckm-dialog .checkin-pending .ckm .parameter:not(:focus) {
    border-color: var(--ckm-line) !important;
    box-shadow: none;
}

.ckm-dialog .checkin-pending .ckm div.soca-outdoor-chb.is-invalid {
    border-color: transparent !important;
    background: none;
}

/* Club: autocomplete input + "Brez kluba" toggle */
.ckm-dialog .ckm .checking_club_wrapper {
    display: flex;
    gap: 10px;
    margin: 0;
}

.ckm-dialog .ckm #display-club-name {
    flex: 1 1 auto;
    width: auto !important;
    min-width: 0;
}

.ckm-dialog .ckm .no_club {
    flex: none;
    width: auto;
    height: 44px;
    box-sizing: border-box;
    padding: 0 20px;
    border: 1px solid var(--ckm-primary);
    border-radius: 9px;
    background: #fff;
    color: var(--ckm-primary-text);
    font: 600 15px/1 var(--ckm-font);
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s, color .15s;
}

.ckm-dialog .ckm .no_club:hover {
    background: var(--ckm-primary-soft);
}

.ckm-dialog .ckm .checking_club_wrapper:has(#display-club-name:disabled) .no_club {
    background: var(--ckm-primary);
    color: #fff;
}

.ckm-dialog .ckm .some_other_club {
    margin: 6px 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    color: var(--ckm-primary-text) !important;
    font-size: 13px;
    font-weight: 600;
    text-align: left !important;
    text-decoration: underline;
}

.ckm-dialog .ckm .other_club_titles {
    margin-top: 12px;
}

/* Licence: validity icons sit inside the input */
.ckm-dialog .ckm #check_licence {
    padding-right: 40px !important;
}

.ckm-dialog .ckm .position-relative-m > .position-absolute-m {
    top: 14px !important;
    right: 14px !important;
    line-height: 1;
}

/* Moved into its own row by initModernCheckinForm; pulled up close to the input above */
.ckm-dialog .ckm-fields > #licenceInvalidMessage {
    flex-basis: 100%;
    margin-top: -10px !important;
    font-size: 12px !important;
    font-weight: 400;
    line-height: 1.5;
}

.ckm-dialog .ckm .form-parameter-image {
    margin-bottom: 8px;
}

.ckm-dialog .ckm .form-parameter-image img {
    border-radius: 9px;
}

/* ---------- Consents ---------- */

.ckm-dialog .ckm div.soca-outdoor-chb,
.ckm-dialog .ckm .uslovi-k {
    position: relative;
    margin: 0 !important;
    padding: 5px 10px 5px 38px;
    border: 1px solid transparent;
    border-radius: 9px;
    font: 400 15px/1.5 var(--ckm-font);
    color: var(--ckm-text);
}

.ckm-dialog .ckm div.soca-outdoor-chb > input[type=checkbox],
.ckm-dialog .ckm .uslovi-k > input[type=checkbox] {
    position: absolute;
    top: 7px;
    left: 10px;
    width: 19px;
    height: 19px;
    margin: 0;
    accent-color: var(--ckm-primary);
    cursor: pointer;
}

.ckm-dialog .ckm div.soca-outdoor-chb a,
.ckm-dialog .ckm .uslovi-k a {
    color: var(--ckm-primary-text) !important;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.ckm-dialog .ckm div.soca-outdoor-chb.is-invalid {
    background: var(--ckm-red-soft);
}

.ckm-dialog .ckm #soca-ol {
    margin: 6px 0 0;
    padding-left: 18px;
}

/* ---------- Discount ---------- */

.ckm-dialog .ckm .wrap-input {
    position: static !important;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0 !important;
}

.ckm-dialog .ckm .wrap-input .discount_code {
    flex: 1 1 180px;
    width: auto !important;
    min-width: 0;
}

.ckm-dialog .ckm .wrap-input .check_discount {
    position: static !important;
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    height: 44px;
    box-sizing: border-box;
    padding: 0 20px !important;
    border: 0 !important;
    border-radius: 9px;
    background: var(--ckm-primary) !important;
    color: #fff !important;
    font: 600 15px/1 var(--ckm-font);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .15s;
}

.ckm-dialog .ckm .wrap-input .check_discount:hover {
    background: var(--ckm-primary-dark) !important;
}

.ckm-dialog .ckm .discounts_messages {
    flex-basis: 100%;
    margin: 0;
    font-size: 13px;
}

/* ---------- Footer: errors, submit, disclaimer ---------- */

.ckm-dialog .ckm-footer {
    padding-top: 20px;
    border-top: 1px solid var(--ckm-line);
}

.ckm-dialog .ckm #checking-error-reporting {
    margin: 0 0 14px;
}

.ckm-dialog .ckm #checking-error-reporting:has(li) {
    padding: 12px 16px;
    border: 1px solid #f2caca;
    border-radius: 10px;
    background: var(--ckm-red-soft);
}

.ckm-dialog .ckm #checking-error-reporting h3 {
    margin: 0;
    font: 700 12px/1.3 var(--ckm-font);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ckm-red);
}

.ckm-dialog .ckm #checking-error-reporting ul {
    margin: 0;
    padding: 0;
}

.ckm-dialog .ckm #checking-error-reporting h3 + ul {
    margin-top: 4px;
}

.ckm-dialog .ckm #checking-error-reporting li {
    position: relative;
    padding: 2px 0 2px 15px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--ckm-red);
    list-style: none;
}

.ckm-dialog .ckm #checking-error-reporting li::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 2px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.ckm-dialog .ckm .checkin-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    height: 48px;
    min-height: 0;
    box-sizing: border-box;
    padding: 0 20px;
    border: 0;
    border-radius: 10px;
    background: var(--ckm-primary) !important;
    color: #fff !important;
    font: 700 19px/1 var(--ckm-display);
    letter-spacing: .08em;
    text-transform: uppercase;
    text-shadow: none;
    text-decoration: none;
    box-shadow: 0 10px 20px -12px rgba(0, 136, 179, .9);
    cursor: pointer;
    transition: background-color .15s, box-shadow .15s;
}

.ckm-dialog .ckm .checkin-submit:hover {
    background: var(--ckm-primary-dark) !important;
}

.ckm-dialog .ckm-footer > p {
    margin: 14px 0 4px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--ckm-muted);
    text-align: center;
}

.ckm-dialog .ckm-footer > a {
    font-size: 13px;
    font-weight: 600;
    color: var(--ckm-primary-text) !important;
}

/* ---------- Guest and register forms ---------- */

/* Hidden helpers (e.g. submit buttons until reCAPTCHA is solved) must stay hidden despite the button styles above */
.ckm-dialog .ckm .d-none-m,
.ckm-dialog .ckm-fields > div:empty {
    display: none !important;
}

.ckm-dialog .ckm .popup-line-custom-m {
    width: auto;
}

/* Personal data in wide + narrow pairs that fill a row each: Email | Telefon, Spol | Datum rojstva, Ulica | Poštna številka, Kraj | Država */
.ckm-dialog .ckm-fields > .popup-line:has([name$="_user_email"], [name$="_user_day"], [name$="_user_address"], [name$="_user_city"]) {
    flex: 0 0 calc((100% - 16px) * 2 / 3);
}

.ckm-dialog .ckm-fields > .popup-line:has([name$="_user_phone"], [name$="_user_gender"], [name$="_user_zip"], [name$="_user_country"]) {
    flex: 0 0 calc((100% - 16px) / 3);
}

.ckm-dialog .ckm .d-flex-m {
    display: flex;
    gap: 8px;
}

.ckm-dialog .ckm .d-flex-m > .ckm-select {
    flex: 1 1 0;
    min-width: 0;
}

.ckm-dialog .ckm .d-flex-m > .clear {
    display: none;
}

.ckm-dialog .ckm .popup-line .font-small-m {
    margin-top: 4px;
    font-size: 12px !important;
}

/* The guest form's licence line wraps label and input, so its icon is placed from the bottom */
.ckm-dialog .ckm .popup-line.position-relative-m > .position-absolute-m {
    top: auto !important;
    bottom: 14px;
}

/* The person's own consents (terms, newsletter), moved under Soglasja by initModernCheckinForm */
.ckm-dialog .ckm .ckm-consent {
    position: relative;
    margin: 0 !important;
    padding: 5px 10px 5px 38px;
    border: 1px solid transparent;
    border-radius: 9px;
}

.ckm-dialog .ckm .ckm-consent label {
    margin: 0;
    font: 400 15px/1.5 var(--ckm-font);
    color: var(--ckm-text);
}

.ckm-dialog .ckm .ckm-consent input[type=checkbox] {
    position: absolute;
    top: 7px;
    left: 10px;
    width: 19px;
    height: 19px;
    margin: 0;
    accent-color: var(--ckm-primary);
    cursor: pointer;
}

.ckm-dialog .ckm .ckm-consent .terms-text {
    color: var(--ckm-primary-text) !important;
    text-decoration: underline !important;
    text-underline-offset: 3px;
}

.ckm-dialog .ckm .ckm-consent .fa-exclamation-triangle {
    display: none;
}

.ckm-dialog .ckm .ckm-consent.is-invalid {
    background: var(--ckm-red-soft);
}

.ckm-dialog .checkin-pending .ckm .ckm-consent.is-invalid {
    border-color: transparent !important;
    background: none;
}

/* reCAPTCHA and the two guest buttons ("add another participant" + submit) */
.ckm-dialog .ckm-footer fieldset {
    min-width: 0;
    margin: 0 0 14px;
    padding: 0;
    border: 0;
}

.ckm-dialog .ckm #submit-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ckm-dialog .ckm #submit-buttons > .checkin-submit {
    flex: 1 1 220px;
    width: auto !important;
    margin: 0 !important;
}

.ckm-dialog .ckm .checkin-and-add-more-users {
    border: 1px solid var(--ckm-primary);
    background: #fff !important;
    color: var(--ckm-primary) !important;
    box-shadow: none;
}

.ckm-dialog .ckm .checkin-and-add-more-users:hover {
    background: var(--ckm-primary-soft) !important;
}

/* ---------- Participant chooser (_childs-checkin.php): account holder and children ---------- */

.ui-dialog.ckm-chooser-dialog {
    position: fixed !important;
    top: 0 !important;
    right: 0;
    bottom: 0;
    left: 0 !important;
    width: min(580px, calc(100vw - 28px)) !important;
    height: fit-content !important;
    max-height: calc(100vh - 48px);
    margin: auto !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 18px !important;
    background: #fff !important;
    box-shadow: 0 32px 72px -28px rgba(8, 12, 20, .6);
    overflow: hidden;
    font-family: var(--ckm-font);
}

.ui-dialog.ckm-chooser-dialog .ui-dialog-titlebar {
    display: none !important;
}

.ui-dialog.ckm-chooser-dialog .ui-dialog-content {
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: calc(100vh - 48px);
    padding: 0 !important;
    overflow-y: auto;
    background: #fff;
}

.ckm-chooser-dialog .ckm-chooser {
    padding: 28px 32px 32px;
    color: var(--ckm-text);
    font: 400 15px/1.5 var(--ckm-font);
    text-align: left;
}

.ckm-chooser-dialog .ckm-chooser-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.ckm-chooser-dialog .ckm-chooser-title {
    margin: 0;
    padding: 0;
    font: 700 34px/1.05 var(--ckm-display);
    color: #0d3a50;
}

.ckm-chooser-dialog .ckm-close {
    position: relative;
    flex: none;
    width: 40px;
    height: 40px;
    margin: 0 -8px 0 0;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: none;
    color: #4b5563;
    font-size: 0;
    cursor: pointer;
    transition: background-color .15s;
}

.ckm-chooser-dialog .ckm-close::before,
.ckm-chooser-dialog .ckm-close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
}

.ckm-chooser-dialog .ckm-close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.ckm-chooser-dialog .ckm-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.ckm-chooser-dialog .ckm-close:hover {
    background: var(--ckm-soft);
}

.ckm-chooser-dialog .ckm-close:focus-visible {
    outline: 3px solid rgba(0, 136, 179, .35);
    outline-offset: 2px;
}

/* A card per action, marked by its colour bar: blue = new registration, red = withdraw */
.ckm-chooser-dialog .ckm-choice {
    position: relative;
    margin-top: 14px;
    padding: 18px 20px 20px 28px;
    border: 1px solid #dfe8ee;
    border-radius: 12px;
    background: #f5f9fc;
    overflow: hidden;
}

.ckm-chooser-dialog .ckm-choice::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 6px;
    background: var(--ckm-primary);
}

.ckm-chooser-dialog .ckm-choice--checkout {
    border-color: #f0e3e0;
    background: #fdf8f7;
}

.ckm-chooser-dialog .ckm-choice--checkout::before {
    background: #b42318;
}

.ckm-chooser-dialog .ckm-choice-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    font: 700 14px/1.2 var(--ckm-font);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ckm-primary-text);
}

.ckm-chooser-dialog .ckm-choice--checkout .ckm-choice-label {
    color: #b42318;
}

.ckm-chooser-dialog .ckm-choice-label svg {
    flex: none;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.4;
    stroke-linecap: round;
}

.ckm-chooser-dialog .ckm-choice-row {
    display: flex;
    gap: 12px;
}

/* Chooser dropdowns: a bit taller, and red in the withdraw card */
.ui-dialog.ckm-chooser-dialog .ckm-select {
    flex: 1 1 auto;
}

.ui-dialog.ckm-chooser-dialog .ckm-select-button {
    height: 46px;
    border-color: #b9c5cf;
    font-size: 16px;
    line-height: 44px;
}

.ui-dialog.ckm-chooser-dialog .ckm-choice--checkout .ckm-select-button:focus-visible,
.ui-dialog.ckm-chooser-dialog .ckm-choice--checkout .ckm-select.is-open .ckm-select-button {
    border-color: #b42318;
    box-shadow: 0 0 0 3px rgba(180, 35, 24, .14);
}

.ui-dialog.ckm-chooser-dialog .ckm-choice--checkout .ckm-select.is-open .ckm-select-button {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23b42318' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 15 6-6 6 6'/%3E%3C/svg%3E");
}

.ui-dialog.ckm-chooser-dialog .ckm-choice--checkout .ckm-select-option.is-active {
    background: #fbefed;
    color: #b42318;
}

.ui-dialog.ckm-chooser-dialog .ckm-choice--checkout .ckm-select-option[aria-selected="true"]::after {
    border-color: #b42318;
}

.ckm-chooser-dialog .ckm-choice-btn {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    height: 46px;
    box-sizing: border-box;
    padding: 0 22px;
    border: 2px solid var(--ckm-primary);
    border-radius: 9px;
    background: var(--ckm-primary);
    color: #fff !important;
    font: 700 16px/1 var(--ckm-font);
    text-decoration: none;
    transition: background-color .15s, border-color .15s, color .15s;
}

.ckm-chooser-dialog .ckm-choice-btn:hover {
    border-color: var(--ckm-primary-dark);
    background: var(--ckm-primary-dark);
}

.ckm-chooser-dialog .ckm-choice-btn--danger {
    border-color: #b42318;
    background: #fff;
    color: #b42318 !important;
}

.ckm-chooser-dialog .ckm-choice-btn--danger:hover {
    border-color: #b42318;
    background: #b42318;
    color: #fff !important;
}

/* Nobody registered yet: one button per person */
.ckm-chooser-dialog .ckm-choice-people {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ckm-chooser-dialog .ckm-choice-person {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 46px;
    box-sizing: border-box;
    padding: 0 16px;
    border: 1px solid #b9c5cf;
    border-radius: 9px;
    background: #fff;
    color: var(--ckm-ink) !important;
    font: 500 16px/1 var(--ckm-font);
    text-decoration: none;
    transition: border-color .15s, color .15s;
}

.ckm-chooser-dialog .ckm-choice-person::after {
    content: '';
    width: 8px;
    height: 8px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    transform: rotate(45deg);
}

.ckm-chooser-dialog .ckm-choice-person:hover {
    border-color: var(--ckm-primary);
    color: var(--ckm-primary-text) !important;
}

@media (max-width: 480px) {
    .ckm-chooser-dialog .ckm-chooser {
        padding: 22px 18px 22px;
    }

    .ckm-chooser-dialog .ckm-chooser-title {
        font-size: 28px;
    }

    .ckm-chooser-dialog .ckm-choice {
        padding: 16px 16px 16px 22px;
    }

    .ckm-chooser-dialog .ckm-choice-row {
        flex-direction: column;
    }
}

/* ---------- Styled dropdowns (ckmCustomSelect in checkin_modern.php): checkin forms and participant chooser ---------- */

:is(.ui-dialog, .ckm-inline) .ckm-select {
    position: relative;
    min-width: 0;
}

:is(.ui-dialog, .ckm-inline) .ckm-select.is-hidden {
    display: none;
}

/* The real select stays in the page, invisible but 1px big, so jQuery's :visible (.parameter:visible) still counts it */
:is(.ui-dialog, .ckm-inline) .ckm-select > select.ckm-select-native {
    position: absolute !important;
    bottom: 0;
    left: 0;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    opacity: 0;
    pointer-events: none;
}

:is(.ui-dialog, .ckm-inline) .ckm-select-button {
    display: block;
    width: 100%;
    height: 44px;
    box-sizing: border-box;
    margin: 0;
    padding: 0 38px 0 14px;
    overflow: hidden;
    border: 1px solid var(--ckm-line);
    border-radius: 9px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2315191f' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center / 13px;
    color: var(--ckm-ink);
    font: 400 15px/42px var(--ckm-font);
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}

:is(.ui-dialog, .ckm-inline) .ckm-select-button:hover {
    border-color: var(--ckm-line-strong);
}

:is(.ui-dialog, .ckm-inline) .ckm-select-button:focus-visible,
:is(.ui-dialog, .ckm-inline) .ckm-select.is-open .ckm-select-button {
    border-color: var(--ckm-primary);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(0, 136, 179, .16);
}

:is(.ui-dialog, .ckm-inline) .ckm-select.is-open .ckm-select-button {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%230088b3' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 15 6-6 6 6'/%3E%3C/svg%3E");
}

:is(.ui-dialog, .ckm-inline) .ckm-select-button:disabled {
    border-color: var(--ckm-line);
    background-color: var(--ckm-soft);
    color: #9aa3ad;
    cursor: not-allowed;
}

/* Mirrors .is-invalid of the hidden select */
:is(.ui-dialog, .ckm-inline) .ckm-select-button.is-invalid {
    border-color: var(--ckm-red);
    box-shadow: 0 0 0 3px rgba(209, 43, 43, .12);
}

:is(.ui-dialog, .ckm-inline) .ckm-select-list {
    display: none;
    position: fixed;
    z-index: 10;
    box-sizing: border-box;
    max-height: 280px;
    margin: 0;
    padding: 6px;
    overflow-y: auto;
    border: 1px solid #dfe5ea;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 18px 40px -12px rgba(15, 23, 42, .3), 0 2px 6px rgba(15, 23, 42, .06);
    list-style: none;
    outline: 0;
}

:is(.ui-dialog, .ckm-inline) .ckm-select.is-open .ckm-select-list {
    display: block;
}

:is(.ui-dialog, .ckm-inline) .ckm-select-option {
    position: relative;
    margin: 0;
    padding: 10px 38px 10px 12px;
    border-radius: 8px;
    color: var(--ckm-ink);
    font: 400 15px/1.3 var(--ckm-font);
    text-align: left;
    list-style: none;
    cursor: pointer;
}

:is(.ui-dialog, .ckm-inline) .ckm-select-option.is-active {
    background: #e3f1f8;
    color: var(--ckm-primary-text);
}

:is(.ui-dialog, .ckm-inline) .ckm-select-option.is-disabled {
    color: #a3acb5;
    cursor: default;
}

:is(.ui-dialog, .ckm-inline) .ckm-select-option[aria-selected="true"] {
    font-weight: 600;
}

/* Tick next to the selected entry */
:is(.ui-dialog, .ckm-inline) .ckm-select-option[aria-selected="true"]::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 15px;
    width: 10px;
    height: 5px;
    border-bottom: 2px solid var(--ckm-primary);
    border-left: 2px solid var(--ckm-primary);
    transform: translateY(-70%) rotate(-45deg);
}

:is(.ui-dialog, .ckm-inline) .ckm-select-list::-webkit-scrollbar {
    width: 12px;
}

:is(.ui-dialog, .ckm-inline) .ckm-select-list::-webkit-scrollbar-track {
    margin: 8px 0;
    background: transparent;
}

:is(.ui-dialog, .ckm-inline) .ckm-select-list::-webkit-scrollbar-thumb {
    border: 4px solid transparent;
    border-radius: 12px;
    background: #c5cdd5 padding-box;
}

/* ---------- Scrollbars ---------- */

/* Chrome, Edge, Safari: slim rounded thumb that keeps clear of the card's rounded corners */
.ckm-dialog .ckm::-webkit-scrollbar,
.ckm-dialog .ckm-main::-webkit-scrollbar,
.ckm-dialog .ckm-side::-webkit-scrollbar {
    width: 12px;
}

.ckm-dialog .ckm::-webkit-scrollbar-track,
.ckm-dialog .ckm-main::-webkit-scrollbar-track,
.ckm-dialog .ckm-side::-webkit-scrollbar-track {
    margin: 14px 0;
    background: transparent;
}

.ckm-dialog .ckm::-webkit-scrollbar-thumb,
.ckm-dialog .ckm-main::-webkit-scrollbar-thumb,
.ckm-dialog .ckm-side::-webkit-scrollbar-thumb {
    border: 4px solid transparent;
    border-radius: 12px;
    background: #c5cdd5 padding-box;
}

.ckm-dialog .ckm::-webkit-scrollbar-thumb:hover,
.ckm-dialog .ckm-main::-webkit-scrollbar-thumb:hover {
    border-width: 3px;
    background-color: #9ea8b2;
}

/* Firefox has no ::-webkit-scrollbar; it gets the standard thin scrollbar in the same colours */
@supports not selector(::-webkit-scrollbar) {
    .ckm-dialog .ckm,
    .ckm-dialog .ckm-main {
        scrollbar-width: thin;
        scrollbar-color: #c5cdd5 transparent;
    }

}

/* ---------- Smaller screens ---------- */

/* Short screens keep more of the form visible */
@media (max-height: 760px) {
    .ckm-dialog {
        --ckm-edge-y: 24px;
    }
}

@media (max-width: 1024px) {
    .ckm-dialog .ckm-side {
        flex-basis: 290px;
        padding: 14px;
    }

    .ckm-dialog .ckm-head {
        padding: 26px 28px 14px;
    }

    .ckm-dialog .ckm-body {
        padding: 6px 28px 28px;
    }
}

/* Phones: a floating card that scrolls as a whole; the race card goes above the form and the summary below it */
@media (max-width: 760px) {
    .ckm-dialog {
        --ckm-edge-y: 24px;
    }

    /* The transform makes the card the frame of the fixed close button, so it stays in the card's corner while the form scrolls */
    .ui-dialog.ckm-dialog {
        width: calc(100vw - 28px) !important;
        max-height: calc(100dvh - 2 * var(--ckm-edge-y));
        border-radius: 16px !important;
        transform: translateZ(0);
    }

    .ckm-dialog .ckm {
        flex-direction: column;
        max-height: calc(100vh - 2 * var(--ckm-edge-y));
        max-height: calc(100dvh - 2 * var(--ckm-edge-y));
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .ckm-dialog .ckm > * {
        flex: none;
    }

    .ckm-dialog .ckm-main {
        overflow: visible;
    }

    .ckm-dialog .ckm-side {
        display: contents;
    }

    .ckm-dialog .ckm-race-card {
        order: 0;
        margin: 14px 14px 0;
    }

    .ckm-dialog .ckm-summary {
        order: 2;
        margin: 0 14px 14px;
    }

    .ckm-dialog .ckm-head {
        padding: 16px 20px 12px;
    }

    .ckm-dialog .ckm-title {
        padding-right: 52px;
        font-size: 26px;
    }

    .ckm-dialog .ckm-close {
        position: fixed;
        top: 10px;
        right: calc(10px + var(--ckm-scrollbar, 0px));
        z-index: 5;
        width: 40px;
        height: 40px;
        margin: 0;
    }

    .ckm-dialog .ckm-body {
        padding: 4px 20px 26px;
    }

    .ckm-dialog .ckm-section-title {
        font-size: 20px;
    }

    /* The personal-data pairs stack on phones */
    .ckm-dialog .ckm-fields > .popup-line:has([name$="_user_email"], [name$="_user_day"], [name$="_user_address"], [name$="_user_city"], [name$="_user_phone"], [name$="_user_gender"], [name$="_user_zip"], [name$="_user_country"]) {
        flex-basis: 100%;
    }

    /* 16px keeps iOS from zooming into the field on focus */
    .ckm-dialog .ckm select,
    .ckm-dialog .ckm .ckm-select-button,
    .ckm-dialog .ckm input[type=text],
    .ckm-dialog .ckm input[type=number],
    .ckm-dialog .ckm input:not([type]) {
        font-size: 16px;
    }
}

/* ---------- In the page instead of a dialog (.ckm-inline): group register page ---------- */

/* The same card as the dialog, placed in the page: it takes its natural height and the page scrolls instead of its columns */
.ckm-dialog.ckm-inline {
    max-width: 1080px;
    margin: 24px auto;
    border: 1px solid #e3e8ec;
    border-radius: 0;
    background: #fff;
    font-family: var(--ckm-font);
    text-align: left;
}

/* Add and edit member: one column, as wide as the page's tables */
.ckm-dialog.ckm-inline--single {
    max-width: none;
}

/* Two fields per row however wide the card is; a lone last field takes the whole row */
.ckm-dialog.ckm-inline--single .ckm-fields > * {
    flex-basis: calc(50% - 8px);
}

.ckm-dialog.ckm-inline .ckm {
    position: relative;
    max-height: none;
}

.ckm-dialog.ckm-inline .ckm-main,
.ckm-dialog.ckm-inline .ckm-side {
    overflow: visible;
}

.ckm-dialog.ckm-inline .ckm-head {
    position: static;
}

/* The summary with the submit button stays in view while the form is scrolled */
.ckm-dialog.ckm-inline .ckm-summary {
    position: sticky;
    top: 24px;
}

/* Smaller submit buttons without a shadow */
.ckm-dialog.ckm-inline .ckm .checkin-submit {
    height: 42px;
    font-size: 16px;
    box-shadow: none;
}

/* Add and edit member: the button is as wide as its text */
.ckm-dialog.ckm-inline--single .ckm .checkin-submit {
    display: inline-flex;
    width: auto !important;
    min-width: 180px;
    padding: 0 28px;
}

/* Checkin card: the summary's button still wraps its text in the narrow column */
.ckm-dialog.ckm-inline .ckm .ckm-summary .checkin-submit {
    height: auto;
    min-height: 42px;
    padding: 10px 16px;
    font-size: 15px;
}

@media (max-width: 760px) {
    .ckm-dialog.ckm-inline {
        margin: 16px 0;
    }

    .ckm-dialog.ckm-inline .ckm {
        max-height: none;
        overflow: visible;
    }

    .ckm-dialog.ckm-inline .ckm-summary {
        position: static;
    }

    /* The one-column cards keep the close button in their header row (in the dialog it floats over the card) */
    .ckm-dialog.ckm-inline--single .ckm-close {
        position: relative;
        top: auto;
        right: auto;
    }

    .ckm-dialog.ckm-inline--single .ckm-title {
        padding-right: 0;
    }

    .ckm-dialog.ckm-inline--single .ckm-fields > * {
        flex-basis: 100%;
    }
}
