/**
 * Baijia Contact Form Styles
 */

.baijia-contact-form-wrapper {
    width: 100%;
    margin: 0 auto;
}

/* Form Fields */
.baijia-cf-field {
    margin-bottom: 16px;
}

.baijia-cf-field input[type="text"],
.baijia-cf-field input[type="email"],
.baijia-cf-field input[type="tel"],
.baijia-cf-field textarea,
.baijia-cf-field select {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #c8c8c8;
    border-radius: 2px;
    background: #fff;
    font-size: 15px;
    color: #333;
    outline: none;
    transition: border-color 0.3s;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}

.baijia-cf-field input::placeholder,
.baijia-cf-field textarea::placeholder {
    color: #999;
}

.baijia-cf-field input:focus,
.baijia-cf-field textarea:focus,
.baijia-cf-field select:focus {
    border-color: #888;
}

.baijia-cf-field textarea {
    resize: vertical;
    min-height: 100px;
}

/* Select dropdown arrow */
.baijia-cf-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='8' viewBox='0 0 14 8'%3E%3Cpath d='M1 1l6 6 6-6' stroke='%23666' stroke-width='1.4' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 44px;
    cursor: pointer;
}

.baijia-cf-field select:invalid,
.baijia-cf-field select option[value=""][disabled] {
    color: #999;
}

.baijia-cf-field select option {
    color: #333;
}

/* Phone field with country code */
.baijia-cf-phone-wrapper {
    display: flex;
    align-items: stretch;
    border: 1px solid #c8c8c8;
    border-radius: 2px;
    background: #fff;
    transition: border-color 0.3s;
    overflow: hidden;
}

.baijia-cf-phone-wrapper:focus-within {
    border-color: #888;
}

.baijia-cf-phone-code {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    border-right: 1px solid #e5e5e5;
    user-select: none;
}

.baijia-cf-phone-code:hover {
    background-color: #f8f8f8;
}

.baijia-cf-phone-flag {
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
}

.baijia-cf-phone-dial {
    font-size: 14px;
    color: #333;
    white-space: nowrap;
}

.baijia-cf-phone-arrow {
    color: #999;
    flex-shrink: 0;
}

.baijia-cf-phone-code-select {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.baijia-cf-field-phone input[type="tel"] {
    border: none;
    border-radius: 0;
    flex: 1;
    min-width: 0;
}

.baijia-cf-field-phone input[type="tel"]:focus {
    border: none;
    box-shadow: none;
}

/* Checkboxes */
.baijia-cf-checkbox {
    margin-bottom: 14px;
}

.baijia-cf-checkbox label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
    cursor: pointer;
}

.baijia-cf-checkbox input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    accent-color: #222;
}

.baijia-cf-checkbox a {
    color: #333;
    text-decoration: underline;
}

/* Submit */
.baijia-cf-actions {
    margin-top: 24px;
}

.baijia-cf-submit {
    display: inline-block;
    background-color: #222;
    color: #fff;
    padding: 14px 50px;
    border: none;
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
    font-family: inherit;
}

.baijia-cf-submit:hover {
    background-color: #cc0000;
    color: #fff;
}

.baijia-cf-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Success message */
.baijia-cf-success {
    padding: 30px 20px;
    text-align: center;
}

.baijia-cf-success p {
    font-size: 16px;
    color: #333;
    line-height: 1.6;
}

.baijia-cf-success svg {
    margin-bottom: 15px;
    color: #4caf50;
}

/* Phone dropdown overlay (custom dropdown) */
.baijia-cf-phone-dropdown {
    position: absolute;
    top: 100%;
    left: -1px;
    z-index: 100;
    background: #fff;
    border: 1px solid #c8c8c8;
    border-radius: 2px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    max-height: 250px;
    overflow-y: auto;
    min-width: 280px;
    display: none;
}

.baijia-cf-phone-dropdown.is-open {
    display: block;
}

.baijia-cf-phone-dropdown-search {
    padding: 8px 12px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: #fff;
}

.baijia-cf-phone-dropdown-search input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 2px;
    font-size: 13px;
    outline: none;
}

.baijia-cf-phone-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background-color 0.15s;
}

.baijia-cf-phone-dropdown-item:hover {
    background-color: #f5f5f5;
}

.baijia-cf-phone-dropdown-item.is-selected {
    background-color: #f0f0f0;
    font-weight: 500;
}

.baijia-cf-phone-dropdown-item .flag {
    font-size: 18px;
}

.baijia-cf-phone-dropdown-item .dial {
    color: #999;
    margin-left: auto;
    flex-shrink: 0;
}

/* Mobile */
@media (max-width: 768px) {
    .baijia-cf-field input[type="text"],
    .baijia-cf-field input[type="email"],
    .baijia-cf-field input[type="tel"],
    .baijia-cf-field textarea,
    .baijia-cf-field select {
        padding: 12px 14px;
        font-size: 14px;
    }

    .baijia-cf-submit {
        padding: 12px 36px;
        font-size: 14px;
    }
}
