/* The product's links with the suppliers' products: the "Furnizori" tab of the product form and the
   question after a rename (js/views/subViews/ProductSupplierLinksPanel.js, _docs/product-supplier-links.md).
   A table from 768px; on a phone every link is a card with the column names before the values. */

.product-supplier-links-panel {
    clear: both;
    padding: 10px 15px 15px;
}

.psl-intro {
    margin: 0 0 12px;
    max-width: 760px;
}

.psl-msg,
.psl-error {
    margin: 0 0 12px;
}

.psl-error {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.psl-loading,
.psl-empty {
    margin: 12px 0;
}

.psl-empty {
    max-width: 760px;
    padding: 12px 14px;
    border: 1px dashed #ccc;
    border-radius: 4px;
    background: #fafafa;
}

.psl-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin: 0 0 8px;
}

.psl-check-all-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-weight: normal;
    cursor: pointer;
}

.psl-check-all-label input,
.psl-check,
.psl-dialog-check {
    margin: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.psl-confirm {
    margin: 0 0 12px;
    padding: 12px 14px;
    border: 1px solid #ebccd1;
    border-radius: 4px;
    background: #fdf5f5;
}

.psl-confirm-question {
    margin: 0 0 6px;
}

.psl-consequence {
    margin: 0 0 10px;
    color: #8a6d3b;
}

.psl-confirm-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.psl-table {
    margin-bottom: 0;
}

.psl-table > thead > tr > th {
    white-space: nowrap;
}

.psl-table > tbody > tr > td {
    vertical-align: middle;
    word-break: break-word;
}

.psl-table .psl-col-check {
    width: 34px;
}

.psl-table .psl-col-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
}

.psl-row-checked > td {
    background: #f5f9fd;
}

.psl-supplier-name,
.psl-sku {
    display: block;
}

.psl-sku {
    font-weight: 600;
}

.psl-supplier-tax,
.psl-seller,
.psl-memory,
.psl-factor {
    display: block;
    font-size: 12px;
}

.psl-supplier-off {
    display: inline-block;
    margin-top: 3px;
}

.psl-delete-one {
    padding-left: 4px;
    padding-right: 4px;
    color: #a94442;
}

.psl-delete-one:hover,
.psl-delete-one:focus {
    color: #843534;
}

/* the purchase costs from the NIRs, under the links */
.psl-costs-section {
    margin-top: 22px;
}

.psl-section-title {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
}

.psl-costs-note {
    margin: 0 0 8px;
    max-width: 760px;
    font-size: 12px;
}

.psl-costs {
    margin-bottom: 0;
}

.psl-costs > thead > tr > th {
    white-space: nowrap;
}

.psl-costs > tbody > tr > td {
    vertical-align: top;
    word-break: break-word;
}

.psl-costs .psl-num {
    text-align: right;
}

.psl-cost {
    display: block;
    font-weight: 600;
    white-space: nowrap;
}

.psl-cost-sub,
.psl-trend {
    display: block;
    font-size: 12px;
}

.psl-trend-up {
    color: #a94442;
}

.psl-trend-down {
    color: #3c763d;
}

.psl-trend-same {
    color: #777;
}

.psl-costs-all > td {
    border-top: 2px solid #ddd;
    background: #fafafa;
}

.psl-costs-all .psl-supplier-name {
    font-weight: 600;
}

/* the question after a rename */
.psl-dialog-text {
    margin: 0 0 8px;
}

.psl-dialog-list {
    max-height: 45vh;
    margin: 0 0 8px;
    padding: 0;
    overflow-y: auto;
    list-style: none;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
}

.psl-dialog-list > li + li {
    border-top: 1px solid #eee;
}

.psl-dialog-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    padding: 10px 12px;
    font-weight: normal;
    cursor: pointer;
}

.psl-dialog-item .psl-dialog-check {
    flex: 0 0 auto;
    margin-top: 2px;
}

.psl-dialog-item-text {
    min-width: 0;
    word-break: break-word;
}

.psl-dialog-msg:empty {
    display: none;
}

.psl-dialog-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

/* while a delete runs the dialog stays (no X, no Esc, no backdrop) */
.psl-dialog-busy .psl-dialog-x {
    visibility: hidden;
}

@media (max-width: 767px) {
    .product-supplier-links-panel {
        padding: 8px 10px 12px;
    }

    /* every link a card: the checkbox and "Șterge" on the first line, then the columns with their names */
    .psl-table,
    .psl-table > tbody,
    .psl-table > tbody > tr,
    .psl-table > tbody > tr > td {
        display: block;
        width: 100%;
    }

    .psl-table > thead {
        display: none;
    }

    .psl-table > tbody > tr {
        position: relative;
        margin: 0 0 10px;
        padding: 8px 10px 4px 40px;
        border: 1px solid #ddd;
        border-radius: 4px;
        background: #fff;
    }

    .psl-table > tbody > tr > td {
        padding: 3px 0;
        border-top: 0;
    }

    .psl-table .psl-col-check {
        position: absolute;
        top: 10px;
        left: 12px;
        width: auto;
        padding: 0;
    }

    .psl-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        color: #777;
        text-transform: uppercase;
        letter-spacing: 0.02em;
    }

    .psl-table .psl-col-actions {
        width: 100%;
        text-align: left;
    }

    .psl-delete-one {
        min-height: 36px;
        padding-left: 0;
    }

    .psl-toolbar .psl-delete-selected,
    .psl-confirm-buttons .btn {
        min-height: 36px;
    }

    .psl-confirm-buttons .btn {
        flex: 1 1 auto;
    }

    .psl-dialog-footer .btn {
        flex: 1 1 100%;
        margin: 0;
        white-space: normal;
    }

    /* every supplier a card: its name on top, then the four costs two by two */
    .psl-costs,
    .psl-costs > tbody {
        display: block;
        width: 100%;
    }

    .psl-costs > thead {
        display: none;
    }

    .psl-costs > tbody > tr {
        display: flex;
        flex-wrap: wrap;
        margin: 0 0 10px;
        padding: 8px 10px 6px;
        border: 1px solid #ddd;
        border-radius: 4px;
        background: #fff;
    }

    .psl-costs > tbody > tr.psl-costs-all {
        background: #fafafa;
        border-width: 2px;
    }

    .psl-costs > tbody > tr > td,
    .psl-costs-all > td {
        display: block;
        flex: 1 1 50%;
        min-width: 0;
        padding: 4px 8px 4px 0;
        border-top: 0;
        background: transparent;
    }

    .psl-costs > tbody > tr > td.psl-cost-supplier {
        flex-basis: 100%;
        padding-bottom: 6px;
    }

    .psl-costs .psl-num {
        text-align: left;
    }

    .psl-costs td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        color: #777;
        text-transform: uppercase;
        letter-spacing: 0.02em;
    }

    .psl-cost {
        white-space: normal;
    }

    /* the safe choice on top on a phone */
    .psl-dialog-footer .psl-dialog-keep {
        order: -1;
    }
}
