/* X12 Local Editor and X12 JSON Converter, styled like the edifabric.com EDI Spec Builder */

body.edn-tool {
    padding-top: 55px;
    color: #5d6778;
    background-color: #fff;
}

.edn-tool .header .site-logo .df-logo {
    display: inline-flex;
    align-items: center;
    font-family: Poppins, sans-serif;
    font-weight: 700;
}

.edn-tool .header .site-logo .avatar {
    display: inline-block;
    width: 32px;
    height: 32px;
}

/* ---------- Page ---------- */
.tool-page {
    padding: 2rem 0 0;
}

.tool-container {
    max-width: 1560px;
}

.tool-page h1 {
    margin: 0.25rem 0 0.75rem;
    font-size: 1.75rem;
    font-weight: 700;
    color: #252930;
}

.tool-modes {
    display: inline-flex;
    gap: 2px;
    margin-bottom: 1rem;
    padding: 3px;
    border: 1px solid #e7e9ed;
    border-radius: 0.6rem;
    background-color: #f8f9fc;
}

.tool-mode {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.9rem;
    border-radius: 0.45rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #5d6778;
    white-space: nowrap;
}

.tool-mode i {
    margin-right: 0.45rem;
    font-size: 0.75rem;
}

.tool-mode:hover,
.tool-mode:focus {
    color: #252930;
    text-decoration: none;
}

.tool-mode.active {
    color: #4550E6;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(27, 46, 75, 0.12);
}

/* ---------- Header menus ---------- */
.edn-tool .header .api-key-btn.theme-toggle {
    margin-left: 0.125rem;
}


.edn-tool .header .nav-menu {
    min-width: 320px;
    padding: 0.5rem;
    border: 1px solid #e7e9ed;
    border-radius: 0.75rem !important;
}

.edn-tool .header .nav-menu .dropdown-header {
    padding: 0.5rem 0.75rem 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8a94a6;
}

.edn-tool .header .nav-menu .dropdown-divider {
    margin: 0.5rem 0;
    border-color: #e7e9ed;
}

.edn-tool .header .nav-menu .dropdown-item {
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    white-space: normal;
}

.edn-tool .header .nav-menu .dropdown-item:hover,
.edn-tool .header .nav-menu .dropdown-item:focus {
    background-color: #f8f9fc;
}

.edn-tool .header .nav-menu .dropdown-item.active {
    background-color: #f1f2fe;
}

.edn-tool .header .nav-menu .theme-icon-holder {
    flex: 0 0 32px;
    height: 32px;
    margin-right: 0.75rem;
    border-radius: 0.5rem;
    background-color: #eef0fd;
    color: #4550E6;
    font-size: 0.8125rem;
}

.edn-tool .header .nav-menu .logo-ef-bg {
    background: url("../img/edifabric.png") center / cover no-repeat;
}

.edn-tool .header .nav-menu .nav-menu-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.3;
    color: #252930;
}

.edn-tool .header .nav-menu .dropdown-item.active .nav-menu-label {
    color: #4550E6;
}

.edn-tool .header .nav-menu .nav-menu-label small {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.75rem;
    font-weight: 400;
    color: #8a94a6;
}

@media (max-width: 991.98px) {
    .edn-tool .header .nav-menu {
        min-width: 0;
        border: 0;
        box-shadow: none !important;
    }
}

.tool-intro {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    margin-bottom: 1.5rem;
}

.tool-lead {
    max-width: 960px;
    margin-bottom: 0;
    font-size: 1rem;
}

.tool-intro .privacy-pill {
    margin-right: 0;
}

/* ---------- File panel ---------- */
.tool-file {
    margin-bottom: 1.5rem;
    border: 1px solid #e7e9ed;
    border-radius: 0.75rem;
}

.tool-file-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: #f8f9fc;
    border-bottom: 1px solid #e7e9ed;
    border-radius: 0.75rem 0.75rem 0 0;
}

.tool-file-head h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #252930;
}

.tool-file-actions {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.tool-file-actions .btn-primary {
    color: #fff;
}

.tool-file-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    overflow: hidden;
    opacity: 0;
    z-index: -1;
}

.tool-file-input + label {
    cursor: pointer;
}

.tool-file .dropdown-menu {
    max-height: 70vh;
    overflow-y: auto;
    font-size: 0.875rem;
}

.tool-file .dropdown-menu,
.tool-actions .dropdown-menu {
    padding: 0.375rem;
}

.tool-file .dropdown-item,
.tool-actions .dropdown-item {
    padding: 0.4rem 0.75rem;
    border-radius: 0.375rem;
}

.tool-file .dropdown-item:hover,
.tool-file .dropdown-item:focus,
.tool-actions .dropdown-item:hover,
.tool-actions .dropdown-item:focus {
    color: #4550E6;
    background-color: #f1f2fe;
}

.tool-actions .dropdown-item:hover i,
.tool-actions .dropdown-item:focus i {
    color: #4550E6;
}

.tool-file .dropdown-header {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #8392a5;
    text-transform: uppercase;
}

.tool-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #252930;
}

.tool-status-dot {
    flex: 0 0 auto;
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 50%;
}

.tool-section {
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid #e7e9ed;
}

.tool-section-title {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #8392a5;
    text-transform: uppercase;
}

.tool-props {
    display: grid;
    grid-template-columns: 5.5rem 1fr;
    gap: 0.25rem 1rem;
    margin: 0;
    font-size: 0.8125rem;
}

.tool-props + .tool-props {
    margin-top: 0.25rem;
}

.tool-props .tool-rules {
    white-space: pre-line;
}

#liStatus.tool-status {
    display: flex;
    white-space: normal;
}

#liStatusSpinner:not(.d-none) + #liStatusIcon {
    display: none;
}

.tool-props dt {
    font-weight: 600;
    color: #252930;
}

.tool-props dd {
    margin: 0;
    min-width: 0;
    color: #5d6778;
    overflow-wrap: anywhere;
}

.tool-props dd.tool-mono,
.tool-props .tool-mono {
    font-family: SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.75rem;
}

.tool-props dd p {
    margin: 0;
    white-space: pre-line;
}

.tool-splitter {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.tool-splitter code {
    font-size: 0.75rem;
    color: #252930;
    word-break: break-all;
}

.tool-splitter .btn-link {
    padding: 0;
    font-size: 0.8125rem;
    line-height: 1.2;
}

/* ---------- Errors ---------- */
#errors-panel .dataTables_wrapper {
    margin: 0 -0.5rem;
}

table.dataTable.errors-table {
    border-collapse: collapse;
}

table.dataTable.errors-table thead {
    display: none;
}

table.dataTable.errors-table.no-footer,
table.dataTable.errors-table tbody tr {
    background-color: transparent;
    border-bottom: 0;
}

table.dataTable.errors-table td {
    padding: 0.4rem 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #b42318;
    white-space: normal;
    word-break: break-word;
    cursor: pointer;
    border: 0;
    border-radius: 0.25rem;
}

table.dataTable.errors-table tbody tr:hover td {
    background-color: #fdeeee;
}

table.dataTable.errors-table tbody tr.selected td {
    color: #252930;
    background-color: #fbd9d6;
}

#errors-panel .dataTables_paginate {
    float: none;
    padding: 0.5rem 0 0;
    text-align: center;
}

#errors-panel .dataTables_paginate .paginate_button {
    min-width: 2rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.8125rem;
    border: 0;
    border-radius: 0.25rem;
}

#errors-panel .dataTables_paginate .paginate_button.current,
#errors-panel .dataTables_paginate .paginate_button.current:hover {
    color: #fff !important;
    background: #4550E6;
    border: 0;
}

#errors-panel .dataTables_paginate .paginate_button:hover {
    color: #252930 !important;
    background: #f1f2f8;
    border: 0;
}

/* ---------- Tool ---------- */
.tool-app {
    margin-bottom: 1.5rem;
    border: 1px solid #e7e9ed;
    border-radius: 0.75rem;
    overflow: hidden;
}

.tool-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e7e9ed;
}

.tool-actions .btn {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.tool-actions .btn-primary {
    color: #fff;
}

.tool-actions .tool-divider {
    width: 1px;
    height: 1.5rem;
    margin: 0 0.25rem;
    background-color: #e7e9ed;
}

.tool-actions .btn-group .collapse.show,
.tool-actions .btn-group .collapsing {
    display: flex;
}

.tool-actions .settings-input {
    height: 100%;
    padding: 0 0.75rem;
    font-size: 0.8125rem;
    color: #252930;
    border: 1px solid #6c757d;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    outline: 0;
}

.tool-actions .settings-input.tool-model {
    width: 260px;
}

.tool-actions .settings-input.tool-split {
    width: 80px;
}

.tool-actions .btn-group > .btn.active {
    color: #fff;
    background-color: #6c757d;
}

.tool-actions .dropdown-menu {
    font-size: 0.875rem;
}

.tool-actions .dropdown-item i {
    width: 1.25rem;
    color: #8392a5;
}

.tool-actions .ml-auto {
    margin-left: auto;
}

.tool-panes {
    display: flex;
}

.tool-pane {
    flex: 1 1 50%;
    min-width: 0;
}

.tool-resizer {
    position: relative;
    z-index: 2;
    flex: 0 0 9px;
    margin: 0 -4px;
    cursor: col-resize;
    touch-action: none;
}

.tool-resizer::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 4px;
    width: 1px;
    background-color: #e7e9ed;
    transition: background-color 0.15s, left 0.15s, width 0.15s;
}

.tool-resizer::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 1px;
    width: 7px;
    height: 32px;
    transform: translateY(-50%);
    background-color: #fff;
    border: 1px solid #e7e9ed;
    border-radius: 4px;
    transition: border-color 0.15s;
}

.tool-resizer:hover::before,
.tool-resizer:focus-visible::before,
.tool-resizer.dragging::before {
    left: 3px;
    width: 3px;
    background-color: #4550E5;
}

.tool-resizer:hover::after,
.tool-resizer:focus-visible::after,
.tool-resizer.dragging::after {
    border-color: #4550E5;
}

.tool-resizer:focus {
    outline: none;
}

body.tool-resizing {
    cursor: col-resize;
    user-select: none;
}

.tool-tabs {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 1rem 0;
    background-color: #f8f9fc;
    border-bottom: 1px solid #e7e9ed;
}

.tool-tabs .nav-tabs {
    border-bottom: 0;
}

.tool-tabs .nav-link {
    padding: 0.4rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #5d6778;
    background-color: transparent;
}

.tool-tabs .nav-link.active {
    color: #4550E6;
    background-color: #fff;
}

.tool-tabs .nav-link.static {
    cursor: default;
}

.tool-tabs-note {
    padding-bottom: 0.45rem;
    font-size: 0.75rem;
    color: #8392a5;
    white-space: nowrap;
}

.tool-code,
#spec-tree,
.tool-empty {
    height: calc(100vh - 300px);
    min-height: 440px;
    max-height: 760px;
}

#spec-tree {
    padding: 0.5rem;
    overflow: auto;
}

.tool-empty {
    padding: 3rem 1.5rem;
    font-size: 0.875rem;
    color: #8392a5;
    text-align: center;
}

.tool-empty > .fas {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 1.75rem;
    color: #b4bdce;
}

.tool-empty + #spec-tree {
    display: none;
}

.tool-empty.d-none + #spec-tree {
    display: block;
}

/* ---------- Editor and tree details ---------- */
.errorMarker2 {
    position: absolute;
    z-index: 20;
    background: #b42318;
    opacity: 0.2;
}

.ace_gutter-cell.ace_error {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%23dc3545' viewBox='-2 -2 7 7'%3e%3cpath stroke='%23dc3545' d='M0 0l3 3m0-3L0 3'/%3e%3ccircle r='.5'/%3e%3ccircle cx='3' r='.5'/%3e%3ccircle cy='3' r='.5'/%3e%3ccircle cx='3' cy='3' r='.5'/%3e%3c/svg%3E");
}

.ace-tm .ace_marker-layer .ace_selection {
    background: #e5e7fd;
}

.jstree-default .jstree-anchor {
    font-size: 0.8125rem;
    color: #252930;
}

.jstree-default .jstree-hovered {
    background: #f1f2f8;
    border-radius: 0.25rem;
    box-shadow: none;
}

.jstree-default .jstree-clicked {
    background: #e5e7fd;
    border-radius: 0.25rem;
    box-shadow: none;
}

#spec-tree li a[id^="_"] {
    font-weight: 600;
}

.jsTreeS, .jsTreeL, .jsTreeA, .jsTreeM, .jsTreeE, .jsTreeC, .jsTreeCS {
    background-position: center center !important;
    background-size: auto;
}

.jsTreeS { background-image: url('../../lib/jstree/segment.svg') !important; }
.jsTreeL { background-image: url('../../lib/jstree/loop.svg') !important; }
.jsTreeA { background-image: url('../../lib/jstree/all.svg') !important; }
.jsTreeM { background-image: url('../../lib/jstree/message.svg') !important; }
.jsTreeE { background-image: url('../../lib/jstree/element.svg') !important; }
.jsTreeC { background-image: url('../../lib/jstree/composite.svg') !important; }
.jsTreeCS { background-image: url('../../lib/jstree/control.svg') !important; }

/* ---------- Buttons ---------- */
.edn-tool .btn.btn-light {
    color: #252930;
    background-color: #fff;
    border-color: #e7e9ed;
}

.edn-tool .btn.btn-light:hover,
.edn-tool .btn.btn-light:focus {
    color: #252930;
    background-color: #e9ebee;
    border-color: #e2e5e9;
}

.edn-tool .btn:disabled,
.edn-tool .btn.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ---------- Notifications and dialogs ---------- */
.tool-toast {
    position: fixed;
    top: 90px;
    right: 1rem;
    z-index: 1080;
    min-width: 280px;
    max-width: 380px;
}

.tool-toast.bg-toast .toast-header {
    color: #b42318;
    background-color: #fdeeee;
}

.tool-toast.bg-toast-success .toast-header {
    color: #0f6b3d;
    background-color: #eefaf3;
}

.tool-toast .toast-body {
    font-size: 0.875rem;
    background-color: #fff;
}

.tool-modal-note {
    font-size: 0.8125rem;
    color: #5d6778;
}

.edn-tool .modal .btn-primary {
    color: #fff;
}

.edn-tool .modal-footer {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.edn-tool .modal-footer .tool-modal-help {
    margin-right: auto;
    font-size: 0.8125rem;
}

.edn-tool .modal-title {
    color: #252930;
}

#ack-editor {
    height: 50vh;
    border: 1px solid #e7e9ed;
    border-radius: 0.5rem;
}

.tool-validate-levels .custom-control {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

/* ---------- Content below the tool ---------- */
.edn-tool .edn-seo {
    margin-top: 2rem;
    background-color: #f8f9fc;
    border-bottom: 1px solid #e7e9ed;
}

.edn-tool .edn-seo .edn-cta {
    background-color: #fff;
}

.edn-tool .faq-section h3 {
    color: #252930;
}

.edn-tool .footer .footer-tagline {
    max-width: 640px;
    margin: 0 auto 1rem;
    padding: 0 1rem;
    font-style: italic;
    color: #8392a5;
}

@media (min-width: 992px) {
    body.edn-tool {
        padding-top: 60px;
    }
}

@media (max-width: 991.98px) {
    .tool-panes {
        flex-direction: column;
    }

    .tool-pane {
        flex: 1 1 auto !important;
    }

    .tool-pane:last-child {
        border-top: 1px solid #e7e9ed;
    }

    .tool-resizer {
        display: none;
    }

    .tool-code,
    #spec-tree {
        height: 420px;
        min-height: 0;
    }

    .tool-file #errors-panel {
        max-height: 360px;
        overflow: auto;
    }
}

@media (max-width: 575.98px) {
    .tool-actions .settings-input.tool-model {
        width: 180px;
    }

    .tool-tabs-note {
        display: none;
    }
}
