/* Contact Form Enhanced - Frontend Styles */

.cfe-form {
    max-width: 100%;
    margin: 0 0 2em;
}

.cfe-form * {
    box-sizing: border-box;
}

.cfe-form-field {
    margin-bottom: 1.5em;
}

.cfe-form-field label {
    display: block;
    margin-bottom: 0.5em;
    font-weight: 600;
    color: #333;
}

.cfe-form-field .required {
    color: #d63638;
    font-weight: normal;
}

.cfe-form-field input[type="text"],
.cfe-form-field input[type="email"],
.cfe-form-field input[type="url"],
.cfe-form-field input[type="tel"],
.cfe-form-field input[type="number"],
.cfe-form-field input[type="date"],
.cfe-form-field input[type="time"],
.cfe-form-field textarea,
.cfe-form-field select {
    width: 100%;
    padding: 0.5em;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
    line-height: 1.5;
    background-color: #fff;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.cfe-form-field input:focus,
.cfe-form-field textarea:focus,
.cfe-form-field select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.cfe-form-field.error input,
.cfe-form-field.error textarea,
.cfe-form-field.error select {
    border-color: #d63638;
}

.cfe-error-message {
    color: #d63638;
    font-size: 0.875em;
    margin-top: 0.25em;
    display: none;
}

.cfe-form-field.error .cfe-error-message {
    display: block;
}

.cfe-checkbox-group,
.cfe-radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

.cfe-checkbox-item,
.cfe-radio-item {
    display: flex;
    align-items: center;
}

.cfe-checkbox-item input,
.cfe-radio-item input {
    margin-right: 0.5em;
}

.cfe-form-submit {
    margin-top: 1.5em;
}

.cfe-submit-button {
    background-color: #2271b1;
    color: #fff;
    border: none;
    padding: 0.75em 1.5em;
    font-size: 1em;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.cfe-submit-button:hover {
    background-color: #135e96;
}

.cfe-submit-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.cfe-form-response {
    padding: 1em;
    margin-top: 1em;
    border-radius: 4px;
    display: none;
}

.cfe-form-response.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    display: block;
}

.cfe-form-response.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    display: block;
}

.cfe-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #2271b1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

.cfe-form.loading .cfe-spinner {
    display: inline-block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Multi-step form styles */
.cfe-form-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2em;
    padding: 0;
    list-style: none;
}

.cfe-form-step {
    flex: 1;
    text-align: center;
    padding: 1em;
    background-color: #f0f0f0;
    position: relative;
    color: #666;
}

.cfe-form-step.active {
    background-color: #2271b1;
    color: #fff;
}

.cfe-form-step.completed {
    background-color: #00a32a;
    color: #fff;
}

.cfe-form-step::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -10px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid #f0f0f0;
    border-top: 20px solid transparent;
    border-bottom: 20px solid transparent;
    z-index: 1;
}

.cfe-form-step.active::after {
    border-left-color: #2271b1;
}

.cfe-form-step.completed::after {
    border-left-color: #00a32a;
}

.cfe-form-step:last-child::after {
    display: none;
}

.cfe-step-content {
    display: none;
}

.cfe-step-content.active {
    display: block;
}

.cfe-step-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 2em;
}

.cfe-step-prev,
.cfe-step-next {
    padding: 0.5em 1em;
    background-color: #2271b1;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.cfe-step-prev:hover,
.cfe-step-next:hover {
    background-color: #135e96;
}

.cfe-step-prev:disabled,
.cfe-step-next:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* File upload styles */
.cfe-file-upload {
    position: relative;
    display: inline-block;
    cursor: pointer;
    width: 100%;
}

.cfe-file-upload input[type="file"] {
    position: absolute;
    left: -9999px;
}

.cfe-file-upload-label {
    display: block;
    padding: 0.75em;
    background-color: #f0f0f0;
    border: 2px dashed #ddd;
    border-radius: 4px;
    text-align: center;
    transition: background-color 0.3s, border-color 0.3s;
}

.cfe-file-upload:hover .cfe-file-upload-label {
    background-color: #e8e8e8;
    border-color: #999;
}

.cfe-file-upload.has-file .cfe-file-upload-label {
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.cfe-file-list {
    margin-top: 0.5em;
    padding: 0;
    list-style: none;
}

.cfe-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5em;
    background-color: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 0.25em;
}

.cfe-file-remove {
    color: #d63638;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 1.2em;
}

/* Honeypot field (hidden) */
.cfe-honeypot {
    position: absolute;
    left: -9999px;
    visibility: hidden;
}

/* Responsive design */
@media (max-width: 768px) {
    .cfe-form-steps {
        flex-direction: column;
    }
    
    .cfe-form-step::after {
        display: none;
    }
    
    .cfe-step-navigation {
        flex-direction: column;
        gap: 1em;
    }
    
    .cfe-step-prev,
    .cfe-step-next {
        width: 100%;
    }
}

/* RTL support */
.rtl .cfe-form-field label {
    text-align: right;
}

.rtl .cfe-checkbox-item input,
.rtl .cfe-radio-item input {
    margin-right: 0;
    margin-left: 0.5em;
}

.rtl .cfe-form-step::after {
    right: auto;
    left: -10px;
    border-left: none;
    border-right: 10px solid #f0f0f0;
}

.rtl .cfe-form-step.active::after {
    border-right-color: #2271b1;
}

.rtl .cfe-form-step.completed::after {
    border-right-color: #00a32a;
}