﻿:root {
    --brand-primary: #0b66ff;
    --brand-accent: #0b9cff;
    --bg: #ffffff;
    --text: #111827;
    --muted: #6b7280;
    --input-bg: #f8fafc;
    --radius: 8px;
    --success: #27ae60;
    --error: #c0392b;
    --font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    background: transparent;
    font-family: var(--font-family);
    font-size: 13px;
    color: var(--text);
}

/* ── Outer card shell ─────────────────────────────────────────────── */

.cv4-form {
    padding: 16px 16px 12px;
    width: 100%;
}

/* ── Branded header ───────────────────────────────────────────────── */

.cv4-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e6e9ef;
}

.cv4-brand-logo {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--input-bg);
    border: 1px solid #e6e9ef;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
}

    .cv4-brand-logo img {
        width: 100%;
        height: 100%;
        object-fit: contain;
        display: block;
    }

.cv4-brand-title {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
    line-height: 1.2;
}

.cv4-brand-sub {
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

/* ── Field ────────────────────────────────────────────────────────── */

.cv4-field {
    position: relative;
    margin-bottom: 12px;
}

/* Inline label sits at the top edge of the input border */
.cv4-field-label {
    position: absolute;
    top: 0;
    left: 12px;
    transform: translateY(-50%);
    padding: 0 5px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    color: var(--muted);
    background: var(--input-bg);
    pointer-events: none;
    z-index: 1;
    white-space: nowrap;
}

    .cv4-field-label .cv4-req {
        color: var(--error);
        margin-left: 2px;
    }

/* ── Input ────────────────────────────────────────────────────────── */

.cv4-input {
    width: 100%;
    padding: 14px 40px 10px 12px;
    border: 1px solid #e6e9ef;
    border-radius: var(--radius);
    background: var(--input-bg);
    font-size: 14px;
    font-family: var(--font-family);
    color: var(--text);
    outline: none;
    transition: border-color 0.13s, box-shadow 0.13s;
    -webkit-appearance: none;
    appearance: none;
}

    .cv4-input:focus {
        border-color: var(--brand-primary);
        box-shadow: 0 0 0 3px rgba(11,102,255,0.10);
    }

    .cv4-input.cv4-err {
        border-color: var(--error);
        box-shadow: 0 0 0 3px rgba(192,57,43,0.10);
    }

    .cv4-input.cv4-ok {
        border-color: var(--success);
        box-shadow: 0 0 0 3px rgba(39,174,96,0.10);
    }

/* Extra padding for PAN (brand icon + indicator) */
.cv4-pan-field .cv4-input {
    padding-right: 72px;
}

/* Extra padding for CVV (diagram icon + indicator) */
.cv4-cvv-field .cv4-input {
    padding-right: 60px;
}

/* Single icon padding (indicator only) */
.cv4-input-single-icon {
    padding-right: 36px;
}

/* Textarea */
.cv4-textarea {
    padding: 14px 12px 10px;
    min-height: 60px;
    resize: vertical;
}

/* Cardholder — uppercase */
#cardholder {
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Postal — uppercase */
#postal {
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Icon slot ────────────────────────────────────────────────────── */

.cv4-icon-slot {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 5px;
    pointer-events: none;
}

/* ── Validation indicator ─────────────────────────────────────────── */

.cv4-ind {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
    flex-shrink: 0;
}

    .cv4-ind.cv4-ind-valid {
        display: flex;
        background: var(--success);
    }

    .cv4-ind.cv4-ind-error {
        display: flex;
        background: var(--error);
    }

/* ── Brand icon (PAN) ─────────────────────────────────────────────── */

.cv4-brand-icon {
    width: 32px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
}

/* ── CVV diagram icon ─────────────────────────────────────────────── */

.cv4-cvv-icon {
    width: 28px;
    height: 18px;
    flex-shrink: 0;
}

/* ── Row layout (expiry + CVV; optionally CVV + postal) ───────────── */

.cv4-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

    .cv4-row .cv4-field {
        margin-bottom: 0;
    }

    /* Expiry always 50/50 with CVV */
    .cv4-row .cv4-field-expiry {
        flex: 1 1 0;
    }

    .cv4-row .cv4-field-cvv {
        flex: 1 1 0;
    }

    /* Address row below expiry/CVV:
           Postal only  → full width (no extra class needed, flex:1 default)
           Street+Postal → street 66% / postal 34% */
    .cv4-row .cv4-field-street-wide {
        flex: 0 0 66%;
    }

    .cv4-row .cv4-field-postal-narrow {
        flex: 0 0 calc(34% - 10px);
    }

/* ── Field error text ─────────────────────────────────────────────── */

.cv4-field-error {
    font-size: 11px;
    color: var(--error);
    margin-top: 3px;
    display: none;
    padding-left: 2px;
}

    .cv4-field-error.cv4-show {
        display: block;
    }

/* ── Recurring checkbox ───────────────────────────────────────────── */

.cv4-recurring {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    border-radius: var(--radius);
    border: 1px solid #e6e9ef;
    cursor: pointer;
    transition: border-color 0.13s;
    margin-bottom: 12px;
}

    .cv4-recurring:hover {
        border-color: var(--brand-primary);
    }

    .cv4-recurring input[type="checkbox"] {
        width: 15px;
        height: 15px;
        margin: 0;
        cursor: pointer;
        accent-color: var(--brand-primary);
        flex-shrink: 0;
    }

    .cv4-recurring label {
        font-size: 12px;
        color: var(--text);
        cursor: pointer;
        margin: 0;
    }

/* ── Comment textarea ─────────────────────────────────────────────── */

.cv4-comment-field {
    margin-bottom: 12px;
}

/* ── Message panel ────────────────────────────────────────────────── */

#messagePanel {
    display: none;
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 12px;
    margin-bottom: 12px;
    line-height: 1.4;
}

    #messagePanel.cv4-hard-error {
        background: #fdecea;
        border-left: 4px solid #f44336;
        color: #7b1414;
    }

#cvMessage {
    display: none;
    padding: 8px 10px;
    border-radius: var(--radius);
    font-size: 12px;
    margin-bottom: 10px;
    line-height: 1.4;
}

    #cvMessage.cv-msg-error {
        background: #fdecea;
        border-left: 3px solid #f44336;
        color: #7b1414;
    }

    #cvMessage.cv-msg-decline {
        background: #fff3cd;
        border-left: 3px solid #ffc107;
        color: #7a5a00;
    }

    #cvMessage.cv-msg-info {
        background: #e8f5e9;
        border-left: 3px solid #4caf50;
        color: #1b5e20;
    }

/* ── Submit button ────────────────────────────────────────────────── */

.cv4-submit-btn {
    display: block;
    width: 100%;
    padding: 13px 12px;
    margin-bottom: 12px;
    background: var(--brand-primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font-family);
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: opacity 0.15s, background 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

    .cv4-submit-btn:hover:not(:disabled) {
        opacity: 0.88;
    }

    .cv4-submit-btn:disabled {
        opacity: 0.55;
        cursor: not-allowed;
    }

/* ── Form-level error ─────────────────────────────────────────────── */

.cv4-form-error {
    padding: 9px 12px;
    border-radius: var(--radius);
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 10px;
    background: #fdecea;
    border-left: 3px solid var(--error);
    color: #7b1414;
}

/* ── Success panel ────────────────────────────────────────────────── */
/* Shown by cv-hosted4.js after a successful POST. The branded header  */
/* remains visible; the form body is hidden and this panel shown.      */

.cv4-success {
    display: none;
    padding: 20px 16px 16px;
    text-align: center;
}

.cv4-success-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
}

    .cv4-success-icon svg {
        display: block;
    }

.cv4-success-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.cv4-success-body {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
}

/* ── PCI badge ────────────────────────────────────────────────────── */

.cv4-pci-badge {
    text-align: center;
    margin-top: 10px;
    font-size: 10px;
    color: #aaaaaa;
    letter-spacing: 0.03em;
}

    .cv4-pci-badge svg {
        vertical-align: middle;
        margin-right: 3px;
    }

/* ── Responsive ───────────────────────────────────────────────────── */

@media (max-width: 380px) {
    .cv4-row {
        flex-direction: column;
        gap: 12px;
    }

        .cv4-row .cv4-field {
            flex: none;
            width: 100%;
            margin-bottom: 0;
        }
}
