/* Container styling for the patient ID input to support the prefix */
.oepiv-input-group {
    position: relative;
    display: flex;
    align-items: stretch;
    border: 1px solid #ccc; /* Fallback border */
    border-radius: 4px; /* Common GF border radius */
    overflow: visible !important; /* Allow the counter to be visible outside the container */
    margin-bottom: 25px !important; /* Prevent counter from overlapping subsequent elements */
    background-color: #fff;
    transition: all 0.3s ease;
}

/* Ensure the wrapper mimics the input's focus state if needed, though we hide inner border */
.oepiv-input-group:focus-within {
    border-color: #007cba; /* WordPress/GF focus blue */
    box-shadow: 0 0 0 1px #007cba;
}

/* The prefix area containing the flag and label */
.oepiv-id-prefix {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    background-color: #f0f4f8; /* Default pale background */
    border-right: 1px solid #ccc;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    transition: background-color 0.3s ease;
    overflow: hidden;
    z-index: 1;
}

.oepiv-id-prefix::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--oepiv-flag-url);
    background-size: cover;
    background-position: center;
    opacity: 0.2; /* Semi-transparent background */
    z-index: -1;
    pointer-events: none;
    transition: background-image 0.3s ease;
}

.oepiv-id-prefix .oepiv-label {
    font-size: 0.95em;
    font-family: inherit;
}

/* Specific pale background colors per country */
.oepiv-country-england .oepiv-id-prefix { background-color: #fff0f0; } /* Pale Red for England */
.oepiv-country-scotland .oepiv-id-prefix { background-color: #f0f5ff; } /* Pale Blue for Scotland */
.oepiv-country-wales .oepiv-id-prefix { background-color: #f0fff0; } /* Pale Green for Wales */
.oepiv-country-northern-ireland .oepiv-id-prefix { background-color: #fffcf0; } /* Pale Gold/Orange for NI */

/* Modify the actual GF input to look integrated without borders */
.oepiv-input-group input[type="text"],
.oepiv-input-group input[type="number"] {
    flex: 1;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 8px 12px !important;
    border-radius: 0 !important;
    width: 100% !important;
    background-color: transparent !important;
}

/* Error state styling integration with GF */
.gfield_error .oepiv-input-group {
    border-color: #e00000;
}

/* Position the Gravity Forms character counter absolutely below the input group */
.oepiv-input-group .ginput_counter {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    margin-top: 4px !important;
    width: auto !important;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    z-index: 10 !important;
}
