/**
 * Custom Form Builder - Frontend Styles
 */

/* Form Container */
.cfb-form {
    max-width: 100%;
    margin-bottom: 20px;
}

/* Form Fields */
.cfb-field-wrapper {
    margin-bottom: 15px;
}

.cfb-field-wrapper label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
}

.cfb-field-wrapper input[type="text"],
.cfb-field-wrapper input[type="email"],
.cfb-field-wrapper input[type="url"],
.cfb-field-wrapper input[type="tel"],
.cfb-field-wrapper input[type="number"],
.cfb-field-wrapper input[type="date"],
.cfb-field-wrapper input[type="password"],
.cfb-field-wrapper select,
.cfb-field-wrapper textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

.cfb-field-wrapper .cfb-help-text {
    display: block;
    font-size: 0.9em;
    color: #666;
    margin-top: 4px;
}

.cfb-field-width-half {
    width: 48%;
    display: inline-block;
    vertical-align: top;
    margin-right: 2%;
}

.cfb-field-width-half:nth-child(2n) {
    margin-right: 0;
}

.cfb-field-width-third {
    width: 32%;
    display: inline-block;
    vertical-align: top;
    margin-right: 2%;
}

.cfb-field-width-third:nth-child(3n) {
    margin-right: 0;
}

/* Submit Button Loading State */
.cfb-submit-btn {
    position: relative;
    transition: all 0.3s ease;
}

.cfb-submit-btn.is-loading {
    color: transparent !important;
    pointer-events: none;
    opacity: 0.8;
}

.cfb-submit-btn.is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.2em;
    height: 1.2em;
    margin-top: -0.6em;
    /* Half of height */
    margin-left: -0.6em;
    /* Half of width */
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    border-top-color: #fff;
    animation: cfb-spin 0.8s linear infinite;
}

@keyframes cfb-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Messages */
.cfb-error-summary {
    background-color: #fdeaea;
    border-left: 4px solid #dc3232;
    padding: 10px 15px;
    margin-bottom: 20px;
    color: #dc3232;
}

.cfb-error-summary ul {
    margin: 5px 0 0 20px;
    padding: 0;
    list-style: disc;
}

.cfb-success-message {
    background-color: #e7f7d3;
    border-left: 4px solid #46b450;
    padding: 15px;
    margin-bottom: 20px;
    color: #2e7d32;
}

.cfb-field-error {
    color: #dc3232;
    font-size: 0.9em;
    margin-top: 4px;
    display: block;
}

.cfb-field-wrapper.has-error input,
.cfb-field-wrapper.has-error select,
.cfb-field-wrapper.has-error textarea {
    border-color: #dc3232;
}