.demo-form {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.demo-form__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 24px;
}

.demo-form__field {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.demo-form__field--full {
    grid-column: 1 / -1;
}

.demo-form__field label,
.demo-form__fieldset legend {
    font-size: 14px;
    font-weight: 600;
    color: #344054;
}

.demo-form__field input,
.demo-form__field textarea {
    font-size: 16px;
    line-height: 1.4;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid #D6DEEB;
    background: #F5F8FD;
    color: #13294B;
    transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.demo-form__field input::placeholder,
.demo-form__field textarea::placeholder {
    color: #94A3B8;
}

.demo-form__field input:focus,
.demo-form__field textarea:focus {
    outline: none;
    border-color: #FF3F05;
    box-shadow: 0 0 0 3px rgba(255, 63, 5, 0.15);
    background: #fff;
}

.demo-form__field textarea {
    min-height: 160px;
    resize: vertical;
}

.demo-form__fieldset {
    border: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.demo-form__fieldset legend {
    margin-bottom: 6px;
}

.demo-form__option {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    color: #344054;
    cursor: pointer;
    user-select: none;
}

.demo-form__option input {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid #D6DEEB;
    background: #fff;
    appearance: none;
    position: relative;
    transition: border-color .2s ease;
}

.demo-form__option input:checked {
    border-color: #FF3F05;
}

.demo-form__option input:checked::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #FF3F05;
    transform: translate(-50%, -50%);
}

.demo-form__brand {
    color: #FF3F05;
}

.demo-form__hint {
    margin: -4px 0 6px;
    font-size: 14px;
    color: #6B7280;
}

.demo-form__checkbox {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 12px;
    color: #4B5563;
    cursor: pointer;
    user-select: none;
}

.demo-form__checkbox input {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid #D6DEEB;
    background: #fff;
    appearance: none;
    position: relative;
    flex-shrink: 0;
    margin-top: 2px;
}

.demo-form__checkbox input:checked {
    border-color: #FF3F05;
    background: #FF3F05;
}

.demo-form__checkbox input:checked::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -60%) rotate(45deg);
}

.demo-form__disclaimer {
    font-size: 12px;
    color: #667085;
    line-height: 1.6;
    margin: -10px 0 10px;
}

.demo-form__submit {
    width: 100%;
    justify-content: center;
    font-size: 18px;
    height: 56px;
    line-height: 56px;
    border-radius: 14px;
}

@media (max-width: 991px) {
    .demo-form__grid {
        grid-template-columns: 1fr;
    }

    .demo-form {
        gap: 24px;
    }
}

/* ===== CAPTCHA Styling ===== */
.captcha-wrapper {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 10px;
}

.captcha-canvas-container {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px;
    background: #f9fafb;
    cursor: pointer;
    transition: border-color 0.2s;
}

.captcha-canvas-container:hover {
    border-color: #FD8561;
}

#captcha-canvas {
    display: block;
}

#captcha-input {
    flex: 1;
    min-width: 150px;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

#captcha-input:focus {
    outline: none;
    border-color: #FD8561;
}

.captcha-refresh {
    padding: 12px 20px;
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.captcha-refresh:hover {
    background: #e5e7eb;
}

.captcha-error {
    color: #dc2626;
    font-size: 14px;
    margin-top: 8px;
    display: none;
}

.captcha-error.show {
    display: block;
}

/* ===== International Phone Input Styling ===== */

/* 
 * NOTE: In v24+, the class .iti--show-flags doesn't exist.
 * We use .iti--allow-dropdown instead, or just make .iti visible.
 */

.phone-input-wrapper {
    width: 100%;
}

.phone-input-wrapper .iti {
    width: 100%;
    display: block;
}

/* Main phone input field styling */
.phone-input-wrapper .iti__tel-input {
    width: 100%;
    height: 52px;
    padding: 14px 16px;
    padding-left: 110px !important;
    border: 1px solid #D6DEEB;
    border-radius: 12px;
    font-size: 16px;
    line-height: 1.4;
    background: #F5F8FD;
    color: #13294B;
    box-sizing: border-box;
    transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.phone-input-wrapper .iti__tel-input::placeholder {
    color: #94A3B8;
}

.phone-input-wrapper .iti__tel-input:focus {
    outline: none;
    border-color: #FF3F05;
    box-shadow: 0 0 0 3px rgba(255, 63, 5, 0.15);
    background: #fff;
}

/* Country selector button - positioned inside the input */
.phone-input-wrapper .iti__country-container {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
}

.phone-input-wrapper .iti__selected-country {
    padding: 0 8px 0 12px;
    background: #EEF2F8;
    border-right: 1px solid #D6DEEB;
    border-radius: 12px 0 0 12px;
    height: 100%;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.phone-input-wrapper .iti__selected-country:hover {
    background: #E2E8F0;
}

/* Flag display */
.phone-input-wrapper .iti__flag {
    display: inline-block;
    width: 15px;
    height: 10px;
    /* The library handles the background positioning automatically. 
       Do not add background properties here. */
    box-shadow: 0px 0px 1px 0px #888; /* Optional: adds a border */
}

/* Dropdown styling */
.iti__dropdown-content {
    border: 1px solid #D6DEEB;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    max-height: 280px;
    overflow: hidden;
    background: #fff;
    z-index: 9999;
}

.iti__search-input {
    padding: 12px 14px;
    border: none;
    border-bottom: 1px solid #E5E7EB;
    width: 100%;
    font-size: 14px;
    box-sizing: border-box;
}

.iti__search-input:focus {
    outline: none;
    border-bottom-color: #FF3F05;
}

.iti__country-list {
    max-height: 220px;
    overflow-y: auto;
    margin: 0;
    padding: 0;
    list-style: none;
}

.iti__country {
    padding: 10px 14px;
    transition: background-color 0.15s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
}

.iti__country:hover {
    background: #F5F8FD;
}

.iti__country--highlight {
    background: #FFF5F2;
}

/* Country name and dial code in dropdown */
.iti__country-name {
    flex: 1;
    font-size: 14px;
    color: #344054;
}

.iti__dial-code {
    font-size: 13px;
    color: #6B7280;
}

/* Preferred countries separator */
.iti__country-list .iti__divider {
    border-bottom: 1px solid #E5E7EB;
    margin: 4px 0;
}

/* Dial code display next to flag */
.iti__selected-dial-code {
    margin-left: 6px;
    font-size: 14px;
    color: #344054;
    font-weight: 500;
}

/* Arrow indicator */
.iti__arrow {
    margin-left: 6px;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #6B7280;
    transition: transform 0.2s ease;
}

.iti__arrow--up {
    border-top: none;
    border-bottom: 5px solid #6B7280;
}

/* Error state for phone input */
.phone-input-wrapper.has-error .iti__tel-input {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}

.phone-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.phone-error.show {
    display: block;
}

/* Ensure dropdown appears above other elements */
.iti--container {
    z-index: 9999;
}

/* Loading state while initializing */
.phone-input-wrapper.loading .iti__tel-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath fill='%2394A3B8' d='M12 2A10 10 0 1 0 22 12A10 10 0 0 0 12 2Zm0 18a8 8 0 1 1 8-8A8 8 0 0 1 12 20Z' opacity='0.5'/%3E%3Cpath fill='%2394A3B8' d='M20 12h2A10 10 0 0 0 12 2V4A8 8 0 0 1 20 12Z'%3E%3CanimateTransform attributeName='transform' dur='1s' from='0 12 12' repeatCount='indefinite' to='360 12 12' type='rotate'/%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}