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

html, body {
    margin: 0;
    padding: 0;
    background: transparent;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    color: #333333;
}

.cv-form {
    padding: 16px;
    width: 100%;
}

.cv-field {
    margin-bottom: 20px;
    position: relative;
}

    .cv-field label {
        display: block;
        font-size: 11px;
        font-weight: 700;
        color: #555555;
        margin-bottom: 4px;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

        .cv-field label .cv-required {
            color: #c0392b;
            margin-left: 2px;
        }

    .cv-field input[type="text"],
    .cv-field input[type="tel"] {
        width: 100%;
        padding: 8px 10px;
        border: 1px solid #cccccc;
        border-radius: 4px;
        font-size: 13px;
        font-family: Arial, Helvetica, sans-serif;
        color: #333333;
        background: #ffffff;
        outline: none;
        transition: border-color 0.15s;
        -webkit-appearance: none;
    }

        .cv-field input[type="text"]:focus,
        .cv-field input[type="tel"]:focus {
            border-color: #2E75B6;
            box-shadow: 0 0 0 2px rgba(46,117,182,0.15);
        }

    .cv-field input.cv-error {
        border-color: #c0392b;
        box-shadow: 0 0 0 2px rgba(192,57,43,0.12);
    }

    .cv-field input.cv-valid {
        border-color: #27ae60;
        box-shadow: 0 0 0 2px rgba(39,174,96,0.12);
    }

/* Cardholder name — uppercase to match physical card appearance.
           JS also forces uppercase on input; CSS reinforces it visually.
           Slightly reduced font size + increased letter-spacing per guide tip. */
#cardholder {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 12px;
}

/* Validation indicator — sits to the right inside the field wrapper.
           Absolutely positioned so it never shifts field layout or label height.
           For card-wrapper fields (card number) it sits left of the brand icon. */
.cv-field-wrap {
    position: relative;
}

    .cv-field-wrap input {
        padding-right: 32px; /* room for the indicator */
    }

/* Card number needs room for both indicator + brand icon */
.cv-card-wrapper input {
    padding-right: 46px; /* room for one icon — brand icon or indicator */
}

.cv-indicator {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
    flex-shrink: 0;
}

/* For card number the indicator sits left of the brand icon */
.cv-card-wrapper .cv-indicator {
    right: 46px;
}

.cv-indicator.cv-ind-valid {
    display: flex;
    background: #27ae60;
    color: #ffffff;
}

.cv-indicator.cv-ind-error {
    display: flex;
    background: #c0392b;
    color: #ffffff;
}

/* Inline field error — absolutely positioned below the input so it
           never shifts the field height or displaces adjacent elements */
.cv-field-error {
    position: absolute;
    left: 0;
    top: calc(100% + 2px);
    font-size: 11px;
    color: #c0392b;
    white-space: nowrap;
    pointer-events: none;
}

/* Give each field wrapper enough bottom margin to accommodate the
           absolutely-positioned error text without overlapping the next field */
.cv-field {
    margin-bottom: 20px; /* increased from 12px */
    position: relative;
}

.cv-row {
    display: flex;
    gap: 10px;
}

    .cv-row .cv-field {
        flex: 1;
    }

/* Card number with brand icon */
.cv-card-wrapper {
    position: relative;
}

.cv-brand-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 20px;
    pointer-events: none;
}

/* Recurring checkbox row */
.cv-recurring {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

    .cv-recurring input[type="checkbox"] {
        width: 15px;
        height: 15px;
        margin: 0;
        cursor: pointer;
        accent-color: #2E75B6;
    }

    .cv-recurring label {
        font-size: 12px;
        color: #555555;
        cursor: pointer;
        margin: 0;
    }

/* Message panel */
#messagePanel {
    display: none;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 12px;
    line-height: 1.4;
}

    #messagePanel.cv-msg-error {
        background: #fdecea;
        border-left: 4px solid #f44336;
        color: #7b1414;
    }

    #messagePanel.cv-msg-decline {
        background: #fff3cd;
        border-left: 4px solid #ffc107;
        color: #7a5a00;
    }

    #messagePanel.cv-msg-info {
        background: #e8f5e9;
        border-left: 4px solid #4caf50;
        color: #1b5e20;
    }

/* Hard-error state (server-side config failure) */
.cv-hard-error {
    padding: 16px;
    font-size: 12px;
    color: #7b1414;
    background: #fdecea;
    border-left: 4px solid #f44336;
    border-radius: 4px;
    margin: 16px;
}

/* CVV wrapper — mirrors cv-card-wrapper layout:
           indicator (✓/✗) sits to the left of the card-back icon.
           input padding makes room for both at 32px icon + 16px indicator. */
.cv-cvv-wrapper {
    position: relative;
}

    .cv-cvv-wrapper input {
        padding-right: 46px; /* card hint icon — swapped out for cv-indicator on valid */
    }

    .cv-cvv-wrapper .cv-indicator {
        right: 46px; /* sit left of the 32px icon at right: 8px */
    }

.cv-cvv-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 20px;
    pointer-events: none;
    display: block;
}

/* PCI lock badge */
.cv-pci-badge {
    text-align: center;
    margin-top: 12px;
    font-size: 10px;
    color: #aaaaaa;
    letter-spacing: 0.03em;
}

    .cv-pci-badge svg {
        vertical-align: middle;
        margin-right: 3px;
    }
