/* Simple Form Builder Frontend Styles */

.sfb-form-wrapper {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.sfb-form {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.sfb-form-title {
    margin: 0 0 10px 0;
    font-size: 24px;
    font-weight: 600;
    color: #1d2327;
}

.sfb-form-description {
    margin: 0 0 25px 0;
    color: #646970;
    font-size: 14px;
}

.sfb-form-fields {
    margin-bottom: 25px;
}

/* Individual Field Styles */
.sfb-field {
    margin-bottom: 20px;
}

.sfb-field:last-child {
    margin-bottom: 0;
}

.sfb-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #1d2327;
    font-size: 14px;
}

.sfb-required {
    color: #d63638;
    margin-left: 3px;
}

/* Input Styles */
.sfb-input,
.sfb-textarea,
.sfb-select {
    width: 100%;
    padding: 12px 15px;
    font-size: 15px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    background: #fff;
    color: #1d2327;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.sfb-input:focus,
.sfb-textarea:focus,
.sfb-select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
}

.sfb-input::placeholder,
.sfb-textarea::placeholder {
    color: #a0a0a0;
}

.sfb-textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
}

.sfb-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23646970' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

/* Radio and Checkbox Groups */
.sfb-radio-group,
.sfb-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sfb-radio-label,
.sfb-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    color: #3c434a;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.sfb-radio-label:hover,
.sfb-checkbox-label:hover {
    background: #f6f7f7;
    border-color: #c0c0c0;
}

.sfb-radio-label input,
.sfb-checkbox-label input {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: #2271b1;
}

/* Submit Button */
.sfb-form-submit {
    margin-top: 25px;
}

.sfb-submit-btn {
    display: inline-block;
    width: 100%;
    padding: 14px 30px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    background: #2271b1;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sfb-submit-btn:hover {
    background: #135e96;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 113, 177, 0.3);
}

.sfb-submit-btn:active {
    transform: translateY(0);
}

.sfb-submit-btn:disabled {
    background: #a0a0a0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Form Message */
.sfb-form-message {
    margin-top: 20px;
    padding: 15px 20px;
    border-radius: 6px;
    font-size: 14px;
    text-align: center;
}

.sfb-form-message.success {
    background: #d1e7dd;
    border: 1px solid #badbcc;
    color: #0f5132;
}

.sfb-form-message.error {
    background: #f8d7da;
    border: 1px solid #f5c2c7;
    color: #842029;
}

/* Loading State */
.sfb-form.loading .sfb-submit-btn {
    position: relative;
    color: transparent;
}

.sfb-form.loading .sfb-submit-btn::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: sfb-spin 0.8s linear infinite;
}

@keyframes sfb-spin {
    to { transform: rotate(360deg); }
}

/* Validation Styles */
.sfb-input:invalid:not(:placeholder-shown),
.sfb-textarea:invalid:not(:placeholder-shown),
.sfb-select:invalid {
    border-color: #d63638;
}

.sfb-input:valid:not(:placeholder-shown),
.sfb-textarea:valid:not(:placeholder-shown) {
    border-color: #00a32a;
}

/* Field Type Specific Styles */
.sfb-field-hidden {
    display: none;
}

.sfb-field-date .sfb-input,
.sfb-field-time .sfb-input {
    max-width: 250px;
}

.sfb-field-number .sfb-input {
    max-width: 200px;
}

/* Responsive */
@media screen and (max-width: 600px) {
    .sfb-form-wrapper {
        padding: 15px;
    }
    
    .sfb-form {
        padding: 20px;
    }
    
    .sfb-form-title {
        font-size: 20px;
    }
    
    .sfb-input,
    .sfb-textarea,
    .sfb-select {
        padding: 10px 12px;
        font-size: 16px; /* Prevents zoom on mobile */
    }
    
    .sfb-submit-btn {
        padding: 12px 20px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .sfb-form {
        background: #1e1e1e;
        border-color: #3c3c3c;
    }
    
    .sfb-form-title,
    .sfb-label {
        color: #e0e0e0;
    }
    
    .sfb-form-description {
        color: #a0a0a0;
    }
    
    .sfb-input,
    .sfb-textarea,
    .sfb-select {
        background: #2d2d2d;
        border-color: #4a4a4a;
        color: #e0e0e0;
    }
    
    .sfb-radio-label,
    .sfb-checkbox-label {
        border-color: #4a4a4a;
        color: #e0e0e0;
    }
    
    .sfb-radio-label:hover,
    .sfb-checkbox-label:hover {
        background: #2d2d2d;
    }
}
