/**
 * Contact Form override — Frontend Styles
 * Prefix: ovr-
 */

/* ── Form Wrapper ──────────────────────────────────────────────────────────── */
.ovr-form-wrapper {
    width: 100%;
    box-sizing: border-box;
}

.cfovr-form {
    display: flex;
    flex-direction: column;
    width: 100%;
}

/* ── Field Group ───────────────────────────────────────────────────────────── */
.ovr-field-group {
    margin-bottom: 18px;
    width: 100%;
}

.ovr-field-label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
    font-size: 14px;
}

.ovr-required-mark {
    color: #e53e3e;
    margin-left: 2px;
}

/* ── Input Fields ──────────────────────────────────────────────────────────── */
.ovr-field-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 14px;
    color: #2d3748;
    background-color: #fff;
    transition: border-color 0.25s ease;
    appearance: none;
}

.ovr-field-input:focus {
    outline: none;
    box-shadow: none;
}

.ovr-field-input::placeholder {
    color: #a0aec0;
}

.ovr-field-textarea {
    min-height: 30px;
    max-height: 250px;
    resize: none;
    overflow-y: hidden;
    transition: height 0.1s ease;
}

/* ── Submit Button ─────────────────────────────────────────────────────────── */
.ovr-submit-btn {
    display: inline-block;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    padding: 12px 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    transition: all 0.25s ease;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
    letter-spacing: 0.3px;
}

.ovr-submit-btn:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}

.ovr-submit-btn:active {
    transform: translateY(0);
}

.ovr-submit-btn:disabled {
    background: #cbd5e0;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* ── Messages ──────────────────────────────────────────────────────────────── */
.cfovr-message {
    margin-top: 16px;
    font-weight: 500;
}

.cfovr-message .success-message {
    color: #276749;
    background-color: #f0fff4;
    border: 1px solid #9ae6b4;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
}

.cfovr-message .error-message {
    color: #9b2c2c;
    border: 1px solid #9b2c2c;
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
}

/* ── Empty Form Notice (editor only) ───────────────────────────────────────── */
.ovr-empty-form-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 40px 20px;
    text-align: center;
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    color: #6b7280;
    background: #f9fafb;
}

.ovr-empty-icon {
    font-size: 36px;
}

/* ── Form Row Layout ───────────────────────────────────────────────────────── */

/*
 * Each row is a flex container.
 * Fields inside the same row appear side-by-side.
 * Rows stack vertically.
 */
.ovr-form-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: inherit;
    width: 100%;
    margin-bottom: 0;
}

/* Every field group inside a row gets equal share */
.ovr-form-row .ovr-field-group {
    flex: 1 1 0%;
    min-width: 0;
    margin-bottom: 0;
}

/* Submit group inside a row — same flex share as other fields */
.ovr-form-row .ovr-submit-group {
    flex: 1 1 0%;
    min-width: 0;
    margin-bottom: 0;
    display: flex;
    align-items: flex-end;
}

/* Single-field row (submit alone, or any single field) — full width */
.ovr-cols-1 .ovr-field-group,
.ovr-cols-1 .ovr-submit-group {
    flex: 1 1 100%;
}

/* ── Submit Button Width Modes ─────────────────────────────────────────────── */

/* Full-width mode: button stretches to fill its container */
.ovr-submit-group .ovr-submit-btn--full {
    width: 100%;
    white-space: nowrap;
}

/* Inline mode: button only as wide as its content */
.ovr-submit-group .ovr-submit-btn--inline {
    display: inline-block;
    width: auto;
    white-space: nowrap;
}

/* Fallback for legacy class names */
.ovr-submit-group .cfovr-submit-btn:not(.ovr-submit-btn--inline) {
    width: 100%;
    white-space: nowrap;
}


/* ── Select / Dropdown ─────────────────────────────────────────────────────── */

.ovr-field-group select.ovr-field-input,
.ovr-field-group .ovr-field-select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23666' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

/* ── Error Messages ───────────────────────────────────────────────────────── */
.ovr-field-error-msg {
    color: #e53935;
    font-size: 12px;
    margin-top: 5px;
    display: none;
    font-weight: 500;
}

.ovr-field-invalid {
    border-color: #e53935 !important;
}

.ovr-phone-intl-wrapper.ovr-field-invalid .ovr-phone-country-select {
    border-right-color: #e53935 !important;
}

.cfovr-message {
    width: 100%;
    clear: both;
    margin-top: 15px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    box-sizing: border-box;
    flex-shrink: 0;
    align-self: stretch;
}

.cfovr-message .error-message {
    color: #e53935;
}

.cfovr-message .success-message {
    color: #43a047;
}

/* ── Radio Buttons ─────────────────────────────────────────────────────────── */

.ovr-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    margin-top: 6px;
}

.ovr-radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.95em;
}

.ovr-radio-label input[type="radio"] {
    margin: 0;
    accent-color: currentColor;
}

/* ── Checkbox ──────────────────────────────────────────────────────────────── */

.ovr-checkbox-group {
    display: flex;
    align-items: flex-start;
}

.ovr-radio-group,
.ovr-checkbox-group-multi {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 8px;
}

.ovr-radio-label,
.ovr-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.4;
    color: #4a5568;
    user-select: none;
    transition: color 0.2s ease;
}

.ovr-radio-label input[type="radio"],
.ovr-checkbox-label input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.ovr-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.95em;
    line-height: 1.4;
}

.ovr-checkbox-label input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
    accent-color: #6366f1;
}

/* ── CAPTCHA ───────────────────────────────────────────────────────────────── */

.ovr-captcha-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.ovr-captcha-question {
    font-weight: 600;
    font-size: 1em;
    white-space: nowrap;
}

.ovr-captcha-input {
    max-width: 100px;
}

/* ── File Upload ───────────────────────────────────────────────────────────── */

.ovr-field-file {
    width: 100%;
    padding: 6px 0;
    cursor: pointer;
}

/* ── Responsive: stack on small screens ────────────────────────────────────── */

@media (max-width: 600px) {
    .ovr-form-row {
        flex-direction: column;
        flex-wrap: wrap;
    }

    .ovr-form-row .ovr-field-group,
    .ovr-form-row .ovr-submit-group {
        flex: 1 1 100%;
        width: 100%;
    }

    .ovr-submit-group .ovr-submit-btn--inline {
        width: 100%;
    }

    .ovr-captcha-wrapper {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── Phone International Styles ────────────────────────────────────────── */
.ovr-phone-intl-wrapper {
    display: flex;
    align-items: stretch;
    gap: 0;
    width: 100%;
    position: relative;
    border: 1.5px solid #e2e8f0;
    border-radius: 6px;
    overflow: visible;
    background: transparent;
    transition: all 0.25s ease;
}

.ovr-phone-intl-wrapper:focus-within {
    box-shadow: none;
}

.ovr-phone-intl-wrapper .ovr-phone-input {
    border: none !important;
    border-radius: 0 6px 6px 0 !important;
    background: transparent !important;
    margin: 0 !important;
    box-shadow: none !important;
    flex: 1;
}

.ovr-phone-country-select {
    position: relative;
    width: 95px;
    border-right: 1.5px solid #e2e8f0;
    cursor: pointer;
    user-select: none;
    background: transparent;
    border-radius: 6px 0 0 6px;
}

.ovr-selected-country {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 5px;
    padding: 0 12px 0 8px;
    font-size: 14px;
    font-weight: 500;
    color: #4a5568;
    white-space: nowrap;
}

.ovr-selected-country::after {
    content: "";
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid #a0aec0;
    transition: transform 0.2s ease;
}

.ovr-phone-country-select.ovr-open .ovr-selected-country::after {
    transform: rotate(180deg);
}

.ovr-country-list {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    width: 250px;
    max-height: 250px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    padding: 6px 0 !important;
    padding-left: 0 !important;
    margin: 0;
    list-style: none;
    -webkit-overflow-scrolling: touch;
}

/* Custom scrollbar for country list */
.ovr-country-list::-webkit-scrollbar {
    width: 6px;
}

.ovr-country-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.ovr-country-list::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 10px;
}

.ovr-country-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 13.5px;
    color: #2d3748;
}

.ovr-country-item:hover {
    background: #f1f5f9;
}

.ovr-country-flag {
    font-size: 18px;
}

.ovr-country-name {
    flex: 1;
}

.ovr-country-code {
    color: #718096;
    font-size: 12px;
    font-weight: 600;
}

.ovr-phone-simple-group .ovr-field-input {
    letter-spacing: 0.5px;
}

/* ── Field Icon Inside Input ────────────────────────────────────────────────── */

.ovr-input-icon-wrap {
    position: relative;
    display: block;
    width: 100%;
}

.ovr-field-input-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    z-index: 1;
    opacity: 0.72;
    transition: all 0.3s ease;
    border: 0 solid transparent;
    box-sizing: border-box;
    display: block;
}

.ovr-field-input.ovr-has-icon {
    padding-right: 42px;
}