/* Form Element Styling - Sowohl für Frontend als auch Backend */

/* Form Container */
.form-container {
    margin-bottom: 2rem;
}

/* Form Header */
.form-header {
    margin-bottom: 1.5rem;
}

.form-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-description {
    color: #6c757d;
    margin-bottom: 1.5rem;
}

/* Form Fields */
.form-fields-container {
    margin-bottom: 1.5rem;
}

/* Form Field Card für den Backend-Editor */
.form-field-card {
    border: 1px solid #dee2e6;
    transition: box-shadow 0.2s ease-in-out;
    margin-bottom: 1rem;
}

.form-field-card:hover {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.form-field-card .card-header {
    background-color: #f8f9fa;
    padding: 0.75rem 1rem;
}

/* Options-Container */
.options-container {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

/* Form Submit Button */
.form-submit {
    margin-top: 2rem;
}

/* Required Field Indicator */
.required-indicator {
    color: #dc3545;
    margin-left: 0.25rem;
}

/* Form Preview im Backend */
.form-preview .card {
    border: 1px solid #dee2e6;
    margin-bottom: 1rem;
}

.form-preview .card-header {
    background-color: #f8f9fa;
    padding: 0.75rem 1rem;
}

.form-preview .form-fields-preview {
    max-height: 500px;
    overflow-y: auto;
    padding: 0.5rem;
}

/* Success/Error Messages */
.form-success-message {
    padding: 1rem;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 0.25rem;
    color: #155724;
    margin-bottom: 1rem;
}

.form-error-message {
    padding: 1rem;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 0.25rem;
    color: #721c24;
    margin-bottom: 1rem;
}

/* Frontend Styling */
.form-element {
    width: 100%;
}

.form-element .form-control:focus,
.form-element .form-select:focus,
.form-element .form-check-input:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Horizontal Form Layout */
.form-horizontal .form-label {
    text-align: right;
    padding-top: calc(0.375rem + 1px);
}

/* Captcha Bereich */
.captcha-container {
    margin-bottom: 1rem;
    max-width: 320px;
}

.captcha-preview {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    padding: 1rem;
    text-align: center;
    margin-bottom: 1rem;
}

/* Form Validation */
.form-element .invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
}

.form-element .is-invalid {
    border-color: #dc3545;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-element .was-validated .form-control:invalid,
.form-element .was-validated .form-select:invalid,
.form-element .was-validated .form-check-input:invalid {
    border-color: #dc3545;
}

/* Responsive Anpassungen */
@media (max-width: 767.98px) {
    .form-horizontal .form-label {
        text-align: left;
    }
}

/* Formular wird abgesendet - Spinner */
.form-submitting {
    position: relative;
}

.form-submitting::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.form-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: text-bottom;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: form-spinner 0.75s linear infinite;
}

@keyframes form-spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Animation für Erfolgs- und Fehlermeldungen */
.form-message-animate {
    animation: message-fade-in 0.3s ease-in-out;
}

@keyframes message-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Druckanpassungen */
@media print {
    .form-element button[type="submit"],
    .form-element .captcha-container {
        display: none !important;
    }
}