/* Final cross-application UI fixes. Loaded last to override DevExpress/theme styles. */

/* Keep the dashboard panel close to the viewport edges without affecting other pages. */
body:has(.nexa-dashboard-page) .nexa-content {
    padding: 6px !important;
}

body:has(.orders-page) .nexa-content {
    height: 100%;
    min-height: 0;
    overflow: hidden !important;
    padding: 4px !important;
}

body:has(.orders-page) .nexa-page {
    height: 100%;
    min-height: 0;
}

body:has(.trades-page) .nexa-content {
    height: 100%;
    min-height: 0;
    overflow: hidden !important;
    padding: 4px !important;
}

body:has(.trades-page) .nexa-page {
    height: 100%;
    min-height: 0;
}

@media (max-width: 760px) {
    body:has(.nexa-dashboard-page) .nexa-content {
        padding: 4px !important;
    }
}

/* Persian date editors and calendar surfaces. */
.dxbl-date-edit,
.dxbl-date-edit input,
.dxbl-calendar,
.dxbl-calendar * {
    direction: rtl !important;
    text-align: right !important;
    font-family: var(--nexa-font-family, "Vazirmatn", Tahoma, sans-serif) !important;
}

.dxbl-calendar .dxbl-calendar-content,
.dxbl-calendar table {
    direction: rtl !important;
}

/* Mark every invalid Blazor or DevExpress editor clearly. */
input.invalid,
textarea.invalid,
select.invalid,
.invalid input,
.invalid textarea,
.invalid select,
.dxbl-text-edit.invalid,
.dxbl-spin-edit.invalid,
.dxbl-combobox.invalid,
.dxbl-date-edit.invalid,
.dxbl-edit.invalid,
.dxbl-text-edit:has(.invalid),
.dxbl-spin-edit:has(.invalid),
.dxbl-combobox:has(.invalid),
.dxbl-date-edit:has(.invalid),
.dxbl-edit:has(.invalid),
[aria-invalid="true"],
[aria-invalid="true"] .dxbl-edit,
[aria-invalid="true"] input {
    border-color: #dc2626 !important;
    background-color: #fff7f7 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14) !important;
}

.validation-message,
.dxbl-validation-message,
.dxbl-form-layout-item-validation-message {
    color: #b91c1c !important;
    font-weight: 800 !important;
}

.nexa-grid-empty-state {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    min-height: 210px !important;
    width: 100% !important;
    padding: 28px !important;
    color: #5f5749 !important;
    background: linear-gradient(180deg, #fffdf8 0%, #faf7f0 100%) !important;
    font-family: var(--nexa-font-family, "Vazirmatn", Tahoma, sans-serif) !important;
    font-size: 1rem !important;
    text-align: center !important;
}

.nexa-grid-empty-state__icon {
    display: block;
    margin-bottom: 4px;
    font-size: 2rem;
    line-height: 1;
}

.nexa-grid-empty-state strong {
    color: #4f4637;
    font-size: 1rem;
    font-weight: 900;
}

.nexa-grid-empty-state small {
    color: #8a7e6a;
    font-size: 0.82rem;
    font-weight: 700;
}

/* Compact all data grids and master-detail tables. */
.dxbl-grid .dxbl-grid-data-row > td,
.dxbl-grid tbody tr:not([class*="empty"]) > td {
    height: 40px !important;
    min-height: 40px !important;
    padding-top: 5px !important;
    padding-bottom: 5px !important;
    vertical-align: middle !important;
}

.dxbl-grid .dxbl-grid-header-row > td,
.dxbl-grid .dxbl-grid-header-row > th {
    height: 42px !important;
    min-height: 42px !important;
    padding-top: 7px !important;
    padding-bottom: 7px !important;
}

.dxbl-grid .nexa-action-button,
.nexa-table .nexa-action-button {
    min-height: 30px !important;
    padding: 4px 10px !important;
    font-size: 0.8rem !important;
}

.nexa-table th,
.nexa-table td {
    padding-top: 7px !important;
    padding-bottom: 7px !important;
    vertical-align: middle !important;
}

/* Light sidebar matching the gold/cream site palette. */
.nexa-side-menu {
    color: #3f3a31 !important;
    background: linear-gradient(180deg, #fffdf8 0%, #f8f3e8 100%) !important;
    border-left: 1px solid #e7dcc4 !important;
    box-shadow: -8px 0 24px rgba(120, 91, 28, 0.08) !important;
}

.nexa-menu-toolbar {
    border-bottom-color: #eadfc9 !important;
}

.nexa-menu-toolbar-title,
.nexa-menu-section-title {
    color: #76684d !important;
}

.nexa-menu-toggle,
.nexa-mobile-menu-trigger {
    color: #73570f !important;
    background: #fff !important;
    border-color: #ddcfaf !important;
    box-shadow: 0 5px 14px rgba(120, 91, 28, 0.12) !important;
}

.nexa-menu-toggle:hover,
.nexa-mobile-menu-trigger:hover {
    color: #4f3b08 !important;
    background: #f8efd9 !important;
    border-color: #c8ac68 !important;
}

.nexa-menu-item {
    color: #554d40 !important;
}

.nexa-menu-item:hover {
    color: #3f3218 !important;
    background: #f3ead6 !important;
    border-color: #e3d2ad !important;
}

.nexa-menu-item.active {
    color: #3f2f08 !important;
    background: linear-gradient(90deg, #f1dfaa, #ead195) !important;
    border-color: #d4b96f !important;
    box-shadow: 0 8px 20px rgba(161, 117, 20, 0.16) !important;
}

.nexa-menu-item.active::before {
    background: #9a6c08 !important;
}

.nexa-menu-icon-wrap,
.nexa-menu-item.active .nexa-menu-icon-wrap {
    color: #5c513f !important;
    background: #fff !important;
    border: 1px solid #dfd3ba !important;
    box-shadow: 0 3px 10px rgba(95, 72, 24, 0.08) !important;
}

/* The mobile menu must open as a full text drawer, even if desktop mode was collapsed. */
@media (max-width: 900px) {
    .nexa-side-menu,
    .nexa-side-menu.is-collapsed {
        position: fixed !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        z-index: 1001 !important;
        width: min(86vw, 310px) !important;
        min-width: min(86vw, 310px) !important;
        max-width: 310px !important;
        height: 100dvh !important;
        flex: 0 0 min(86vw, 310px) !important;
        padding: 76px 12px 14px !important;
        transform: translateX(105%) !important;
    }

    .nexa-side-menu.is-mobile-open,
    .nexa-side-menu.is-collapsed.is-mobile-open {
        transform: translateX(0) !important;
    }

    .nexa-side-menu .nexa-menu-toolbar {
        justify-content: flex-start !important;
    }

    .nexa-side-menu .nexa-menu-toolbar-title,
    .nexa-side-menu .nexa-menu-text,
    .nexa-side-menu .nexa-menu-section-title,
    .nexa-side-menu.is-collapsed .nexa-menu-toolbar-title,
    .nexa-side-menu.is-collapsed .nexa-menu-text,
    .nexa-side-menu.is-collapsed .nexa-menu-section-title {
        display: block !important;
    }

    .nexa-side-menu .nexa-menu-item,
    .nexa-side-menu.is-collapsed .nexa-menu-item {
        justify-content: flex-start !important;
        gap: 12px !important;
        width: 100% !important;
        margin: 0 0 7px !important;
        padding: 0 12px !important;
    }

    .nexa-side-menu .nexa-menu-icon-wrap,
    .nexa-side-menu.is-collapsed .nexa-menu-icon-wrap {
        flex: 0 0 38px !important;
        width: 38px !important;
        min-width: 38px !important;
    }
}

/* Ensure menu icons are visible even when Bootstrap Icons font is unavailable. */
.ledger-tools {
    display: flex;
    align-items: end;
    gap: 0.75rem;
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid #e7dcc4;
    border-radius: 1rem;
    background: #fffdf8;
}

.ledger-tools .nexa-form-field {
    flex: 1;
    max-width: 520px;
}

@media (max-width: 760px) {
    .ledger-tools {
        align-items: stretch;
        flex-direction: column;
    }

    .ledger-tools .nexa-form-field {
        max-width: none;
    }
}

/* Ensure menu icons are visible even when Bootstrap Icons font is unavailable. */
.nexa-menu-icon::before {
    display: inline-block;
    width: 1.2em;
    text-align: center;
    font-family: "Segoe UI Symbol", "Arial Unicode MS", sans-serif !important;
    font-size: 1rem;
    font-style: normal;
    font-weight: 700;
    line-height: 1;
}

.bi-house-door-fill::before {
    content: "⌂" !important;
}
.bi-receipt-cutoff::before {
    content: "▤" !important;
}
.bi-arrow-left-right::before {
    content: "⇄" !important;
}
.bi-truck::before {
    content: "▰" !important;
}
.bi-bank2::before,
.bi-bank::before {
    content: "▥" !important;
}
.bi-cash-stack::before {
    content: "≋" !important;
}
.bi-coin::before {
    content: "◉" !important;
}
.bi-journal-text::before {
    content: "▤" !important;
}
.bi-buildings-fill::before {
    content: "▦" !important;
}
.bi-people-fill::before {
    content: "♟" !important;
}
.bi-box-fill::before,
.bi-box-seam-fill::before {
    content: "□" !important;
}
.bi-house-gear-fill::before {
    content: "⚙" !important;
}
.bi-credit-card-2-front-fill::before {
    content: "▭" !important;
}
.bi-graph-up-arrow::before,
.bi-bar-chart-fill::before {
    content: "▥" !important;
}
.bi-clipboard2-check-fill::before {
    content: "✓" !important;
}
.bi-chevron-double-left::before {
    content: "«" !important;
}
.bi-chevron-double-right::before {
    content: "»" !important;
}
.bi-list::before {
    content: "☰" !important;
}
.bi-x-lg::before {
    content: "×" !important;
}
@media print {
    body * {
        visibility: hidden !important;
    }

    .delivery-print-sheet,
    .delivery-print-sheet * {
        visibility: visible !important;
    }

    .delivery-print-sheet {
        position: absolute !important;
        inset: 0 !important;
        width: 100% !important;
    }
}
