/* Custom Forms Styling */
.custom-form-container {
    max-width: 100%;
    margin: 0 auto;
}

/* Honeypot field - invisible to humans, visible to bots */
.form-field-hp {
    opacity: 0;
    position: absolute;
    top: 0;
    left: 0;
    height: 0;
    width: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

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

.custom-form {
    width: 100%;
}

/* Enable side-by-side fields using cssClass like col-6, col-md-6 etc. */
.form-step {
    display: flex;
    flex-wrap: wrap;
    gap: 0 15px;
}

.form-field-wrapper {
    margin-bottom: 1.5rem;
    width: 100%;
}

/* Hidden fields should not take up space */
.form-field-wrapper[data-field-type="hidden"] {
    margin: 0;
    padding: 0;
    height: 0;
    overflow: hidden;
}

/* Column classes for field widths */
.form-field-wrapper.col-6 {
    width: calc(50% - 8px);
}

.form-field-wrapper.col-4 {
    width: calc(33.333% - 10px);
}

.form-field-wrapper.col-3 {
    width: calc(25% - 12px);
}

@media (min-width: 768px) {
    .form-field-wrapper.col-md-6 {
        width: calc(50% - 8px);
    }
    .form-field-wrapper.col-md-4 {
        width: calc(33.333% - 10px);
    }
}

@media (max-width: 767px) {
    .form-field-wrapper.col-6,
    .form-field-wrapper.col-md-6,
    .form-field-wrapper.col-md-4 {
        width: 100%;
    }
}

.form-group {
    position: relative;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.required-indicator {
    color: #dc3545;
    margin-left: 0.25rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    color: #495057;
    background-color: #fff;
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-control.is-invalid {
    border-color: #dc3545;
}

.form-control.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Phone with country code */
.phone-with-country {
    display: flex;
    gap: 0.5rem;
}

.country-code-select {
    flex: 0 0 auto;
    max-width: 120px;
}

/* File upload styling */
.file-input {
    padding: 0.5rem;
}

.file-input::-webkit-file-upload-button {
    padding: 0.5rem 1rem;
    margin-right: 1rem;
    background-color: #f8f9fa;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    cursor: pointer;
}

.file-input::-webkit-file-upload-button:hover {
    background-color: #e9ecef;
}

/* Help text */
.form-help-text,
.form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #6c757d;
}

/* Field errors */
.field-error {
    display: none;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #dc3545;
}

/* Form messages */
.form-messages {
    margin: 1.5rem 0;
}

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

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

/* ---- Multi-Step Progress Indicator ---- */
.form-steps-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    padding: 0 1rem;
}

.form-step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
    z-index: 1;
}

.form-step-indicator .step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.form-step-indicator .step-label {
    font-size: 0.8rem;
    color: #999;
    text-align: center;
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.3s ease;
}

.form-step-indicator.active .step-number {
    background: #007bff;
    color: #fff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.form-step-indicator.active .step-label {
    color: #007bff;
    font-weight: 600;
}

.form-step-indicator.completed .step-number {
    background: #28a745;
    color: #fff;
}

.form-step-indicator.completed .step-label {
    color: #28a745;
}

.form-step-connector {
    flex: 1;
    height: 2px;
    background: #e0e0e0;
    margin: 0 8px;
    margin-bottom: 24px;
    transition: background 0.3s ease;
}

/* ---- Step Content ---- */
.form-step {
    position: relative;
}

.step-description {
    margin-bottom: 1.5rem;
    color: #666;
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-left: 3px solid #007bff;
    border-radius: 0 4px 4px 0;
}

/* ---- Step Transition Animations ---- */
.step-exit-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.step-exit-right {
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.step-enter-left {
    animation: slideInFromRight 0.3s ease forwards;
}

.step-enter-right {
    animation: slideInFromLeft 0.3s ease forwards;
}

@keyframes slideInFromRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInFromLeft {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ---- Navigation Buttons ---- */
.btn-prev,
.btn-next {
    display: inline-block;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.btn-prev {
    background-color: #6c757d;
    color: #fff;
    border: 1px solid #6c757d;
}

.btn-prev:hover {
    background-color: #5a6268;
    border-color: #545b62;
}

.btn-prev:focus {
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(108, 117, 125, 0.5);
}

.btn-next {
    background-color: #007bff;
    color: #fff;
    border: 1px solid #007bff;
}

.btn-next:hover {
    background-color: #0069d9;
    border-color: #0062cc;
}

.btn-next:focus {
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.5);
}

/* Submit button */
.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    align-items: center;
    margin-top: 2rem;
}

.btn-submit {
    display: inline-block;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    color: #fff;
    background-color: #007bff;
    border: 1px solid #007bff;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.btn-submit:hover:not(:disabled) {
    background-color: #0056b3;
    border-color: #004085;
}

.btn-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.btn-submit:focus {
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.5);
}

/* Loading spinner */
.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Multi-select dropdown */
select[multiple].form-control {
    height: auto;
    min-height: 120px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    

    .country-code-select {
        width: 100%;
    }

    .form-control {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .form-step-indicator .step-label {
        display: none;
    }

    .form-step-connector {
        margin-bottom: 0;
    }

    .form-steps-progress {
        margin-bottom: 1.5rem;
    }

    .btn-prev,
    .btn-next {
        padding: 0.6rem 1.5rem;
        font-size: 0.9rem;
    }
}

/* Accessibility improvements */
.form-control:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Hidden fields (for conditional logic) */
.form-field-wrapper[style*="display: none"] {
    display: none !important;
}

/* ---- Thank You Panel ---- */
.form-thank-you {
    text-align: center;
    padding: 3rem 2rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.form-thank-you--visible {
    opacity: 1;
    transform: translateY(0);
}

.form-thank-you-icon {
    margin-bottom: 1.5rem;
}

.checkmark-svg {
    width: 72px;
    height: 72px;
}

.checkmark-circle {
    stroke: #28a745;
    stroke-width: 2;
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-linecap: round;
}

.form-thank-you--visible .checkmark-circle {
    animation: checkmarkCircle 0.6s ease-in-out forwards;
}

.checkmark-check {
    stroke: #28a745;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
}

.form-thank-you--visible .checkmark-check {
    animation: checkmarkCheck 0.3s 0.4s ease-in-out forwards;
}

@keyframes checkmarkCircle {
    to { stroke-dashoffset: 0; }
}

@keyframes checkmarkCheck {
    to { stroke-dashoffset: 0; }
}

.form-thank-you-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 0.75rem;
}

.form-thank-you-message {
    font-size: 1.05rem;
    color: #666;
    margin: 0 0 2rem;
    line-height: 1.6;
}

.btn-submit-another {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #007bff;
    background: transparent;
    border: 1px solid #007bff;
    border-radius: 0.25rem;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.btn-submit-another:hover {
    background: #007bff;
    color: #fff;
}

.btn-submit-another:focus {
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* GDPR/Privacy notice styling (if needed) */
.form-privacy-notice {
    margin-top: 1rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-left: 4px solid #007bff;
    font-size: 0.875rem;
}

/* ---- Title / Description Field ---- */
.form-title-description {
    padding: 0.5rem 0;
}

.form-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 0.25rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

.form-section-description {
    margin: 0;
    color: #666;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* ---- Rich Text Field ---- */
.form-richtext-wrapper {
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    overflow: hidden;
}

.form-richtext-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 4px 6px;
    background: #f8f9fa;
    border-bottom: 1px solid #ced4da;
}

.rt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #495057;
}

.rt-btn:hover {
    background: #e9ecef;
}

.rt-btn.active {
    background: #dee2e6;
}

.rt-separator {
    width: 1px;
    height: 20px;
    background: #ced4da;
    margin: 0 4px;
}

.form-richtext-editor {
    min-height: 120px;
    padding: 0.75rem 1rem;
    border: none;
    outline: none;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
}

.form-richtext-editor:empty::before {
    content: attr(data-placeholder);
    color: #adb5bd;
    pointer-events: none;
}

.form-richtext-editor:focus {
    box-shadow: none;
}

.form-richtext-wrapper:focus-within {
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* ---- Data Consent Field ---- */
.form-data-consent {
    padding: 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.25rem;
}

.consent-check {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.consent-check .form-check-input {
    margin-top: 0.25rem;
    flex-shrink: 0;
}

.consent-label {
    font-size: 0.95rem;
    color: #333;
    line-height: 1.4;
}

.consent-details {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #6c757d;
    line-height: 1.4;
    padding-left: 1.5rem;
}