/*
    PMPLAT-154 - design tokens and controls for the widget login / reset / registration screens.

    The reference HTML attached to the ticket is written against a design system this
    codebase does not carry: it references var(--surface-2), var(--text-accent) and so on.
    Those tokens are defined here, scoped to .rc-auth so nothing else in the widget or a
    host partner page is affected.

    Scoped rather than :root deliberately - the widget renders inside partner iframes and
    must not leak styles into, or inherit surprises from, the surrounding page.
*/

.rc-auth {
    --surface-1: #f3f4f6;
    --surface-2: #ffffff;
    --border: #e5e7eb;
    --border-danger: #dc2626;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --text-accent: #1a73e8;
    --text-danger: #dc2626;
    --bg-accent: #eaf1fd;
    --fill-accent: #1a73e8;
    --fill-primary: #111111;
    --on-primary: #ffffff;

    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.rc-auth *,
.rc-auth *::before,
.rc-auth *::after {
    box-sizing: border-box;
}

.rc-auth .rc-card {
    width: 100%;
    box-sizing: border-box;
    background: var(--surface-2);
    border: 0.5px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem 1.5rem;
    margin: 0 auto;
}

/* Partner logos vary enormously in shape - real ones range from 1.29:1 (near square)
   to 5.85:1 (a long wordmark). Constraining only the height makes a square logo look
   tiny next to a wide one, so the image is fitted inside a FIXED box: the wrapper holds
   the vertical rhythm steady whatever the partner supplies, and the image scales down
   to fit within both bounds without ever being stretched. */
.rc-auth .rc-logo-wrap {
    height: 52px;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rc-auth .rc-logo {
    max-height: 52px;
    max-width: 190px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.rc-auth h1 {
    font-size: 19px;
    font-weight: 700;
    margin: 0 0 3px;
}

.rc-auth label {
    font-size: 13px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 6px;
    font-weight: 400;
}

/* Inputs and selects share one look so the profile form's selects line up with its inputs. */
.rc-auth input[type="text"],
.rc-auth input[type="email"],
.rc-auth input[type="password"],
.rc-auth select {
    width: 100%;
    height: 38px;
    padding: 0 10px;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
}

.rc-auth input::placeholder {
    color: var(--text-muted);
}

.rc-auth input:focus,
.rc-auth select:focus {
    border-color: var(--text-accent);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

/* Applied by the controller when a field fails validation. */
.rc-auth .rc-invalid {
    box-shadow: 0 0 0 1px var(--border-danger);
    border-color: var(--border-danger);
}

.rc-auth input[readonly] {
    color: var(--text-muted);
    background: var(--surface-1);
}

.rc-auth .rc-btn {
    width: 100%;
    height: 42px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-primary);
    cursor: pointer;
}

.rc-auth .rc-btn-primary {
    background: var(--fill-primary);
    color: var(--on-primary);
    border: none;
}

.rc-auth .rc-btn:disabled {
    opacity: 0.6;
    cursor: default;
}

/* "Forgot password?" - a link rendered as a button so it is keyboard reachable. */
.rc-auth .rc-link {
    border: none;
    background: none;
    padding: 0;
    height: auto;
    font-size: 13px;
    color: var(--text-accent);
    cursor: pointer;
}

.rc-auth .rc-error {
    font-size: 12px;
    color: var(--text-danger);
    margin: 2px 0 0;
}

.rc-auth .rc-section-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 12px 0 6px;
}

.rc-auth .rc-optional {
    color: var(--text-muted);
}

/* "New here" rule between log in and create-account. */
.rc-auth .rc-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 1.1rem 0;
}

.rc-auth .rc-divider::before,
.rc-auth .rc-divider::after {
    content: "";
    flex: 1;
    height: 0.5px;
    background: var(--border);
}

.rc-auth .rc-divider span {
    font-size: 12px;
    color: var(--text-muted);
}

.rc-auth .rc-progress {
    height: 4px;
    background: var(--surface-1);
    border-radius: 2px;
    margin-bottom: 14px;
    overflow: hidden;
}

.rc-auth .rc-progress > div {
    height: 100%;
    background: var(--fill-accent);
}

/* minmax(0, 1fr) rather than 1fr: a 1fr track cannot shrink below its content's
   min-width, and the country <select> is as wide as its longest option name - which
   pushed the whole row outside the card. min-width:0 on the children does the same
   job for anything nested inside them. */
.rc-auth .rc-grid-2 {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* flex-basis 0 rather than 200px: the columns then split the row by ratio alone and
   never consult the content's own width, so a <select> holding 250 country names
   cannot widen its column. min-width:0 lets them shrink below intrinsic width. */
.rc-auth .rc-grid-2 > * {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
}

.rc-auth .rc-grid-3 {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rc-auth .rc-grid-3 > * {
    flex: 1 1 0;
    min-width: 0;
    max-width: 100%;
}

/* The widget is embedded at partner-chosen widths; stack the paired fields when narrow. */


.rc-auth .rc-grid-2 > *,
.rc-auth .rc-grid-3 > * {
    min-width: 0;
}

/* the legacy site stylesheet sizes .input / .form-control with fixed widths; inside
   these cards the field should always fill its column instead */
.rc-auth input.input,
.rc-auth select.input,
.rc-auth select.form-control,
.rc-auth input.form-control {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* the profile form labels its fields with <span class="help-inline"> rather than
   <label>; give them the same treatment so both forms read identically */
.rc-auth .help-inline {
    font-size: 13px;
    line-height: 1.2;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 6px;
    font-weight: 400;
}

/* each field group needs breathing room between rows */
.rc-auth .rc-grid-2 > div,
.rc-auth #dvForm > form > div {
    margin-bottom: 8px;
}

/* belt and braces: the widget renders inside partner iframes at widths we do not
   control, so nothing in these cards is allowed to push the layout sideways */
.rc-auth,
.rc-auth * {
    max-width: 100%;
}

.rc-auth {
    overflow-x: hidden;
}

/* validation messages sit inside these rows as siblings of the fields; they must span
   the row rather than compete for a column */
.rc-auth .rc-grid-2 > span,
.rc-auth .rc-grid-3 > span {
    flex: 1 1 100%;
}

/* a <select> takes its intrinsic width from its widest <option> (the country list runs
   to names like "United States Minor Outlying Islands"). Without min-width:0 that
   measurement escapes the column it is sitting in. */
.rc-auth select,
.rc-auth input {
    min-width: 0;
}

/* validation text is inline-sized so it does not add a full line of height */
.rc-auth .error,
.rc-auth .text-danger {
    font-size: 12px;
    line-height: 1.3;
    display: block;
    margin-top: 2px;
}

/* Responsive. The widget is embedded at partner-chosen widths and members open it on
   phones and tablets, so the paired rows collapse rather than squeeze. */
@media (max-width: 560px) {
    .rc-auth .rc-card {
        padding: 1.25rem 1rem;
        border-radius: 10px;
    }
    .rc-auth .rc-grid-2 > *,
    .rc-auth .rc-grid-3 > * {
        flex: 1 1 100%;
    }
    .rc-auth h1 {
        font-size: 18px;
    }
}

/* tablets and narrow embeds: keep month/day/year on one line, it reads better than
   three stacked selects */
@media (min-width: 400px) and (max-width: 560px) {
    .rc-auth .rc-grid-3 > select {
        flex: 1 1 0;
    }
}

@media (max-width: 380px) {
    .rc-auth .rc-card {
        padding: 1rem 0.85rem;
    }
    .rc-auth input,
    .rc-auth select {
        height: 40px;
    }
}

/* the profile step is long; trim the header block so the whole card has a chance of
   fitting one screen without scrolling */
.rc-auth #dvForm .rc-card > p {
    margin-bottom: 14px;
    line-height: 1.45;
}

/* footer legal text */
.rc-auth #dvForm form > div:last-of-type {
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--text-muted);
}

/* Two fields side by side WITHOUT a wrapper row. inline-block siblings lay out against
   the form's own width, so there is no intermediate container that can collapse - which
   is exactly what kept blanking this pair when it was a flex row.
   font-size:0 on nothing needed: the 4px inline whitespace gap is absorbed by using
   calc(50% - 8px) with a small margin. */
.rc-auth .rc-half {
    display: inline-block;
    vertical-align: top;
    /* the newline between two inline-block siblings renders as a ~5px space, so the
       pair must total well under 100% or the second wraps to its own line */
    width: calc(50% - 12px);
    box-sizing: border-box;
}

.rc-auth .rc-half + .rc-half {
    margin-left: 10px;
}

@media (max-width: 560px) {
    .rc-auth .rc-half {
        display: block;
        width: 100%;
    }
    .rc-auth .rc-half + .rc-half {
        margin-left: 0;
    }
}
