/**
 * Advanced Form Engine - Frontend Styles
 * 
 * Public-facing styles for forms displayed on the frontend
 */

/* ==========================================================================
   Form Container & Layout
   ========================================================================== */

.afe-form-container {
    max-width: 100%;
    margin: 0 auto 30px;
    padding: 0;
    font-family: inherit;
    line-height: 1.6;
}

.afe-form-title {
    font-size: 1.8em;
    margin: 0 0 15px;
    color: #333;
    font-weight: 600;
}

.afe-form-description {
    margin: 0 0 25px;
    color: #666;
    font-size: 1em;
    line-height: 1.5;
}

.afe-form {
    background: #fff;
    padding: 30px;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ==========================================================================
   Field Wrapper & Labels
   ========================================================================== */

.afe-field-wrapper {
    margin-bottom: 25px;
    position: relative;
}

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

.afe-field-label {
    display: block;
    margin: 0 0 8px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
    line-height: 1.4;
}

.afe-field-label .required {
    color: #e74c3c;
    margin-left: 3px;
    font-weight: bold;
}

.afe-field-description {
    margin: 0 0 10px;
    font-size: 13px;
    color: #7f8c8d;
    font-style: italic;
}

.afe-field-input {
    position: relative;
}

/* ==========================================================================
   Input Fields
   ========================================================================== */

.afe-input,
.afe-textarea,
.afe-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    font-family: inherit;
    line-height: 1.5;
    background-color: #fff;
    transition: all 0.3s ease;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.afe-input:focus,
.afe-textarea:focus,
.afe-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    background-color: #fcfcfc;
}

.afe-input:hover,
.afe-textarea:hover,
.afe-select:hover {
    border-color: #bdc3c7;
}

/* Input States */
.afe-input:invalid,
.afe-textarea:invalid,
.afe-select:invalid {
    border-color: #e74c3c;
    /* box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1); */
}

.afe-input:disabled,
.afe-textarea:disabled,
.afe-select:disabled {
    background-color: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

/* ==========================================================================
   Specific Field Types
   ========================================================================== */

/* Textarea */
.afe-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Select */
.afe-select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23666' d='m2 0-2 2h4zm0 5 2-2h-4z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 40px;
}

.afe-select[multiple] {
    background-image: none;
    padding-right: 15px;
    min-height: 120px;
}

/* File Input */
.afe-file {
    padding: 8px 15px;
    border: 2px dashed #ddd;
    background-color: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
}

.afe-file:hover {
    border-color: #3498db;
    background-color: #f0f8ff;
}

.afe-file:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* ==========================================================================
   Radio & Checkbox Groups
   ========================================================================== */

.afe-radio-group,
.afe-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.afe-radio-label,
.afe-checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-weight: normal !important;
    font-size: 15px;
    line-height: 1.4;
    margin: 0;
    padding: 8px 0;
    transition: color 0.2s ease;
}

.afe-radio-label:hover,
.afe-checkbox-label:hover {
    color: #2c3e50;
}

.afe-radio,
.afe-checkbox {
    width: 18px !important;
    height: 18px;
    margin: 2px 12px 0 0;
    cursor: pointer;
    flex-shrink: 0;
}

.afe-radio-text,
.afe-checkbox-text {
    flex: 1;
    padding-top: 1px;
}

/* Custom styling for radio and checkbox */
.afe-radio {
    border-radius: 50%;
}

.afe-checkbox {
    border-radius: 3px;
}

/* ==========================================================================
   Form Actions & Buttons
   ========================================================================== */

.afe-form-actions {
    margin-top: 35px;
    text-align: left;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.afe-submit-btn {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: #fff;
    border: none;
    padding: 15px 35px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.2);
    min-width: 140px;
}

.afe-submit-btn:hover {
    background: linear-gradient(135deg, #2980b9 0%, #21618c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.afe-submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.2);
}

.afe-submit-btn:disabled {
    background: #bdc3c7 !important;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
    opacity: 0.6;
}

/* Loading state */
.afe-submit-btn.loading {
    position: relative;
    color: transparent;
}

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

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

/* ==========================================================================
   Messages & Validation
   ========================================================================== */

.afe-form-messages {
    margin-top: 20px;
}

.afe-success {
    background: #d4edda;
    color: #155724;
    padding: 15px 20px;
    border-radius: 5px;
    border: 1px solid #c3e6cb;
    margin-bottom: 20px;
    font-weight: 500;
}

.afe-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px 20px;
    border-radius: 5px;
    border: 1px solid #f5c6cb;
    margin-bottom: 20px;
    font-weight: 500;
}

.afe-warning {
    background: #fff3cd;
    color: #856404;
    padding: 15px 20px;
    border-radius: 5px;
    border: 1px solid #ffeaa7;
    margin-bottom: 20px;
    font-weight: 500;
}

/* Field-specific errors */
.afe-field-errors {
    margin-top: 6px;
    min-height: 0;
    overflow: hidden;
    transition: min-height 0.3s ease;
}

.afe-error-message,
.afe-error-list {
    font-size: 13px;
    color: #e74c3c;
    line-height: 1.4;
    animation: slideDown 0.3s ease;
}

.afe-field-errors .error-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.afe-field-errors .error-list li {
    color: #e74c3c;
    font-size: 14px;
    margin-bottom: 5px;
    padding-left: 20px;
    position: relative;
}

.afe-field-errors .error-list li:before {
    content: '⚠';
    position: absolute;
    left: 0;
    top: 0;
    font-size: 14px;
}

.afe-error-message,
.afe-error-list {
    font-size: 13px;
    color: #e74c3c;
    line-height: 1.4;
    animation: slideDown 0.3s ease;
}

.afe-error-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.afe-error-list li {
    padding: 4px 0 4px 20px;
    position: relative;
}

.afe-error-list li::before {
    content: '⚠';
    position: absolute;
    left: 0;
    font-size: 14px;
    margin-top: 1px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Field error state */
.afe-field-wrapper.has-error .afe-input,
.afe-field-wrapper.has-error .afe-textarea,
.afe-field-wrapper.has-error .afe-select,
.afe-field-wrapper.has-error .afe-datepicker,
.afe-field-wrapper.has-error .select2-container--default .select2-selection--single
{
    border-color: #e74c3c !important;
    background-color: #fdf2f2 !important;
}

.afe-field-wrapper.has-error .afe-field-label {
    color: #e74c3c;
}

/* ==========================================================================
   Progress Indicator (for multi-step forms)
   ========================================================================== */

.afe-progress {
    margin: 0 0 30px;
    background: #f8f9fa;
    border-radius: 10px;
    overflow: hidden;
    height: 8px;
}

.afe-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    transition: width 0.5s ease;
    border-radius: 10px;
}

.afe-step-indicator {
    display: flex;
    justify-content: space-between;
    margin: 0 0 20px;
    padding: 0;
    list-style: none;
}

.afe-step-indicator li {
    flex: 1;
    text-align: center;
    padding: 10px;
    background: #e9ecef;
    color: #6c757d;
    font-size: 14px;
    font-weight: 500;
    position: relative;
}

.afe-step-indicator li.active {
    background: #3498db;
    color: #fff;
}

.afe-step-indicator li.completed {
    background: #27ae60;
    color: #fff;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .afe-form-container {
        margin: 0 0 20px;
    }
    
    .afe-form {
        padding: 20px 15px;
        border-radius: 4px;
        border-left: none;
        border-right: none;
    }
    
    .afe-form-title {
        font-size: 1.5em;
        margin-bottom: 10px;
    }
    
    .afe-input,
    .afe-textarea,
    .afe-select {
        padding: 14px 15px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .afe-submit-btn {
        width: 100%;
        padding: 16px;
        font-size: 18px;
    }
    
    .afe-form-actions {
        text-align: center;
    }
    
    .afe-radio-group,
    .afe-checkbox-group {
        gap: 15px;
    }
    
    .afe-step-indicator li {
        padding: 8px 5px;
        font-size: 12px;
    }

        .afe-error-message,
    .afe-error-list {
        font-size: 12px;
    }
    
    .afe-error-list li {
        font-size: 11px;
    }
    
    .afe-form-validation-summary {
        padding: 12px 15px;
    }
    
    .afe-form-validation-summary h4 {
        font-size: 14px;
    }
    
    .afe-form-validation-summary li {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .afe-form {
        padding: 15px 10px;
    }
    
    .afe-field-wrapper {
        margin-bottom: 20px;
    }
    
    .afe-form-title {
        font-size: 1.3em;
    }
    
    .afe-submit-btn {
        padding: 14px;
        font-size: 16px;
    }
}

/* ==========================================================================
   Accessibility Improvements
   ========================================================================== */

/* Focus visible for better keyboard navigation */
.afe-input:focus-visible,
.afe-textarea:focus-visible,
.afe-select:focus-visible,
.afe-radio:focus-visible,
.afe-checkbox:focus-visible,
.afe-submit-btn:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .afe-input,
    .afe-textarea,
    .afe-select {
        border-width: 3px;
    }
    
    .afe-submit-btn {
        border: 2px solid #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .afe-input,
    .afe-textarea,
    .afe-select,
    .afe-submit-btn,
    .afe-progress-bar {
        transition: none;
    }
    
    .afe-submit-btn.loading::after {
        animation: none;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .afe-form {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .afe-submit-btn {
        display: none;
    }
    
    .afe-form-messages {
        display: none;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */
/* 
@media (prefers-color-scheme: dark) {
    .afe-form {
        background: #2c3e50;
        border-color: #34495e;
        color: #ecf0f1;
    }
    
    .afe-form-title,
    .afe-field-label {
        color: #ecf0f1;
    }
    
    .afe-field-description {
        color: #bdc3c7;
    }
    
    .afe-input,
    .afe-textarea,
    .afe-select {
        background-color: #34495e;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
    
    .afe-input:focus,
    .afe-textarea:focus,
    .afe-select:focus {
        background-color: #3a526b;
        border-color: #5dade2;
    }
    
    .afe-file {
        background-color: #34495e;
        border-color: #4a5f7a;
        color: #ecf0f1;
    }
} */

/* ==========================================================================
   Frontend Validation Enhancements
   ========================================================================== */

/* Field validation states */
.afe-field-wrapper.validating .afe-input,
.afe-field-wrapper.validating .afe-textarea,
.afe-field-wrapper.validating .afe-select {
    border-color: #ff9800;
    background-color: #fff8e1;
}

.afe-field-wrapper.valid .afe-input,
.afe-field-wrapper.valid .afe-textarea,
.afe-field-wrapper.valid .afe-select {
    border-color: #4caf50;
    background-color: #f1f8f4;
}

.afe-field-wrapper.invalid .afe-input,
.afe-field-wrapper.invalid .afe-textarea,
.afe-field-wrapper.invalid .afe-select {
    border-color: #e74c3c;
    background-color: #fdf2f2;
}

/* Validation icons */
.afe-field-input {
    position: relative;
}

.afe-validation-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.afe-field-wrapper.validating .afe-validation-icon {
    content: '⟳';
    opacity: 1;
    color: #ff9800;
    animation: spin 1s linear infinite;
}

.afe-field-wrapper.valid .afe-validation-icon {
    opacity: 1;
    color: #4caf50;
}

.afe-field-wrapper.invalid .afe-validation-icon {
    opacity: 1;
    color: #e74c3c;
}

.afe-field-wrapper.valid .afe-validation-icon::before {
    content: '✓';
    opacity: 1;
    color: #4caf50;
}

.afe-field-wrapper.invalid .afe-validation-icon::before {
    content: '✗';
    opacity: 1;
    color: #e74c3c;
}

@keyframes spin {
    from { transform: translateY(-50%) rotate(0deg); }
    to { transform: translateY(-50%) rotate(360deg); }
}

/* Validation messages */
.afe-field-validation {
    margin-top: 6px;
    min-height: 0;
    overflow: hidden;
    transition: min-height 0.3s ease;
}

.afe-field-validation.show {
    min-height: 20px;
}

.afe-validation-message {
    font-size: 13px;
    line-height: 1.4;
    display: flex;
    align-items: start;
    gap: 6px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.afe-validation-message.error {
    color: #e74c3c;
}

.afe-validation-message.success {
    color: #4caf50;
}

.afe-validation-message::before {
    content: '⚠';
    flex-shrink: 0;
    font-size: 14px;
    margin-top: 1px;
}

.afe-validation-message.success::before {
    content: '✓';
}

/* Multiple validation errors */
.afe-validation-errors {
    margin-top: 8px;
}

.afe-validation-errors ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.afe-validation-errors li {
    color: #e74c3c;
    font-size: 12px;
    padding: 4px 0 4px 20px;
    position: relative;
    line-height: 1.4;
}

.afe-validation-errors li::before {
    content: '•';
    position: absolute;
    left: 8px;
    font-weight: bold;
}

/* Form-level validation summary */
.afe-form-validation-summary {
    background: #fcebec;
    border: 2px solid #e74c3c;
    border-radius: 6px;
    padding: 15px 20px;
    margin-bottom: 20px;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.afe-form-validation-summary h4 {
    margin: 0 0 10px 0;
    color: #e74c3c;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.afe-form-validation-summary h4::before {
    content: '⚠';
    font-size: 20px;
}

.afe-form-validation-summary ul {
    margin: 0;
    padding-left: 20px;
}

.afe-form-validation-summary li {
    color: #721c24;
    margin-bottom: 5px;
    font-size: 14px;
}

/* Real-time validation feedback */
.afe-field-wrapper.typing .afe-input,
.afe-field-wrapper.typing .afe-textarea {
    border-color: #2271b1;
}

/* Validation on submit */
.afe-form.validating {
    opacity: 0.7;
    pointer-events: none;
}

.afe-submit-btn.validating {
    position: relative;
    color: transparent;
}

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

/* Password strength indicator (for password validation) */
.afe-password-strength {
    margin-top: 8px;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.afe-password-strength-bar {
    height: 100%;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.afe-password-strength.weak .afe-password-strength-bar {
    width: 33%;
    background: #e74c3c;
}

.afe-password-strength.medium .afe-password-strength-bar {
    width: 66%;
    background: #ff9800;
}

.afe-password-strength.strong .afe-password-strength-bar {
    width: 100%;
    background: #4caf50;
}

.afe-password-strength-text {
    font-size: 12px;
    margin-top: 4px;
    font-weight: 500;
}

.afe-password-strength.weak .afe-password-strength-text {
    color: #e74c3c;
}

.afe-password-strength.medium .afe-password-strength-text {
    color: #ff9800;
}

.afe-password-strength.strong .afe-password-strength-text {
    color: #4caf50;
}

/* ==========================================================================
   Responsive Validation Styles
   ========================================================================== */

@media (max-width: 768px) {
    .afe-validation-message {
        font-size: 12px;
    }
    
    .afe-validation-errors li {
        font-size: 11px;
    }
    
    .afe-form-validation-summary {
        padding: 12px 15px;
    }
    
    .afe-form-validation-summary h4 {
        font-size: 14px;
    }
    
    .afe-form-validation-summary li {
        font-size: 13px;
    }
}

/* ==========================================================================
   Accessibility - Validation
   ========================================================================== */

/* ARIA live regions for screen readers */
.afe-validation-message[role="alert"] {
    /* Announced by screen readers */
    padding: 0;
}

/* Focus management */
.afe-field-wrapper.invalid .afe-input:focus,
.afe-field-wrapper.invalid .afe-textarea:focus,
.afe-field-wrapper.invalid .afe-select:focus {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.2);
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .afe-field-wrapper.invalid .afe-input,
    .afe-field-wrapper.invalid .afe-textarea,
    .afe-field-wrapper.invalid .afe-select {
        border-width: 3px;
    }
    
    .afe-validation-message {
        font-weight: 600;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .afe-validation-icon,
    .afe-validation-message,
    .afe-form-validation-summary {
        animation: none;
    }
    
    .afe-field-input,
    .afe-password-strength,
    .afe-password-strength-bar {
        transition: none;
    }

    .afe-validation-icon,
    .afe-error-message,
    .afe-form-validation-summary {
        animation: none;
    }
}

/* ==========================================================================
   Process Container Styles
   ========================================================================== */

.afe-process-container {
    max-width: 100%;
    margin: 0 auto 30px;
    padding: 0;
}

.afe-process-header {
    text-align: center;
    margin-bottom: 30px;
}

.afe-process-title {
    font-size: 2em;
    margin: 0 0 10px;
    color: #2c3e50;
    font-weight: 700;
}

.afe-process-description {
    font-size: 1.1em;
    color: #666;
    line-height: 1.6;
    max-width: 700px;
    margin: 0 auto;
}

/* ==========================================================================
   Progress Indicator
   ========================================================================== */

.afe-progress-container {
    margin: 0 0 40px;
}

.afe-progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
}

.afe-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db 0%, #2980b9 100%);
    border-radius: 10px;
    transition: width 0.5s ease;
    position: relative;
}

.afe-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.afe-progress-steps {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.afe-progress-step {
    flex: 1;
    text-align: center;
    position: relative;
    padding: 15px 10px;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.afe-progress-step::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -5px;
    width: 10px;
    height: 2px;
    background: #ddd;
    transform: translateY(-50%);
}

.afe-progress-step:first-child::before {
    display: none;
}

.afe-step-number {
    display: inline-block;
    width: 32px;
    height: 32px;
    line-height: 32px;
    border-radius: 50%;
    background: #ddd;
    color: #666;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 8px;
    transition: all 0.3s ease;
}

.afe-step-label {
    display: block;
    font-size: 13px;
    color: #666;
    font-weight: 500;
    line-height: 1.3;
}

/* Active step */
.afe-progress-step.active {
    background: #e3f2fd;
}

.afe-progress-step.active .afe-step-number {
    background: #3498db;
    color: #fff;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.4);
}

.afe-progress-step.active .afe-step-label {
    color: #2c3e50;
    font-weight: 600;
}

/* Completed step */
.afe-progress-step.completed {
    background: #d4edda;
}

.afe-progress-step.completed .afe-step-number {
    background: #27ae60;
    color: #fff;
}

.afe-progress-step.completed .afe-step-number::before {
    content: '✓';
}

.afe-progress-step.completed .afe-step-label {
    color: #155724;
}

.afe-progress-step.completed::before {
    background: #27ae60;
}

/* ==========================================================================
   Step Container
   ========================================================================== */

.afe-step-container {
    margin-bottom: 30px;
}

.afe-step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.afe-step-title {
    font-size: 1.5em;
    margin: 0;
    color: #2c3e50;
    font-weight: 600;
}

.afe-step-counter {
    font-size: 14px;
    color: #666;
    font-weight: 500;
    padding: 6px 12px;
    background: #f8f9fa;
    border-radius: 20px;
}

/* ==========================================================================
   Process Navigation Buttons
   ========================================================================== */

.afe-form-actions {
    display: flex;
    gap: 15px;
    justify-content: space-between;
    align-items: center;
}

.afe-back-btn {
    background: #6c757d;
    color: #fff;
    border: none;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 500;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.afe-back-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(108, 117, 125, 0.3);
}

.afe-back-btn:active {
    transform: translateY(0);
}

.afe-back-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.afe-btn-icon {
    font-size: 18px;
    line-height: 1;
}

.afe-process-next,
.afe-process-back {
    flex: 0 0 auto;
}

/* Single button centered */
.afe-form-actions:has(:only-child) {
    justify-content: flex-start;
}

/* ==========================================================================
   Responsive Updates
   ========================================================================== */

@media (max-width: 768px) {
    .afe-process-title {
        font-size: 1.5em;
    }
    
    .afe-progress-steps {
        gap: 5px;
    }
    
    .afe-progress-step {
        padding: 10px 5px;
    }
    
    .afe-step-number {
        width: 28px;
        height: 28px;
        line-height: 28px;
        font-size: 12px;
        margin-bottom: 5px;
    }
    
    .afe-step-label {
        font-size: 11px;
    }
    
    .afe-step-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .afe-step-title {
        font-size: 1.2em;
    }
    
    .afe-form-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .afe-back-btn,
    .afe-process-next {
        width: 100%;
        justify-content: center;
    }
    
    /* Reverse order on mobile so next is on top */
    .afe-form-actions {
        flex-direction: column-reverse;
    }
}

@media (max-width: 480px) {
    .afe-progress-step {
        padding: 8px 3px;
    }
    
    .afe-step-number {
        width: 24px;
        height: 24px;
        line-height: 24px;
        font-size: 11px;
    }
    
    .afe-step-label {
        font-size: 10px;
        display: none; /* Hide labels on very small screens */
    }
    
    .afe-progress-step.active .afe-step-label,
    .afe-progress-step.completed .afe-step-label {
        display: block; /* Show only active/completed labels */
    }
}

/* ==========================================================================
   Hidden Field (ensure it's truly hidden)
   ========================================================================== */

.afe-field-hidden {
    display: none !important;
}

/* ==========================================================================
   Dark Mode Updates
   ========================================================================== */
/* 
@media (prefers-color-scheme: dark) {
    .afe-process-header {
        color: #ecf0f1;
    }
    
    .afe-process-title {
        color: #ecf0f1;
    }
    
    .afe-process-description {
        color: #bdc3c7;
    }
    
    .afe-progress-bar {
        background: #34495e;
    }
    
    .afe-progress-step {
        background: #2c3e50;
    }
    
    .afe-progress-step.active {
        background: #1a3a52;
    }
    
    .afe-progress-step.completed {
        background: #1e4d2b;
    }
    
    .afe-step-header {
        border-color: #34495e;
    }
    
    .afe-step-title {
        color: #ecf0f1;
    }
    
    .afe-step-counter {
        background: #34495e;
        color: #bdc3c7;
    }
    
    .afe-heading {
        color: #ecf0f1;
    }
    
    .afe-paragraph {
        color: #bdc3c7;
    }
    
    .afe-divider {
        border-color: #4a5f7a;
    }
    
    .afe-back-btn {
        background: #4a5f7a;
    }
    
    .afe-back-btn:hover {
        background: #5a6f8a;
    }
} */

/* ==========================================================================
   Reduced Motion Updates
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .afe-progress-fill,
    .afe-progress-step,
    .afe-step-number,
    .afe-back-btn,
    .afe-submit-btn {
        transition: none;
    }
    
    .afe-progress-fill::after {
        animation: none;
    }
}

.afe-process-container.afe-redirecting {
    opacity: 0.6;
    pointer-events: none;
}

.afe-process-container.afe-redirecting::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Honeypot fields - hidden from users but visible to bots */
.afe-hp-field {
    position: absolute !important;
    left: -9999px !important;
    top: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
    overflow: hidden !important;
}

/* Alternative hiding methods (use one) */
.afe-hp-field-alt {
    display: none !important;
    visibility: hidden !important;
}

.afe-hp-field-visibility {
    position: absolute;
    left: -5000px;
    width: 0;
    height: 0;
    opacity: 0;
}


.afe-button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.afe-button-small {
    padding: 6px 12px;
    font-size: 12px;
}

.afe-button-large {
    padding: 12px 24px;
    font-size: 16px;
}

.afe-button-primary {
    background: #2271b1;
    color: white;
}

.afe-button-secondary {
    background: #6c757d;
    color: white;
}

.afe-button-success {
    background: #28a745;
    color: white;
}

.afe-button-danger {
    background: #dc3545;
    color: white;
}

.afe-button-warning {
    background: #ffc107;
    color: #212529;
}

.afe-button-info {
    background: #17a2b8;
    color: white;
}

.afe-button-dark {
    background: #343a40;
    color: white;
}

.afe-button-light {
    background: #f8f9fa;
    color: #212529;
    border: 1px solid #dee2e6;
}

.afe-button .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.afe-button-align-left {
    justify-content: left !important;
    display: flex;
}

.afe-button-align-center {
    justify-content: center !important;
    display: flex;
}

.afe-button-align-right {
    justify-content: right !important;
    display: flex;
}

.form-field.field-align-left {
    justify-content: flex-start;
}

.form-field.field-align-center {
    justify-content: center;
}

.form-field.field-align-right {
    justify-content: flex-end;
}

/* Container Styles */
.afe-container {
    width: 100%;
    border-radius: 4px;
}

.afe-container-default {
    border: 0px solid #ddd;
}

.afe-container-bordered {
    border: 2px solid #333;
}

.afe-container-card {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}

/* Container Padding */
.afe-container-padding-none {
    padding: 0;
}

.afe-container-padding-small {
    padding: 10px;
}

.afe-container-padding-medium {
    padding: 20px;
}

.afe-container-padding-large {
    padding: 30px;
}

/* Container Grid */
.afe-container-grid {
    width: 100%;
}

/* Container Flow Layout */
.afe-container-flow {
    display: flex;
}

.afe-container-flow > .afe-field-wrapper {
    grid-column: unset !important;
    margin-bottom: 0px;
}

.afe-container-flow > .afe-layout-element {
    grid-column: unset !important;
    width: 100%;
}

.afe-highlighted-option {
    /* background: rgba(255, 35, 11, 0.522); */
}

.afe-select-separator {
    color: #aaa;
    font-size: 10px;
    letter-spacing: 1px;
    pointer-events: none;
}

.afe-form-grid  {
    display: grid; 
    grid-template-columns: repeat(12, 1fr); 
    gap: 5px; 
    align-items: start;
}

.afe-button-full {
    width: 100%;
}

.afe-button-auto {
    width: auto;
}

.afe-button-text-left {
    justify-content: start;
}

.afe-button-text-center {
    justify-content: center;
}

.afe-button-text-right {
    justify-content: right;
}

.afe-input::placeholder {
    color: rgb(104, 104, 104)
}

.select2-selection__placeholder {
    color: rgb(104, 104, 104) !important
}

/* Vertical layout (default) */
.afe-checkbox-group.afe-checkbox-vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.afe-checkbox-group.afe-checkbox-vertical .afe-checkbox-label {
    display: flex;
    align-items: center;
}

/* Horizontal layout */
.afe-checkbox-group.afe-checkbox-horizontal {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 15px 20px; /* vertical and horizontal gap */
}

.afe-checkbox-group.afe-checkbox-horizontal .afe-checkbox-label {
    display: flex;
    align-items: center;
}

/* Common styles */
.afe-checkbox-label {
    cursor: pointer;
    margin: 0;
}

/* .afe-checkbox {
    margin-right: 8px;
} */

/* Top label position (default) */
.afe-field-wrapper.afe-label-top {
    display: flex;
    flex-direction: column;
}

.afe-field-wrapper.afe-label-top .afe-field-label {
    margin-bottom: 8px;
}

/* Left label position */
.afe-field-wrapper.afe-label-left {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
        "label input"
        "description description"
        "errors errors";
    gap: 12px;
    align-items: start;
}

.afe-field-wrapper.afe-label-left .afe-field-label {
    grid-area: label;
    padding-top: 8px;
    white-space: nowrap;
}

.afe-field-wrapper.afe-label-left .afe-field-description {
    grid-area: description;
}

.afe-field-wrapper.afe-label-left .afe-field-input {
    grid-area: input;
}

.afe-field-wrapper.afe-label-left .afe-field-errors {
    grid-area: errors;
}

/* Vertical layout (default) */
.afe-radio-group.afe-radio-vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.afe-radio-group.afe-radio-vertical .afe-radio-label {
    display: flex;
    align-items: center;
}

/* Horizontal layout */
.afe-radio-group.afe-radio-horizontal {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 15px 20px; /* vertical and horizontal gap */
}

.afe-radio-group.afe-radio-horizontal .afe-radio-label {
    display: flex;
    align-items: center;
}

.afe-date-wrapper {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
}

.afe-datepicker::placeholder {
    color: rgb(104, 104, 104)
}

.afe-field-wrapper .select2-container {
    background-color: #fff;
}

.afe-field-wrapper .select2-container--default .select2-selection--single {
    background-color: #fff !important;
    border-radius: 0 !important;
}

/* ============================================
   API Error / Retry Button Styles
   ============================================ */

.afe-api-error {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    color: #856404;
}

.afe-error-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.afe-error-content {
    flex: 1;
}

.afe-error-content strong {
    display: block;
    margin-bottom: 4px;
    color: #664d03;
}

.afe-error-content span {
    font-size: 14px;
    line-height: 1.4;
}

.afe-error-actions {
    flex-shrink: 0;
}

.afe-retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background-color: #0073aa;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.afe-retry-btn:hover {
    background-color: #005a87;
}

.afe-retry-btn:disabled {
    background-color: #999;
    cursor: not-allowed;
}

.afe-retry-icon {
    font-size: 16px;
}

.afe-button-small {
    padding: 6px 12px;
    font-size: 13px;
}

/* Responsive: Stack on small screens */
@media (max-width: 480px) {
    .afe-api-error {
        flex-direction: column;
        text-align: center;
    }
    
    .afe-error-actions {
        width: 100%;
    }
    
    .afe-retry-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================================================
   Range Slider - Number Inside Thumb
   ========================================================================== */

.afe-range-wrapper {
    position: relative;
    height: 28px;
    display: flex;
    align-items: center;
    width: 100%;
}

.afe-range-wrapper input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 3px;
    background: #ddd;
    border-radius: 2px;
    outline: none;
    border: none;
    cursor: pointer;
    position: relative;
    z-index: 2;
    margin: 0;
    padding: 0;
}

/* Transparent native thumb - keeps drag working */
.afe-range-wrapper input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
}

.afe-range-wrapper input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: transparent;
    cursor: pointer;
    border-radius: 50%;
    border: none;
}

/* Custom visible thumb with number inside */
.afe-range-thumb-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    background: #3498db;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    pointer-events: none;
    z-index: 1;
    user-select: none;
    line-height: 1;
}