.row {
    margin-left: 0px;
    margin-right: 0px;
    margin-top: 5px;
    margin-bottom: 5px;
}

.width5Percent {
    width: 5%;
}

.width90Percent {
    width: 95%;
}

.noPaddingLeftRight{
    padding-left: 0px;
    padding-right: 0px;
}

.noPaddingBottom {
    padding-bottom: 0px;
}

.pading5px {
    padding: 5px 5px 5px 5px;
}

.marginRigh5px {
    margin-right: 5px;
}

.marginLeft10px {
    margin-left: 10px;
}

.marginBottom2px {
    margin-bottom: 2px;
}

.marginBottom0px {
    margin-bottom: 0px;
}

.marginTopBottom0px {
    margin-bottom: 0px;
    margin-top: 0px;
}
.error {
    border-color: #a94442;
    -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
}

#saving{
    margin-bottom: 3px;
}

@media (min-width: 576px) {
    .widthFromTo {
        width: 100px;
    }

    .modal-icons-dialog {
        margin-left:20px;
        margin-top: 20px;
    }
}

@media (min-width: 768px) {
    .widthFromTo {
        width: 145px;
    }

    .modal-icons-dialog {
        margin-left: 20px;
        margin-top: 20px;
    }
}

@media (min-width: 992px) {
    .widthFromTo {
        width: 240px;
    }

    .modal-icons-dialog {
        margin-left: 20px;
        margin-top: 20px;
    }
}

.TrialDays {
    color: red;
    text-align: right;
}

.noPaddingRight{
    padding-right:0px;
}

.labelIfAndReturn {
    font-weight: bold;
    text-align: right;
}

.displayNone{
    display: none;
}

.bt-glyphicons {
    margin: 0;
    overflow: hidden;
    width: 660px;
    margin: 5px 5px 5px 5px;
    padding: 10px 10px 10px 10px;
}

.bt-glyphicons-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.bt-glyphicons li {
    float: left;
    width: 32px;
    height: 32px;
    padding-top: 1px;
    padding-left: 0px;
    text-align: center;
    border: 1px solid #ced4da;
    background-color: transparent;
}
    .bt-glyphicons li:hover {
        background-color: cornflowerblue;
    }

    .bt-glyphicons li img[src$='.svg'] {
        width: 24px;
        height: 24px;
    }

    #ulIcon img[src$='.svg'] {
        width: 24px;
        height: 24px;
    }

    #ulIcon img[src$='.gif'] {
        width: 24px;
        height: 24px;
    }

    #ulIcon img[src$='.png'] {
        width: 24px;
        height: 24px;
    }

    .text-center img[src$='.svg'] {
        width: 24px;
        height: 24px;
    }

    .text-center img[src$='.png'] {
        width: 24px;
        height: 24px;
    }

    .text-center img[src$='.gif'] {
        width: 24px;
        height: 24px;
    }

.icon-active {
    background-color: forestgreen !important;
}

.DialogIconsWidth,
#DialogHelp .modal-dialog {
    max-width: 700px;
}

/* The switch - the box around the slider */
.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 30px;
}

    /* Hide default HTML checkbox while preserving keyboard focus */
    .switch input {
        opacity: 0;
        width: 0;
        height: 0;
        position: absolute;
    }

/* The slider */
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
}

    .slider:before {
        position: absolute;
        content: "";
        height: 26px;
        width: 26px;
        left: 4px;
        bottom: 2px;
        background-color: white;
        -webkit-transition: .4s;
        transition: .4s;
    }

input:checked + .slider {
    background-color: #2196F3;
}

input:focus + .slider,
input:focus-visible + .slider {
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.45);
}

input:disabled + .slider {
    opacity: 0.55;
    cursor: not-allowed;
}

input:checked + .slider:before {
    -webkit-transform: translateX(26px);
    -ms-transform: translateX(26px);
    transform: translateX(26px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 34px;
}

    .slider.round:before {
        border-radius: 50%;
    }

.blink {
    animation: blink 1s infinite;
}

@keyframes blink {
    0% {
        opacity: 1;
    }

    75% {
        opacity: 1;
    }

    76% {
        opacity: 0;
    }

    100% {
        opacity: 0;
    }
}

.If, .Else, .CustomCondition {
    border: 1px;
    border-style: dotted;
    margin-top: 3px;
    margin-bottom: 3px;
    border-width: thin;
    padding-bottom: 3px;
    padding-top: 3px;
}

/* The web resource responds to the dialog/iframe width, not the host page. */
#MainWindow {
    min-width: 0;
    max-width: 100%;
}

#MainWindow .form-control {
    min-width: 0;
    max-width: 100%;
}

.editor-selection {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 7fr) minmax(100px, 2fr);
    gap: 8px;
    padding: 5px 8px;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 8px;
    padding: 0 8px 5px;
}

.editor-row-actions, .editor-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.editor-status {
    flex: 1 1 200px;
    min-width: 0;
    overflow-wrap: anywhere;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

#ButtonRetryPublish {
    flex-shrink: 0;
    font-weight: 600;
}

#h5Refresh[data-save-status="saved-unpublished"],
#h5Refresh[data-save-status="saved-unpublished-draft-dirty"],
#h5Refresh[data-save-status="published-saved-version-draft-dirty"] {
    color: #8a6d3b !important;
    background-color: #fcf8e3;
    border: 1px solid #faebcc;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.9rem;
    margin-bottom: 0;
}

.editor-tools {
    margin-left: auto;
}

.editor-tools .btn-info {
    min-width: 72px;
}

#Table {
    table-layout: fixed;
}

#Table th:first-child {
    width: auto !important;
}

#Table th:last-child {
    width: 68px !important;
}

#Table td, #Table th {
    overflow-wrap: anywhere;
}

#Table > tbody > tr > td {
    border-top: 3px double #2196F3;
    border-bottom: 3px double #2196F3;
}

#Table > tbody > tr > td:first-child {
    border-left: 3px double #2196F3;
}

#Table > tbody > tr > td:last-child {
    border-right: 3px double #2196F3;
}

#Table td.rule-delete {
    position: relative;
    padding-bottom: 48px;
}

.rule-row-number {
    position: absolute;
    top: 56px;
    bottom: 8px;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #005a9e;
    font-size: 1.5rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    pointer-events: none;
}

.rule-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 3px;
}

.rule-column-label {
    margin: 0;
    white-space: nowrap;
}

.rule-field {
    flex: 1 1 200px;
    max-width: 380px;
    min-width: 140px;
}

.rule-branch-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
}

.rule-branch-actions:empty {
    display: none;
}

.rule-toggles {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.rule-toggle-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.rule-toggle-label {
    margin: 0;
    white-space: nowrap;
}

.rule-toggle-item .switch {
    margin: 0;
}

.rule-actions {
    display: flex;
    flex-direction: row-reverse;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
}

#MainWindow .Condition, #MainWindow .Return {
    display: grid;
    align-items: start;
    gap: 4px 8px;
    margin: 0 0 2px;
}

#MainWindow .Condition {
    /* Keep field columns aligned, including rows with Delete If Condition. */
    grid-template-columns: 88px minmax(0, 3fr) minmax(0, 3fr) minmax(90px, 1fr) minmax(0, 3fr) 150px;
}

#MainWindow .Return {
    grid-template-columns: minmax(0, 1fr) 64px 64px minmax(0, 5fr) 40px minmax(110px, 3fr);
    align-items: center;
}

.Condition > *, .Return > *, .rule-heading > * {
    min-width: 0;
}

.condition-actions {
    text-align: right;
}

.if-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    padding: 0 5px;
}

.if-heading > label {
    margin: 0;
}

.return-icon img {
    max-width: 100%;
    cursor: pointer;
}

.Else > .form-row > .return-label {
    flex: 0 0 88px;
    max-width: 88px;
}

#MainWindow .If, #MainWindow .Else, #MainWindow .CustomCondition {
    padding: 3px;
}

#MainWindow .CustomCondition {
    border-color: #005a9e;
    background-color: #f8fbff;
    padding: 8px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.custom-source-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0 4px 6px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.custom-source-label {
    margin: 0;
    text-align: left !important;
}

.custom-context-hint {
    font-size: 12px;
    color: #323130;
    background-color: #eef6fc;
    border: 1px solid #cfe4fa;
    border-radius: 3px;
    padding: 4px 8px;
    overflow-wrap: anywhere;
}

.custom-context-hint code,
.custom-code-help code {
    color: #004578;
}

textarea.custom-code-editor {
    font-family: Consolas, "Courier New", monospace;
    font-size: 12.5px;
    line-height: 1.45;
    min-height: 120px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    resize: vertical;
    white-space: pre;
    overflow: auto;
    tab-size: 4;
}

textarea.custom-code-editor:focus {
    border-color: #0078d4;
    box-shadow: 0 0 0 0.15rem rgba(0, 120, 212, 0.25);
}

textarea.custom-code-editor:disabled {
    background-color: #e9ecef;
    color: #605e5c;
    cursor: not-allowed;
}

.custom-code-help {
    margin-top: 2px;
}

.rule-disabled .return-icon img {
    opacity: 0.55;
    cursor: not-allowed;
}

.CustomCondition .Return .rule-actions:empty {
    display: none;
}

/* Keep the icon collection inside its dialog at every width. */
#DialogIcons .bt-glyphicons {
    width: auto;
    max-width: 100%;
    padding: 0;
}

.icon-picker-scroll {
    overflow-y: auto;
    max-height: 355px;
    max-height: min(355px, 50vh);
}

#DialogIcons .modal-footer {
    flex-wrap: wrap;
    gap: 8px;
}

#DialogIcons .modal-footer > * {
    margin: 0;
}

#DialogIcons .modal-footer > div {
    flex: 1 1 100%;
    max-width: 100%;
    padding: 0;
    overflow-wrap: anywhere;
}

#DialogIcons .modal-footer > button {
    flex: 0 1 auto;
    width: auto;
    max-width: 100%;
}

#DialogHelp .modal-body {
    overflow-wrap: anywhere;
}

@media (max-width: 1199.98px) {
    /* Adjust spacing only in narrow dialogs; keep desktop and button styling. */
    #MainWindow .rule-heading {
        margin-bottom: 8px;
    }

    #MainWindow .If, #MainWindow .Else, #MainWindow .CustomCondition {
        margin: 10px 0;
        padding: 10px;
    }

    #MainWindow .Condition {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 8px;
        margin: 0;
    }

    #MainWindow .Condition + .Condition {
        margin-top: 12px;
    }

    /* jQuery shows these controls inline; omit their wrappers while hidden. */
    #MainWindow .condition-compare:not(:has(> .form-control[style]:not([style*="display: none"]))),
    #MainWindow .condition-value:not(:has(> .form-control[style]:not([style*="display: none"]))) {
        display: none;
    }

    .condition-label {
        grid-column: 1;
        text-align: left;
    }

    .condition-actions {
        grid-column: 2;
        grid-row: 1;
        text-align: right;
    }

    .condition-spacer, .condition-actions:empty {
        display: none;
    }

    .condition-label {
        max-width: 100px;
        margin: 0;
    }

    #MainWindow .Return {
        grid-template-columns: 64px 32px minmax(0, 1fr) 36px max-content;
        margin-top: 12px;
    }

    .return-spacer {
        display: none;
    }

    .Return .rule-actions {
        grid-column: auto;
        flex-wrap: nowrap;
    }

    .Else > .form-row > .return-label {
        text-align: left;
    }
}

#MainWindow .rule-heading:has(+ div:empty),
#MainWindow .rule-heading:has(+ div[style*="display: none"]) {
    margin-bottom: 0;
}

@media (max-width: 767.98px) {
    .editor-selection {
        grid-template-columns: minmax(0, 1fr) 100px;
    }

    #SelectEntity {
        grid-column: 1 / -1;
    }

    .editor-status {
        flex-basis: 100%;
        order: 1;
    }

    .editor-status:has(> [style*="display: none"]) {
        display: none;
    }

    #Table, #Table tbody {
        display: block;
        width: 100%;
    }

    #Table {
        border: 0;
        padding: 0 8px;
    }

    #Table thead {
        display: none;
    }

    #Table tbody > tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        margin-bottom: 12px;
        border: 3px double #2196F3;
    }

    #Table > tbody > tr > td,
    #Table > tbody > tr > td:first-child,
    #Table > tbody > tr > td:last-child {
        min-width: 0;
        padding: 8px;
        border: 0;
    }

    #Table .rule-delete {
        grid-column: 1 / -1;
        grid-row: 1;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
        background-color: #b8daff;
    }

    #Table td.rule-delete {
        padding-bottom: 8px;
    }

    .rule-row-number {
        position: static;
        order: -1;
        margin-right: auto;
    }

    .rule-delete::before {
        content: attr(data-label);
        font-weight: bold;
    }

    #Table .switch {
        margin: 0;
    }

    #Table tbody > tr > td.rule-main {
        grid-column: 1 / -1;
        grid-row: 2;
        display: block;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .rule-column-label {
        flex: 0 0 100%;
    }

    .rule-field {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .rule-toggles {
        margin-left: 0;
        width: 100%;
        justify-content: flex-start;
    }

    .custom-source-group {
        padding: 0 0 6px;
    }

    #MainWindow .Condition {
        grid-template-columns: minmax(90px, 1fr) minmax(0, 2fr);
    }

    .condition-field, .condition-operator {
        grid-column: 1 / -1;
    }

    #MainWindow .labelIfAndReturn {
        text-align: left;
    }

    #MainWindow .Return {
        grid-template-columns: 32px minmax(0, 1fr) 36px max-content;
    }

    .return-label {
        grid-column: 1 / -1;
    }

    #DialogHelp #help .row > div {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

@media (max-width: 575.98px) {
    .editor-selection {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 399.98px) {
    #MainWindow .Return .return-tooltip {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    #MainWindow .Return .return-icon {
        grid-column: 1;
        grid-row: 3;
    }

    #MainWindow .Return .return-picker {
        grid-column: 3;
        grid-row: 3;
    }

    #MainWindow .Return .rule-actions {
        grid-column: 4;
        grid-row: 3;
    }
}


/* Custom tabs for Custom JavaScript condition */
.custom-tabs {
    border-bottom: 1px solid #c8c8c8;
    margin-bottom: 0;
}

.custom-tabs .nav-item {
    margin-bottom: -1px;
}

.custom-tabs .nav-link {
    font-size: 12px;
    font-weight: 500;
    padding: 3px 14px;
    color: #495057;
    background-color: #f3f2f1;
    border: 1px solid #c8c8c8;
    border-bottom: none;
    border-top-left-radius: 3px;
    border-top-right-radius: 3px;
    margin-right: 2px;
    cursor: pointer;
}

.custom-tabs .nav-link:hover {
    color: #005a9e;
    background-color: #fdfdfd;
}

.custom-tabs .nav-link.active {
    color: #005a9e;
    background-color: #ffffff;
    border-color: #c8c8c8 #c8c8c8 #ffffff;
    border-bottom: 1px solid #ffffff;
    font-weight: 600;
}

.custom-tab-content {
    background-color: #ffffff;
    border: 1px solid #c8c8c8;
    border-top: none;
    border-radius: 0 0 3px 3px;
    padding: 6px 8px;
    margin-bottom: 6px;
}

.custom-variables-container {
    max-height: 190px;
    overflow-y: auto;
    border: 1px solid #c8c8c8;
    border-radius: 2px;
    background-color: #ffffff;
}

.custom-variables-table {
    margin-bottom: 0;
    font-size: 12px;
    border-collapse: collapse;
}

.custom-variables-table thead th {
    position: sticky;
    top: 0;
    background-color: #f3f2f1;
    color: #323130;
    font-weight: 600;
    font-size: 11.5px;
    border-top: none !important;
    border-bottom: 1px solid #c8c8c8 !important;
    border-left: none !important;
    border-right: none !important;
    padding: 6px 8px;
    z-index: 2;
}

.custom-variables-table thead th:not(:first-child) {
    border-left: 1px solid #e1dfdd !important;
}

.custom-variables-table tbody tr {
    border-bottom: 1px solid #edebe9 !important;
}

.custom-variables-table tbody td {
    padding: 5px 8px;
    vertical-align: middle;
    border-top: none !important;
    border-bottom: 1px solid #edebe9 !important;
    border-left: none !important;
    border-right: none !important;
}

.custom-variables-table tbody td:not(:first-child) {
    border-left: 1px solid #e1dfdd !important;
}

.custom-variables-table tbody tr:last-child td {
    border-bottom: none !important;
}

.custom-variables-table code {
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    color: #004578;
    background-color: #f0f6ff;
    padding: 2px 5px;
    border-radius: 3px;
    white-space: nowrap;
}

.custom-var-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-copy-var {
    color: #005a9e;
    background: transparent;
    border: 1px solid transparent;
    padding: 2px 4px;
    border-radius: 3px;
    cursor: pointer;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    transition: all 0.15s ease;
}

.btn-copy-var:hover {
    background-color: #e8f0fe;
    border-color: #c2d7fe;
    color: #004578;
}

.btn-copy-var:active {
    background-color: #d2e3fc;
}

.custom-variable-type-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #495057;
    background-color: #f8f9fa;
    border: 1px solid #ced4da;
    border-radius: 3px;
    white-space: nowrap !important;
}


.custom-validate-btn {
    font-size: 11.5px;
    font-weight: 500;
    padding: 2px 8px;
    margin-bottom: 2px;
    margin-right: 2px;
    color: #005a9e;
    background-color: #f8f9fa;
    border: 1px solid #c8c8c8;
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    line-height: 1.4;
    transition: all 0.15s ease;
}

.custom-validate-btn:hover {
    background-color: #e8f0fe;
    border-color: #005a9e;
    color: #004578;
}

.custom-validate-status {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.custom-validate-status svg {
    vertical-align: middle;
}
