/* Form.io Custom Override Stylesheet */
/* Add this after your formio.all.css import */

/* Reset and base styles */

.builder-sidebar_search.form-control:focus {
    color: var(--bs-body-color);
    background-color: var(--bs-body-bg);
    border-color: var(--bs-primary);
    outline: 0;
    box-shadow: none !important;
    /* box-shadow: 0 0 0 .25rem rgba(13, 110, 253, .25); */
}

.card-body {
    padding: 1.25rem;
}

#render {
    --theme--popover--menu--box-shadow: 0px 0px 6px 0px rgb(23, 41, 64, 0.2), 0px 0px 12px 2px rgb(23, 41, 64, 0.05);


    /* Target the specific input */
    .formio-component-customToggle input {
        /* Hide the default checkbox appearance */
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;

        /* Set the base dimensions for the toggle */
        position: relative;
        width: 3.5em;
        height: 1.5em;
        margin: 0;

        /* Style the track (background) */
        background-color: #ccc;
        border-radius: 1.5em;
        cursor: pointer;
        transition: background-color 0.3s ease;
        outline: none;
        border: none;
    }

    .formio-component-customToggle {

        /* Style the knob/thumb using ::after pseudo-element */
        input::after {
            content: "";
            position: absolute;
            top: 0.15em;
            left: 0.15em;
            width: 1.2em;
            height: 1.2em;
            background-color: white;
            border-radius: 50%;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
            transition: transform 0.3s ease;
        }

        /* Style for checked state */
        input:checked {
            background-color: #4cd964;
            /* Green color when toggle is on */
        }

        /* Move the knob when checked */
        input:checked::after {
            transform: translateX(2em);
        }

        /* Optional: Add focus styles for accessibility */
        input:focus {
            box-shadow: 0 0 0 2px rgba(76, 217, 100, 0.4);
        }

        /* Optional: Add hover effect */
        input:hover {
            opacity: 0.9;
        }
    }



    .formio-form {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
        color: #333;
        line-height: 1.5;
    }

    /* Form container */
    .formio-form .form-group {
        margin-bottom: 1.5rem;
    }

    /* Labels */
    .formio-form .control-label,
    .formio-form label {
        font-weight: 600;
        color: #374151;
        margin-bottom: 0.5rem;
        font-size: 0.875rem;
        display: block;
    }

    /* Form.io Select Dropdown Custom Styling */
    .formio-component-select {
        margin-bottom: 1.5rem;

        /* Label styling */
        .control-label {
            font-weight: 600;
            color: #374151;
            margin-bottom: 8px;
            font-size: 16px;
            display: block;
        }

        /* Main select container */
        .choices {
            position: relative;
            margin-bottom: 0;
        }

        /* Select input field styling */
        .choices__inner {
            background-color: #ffffff !important;
            border: 2px solid #8b5cf6 !important;
            /* Purple border */
            border-radius: 8px !important;
            padding: 12px 40px 12px 16px !important;
            min-height: 52px !important;
            font-size: 16px !important;
            color: #374151 !important;
            cursor: pointer !important;
            transition: all 0.2s ease !important;
            display: flex !important;
            align-items: center !important;
        }

        /* Hover state for select field */
        .choices:hover .choices__inner {
            border-color: #7c3aed !important;
        }

        /* Focus/Open state for select field */
        .choices.is-focused .choices__inner,
        .choices.is-open .choices__inner {
            border-color: #8b5cf6 !important;
            box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1) !important;
            border-radius: 8px 8px 0 0 !important;
            /* Square bottom corners when open */
        }

        /* When closed, keep all corners rounded */
        .choices:not(.is-open) .choices__inner {
            border-radius: 8px !important;
        }

        /* Selected value styling */
        .choices__list--single .choices__item {
            background-color: transparent !important;
            border: none !important;
            padding: 0 !important;
            margin: 0 !important;
            color: #374151 !important;
            font-weight: 400 !important;
        }

        /* Custom dropdown arrow */
        .choices::after {
            content: '';
            position: absolute;
            right: 16px;
            top: 50%;
            transform: translateY(-50%);
            width: 0;
            height: 0;
            border-left: 6px solid transparent;
            border-right: 6px solid transparent;
            border-bottom: 8px solid #9ca3af;
            /* Gray arrow pointing up */
            transition: transform 0.2s ease;
            z-index: 10;
            pointer-events: none;
        }

        /* Arrow rotation when open */
        .choices.is-open::after {
            transform: translateY(-50%) rotate(180deg);
        }

        /* Hide default arrows */
        .choices__inner::after,
        .choices[data-type*="select-one"]::after {
            display: none !important;
        }

        /* Dropdown list container - only when open */
        .choices.is-open .choices__list--dropdown,
        .choices.is-open .choices__list[aria-expanded] {
            background-color: #ffffff !important;
            box-shadow: var(--theme--popover--menu--box-shadow);
            /* box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important; */
            border-radius: 6px;
            border: none;
            margin-top: 1px;
            padding: 4px !important;
            max-height: 200px !important;
            overflow-y: auto !important;
            z-index: 1000 !important;
            position: absolute !important;
            top: 100% !important;
            left: 0 !important;
            right: 0 !important;
            width: 100% !important;
        }

        /* Hide dropdown when not open */
        .choices:not(.is-open) .choices__list--dropdown {
            display: none !important;
        }

        /* Individual dropdown items */
        .choices__list--dropdown .choices__item,
        .choices__list[aria-expanded] .choices__item {
            padding: 12px 16px !important;
            font-size: 16px !important;
            color: #374151 !important;
            cursor: pointer !important;
            transition: background-color 0.15s ease !important;
            background-color: transparent !important;
            border: none !important;
            margin: 0 !important;
            line-height: 1.4 !important;
        }

        /* Dropdown item hover state */
        .choices__list--dropdown .choices__item--selectable.is-highlighted,
        .choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
            background-color: #f3f4f6 !important;
            color: #374151 !important;
            border-radius: 4px !important;

        }

        /* Selected item in dropdown */
        .choices__list--dropdown .choices__item--selectable[aria-selected="true"],
        .choices__list[aria-expanded] .choices__item--selectable[aria-selected="true"] {

            font-weight: 500 !important;
            border-radius: 6px !important;

        }

        /* Remove default focus outline */
        .choices:focus {
            outline: none !important;
        }

        /* Disabled state */
        .choices.is-disabled .choices__inner {
            background-color: #f9fafb !important;
            border-color: #d1d5db !important;
            color: #9ca3af !important;
            cursor: not-allowed !important;
        }

        .choices.is-disabled::after {
            border-bottom-color: #d1d5db !important;
        }

        /* Ensure proper container behavior */
        .choices {
            overflow: visible !important;
            position: relative !important;
        }
    }

    /* .formio-component-select {

        .is-open .choices__list--dropdown,
        .is-open .choices__list[aria-expanded] {
            border: none;
            border-radius: 6px;

            max-block-size: var(--fe0a5a6e);
            padding: 0 4px;
            overflow: hidden auto;
            background-color: var(--theme--popover--menu--background);
            border: none;
            box-shadow: var(--theme--popover--menu--box-shadow);
            transition-timing-function: var(--transition-out);
            transition-duration: var(--fast);
            transition-property: opacity, transform;
            contain: content;
        }

        .choices__list--dropdown .choices__item--selectable.is-highlighted,
        .choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
            background-color: #f2f2f2;
            border-radius: 6px;
            padding: 0 4px 0 9px;
            line-height: 1.4;
        }

        .choices__list--dropdown .choices__item,
        .choices__list[aria-expanded] .choices__item {
            position: relative;
            padding: 0 4px 0 9px;
            font-size: 14px;
            line-height: 1.4;
        }
    } */

    /* Input fields - main styling */
    .formio-form .form-control,
    .formio-form input[type="text"],
    .formio-form input[type="email"],
    .formio-form input[type="tel"],
    .formio-form input[type="password"],
    .formio-form textarea,
    .formio-form select {
        border: 1px solid #d1d5db;
        border-radius: 6px;
        padding: 0.75rem 1rem;
        font-size: 1rem;
        background-color: #ffffff;
        transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
        width: 100%;
        min-height: 48px;
    }

    /* Input focus states */
    .formio-form .form-control:focus,
    .formio-form input:focus,
    .formio-form textarea:focus,
    .formio-form select:focus {
        outline: none;
        border-color: #3b82f6;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    }

    /* Input hover states */
    .formio-form .form-control:hover,
    .formio-form input:hover,
    .formio-form textarea:hover,
    .formio-form select:hover {
        border-color: #9ca3af;
    }

    /* Placeholder styling */
    .formio-form input::placeholder,
    .formio-form textarea::placeholder {
        color: #9ca3af;
        opacity: 1;
    }

    /* Two-column layout for form fields */
    .formio-form .row {
        display: flex;
        flex-wrap: wrap;
        margin: 0 -0.75rem;
    }

    .formio-form .col-sm-6,
    .formio-form .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
        padding: 0 0.75rem;
    }

    /* Select dropdown styling */
    .formio-form select {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
        background-position: right 0.75rem center;
        background-repeat: no-repeat;
        background-size: 1.5em 1.5em;
        padding-right: 2.5rem;
        appearance: none;
    }

    /* Checkbox styling */
    .formio-component-checkbox {
        .form-check-label {
            display: flex !important;
            align-items: center;
            vertical-align: middle;

            .form-check-input {
                position: relative;
                margin-top: 0px;
            }
        }

        .checkbox,
        .form-check {
            display: flex;
            align-items: center;
            margin-bottom: 0.5rem;
        }

        input[type="checkbox"] {
            width: 1.25rem;
            height: 1.25rem;
            margin-right: 0.75rem;
            border: 1px solid #d1d5db;
            border-radius: 4px;
            background-color: #ffffff;
            cursor: pointer;
            min-height: auto;
        }

        input[type="checkbox"]:checked {
            background-color: #3b82f6;
            border-color: #3b82f6;
            background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='m13.854 3.646-7.5 7.5a.5.5 0 0 1-.708 0l-3.5-3.5a.5.5 0 1 1 .708-.708L6 10.293l7.146-7.147a.5.5 0 0 1 .708.708z'/%3e%3c/svg%3e");
        }

        .checkbox label,
        .form-check-label {
            font-weight: 400;
            margin-bottom: 0;
            cursor: pointer;
        }
    }

    /* Tab navigation styling */
    .formio-form .nav-tabs {
        border-bottom: 1px solid #e5e7eb;
        margin-bottom: 2rem;
    }

    .formio-form .nav-tabs .nav-link {
        border: none;
        border-bottom: 2px solid transparent;
        padding: 1rem 1.5rem;
        color: #6b7280;
        font-weight: 500;
        background: none;
        border-radius: 0;
    }

    .formio-form .nav-tabs .nav-link:hover {
        border-bottom-color: #d1d5db;
        color: #374151;
    }

    .formio-form .nav-tabs .nav-link.active {
        color: #3b82f6;
        border-bottom-color: #3b82f6;
        background: none;
    }

    /* Email input with icon */
    .formio-form .input-group {
        position: relative;
    }

    .formio-form .input-group .form-control {
        padding-left: 2.5rem;
    }

    .formio-form .input-group-prepend {
        position: absolute;
        left: 0.75rem;
        top: 50%;
        transform: translateY(-50%);
        z-index: 3;
        pointer-events: none;
    }

    .formio-form .input-group-text {
        background: none;
        border: none;
        color: #9ca3af;
        padding: 0;
    }

    /* Textarea specific styling */
    .formio-form textarea.form-control {
        min-height: 120px;
        resize: vertical;
    }

    /* Error states */
    .formio-form .has-error .form-control,
    .formio-form .is-invalid {
        border-color: #ef4444;
    }

    .formio-form .has-error .form-control:focus,
    .formio-form .is-invalid:focus {
        border-color: #ef4444;
        box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
    }

    .formio-form .help-block,
    .formio-form .invalid-feedback {
        color: #ef4444;
        font-size: 0.875rem;
        margin-top: 0.25rem;
    }

    /* Success states */
    .formio-form .has-success .form-control,
    .formio-form .is-valid {
        border-color: #10b981;
    }

    /* Disabled states */
    .formio-form .form-control:disabled,
    .formio-form input:disabled,
    .formio-form textarea:disabled,
    .formio-form select:disabled {
        background-color: #f9fafb;
        color: #6b7280;
        cursor: not-allowed;
    }

    /* Button styling (if needed) */
    .formio-form .btn {
        padding: 0.75rem 1.5rem;
        border-radius: 6px;
        font-weight: 500;
        transition: all 0.15s ease-in-out;
    }

    .formio-form .btn-primary {
        background-color: #3b82f6;
        border-color: #3b82f6;
        color: white;
    }

    .formio-form .btn-primary:hover {
        background-color: #2563eb;
        border-color: #2563eb;
    }

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

        .formio-form .col-sm-6,
        .formio-form .col-md-6 {
            flex: 0 0 100%;
            max-width: 100%;
        }

        .formio-form .nav-tabs .nav-link {
            padding: 0.75rem 1rem;
            font-size: 0.875rem;
        }
    }

    /* Override any conflicting Form.io specific classes */
    .formio-form .formio-component-textfield .form-control,
    .formio-form .formio-component-email .form-control,
    .formio-form .formio-component-phoneNumber .form-control,
    .formio-form .formio-component-select .form-control,
    .formio-form .formio-component-textarea .form-control {
        border: 1px solid #d1d5db !important;
        border-radius: 6px !important;
        padding: 0.75rem 1rem !important;
    }

    /* Choices.js override (for select components) */
    .formio-form .choices__inner {
        background-color: #ffffff;
        border: 1px solid #d1d5db;
        border-radius: 6px;
        padding: 0.75rem 1rem;
        min-height: 48px;
    }

    .formio-form .choices:focus .choices__inner,
    .formio-form .choices.is-focused .choices__inner {
        border-color: #3b82f6;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    }
}