/* Flag styles - base */
.dmpmf-flag {
    width: 24px;
    height: 16px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
    box-shadow: 0 0 2px rgba(0,0,0,0.9);
    margin-bottom: 0 !important;
}

/* Static flag display - no click, no dropdown */
.dmpmf-flag-static {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 16px;
    max-width: none;
    object-fit: cover;
    border-radius: 2px;
    pointer-events: none;
    box-shadow: 0 0 2px rgba(0,0,0,0.9);
}

/* Override theme CSS (e.g. BeTheme) that resets img dimensions with higher specificity */
.dmpmf-flag-container img.dmpmf-flag-static {
    width: 24px;
    height: 16px;
    max-width: none;
}

/* Flag is centered against the INPUT's height (set by front.js as
   --dmpmf-input-height on the wrapper), not the wrapper itself, so it
   doesn't drift down when a validation message appears below. */
.dmpmf-flag-container {
    position: absolute;
    left: 10px;
    top: calc(var(--dmpmf-input-height, 40px) / 2);
    transform: translateY(-50%);
    z-index: 10;
}

/* Input field — reset theme margins but keep own padding */
.wpcf7-form-control-wrap[data-name^="phone"] input[type="text"] {
    flex: 1;
    min-width: 0;
    outline: none;
    margin: 0;
    line-height: 1.5;
}

/* Padding — scoped to wrapper so specificity beats the reset rule above.
   No flag (default) → 10px; with flag → variant-specific. */
.wpcf7-form-control-wrap[data-name^="phone"] .dmpmf-phone-input {
    padding-left: 10px;
}

.wpcf7-form-control-wrap[data-name^="phone"].dmpmf-has-flag.dmpmf-basic-field .dmpmf-phone-input {
    padding-left: 35px;
}

.wpcf7-form-control-wrap[data-name^="phone"].dmpmf-has-flag.dmpmf-styled-field .dmpmf-phone-input {
    padding-left: 40px;
}

/* Match default CF7 input style */
.wpcf7-form-control-wrap[data-name^="phone"] {
    position: relative;
    display: block;
    margin-bottom: 1em;
}

/* Validation messages — rendered in the normal flow so fields below
   shift down instead of being overlapped. */
.wpcf7-form-control-wrap[data-name^="phone"] .wpcf7-not-valid-tip {
    display: block;
    color: #dc3545;
    font-size: 0.875em;
    margin-top: 5px;
}

.wpcf7-form-control-wrap[data-name^="phone"] .wpcf7-valid-tip {
    display: block;
    color: #28a745;
    font-size: 0.875em;
    margin-top: 5px;
}

.wpcf7-form-control-wrap.dmpmf-is-complete .dmpmf-phone-input {
    border-color: #28a745 !important;
}

.wpcf7-form-control-wrap.dmpmf-is-complete .dmpmf-styled-input:focus {
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.25);
}

/* Styles added for (dmpmf-styled-input) */
.dmpmf-styled-input {
    border-width: 1px;
    border-style: solid;
    border-color: #007bff;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    background-color: #ffffff;
}

.dmpmf-styled-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.dmpmf-styled-field .dmpmf-flag {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    border-radius: 2px;
}

/* Betheme theme specific fix for phone validation success message */
body.wp-theme-betheme .wpcf7-valid-tip {
    margin-top: 0px;
}
