// ==========================================================================
// Form Field 
// ==========================================================================

//
// Field Pill (Sidebar/Ghost)
//

.fui-field-pill {
    border-radius: 3px;
    border: 1px solid #cbd6e2;
    font-size: 16px;
    color: #33475b;
    padding: 10px;
    font-size: 13px;
    font-weight: 400;
    background-color: #fff;
    position: relative;
    cursor: grab;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    z-index: 11;
    user-select: none;

    svg {
        width: 100%;
        height: 100%;
    }
}

.fui-field-pill-icon {
    width: 16px;
    height: 16px;
    margin-right: 6px;
}

.fui-field-pill-drag {
    width: 13px;
    height: 15px;
    margin-left: auto;
    margin-right: -5px;
    opacity: 0;
    transition: all 0.15s ease-out;
    background-image: url("data:image/svg+xml,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Ctitle%3Edrag%3C/title%3E%3Cpath fill='%2396adc4' d='M11 8c-1.657 0-3-1.343-3-3s1.343-3 3-3c1.657 0 3 1.343 3 3s-1.343 3-3 3zM21 8c-1.657 0-3-1.343-3-3s1.343-3 3-3c1.657 0 3 1.343 3 3s-1.343 3-3 3zM11 19c-1.657 0-3-1.343-3-3s1.343-3 3-3c1.657 0 3 1.343 3 3s-1.343 3-3 3zM21 19c-1.657 0-3-1.343-3-3s1.343-3 3-3c1.657 0 3 1.343 3 3s-1.343 3-3 3zM11 30c-1.657 0-3-1.343-3-3s1.343-3 3-3c1.657 0 3 1.343 3 3s-1.343 3-3 3zM21 30c-1.657 0-3-1.343-3-3s1.343-3 3-3c1.657 0 3 1.343 3 3s-1.343 3-3 3z'%3E%3C/path%3E%3C/svg%3E");
    background-size: 13px 15px;
    background-repeat: no-repeat;
    
    .fui-field-pill:hover & {
        opacity: 1;
    }
}


//
// Fields
//

.fui-form-field {
    display: flex;

    * {
        pointer-events: none;
    }
}

//
// Form Field Blocks
//

.fui-field-block {
    width: 100%;
    position: relative;
    padding: 10px 15px !important;
    cursor: grab;
    border-radius: 4px;
    transition: all 0.2s ease;
    user-select: none;
    z-index: 2;

    &:hover {
        background: #f1f5f8;
    }

    &.is-active {
        opacity: 0.3;
    }

    &.has-errors {
        box-shadow: 0 0 1px 1px #ef9898;
        background: #fff6f6;
    }

    &.fui-submit-block {
        cursor: pointer;
        padding: 1.5rem 15px !important;
    }

    svg {
        width: 100%;
        height: 100%;
    }
}

.fui-field-block .warning {
    margin: 8px 0 0;
}

.fui-edit-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.fui-field-info {
    // position: relative;
    display: flex;
    flex: 1;
    align-items: center;
    flex-wrap: wrap;
    margin: -5px 0 5px;
}

.fui-field-label {
    font-size: 14px;
    color: #33475b;
    font-weight: 500;
}

.fui-field-handle {
    color: #8f98a3;
    font-size: 10px !important;
    display: inline-flex;
    margin-left: 8px;
    background-color: #EBEDEF;
    padding: 0;
    height: 16px;
    line-height: 16px;
    padding: 0 6px;
    border-radius: 10px;
    display: none;
}

.fui-field-synced {
    display: flex;
    align-items: center;
    font-size: 10px !important;
    margin-left: 8px;
    font-weight: 500;
    padding: 0 6px;
    border-radius: 10px;
    color: #c05621;
    background: #fffaf0;
    border: 1px solid #f6ad55;

    svg {
        width: 9px;
        height: 9px;
        margin-right: 5px;
    }
}

.fui-field-conditions {
    display: flex;
    align-items: center;
    font-size: 10px !important;
    margin-left: 8px;
    font-weight: 500;
    padding: 0 6px;
    border-radius: 10px;
    color: #1992D4;
    background: #f0faff;
    border: 1px solid #81c3e7;

    svg {
        width: 13px;
        height: 13px;
        margin-right: 5px;
    }
}

.fui-field-visibility-hidden .fui-field-preview {
    opacity: 0.5;
}

.fui-field-visibility-icon-hidden {
    display: flex;
    align-items: center;
    font-size: 10px !important;
    margin-left: 8px;
    font-weight: 500;
    padding: 0 6px;
    border-radius: 10px;
    color: #818cf8;
    background: #eef2ff;
    border: 1px solid #818cf8;

    svg {
        width: 13px;
        height: 13px;
        margin-right: 5px;
    }
}

.fui-field-visibility-disabled .fui-field-preview {
    opacity: 0.5;
}

.fui-field-visibility-icon-disabled {
    display: flex;
    align-items: center;
    font-size: 10px !important;
    margin-left: 8px;
    font-weight: 500;
    padding: 0 6px;
    border-radius: 10px;
    color: #94a3b8;
    background: #f1f5f9;
    border: 1px solid #94a3b8;

    svg {
        width: 13px;
        height: 13px;
        margin-right: 5px;
    }
}

.fui-field-actions {
    opacity: 0;
    position: absolute;
    top: 5px;
    right: 5px;
    margin-left: auto;
    // margin-right: -10px;
    transition: all 0.2s ease;

    .fui-submit-block & {
        
    }

    .fui-field-block:hover > .fui-field-info > & {
        opacity: 1;
    }
}

.fui-field-settings {
    cursor: pointer;
    transition: all 0.2s ease;
    width: 30px;
    height: 28px !important;
    background-color: transparent;
    border-radius: 4px;
    border: none;
    outline: none;
    display: block !important;

    svg {
        pointer-events: none;
        width: 16px;
        height: 16px;
        fill: #9da5af;
        margin: auto;
    }

    &:after {
        display: none !important;
    }

    &:hover svg {
        fill: #33475b;
    }

    &:hover {
        background-color: rgba(0, 0, 0, 0.08);
    }
}

.fui-flex-break {
    flex-basis: 100%;
    height: 0;
}

.fui-field-instructions {
    color: #7b8793;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 3px 0 0;
}



//
// Form Field Previews
//

.fui-field-preview {
    position: relative;
    user-select: none;
    pointer-events: none;

    .fui-field-icon {
        position: absolute;
        top: 50%;
        right: 10px;
        width: 15px;
        height: 15px;
        display: block;
        opacity: 0.4;
        transform: translateY(-50%);
    }

    .fui-field-input[disabled] {
        background-color: lighten(#cbd5e0, 10%);
    }

    .fui-field-label {
        font-size: 11px;
        color: darken(#cbd5e0, 20%);
        font-weight: 500;
        margin-bottom: 2px;
        display: block;
    }

    .fui-row {
        margin-bottom: 8px;

        &:last-child {
            margin-bottom: 0;
        }
    }

    .fui-field-input,
    .fui-field-select {
        appearance: none;
        outline: 0;
        display: block;
        width: 100%;
        font-size: 14px;
        line-height: 1.5;
        transition: all 0.15s ease;
        background-clip: padding-box;
        padding: 0.5rem 1.75rem 0.5rem 0.75rem;
        border: 1px solid #cbd5e0;
        border-radius: 0.25rem;
        color: #a9a9a9;
        background-color: #fff;
    }

    .fui-field-input[type="number"] {
        -moz-appearance: textfield;

        &::-webkit-inner-spin-button, 
        &::-webkit-outer-spin-button {
            -webkit-appearance: none; 
            margin: 0; 
        }
    }

    .fui-field-textarea {
        height: auto;
    }

    .fui-field-checkbox,
    .fui-field-radio {
        box-sizing: border-box;
        padding: 0;

        input {
            clip: rect(0, 0, 0, 0);
            height: 1px;
            margin: -1px;
            overflow: hidden;
            position: absolute;
            width: 1px;
        }

        label {
            padding-left: 1.4rem;
            line-height: 1.5rem;
            position: relative;
            display: inline-block;
            margin-bottom: 0;
            transition: all 0.3s ease;

            &::before {
                position: absolute;
                top: 4px;
                left: 0;
                display: block;
                width: 1rem;
                height: 1rem;
                content: "";
                cursor: pointer;
                border: 1px solid #caced7;
                background-color: #fff;
                background-repeat: no-repeat;
                background-position: center center;
                background-size: 50% 50%;
                transition: all 0.3s ease;
            }
        }
    }

    .fui-field-radio label::before {
        border-radius: 50%;
    }

    .fui-field-checkbox input:checked + label::before,
    .fui-field-radio input:checked + label::before {
        background-color: #0D99F2;
        border-color: #0D99F2;
    }

    .fui-field-radio input:checked + label::before {
        background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3E%3Ccircle r='3' fill='%23fff'/%3E%3C/svg%3E");
        background-size: 8px auto;
    }

    .fui-field-checkbox label::before {
        border-radius: 2px;
    }

    .fui-field-checkbox input:checked + label::before {
        background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath fill='%23fff' d='M6.564.75l-3.59 3.612-1.538-1.55L0 4.26 2.974 7.25 8 2.193z'/%3E%3C/svg%3E");
        background-size: 8px auto;
    }

    .fui-field-select:not([multiple]):not([size]) {
        background: #fff url("data:image/svg+xml;charset=utf8,%3Csvg%20xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 4'%3E%3Cpath fill='%23333F48' fill-rule='evenodd' d='M7.484.643a.23.23 0 0 1-.067.154l-3.12 3.12a.23.23 0 0 1-.154.067.23.23 0 0 1-.154-.067L.869.797A.23.23 0 0 1 .8.643.23.23 0 0 1 .868.489l.335-.335a.218.218 0 0 1 .154-.067.23.23 0 0 1 .154.067l2.632 2.632L6.775.154a.23.23 0 0 1 .154-.067.23.23 0 0 1 .154.067l.334.335c.04.04.067.1.067.154z'/%3E%3C/svg%3E") no-repeat;
        background-position: right 0.75rem center;
        background-size: 0.7rem;
        padding-right: 1.4rem;
    }

    .fui-field-layout-horizontal {
        display: flex;
        flex-wrap: wrap;
        margin: -0.25rem;

        .fui-field-checkbox,
        .fui-field-radio {
            margin: 0.25rem;
        }
    }

    .fui-field-layout-vertical {
        display: block;
    }

    .fui-field-html {
        min-height: 6rem;
        max-height: 16rem;
        overflow: hidden;
    }

    .fui-field-hr {
        padding: 1rem;

        hr {
            border-color: #cbd5e0;
            padding: 0;
            margin: 0;
        }
    }

    .fui-field-file {
        line-height: 1;
        padding: 1rem;
    }

    .fui-phone-flag-wrap {
        position: absolute;
        top: 1px;
        left: 1px;
    }

    .fui-phone-flag-icon {
        width: 20px;
        height: 10px;
        background: rgb(204, 204, 204);
        display: block;
        position: absolute;
        top: 50%;
        left: 10px;
        transform: translateY(-50%);
    }

    .fui-phone-flag-select {
        padding-left: 30px;
        border: none;
        background-position: right 5px center !important;
        background-size: 8px !important;
    }

    // Phone field flags
    @import 'flags';

    // Payments - Stripe
    .fui-type-payment {
        position: relative;
    }

    .fui-payment-icon {
        position: absolute;
        width: 20px;
        height: 20px;
        top: 50%;
        left: 1rem;
        margin-top: -10px;

        svg * {
            fill: #515e80;
        }
    }

    .fui-payment-number {
        position: absolute;
        top: 50%;
        left: 3rem;
        margin-top: -10px;
        color: #b8c3ce;
    }

    .fui-payment-expiry {
        position: absolute;
        top: 50%;
        margin-top: -10px;
        right: 1rem;
        color: #b8c3ce;
    }

    // Payments - PayPal
    .fui-paypal-button {
        background: #ffc439;
        color: #2C2E2F;
        border-radius: 4px;
        margin: 10px 0;
    }

    .fui-paypal-button-label-container {
        padding: 14px;
        display: flex;
        align-items: center;
        margin: auto;
        justify-content: center;
    }

    .fui-paypal-button-text {
        font-weight: bold;
    }

    .fui-paypal-button img {
        width: 65px;
        margin-right: 10px;
    }
}

.fui-color-field {
    margin: 0 !important;
    padding: 3px !important;
    height: 34px;
}


.fui-field-input.is-disabled {
    background-color: lighten(#cbd5e0, 10%);
}


//
// Toggle Block
//

.field[data-type="toggleBlock"] {
    position: static;
    margin: 0;

    > .field {
        position: static;
    }
}

.fui-toggle-block {
    // position: relative;
    margin-bottom: 8px;
    border-radius: 5px;
    border: 1px solid rgba(51, 64, 77, 0.1);
    background-color: #f3f7fc;
    outline: none;
    overflow: hidden;

    &.has-errors {
        border-color: #EF4E4E;
    }
}

.fui-tb-header {
    position: relative;
    display: flex;
    align-items: center;
    padding: 10px;
    box-shadow: 0 1px 0 rgba(51, 64, 77, 0.1);
    
    .has-errors & {
        background-color: rgba(207, 17, 36, 0.1);
    }
}

.fui-tb-header .field {
    margin: 0;
}

.fui-tb-header .fui-tb-header-actions {
    display: flex;
    align-items: center;
    margin-left: auto;
    margin-right: 32px;

    button {
        padding: 0 10px;
        font-size: 12px;
        color: #5e6c7b;
    }
}

.fui-tb-header [data-type="collapse"] {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;

    .field {
        position: relative;
        width: 100%;
        height: 100%;
    }
}

.fui-tb-header .fui-toggle {
    position: absolute;
    // top: 0;
    // right: 0;
    // padding: 10px 15px;
    width: 100%;
    height: 100%;
    text-align: right;
    cursor: pointer;
    user-select: none;
    z-index: 1;

    &:before {
        content: 'downangle';
        font-family: 'Craft';
        speak: none;
        font-feature-settings: "liga", "dlig";
        text-rendering: optimizeLegibility;
        font-weight: normal;
        font-variant: normal;
        text-transform: none;
        line-height: 1;
        direction: ltr;
        display: inline-block;
        text-align: center;
        font-style: normal;
        vertical-align: middle;
        word-wrap: normal !important;
        user-select: none;
        opacity: 0.8;
        padding: 13px 15px;

        transition: transform linear 100ms;
        transform: rotate(0deg);
    }

    &.expanded:before {
        transform: rotate(180deg);
    }
}

.fui-tb-header .lightswitch {
    position: relative;
    z-index: 2;
    margin-right: 5px;
}

.fui-tb-header-title {
    font-weight: 600;
    font-size: 14px;
    margin-left: 5px;
    color: #5f6c7b;

    .has-errors & {
        color: #EF4E4E;
    }
}

.fui-tb-body {
    padding: 14px;
}






//
// Extra Small Lightswitch
//

.lightswitch.extra-small {
    border-radius: 7px;
    width: 24px;
    min-width: 24px;
    height: 14px;
}

.lightswitch.extra-small .lightswitch-container {
    width: 34px;
}

.lightswitch.extra-small .lightswitch-container .handle {
    border-radius: 8px;
    width: 10px;
    height: 10px;
    inset-inline-start: calc(50% - 3px);
    inset-block-start: 2px;
}

.lightswitch.extra-small.on .lightswitch-container .handle {
    inset-inline-start: calc(50% - 5px);
}






//
// Submissions
//

.fui-submission .fields {

    .field > .heading > label {
        font-weight: 600;
    }

    .field .field label {
        font-size: 11px;
        color: darken(#cbd5e0, 20%);
        font-weight: 500;
        margin-bottom: 0;
        display: block;
    }

    .fui-row {
        margin-bottom: 15px;

        &:last-child {
            margin-bottom: 0;
        }
    }

    .fui-field-hr {
        padding: 1rem;

        hr {
            border-color: #cbd5e0;
            padding: 0;
            margin: 0;
        }
    }

    .fui-pre {
        border: 1px solid rgba(96, 125, 159, 0.25);
        background-color: lighten(#cbd5e0, 15%);
        border-radius: 3px;
        padding: 20px;
        margin: 0;
    }

}
