@font-face {
    font-family: 'Rabar';
    src: url('../Fonts/Rabar.ttf') format('truetype');
}

html,
body {
    font-family: 'Rabar', 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
    height: 100%;
    overflow: hidden;
}

/* Lock the main layout to viewport and make the content area scroll */
.mud-layout {
    height: 100vh !important;
    height: 100dvh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

.AppMainContainer {
    flex: 1 !important;
    overflow-y: auto !important;
    min-height: 0 !important;
}



/* Kleshe Custom Popup Styles */
.Backdrop {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    inset: 0;
    height: 100%;
    width: 100%;
    left: 0px;
    bottom: 0px;
    right: 0px;
    top: 0px;
    opacity: 0;
    background-color: rgba(0, 0, 0, 0.5);
    transition: opacity 225ms cubic-bezier(0.4, 0.0, 0.2, 1);
    backdrop-filter: blur(4px);
}

.Backdrop.show {
    opacity: 1;
}

.PopupContainer {
    background-color: var(--mud-palette-background, #fff);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
    transition: opacity 225ms cubic-bezier(0.0, 0, 0.2, 1), transform 225ms cubic-bezier(0.0, 0, 0.2, 1);
    will-change: transform, opacity;
    color: var(--mud-palette-text-primary, #000) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);

    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
}

.PopupContainer.popup-show {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.PopupContainer>.Header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    flex-shrink: 0;
    border-bottom: 1px solid rgba(128, 128, 128, 0.1);
}

.PopupContainer>.Header>.HeaderTitle {
    font-size: clamp(16px, 4vw, 20px);
    font-weight: 700;
}

.PopupContainer>.ScrollableBody {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 24px;
}

.PopupContainer .ButtonsContainer {
    display: flex;
    flex-direction: row;
    justify-content: end;
    gap: 10px;
    margin-top: 24px;
    padding-top: 15px;
}

.mud-snackbar-container {
    z-index: 10000000 !important;
}

/* Horizontal & Vertical Touch Scrollbar for POS Tables - Pinned Scrollbar */
html body .grid-container {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    padding-bottom: 55px !important;
}

html body .pos-new-datagrid {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    height: 100% !important;
    min-height: 0 !important;
}

html body .pos-new-datagrid .mud-table-container {
    overflow-x: auto !important;
    overflow-y: auto !important;
    max-width: 100% !important;
    max-height: calc(100vh - 195px) !important;
    -webkit-overflow-scrolling: touch;
}

html body .pos-new-datagrid .mud-table-head,
html body .pos-new-datagrid .mud-table-head .mud-table-cell {
    position: sticky !important;
    top: 0 !important;
    z-index: 2 !important;
    background-color: var(--mud-palette-surface) !important;
    color: var(--mud-palette-text-primary) !important;
    font-weight: bold !important;
}

/* Hide column options menu (3 vertical dots icon) in all table column headers */
html body .mud-table-column-options-button,
html body .mud-column-options-button,
html body .mud-data-grid-header-options {
    display: none !important;
}

/* Hide sort index number badge (e.g. 1) in table headers */
html body .mud-data-grid-sort-index,
html body .sort-number,
html body .mud-sort-index,
html body .sort-index {
    display: none !important;
}

/* Custom Sleek Scrollbars for Tables and Containers */
.pos-new-datagrid .mud-table-container::-webkit-scrollbar,
.AppMainContainer::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.pos-new-datagrid .mud-table-container::-webkit-scrollbar-track,
.AppMainContainer::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
}

.pos-new-datagrid .mud-table-container::-webkit-scrollbar-thumb,
.AppMainContainer::-webkit-scrollbar-thumb {
    background: var(--mud-palette-lines-default, rgba(128, 128, 128, 0.4));
    border-radius: 4px;
}

.pos-new-datagrid .mud-table-container::-webkit-scrollbar-thumb:hover,
.AppMainContainer::-webkit-scrollbar-thumb:hover {
    background: var(--mud-palette-primary);
}

/* Fix MudBlazor tab slider positioning issues globally in RTL */
.mud-tabs-slider {
    display: none !important;
}

.mud-tab {
    border-bottom: 2px solid transparent !important;
    transition: border-bottom-color 0.2s ease, color 0.2s ease;
}

.mud-tab.mud-tab-active {
    color: var(--mud-palette-primary) !important;
    border-bottom: 2px solid var(--mud-palette-primary) !important;
}


.add-btn {
    height: 38px !important;
    margin-top: 4px !important;
}

.print-btn {
    background-color: #3796b0 !important;
    color: white !important;
    margin-top: 1px !important;
}

/* Barcode & Label Thermal Printing Styles */
@page {
    size: landscape;
    margin: 0 !important;
    padding: 0 !important;
}

@media print {
    html,
    body {
        margin: 0 !important;
        padding: 0 !important;
        background-color: #ffffff !important;
        width: 100% !important;
        height: 100% !important;
    }

    /* Hide all application elements and modals by default during print */
    body * {
        visibility: hidden !important;
    }

    /* Show barcode and receipt print containers and their elements */
    .barcode-print-container,
    .barcode-print-container *,
    .print-receipt-container,
    .print-receipt-container * {
        visibility: visible !important;
    }

    .print-receipt-container {
        display: block !important;
        position: absolute !important;
        top: 5px !important;
        left: 0 !important;
        margin: 0 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        font-family: 'Rabar', Arial, sans-serif;
        color: black !important;
        background-color: white !important;
        padding: 2mm 3mm 6mm 3mm !important;
        box-sizing: border-box !important;
        direction: rtl !important;
    }

    .barcode-print-container {
        display: flex !important;
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        justify-content: center !important;
        align-items: center !important;
        background-color: #ffffff !important;
        color: #000000 !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        z-index: 99999999 !important;
        page-break-inside: avoid !important;
        page-break-after: avoid !important;
        page-break-before: avoid !important;
        break-inside: avoid !important;
        break-after: avoid !important;
        break-before: avoid !important;
        overflow: hidden !important;
    }

    .barcode-label {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        height: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        text-align: center !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .barcode-label .barcode-title {
        font-size: 7.5pt !important;
        font-weight: bold !important;
        text-align: center !important;
        color: #000000 !important;
        margin: 0 !important;
        padding: 0 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 100% !important;
        line-height: 1.1 !important;
    }

    .barcode-label svg {
        max-width: 100% !important;
        width: auto !important;
        height: auto !important;
        display: block !important;
        margin: 0 auto !important;
        padding: 0 !important;
    }

    .barcode-label .barcode-price {
        font-size: 7.5pt !important;
        font-weight: 600 !important;
        text-align: center !important;
        color: #000000 !important;
        margin: 0 0 1px 0 !important;
        padding: 0 !important;
        direction: ltr !important;
        line-height: 1.1 !important;
    }
}

/* --- Report Print Styles --- */
@media print {
    body.printing-report * {
        visibility: hidden !important;
    }
    
    body.printing-report .report-print-container,
    body.printing-report .report-print-container * {
        visibility: visible !important;
    }
    
    body.printing-report .report-print-container {
        position: absolute !important;
        left: 0 !important;
        top: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body.printing-report .grid-container, 
    body.printing-report .pos-new-datagrid,
    body.printing-report .mud-table-container {
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
    }

    body.printing-report .d-print-none,
    body.printing-report .d-print-none * {
        display: none !important;
        visibility: hidden !important;
    }
}