/**
 * StaticForm Public Styles
 */

.staticform-form {
    max-width: 600px;
    margin: 20px auto;
    width: 100%;
}

.staticform-field {
    margin-bottom: 20px;
}

.staticform-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.staticform-field .required {
    color: #dc3545;
}

.staticform-field input[type="text"],
.staticform-field input[type="email"],
.staticform-field input[type="number"],
.staticform-field input[type="tel"],
.staticform-field input[type="url"],
.staticform-field textarea,
.staticform-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color 0.15s ease-in-out;
}

.staticform-field input:focus,
.staticform-field textarea:focus,
.staticform-field select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Validation error styling */
.staticform-field input.field-error,
.staticform-field textarea.field-error,
.staticform-field select.field-error {
    border-color: #dc3545;
    box-shadow: 0 0 0 1px #dc3545;
}

.staticform-field input.field-error:focus,
.staticform-field textarea.field-error:focus,
.staticform-field select.field-error:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 1px #dc3545;
}

.staticform-field input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
}

.staticform-field input[type="file"] {
    width: 100%;
    padding: 5px;
}

.staticform-field textarea {
    min-height: 120px;
    resize: vertical;
}

.staticform-field select[multiple] {
    min-height: 120px;
}

.staticform-submit {
    margin-top: 20px;
}

.staticform-submit-btn {
    background-color: #0073aa;
    color: #fff;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.staticform-submit-btn:hover {
    background-color: #005a87;
}

.staticform-submit-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.staticform-messages {
    margin-top: 20px;
    padding: 15px;
    border-radius: 4px;
}

.staticform-messages.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.staticform-messages.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.staticform-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 15px;
    border-radius: 4px;
    margin: 20px 0;
}

/* Loading state */
.staticform-form.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Captcha container */
.g-recaptcha,
.h-captcha,
.cf-turnstile {
    margin: 20px 0;
}

/* Responsive */
@media screen and (max-width: 768px) {
    .staticform-form {
        max-width: 100%;
    }
}

/* Gutenberg Editor Styles */
.editor-styles-wrapper .staticform-form,
.block-editor-block-preview__content .staticform-form,
.components-server-side-render .staticform-form {
    max-width: 100% !important;
    display: block !important;
    visibility: visible !important;
}

.staticform-block-preview {
    margin: 10px 0;
}

.staticform-block-preview .staticform-form {
    margin: 0;
    pointer-events: none; /* Prevent interaction in editor */
}

.staticform-block-preview .staticform-submit-btn {
    cursor: not-allowed;
    opacity: 0.7;
}

/* Ensure form fields are visible in editor */
.editor-styles-wrapper .staticform-field,
.block-editor-block-preview__content .staticform-field,
.components-server-side-render .staticform-field {
    display: block !important;
    visibility: visible !important;
}

.editor-styles-wrapper .staticform-field input,
.editor-styles-wrapper .staticform-field textarea,
.editor-styles-wrapper .staticform-field select,
.block-editor-block-preview__content .staticform-field input,
.block-editor-block-preview__content .staticform-field textarea,
.block-editor-block-preview__content .staticform-field select,
.components-server-side-render .staticform-field input,
.components-server-side-render .staticform-field textarea,
.components-server-side-render .staticform-field select {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    box-sizing: border-box !important;
}
