/*
 * iframe5.css -- IFRAME 5 (Templates/_shared/iframe5.aspx)
 *
 * Form-only card capture in the common checkout "Card" panel style: a bordered panel
 * with a "Card" heading, labels ABOVE boxed inputs, accepted-brand icons inside the
 * card number box, and a card-back icon inside the security code box. Transparent
 * page background so the frame blends into the host page. No buttons.
 *
 * Layout:
 *   row 1  card number (full width)
 *   row 2  expiration date (MM / YY) | security code  (50 / 50)
 *   row 3  name on card (full width)
 *   row 4  postal code (template.ShowPostal)
 *   narrow frames (< 300px): expiration and security code stack.
 *
 * Fonts: the CCE CSP allows font-src 'self' only, so web fonts cannot load here;
 * the platform UI font is used.
 */

:root {
    --cv5-text: #30313d;
    --cv5-label: #30313d;
    --cv5-placeholder: #77787f;
    --cv5-border: #e0e0e3;
    --cv5-panel-border: #e6e6e9;
    --cv5-bg: #ffffff;
    --cv5-accent: #0570de;
    --cv5-accent-ring: rgba(5, 112, 222, .25);
    --cv5-error: #df1b41;
    --cv5-error-ring: rgba(223, 27, 65, .2);
    --cv5-tip-bg: #30313d;
    --cv5-radius: 6px;
}

html, body {
    margin: 0;
    padding: 0;
    background: transparent;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--cv5-text);
    -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }

form { margin: 0; }

.cv5-form { padding: 1px; }

/* -- Panel + "Card" heading ------------------------------------------------------- */

.cv5-panel {
    padding: 14px 12px 4px;
    border: 1px solid var(--cv5-panel-border);
    border-radius: var(--cv5-radius);
    background: var(--cv5-bg);
}

.cv5-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    color: var(--cv5-accent);
}

.cv5-head-icon { display: block; color: var(--cv5-accent); }

/* -- Rows -------------------------------------------------------------------------- */

.cv5-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.cv5-row > .cv5-field { flex: 1 1 0; min-width: 0; }

/* -- Field: label above a bordered box -------------------------------------------- */

.cv5-field { margin-bottom: 10px; }

.cv5-field label {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    line-height: 18px;
    color: var(--cv5-label);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cv5-box { position: relative; }

.cv5-field input {
    display: block;
    width: 100%;
    height: 44px;
    margin: 0;
    padding: 10px 12px;
    border: 1px solid var(--cv5-border);
    border-radius: var(--cv5-radius);
    outline: 0;
    background: var(--cv5-bg);
    box-shadow: 0 1px 1px rgba(0, 0, 0, .03), 0 3px 6px rgba(0, 0, 0, .02);
    font-family: inherit;
    font-size: 16px;
    font-weight: 400;
    line-height: 22px;
    color: var(--cv5-text);
    transition: border-color .15s ease, box-shadow .15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.cv5-field input::placeholder { color: var(--cv5-placeholder); opacity: 1; }

.cv5-field input:focus {
    border-color: var(--cv5-accent);
    box-shadow: 0 0 0 3px var(--cv5-accent-ring), 0 1px 1px rgba(0, 0, 0, .03);
}

/* Error: red border and ring; the message sits under the box. */
.cv5-field.cv5-invalid input { border-color: var(--cv5-error); color: var(--cv5-error); }
.cv5-field.cv5-invalid input:focus { box-shadow: 0 0 0 3px var(--cv5-error-ring); }

.cv5-err {
    margin: 4px 0 0;
    font-size: 13px;
    line-height: 18px;
    color: var(--cv5-error);
}

.cv5-err:empty { display: none; }

/* -- Card number: brand icons at the right end of the box ------------------------ */

.cv5-num { container-type: inline-size; }

.cv5-brands {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 4px;
    pointer-events: none;
}

.cv5-brands img {
    display: block;
    width: 32px;
    height: 20px;
    border-radius: 3px;
}

.cv5-num.cv5-has-brand input { padding-right: 52px; }
.cv5-num.cv5-has-all input { padding-right: 160px; }

/* Not enough room for every accepted brand: the idle icon row drops out. */
@container (max-width: 319px) {
    .cv5-brands.cv5-all { display: none; }
    .cv5-num.cv5-has-all input { padding-right: 12px; }
}

/* -- Security code: card-back icon inside the box -------------------------------- */

.cv5-cvc input { padding-right: 48px; }

.cv5-cvc-hint {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    /* The transform makes this a stacking context, so the tooltip's own z-index only counts
       inside it; without a z-index here the later, position: relative name / postal boxes
       paint over the tooltip. */
    z-index: 6;
    cursor: help;
    outline: 0;
}

.cv5-cvc-hint img {
    display: block;
    width: 30px;
    height: 19px;
}

.cv5-cvc-hint:focus img { outline: 2px solid var(--cv5-accent); outline-offset: 1px; }

.cv5-tip {
    display: none;
    position: absolute;
    right: 0;
    top: 26px;
    z-index: 5;
    width: 220px;
    padding: 8px 10px;
    border-radius: 4px;
    background: var(--cv5-tip-bg);
    color: #fff;
    font-size: 12px;
    line-height: 1.4;
}

.cv5-cvc-hint:hover .cv5-tip,
.cv5-cvc-hint:focus .cv5-tip { display: block; }

.cv5-opt { color: var(--cv5-placeholder); }

/* -- Status line (server decline / error) ---------------------------------------- */

.cv5-status {
    margin: 0 0 10px;
    font-size: 13px;
    line-height: 18px;
    color: var(--cv5-error);
}

/* -- Hard error (form not configured) -------------------------------------------- */

.cv5-hard-error {
    padding: 12px 0;
    font-size: 14px;
    color: var(--cv5-error);
}

/* -- Narrow frames ---------------------------------------------------------------- */

@media (max-width: 299px) {
    .cv5-row { flex-wrap: wrap; }
    .cv5-row > .cv5-field { flex-basis: 100%; }
}
