/* Offer / Order CSS */

/*
 * CIO-AI-Driven:
 * Extracted from Offer/Order transaction edit template.
 * Scope all rules to the transaction edit wrapper to avoid global side effects.
 */

.offer-order-transaction-edit tbody,
.offer-order-transaction-edit td,
.offer-order-transaction-edit tfoot,
.offer-order-transaction-edit th,
.offer-order-transaction-edit thead,
.offer-order-transaction-edit tr {
    border: 0;
}

.offer-order-transaction-edit th {
    text-align: center;
}

.offer-order-transaction-edit th > small {
    display: flex;
    flex-direction: column;
    font-weight: 300;
    font-size: 0.7em;
}

.offer-order-transaction-edit table {
    border-color: #fff;
    border-collapse: separate;
}

.offer-order-transaction-edit .input-number {
    max-width: 90px;
    text-align: right;
    padding: 2px !important;
}

.offer-order-transaction-edit .number-format {
    text-align: right;
}

.offer-order-transaction-edit .number-format input {
    width: 97px;
}

.offer-order-transaction-edit .row td {
    padding: 5px;
    border: none;
}

.offer-order-transaction-edit .th-id {
    width: 10%;
    text-align: left;
}

.offer-order-transaction-edit .th-title {
    width: 50%;
    text-align: left;
}

.offer-order-transaction-edit .th-name {
    width: 15%;
}

.offer-order-transaction-edit .th-date {
    width: 15%;
    text-align: right;
}

.offer-order-transaction-edit .td-id {
    text-align: left;
    vertical-align: top;
}

.offer-order-transaction-edit .td-title {
    text-align: left;
    vertical-align: top;
}

.offer-order-transaction-edit .td-name {
    vertical-align: top;
}

.offer-order-transaction-edit .td-date {
    text-align: center;
}

.offer-order-transaction-edit .td-delete {
    text-align: right;
    vertical-align: top;
}

.offer-order-transaction-edit .move {
    display: flex;
    font-size: 20px;
    color: #3cdfff;
}

.offer-order-transaction-edit .new-transaction > tbody::before {
    content: '';
    display: block;
    height: 15px;
}

.offer-order-transaction-edit .editable {
    background-color: #f3f3fb;
    border: none;
    border-radius: 25px;
}

.offer-order-transaction-edit .edit-image {
    max-height: 300px;
    max-width: 300px;
}

.offer-order-transaction-edit #positions-app-sidebar {
    position: fixed;
    z-index: 10000;
    background-color: #2c3b41;
    right: 0;
    top: 0;
    height: 100vh;
    width: 350px;
    color: var(--sidebar-menu-color);
}

.offer-order-transaction-edit div.content-wrapper article#form-title-action-bar,
.offer-order-transaction-edit article#form-title-action-bar .content-header {
    background-color: var(--form-header-background);
}

/* ------------------------------------------------------ */
/* Offer/Order header action bar: secondary vs main groups */
/* ------------------------------------------------------ */

/*
 * CIO-AI-Driven:
 * Match datagrid UX where actions are split into:
 * - .global-actions-secondary
 * - .global-actions-main
 */
.ea .content-header .page-actions .global-actions.global-actions-split.global-actions-split--form-header {
    display: flex;
    justify-content: flex-start;
    flex-direction: column;
    align-items: flex-end;
    flex-wrap: wrap;
    width: 100%;
    column-gap: .75rem;
    row-gap: .5rem;
}

.ea .content-header .page-actions .global-actions-split--form-header .global-actions-secondary,
.ea .content-header .page-actions .global-actions-split--form-header .global-actions-main {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: .5rem;
}

/* Avoid double spacing (EasyAdmin uses margin-left between adjacent buttons) */
.ea .content-header .page-actions .global-actions-split--form-header .btn + .btn {
    margin-left: 0 !important;
}

/* Anchor offsets (sticky header) */
.offer-order-transaction-edit #areaSupplierOrder {
    scroll-margin-top: 90px;
}

.offer-order-transaction-edit td.clickable {
    cursor: pointer;
}

.offer-order-transaction-edit table.prices-table {
    table-layout: auto;
}

.offer-order-transaction-edit table.prices-table tr th {
    padding: 0 5px;
    width: 100px;
    max-width: 100px;
    box-sizing: border-box;
}

.offer-order-transaction-edit table.prices-table tr td {
    max-width: 100px;
    box-sizing: border-box;
}

.offer-order-transaction-edit table.prices-table input {
    border: 1px solid #767676;
    box-shadow: none;
    box-sizing: border-box;
    padding: 5px;
    border-radius: 5px;
}

.offer-order-transaction-edit table.prices-table input:disabled {
    background-color: #ecf0f5;
    box-shadow: none;
}

.offer-order-transaction-edit table.prices-table.prices-table-full tr td {
    max-width: 150px;
}

.offer-order-transaction-edit table.prices-table.prices-table-full input[type="text"],
.offer-order-transaction-edit table.prices-table.prices-table-full input[type="number"] {
    max-width: 100%;
    width: 100%;
}

.offer-order-transaction-edit .product-title-format {
    width: 100%;
    font-weight: 700;
    margin-bottom: 5px;
    padding: 2px;
    border: 1px solid #767676;
    border-radius: 5px;
    box-shadow: none;
}

.offer-order-transaction-edit .product-description-format {
    width: 100%;
    height: 60px;
    max-height: 200px;
    padding: 2px;
    border: 1px solid #767676;
    border-radius: 5px;
    box-shadow: none;
}

/* ---------------------------- */
/* TranslationFields custom CSS */
/* ---------------------------- */

.form-group .form-control.is-invalid,
.form-group .form-select.is-invalid,
.form-group textarea.is-invalid {
    border-color: var(--form-input-border-color) !important;
}

/* CIO-AI-Driven: Keep translation field errors readable without stealing input width */
.ciosix-translations-global-edit-translation-group .d-flex > .invalid-feedback {
    flex: 0 1 260px;
    max-width: 260px;
    white-space: normal;
    overflow-wrap: anywhere;
    margin: 0;
    padding: 0 0 0 15px;
}

.ciosix-translations-global-edit-translation-group .d-flex > .form-control,
.ciosix-translations-global-edit-translation-group .d-flex > .form-select,
.ciosix-translations-global-edit-translation-group .d-flex > textarea {
    flex: 1 1 auto;
    min-width: 0;
}

/* ------------------------------ */
/* Internal customer notes (Offer) */
/* ------------------------------ */

/* CIO-AI-Driven: Collapse long internal notes by default to ~6 lines and allow expanding. */
.offer-order-transaction-edit #internalCustomerNotesAlert.internal-customer-notes {
    /* keep bootstrap alert spacing, just ensure consistent layout */
}

.offer-order-transaction-edit #internalCustomerNotesAlert .internal-customer-notes__content {
    /* line clamping works best with -webkit-box */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    /* if notes come as plain text with newlines (no <br>), still show line breaks */
    white-space: pre-line;
}

.offer-order-transaction-edit #internalCustomerNotesAlert.internal-customer-notes--collapsed .internal-customer-notes__content {
    -webkit-line-clamp: 6;
}

.offer-order-transaction-edit #internalCustomerNotesAlert.internal-customer-notes--expanded .internal-customer-notes__content {
    display: block;
    overflow: visible;
}

.offer-order-transaction-edit #internalCustomerNotesAlert .internal-customer-notes__toggle {
    text-decoration: none;
}

/* ------------------------------ */
/* Order: Supplies (Delivery) info */
/* ------------------------------ */

/* CIO-AI-Driven: Permanently visible supply position summary inside the Delivery Note Number cell */
.offer-order-transaction-edit .order-supply-inline {
    display: grid;
    row-gap: .25rem;
}

.offer-order-transaction-edit .order-supply-inline__delivery-note-number {
    font-weight: 600;
}

.offer-order-transaction-edit .order-supply-inline__table-wrap {
    padding: .35rem .5rem;
    border-radius: .375rem;
    border: 1px solid var(--bs-border-color, rgba(0, 0, 0, .15));
    background: var(--bs-tertiary-bg, #f8f9fa);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6);
}

.offer-order-transaction-edit table.order-supply-inline__table {
    font-size: .875rem;
}

.offer-order-transaction-edit table.order-supply-inline__table th,
.offer-order-transaction-edit table.order-supply-inline__table td {
    padding-top: .25rem;
    padding-bottom: .25rem;
}

.offer-order-transaction-edit table.order-supply-inline__table thead th {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .02em;
    color: var(--bs-secondary-color, #6c757d);
    border-bottom-color: var(--bs-border-color, rgba(0, 0, 0, .15));
}

.offer-order-transaction-edit table.order-supply-inline__table tbody tr + tr td {
    border-top-color: rgba(0, 0, 0, .06);
}

.offer-order-transaction-edit .order-supply-inline__article-number {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.offer-order-transaction-edit .order-supply-inline__article-text {
    white-space: normal;
    overflow-wrap: anywhere;
}

.offer-order-transaction-edit .order-supply-inline__flag {
    display: inline-block;
    min-width: 1.25rem;
    font-weight: 700;
}

.offer-order-transaction-edit .order-supply-inline__flag--complete {
    color: var(--bs-success, #198754);
}

.offer-order-transaction-edit .order-supply-inline__flag--partial {
    color: var(--bs-secondary-color, #6c757d);
}

.offer-order-transaction-edit .order-supply-inline__qty-badge {
    display: inline-block;
    font-variant-numeric: tabular-nums;
    padding: .05rem .4rem;
    border-radius: 999px;
    border: 1px solid var(--bs-border-color, rgba(0, 0, 0, .15));
    background: var(--bs-tertiary-bg, #f8f9fa);
    color: var(--bs-body-color, #212529);
    line-height: 1.2;
}

.offer-order-transaction-edit .order-supply-inline__qty-badge--success {
    background: var(--bs-success-bg-subtle, #d1e7dd);
    border-color: var(--bs-success-border-subtle, #badbcc);
    color: var(--bs-success-text-emphasis, #0f5132);
}

.offer-order-transaction-edit .order-supply-inline__qty-badge--warning {
    background: var(--bs-warning-bg-subtle, #fff3cd);
    border-color: var(--bs-warning-border-subtle, #ffecb5);
    color: var(--bs-warning-text-emphasis, #664d03);
}

/* CIO-AI-Driven: Sourcing multi-shop dropdown should align & stretch like other full-width action buttons */
.offer-order-transaction-edit .sourcing-shop-dropdown {
    width: 100%;
}

.offer-order-transaction-edit .sourcing-shop-dropdown {
    position: relative;
}

.offer-order-transaction-edit .sourcing-shop-dropdown .dropdown-menu {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Dropdown in table footer: keep it in flow and full width under the button */
.offer-order-transaction-edit .sourcing-shop-dropdown > .dropdown-menu {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
