/* =========================================================================
   POS Register — dialogs.css
   Per-dialog rules migrated out of Components/*.razor.css.

   Rules whose class name is unique to one dialog stand alone; anything
   generic enough to collide (.mud-*, .selected-row, .btn-cancel) is
   anchored under that dialog's root class. Shared dialog primitives —
   the .ci-* form layout and the currency-dialog .denom-* block — live in
   components.css, not here.
   ========================================================================= */

/* =========================================================================
   GiftReceiptItemsDialog — item picker, no prices shown
   ========================================================================= */
.gr-item-list {
    display: flex;
    flex-direction: column;
    gap: var(--pos-space-2);
    max-height: 320px;
    overflow-y: auto;
}

.gr-item-row {
    display: flex;
    align-items: center;
    gap: var(--pos-space-4);
}

.gr-item-desc {
    flex: 1 1 auto;
}

.gr-item-qty {
    width: 90px;
}

.gr-item-of {
    color: var(--pos-text-muted);
    font-size: 0.85rem;
}

/* =========================================================================
   QuoteSaleConfirmDialog — label-on-left, fixed label column so the
   read-only boxes align on a common edge at a common size
   ========================================================================= */
.qs-form {
    display: flex;
    flex-direction: column;
    gap: var(--pos-space-7);
}

.qs-row {
    display: flex;
    align-items: center;
    gap: var(--pos-space-4);
}

.qs-label {
    width: 120px;
    min-width: 120px;
    font-size: 0.875rem;
    color: var(--pos-text);
}

.qs-input {
    width: 300px;
    min-width: 300px;
}

/* =========================================================================
   ReprintCriteriaDialog — column layout of the legacy "Reprint Receipt"
   ========================================================================= */
.rc-form {
    display: flex;
    flex-direction: column;
    gap: var(--pos-space-7);
}

.rc-row {
    display: flex;
    align-items: center;
    gap: var(--pos-space-4);
}

.rc-label {
    width: 200px;
    min-width: 200px;
}

.rc-input {
    width: 220px;
    min-width: 220px;
}

.rc-input .mud-picker {
    width: 220px;
}

/* =========================================================================
   SelectReprintDocumentTypeDialog — keyboard-navigable tile grid
   ========================================================================= */
.dt-tile-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--pos-space-6);
    padding: var(--pos-space-2) var(--pos-space-4);
}

.dt-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--pos-space-4);
    padding: var(--pos-space-9) var(--pos-space-6);
    border: 2px solid var(--pos-border-light);
    border-radius: var(--pos-radius-lg);
    cursor: pointer;
    user-select: none;
}

.dt-tile:hover {
    border-color: var(--pos-primary);
}

.dt-tile-selected {
    border-color: var(--pos-primary);
    background-color: var(--pos-primary-soft);
}

.dt-tile-icon {
    font-size: 32px;
    line-height: 1;
}

.dt-tile-label {
    font-weight: var(--pos-weight-medium);
}

/* =========================================================================
   SelectTransactionForReprintDialog
   .selected-row and .mud-table-root were bare under ::deep; both are
   anchored to .grid-container here so they cannot reach other Mud tables.
   ========================================================================= */
.grid-container .selected-row {
    background-color: var(--pos-surface-accent) !important;
}

.grid-container .selected-row:hover {
    background-color: var(--pos-chrome-2) !important;
}

.grid-container .selected-row td {
    background-color: var(--pos-surface-accent) !important;
    color: var(--pos-text-on-dark) !important;
}

.grid-container .mud-table-root {
    border: 1px solid var(--pos-neutral-200);
    border-radius: var(--pos-radius);
    overflow: hidden;
}

.sort-hint {
    display: flex;
    align-items: center;
    gap: var(--pos-space-8);
    font-size: 0.78rem;
    color: var(--pos-neutral-500);
    padding: 0 var(--pos-space-2);
    flex-wrap: wrap;
}

.sort-hint span:first-child {
    font-weight: var(--pos-weight-bold);
    color: var(--pos-chrome);
}

/* =========================================================================
   TenderResultsDialog
   ========================================================================= */
.tender-results-body {
    display: flex;
    flex-direction: column;
    gap: var(--pos-space-9);
    padding: var(--pos-space-10);
    background: var(--pos-surface);
    min-width: 320px;
}

/* Header label — matches .payment-method-label in TenderAmountDialog */
.results-title-label {
    background: var(--pos-surface-accent);
    color: var(--pos-text-on-dark);
    padding: var(--pos-space-5) var(--pos-space-9);
    text-align: center;
    font-size: var(--pos-font-2xl);
    font-weight: var(--pos-weight-normal);
    border-radius: var(--pos-radius-lg);
    letter-spacing: 1px;
    box-shadow: var(--pos-shadow-sm);
}

/* Field rows — matches .amount-fields / .amount-field in TenderAmountDialog */
.results-fields {
    display: flex;
    flex-direction: column;
    gap: var(--pos-space-6);
}

.results-field {
    display: flex;
    flex-direction: column;
    gap: var(--pos-space-4);
}

.results-field label {
    font-size: var(--pos-font-lg);
    font-weight: var(--pos-weight-semibold);
    color: var(--pos-text-black);
    letter-spacing: 0.3px;
}

/* =========================================================================
   ChangeDialog
   ========================================================================= */
.change-dialog-body {
    padding: var(--pos-space-4) 0;
    display: flex;
    flex-direction: column;
    gap: var(--pos-space-9);
}

.change-info-rows {
    display: flex;
    flex-direction: column;
    gap: var(--pos-space-4);
}

.change-info-row {
    display: flex;
    align-items: center;
    gap: var(--pos-space-6);
}

.change-info-label {
    font-size: var(--pos-font-lg);
    font-weight: var(--pos-weight-semibold);
    color: var(--pos-text-black);
    min-width: 140px;
}

.change-info-value {
    font-size: var(--pos-font-lg);
    color: var(--pos-chrome);
}

.change-amount-section {
    display: flex;
    flex-direction: column;
    gap: var(--pos-space-6);
}

.change-option-row {
    display: flex;
    align-items: center;
    gap: var(--pos-space-5);
    padding: var(--pos-space-3) 0;
}

.change-option-label {
    font-size: var(--pos-font-lg);
    font-weight: var(--pos-weight-semibold);
    color: var(--pos-text-black);
    min-width: 180px;
}

.change-option-amount {
    font-size: var(--pos-font-lg);
    font-weight: var(--pos-weight-bold);
    color: var(--pos-chrome);
    font-family: 'Segoe UI', 'Courier New', monospace;
}

/* =========================================================================
   TransactionReceiptDialog
   ========================================================================= */
.receipt-dialog-body {
    display: flex;
    flex-direction: column;
    gap: var(--pos-space-9);
    padding: var(--pos-space-4) 0;
}

.receipt-dialog-heading {
    font-size: var(--pos-font-2xl);
    font-weight: var(--pos-weight-bold);
    color: var(--pos-chrome);
    margin: 0;
}

.receipt-action-buttons {
    display: flex;
    gap: var(--pos-space-10);
}

.receipt-btn {
    flex: 1;
    padding: 18px 0;
    font-size: var(--pos-font-xl);
    font-weight: var(--pos-weight-semibold);
    color: var(--pos-text-on-dark);
    background-color: var(--pos-success-strong);
    border: none;
    border-radius: var(--pos-radius);
    cursor: pointer;
    transition: background-color 0.15s;
}

.receipt-btn:hover:not(:disabled) {
    background-color: var(--pos-success-strong);
}

.receipt-btn:active:not(:disabled) {
    background-color: var(--pos-success-strong);
}

.receipt-btn:disabled {
    background-color: var(--pos-primary-light);
    cursor: not-allowed;
}

.receipt-email-section {
    display: flex;
    flex-direction: column;
    gap: var(--pos-space-3);
}

.receipt-email-label {
    font-size: var(--pos-font-lg);
    font-weight: var(--pos-weight-semibold);
    color: var(--pos-chrome);
}

/* =========================================================================
   RecallQuoteSearchDialog — fixed-width method column keeps every input
   aligned on a common left edge regardless of radio-label length
   ========================================================================= */
.rq-form {
    display: flex;
    flex-direction: column;
    gap: var(--pos-space-7);
}

.rq-row {
    display: flex;
    align-items: center;
    gap: var(--pos-space-4);
}

/* Sized to fit the longest label ("Current Customer"). */
.rq-method {
    width: 170px;
    min-width: 170px;
}

/* All input rows share a total width so every box lines up on both edges. */
.rq-input {
    width: 360px;
    min-width: 360px;
}

/* Date row spans the same width; the two pickers split it evenly so each is
   wide enough for a full date (dd/MM/yyyy + calendar icon). */
.rq-dates {
    display: flex;
    align-items: center;
    gap: var(--pos-space-2);
    width: 360px;
}

.rq-date {
    flex: 1 1 0;
    min-width: 0;
}

/* =========================================================================
   DrawerCountDialog
   The .mud-dialog-content compaction was bare under ::deep; it is anchored
   to .drawer-count-dialog (added to the MudDialog) so it cannot reach
   every other dialog in the app.
   ========================================================================= */
.drawer-count-dialog .mud-dialog-content {
    padding-top: var(--pos-space-4);
    padding-bottom: var(--pos-space-4);
}

.dc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--pos-space-3);
    padding-bottom: var(--pos-space-3);
    border-bottom: 1px solid var(--pos-border-light);
    font-size: var(--pos-font-lg);
}

.dc-header-label {
    color: var(--pos-text-muted);
}

.dc-header-value {
    font-weight: var(--pos-weight-semibold);
    color: var(--pos-text);
}

.drawer-count-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: var(--pos-space-1);
    font-size: var(--pos-font-lg);
}

.drawer-count-table thead th {
    text-align: left;
    font-weight: var(--pos-weight-semibold);
    text-transform: uppercase;
    font-size: var(--pos-font-base);
    letter-spacing: .04em;
    color: var(--pos-text-muted);
    padding: var(--pos-space-2) var(--pos-space-6);
    border-bottom: 2px solid var(--pos-border-light);
}

.drawer-count-table th.num,
.drawer-count-table td.num {
    text-align: right;
}

.drawer-count-table tbody td {
    padding: var(--pos-space-2) var(--pos-space-6);
    border-bottom: 1px solid var(--pos-border-light);
    font-variant-numeric: tabular-nums;
}

.drawer-count-table tbody tr.dc-clickable {
    cursor: pointer;
}

.drawer-count-table tbody tr:hover {
    background: var(--pos-scrim-05);
}

.dc-cash-input {
    width: 100px;
    text-align: right;
    padding: var(--pos-space-2) var(--pos-space-4);
    border: 1px solid var(--pos-border-input);
    border-radius: var(--pos-radius);
    font-size: var(--pos-font-lg);
    font-variant-numeric: tabular-nums;
}

.dc-cash-input:focus {
    outline: none;
    border-color: var(--pos-primary);
    box-shadow: 0 0 0 2px var(--pos-primary-soft);
}

.dc-muted {
    color: var(--pos-neutral-400);
}

.drawer-count-table tbody tr.dc-error-row td {
    color: var(--pos-danger);
    font-weight: var(--pos-weight-semibold);
}

.dc-over {
    color: var(--pos-success-strong);
    font-weight: var(--pos-weight-semibold);
}

.dc-short {
    color: var(--pos-danger);
    font-weight: var(--pos-weight-semibold);
}

/* Summary panel */
.dc-summary {
    margin-top: var(--pos-space-4);
    padding: var(--pos-space-4) var(--pos-space-7);
    background: var(--pos-surface-muted);
    border: 1px solid var(--pos-border-light);
    border-radius: var(--pos-radius-md);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1px var(--pos-space-12);
    font-size: var(--pos-font-md);
}

.dc-summary .label {
    color: var(--pos-text-muted);
}

.dc-summary .value {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.dc-summary .total-label,
.dc-summary .total-value {
    font-weight: var(--pos-weight-bold);
    color: var(--pos-text);
    border-top: 1px solid var(--pos-border-light);
    padding-top: var(--pos-space-2);
    margin-top: var(--pos-space-1);
}

.dc-notes {
    margin-top: var(--pos-space-3);
}

/* =========================================================================
   TenderDialog  (root: .tender-dialog on the MudDialog)

   Dropped as dead — the dialog was converted from a hand-rolled modal to
   MudDialog and this chrome no longer exists in markup:
     .tender-modal-overlay / -content / -header, .close-button,
     .tender-actions, .btn-tender-action, .btn-tender-cancel,
     .payment-method-btn, .green, .yellow
   The .mud-table-* overrides were bare under ::deep and are anchored to
   .tender-dialog so they cannot restyle every Mud table in the app.
   ========================================================================= */
.refund-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--pos-space-5);
    background: var(--pos-danger-strong);
    color: var(--pos-text-on-dark);
    font-size: var(--pos-font-3xl);
    font-weight: var(--pos-weight-bold);
    letter-spacing: 2px;
    padding: var(--pos-space-5) var(--pos-space-9);
    text-transform: uppercase;
}

.refund-indicator__icon {
    font-size: 24px !important;
    color: var(--pos-text-on-dark) !important;
}

.tender-modal-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: var(--pos-surface-muted);
}

/* ---- Left section ------------------------------------------------------ */
.tender-left-section {
    width: 35%;
    padding: var(--pos-space-6);
    display: flex;
    flex-direction: column;
    gap: var(--pos-space-5);
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid var(--pos-chrome-2);
}

.tender-totals,
.payment-status {
    background: var(--pos-surface-accent);
    border-radius: var(--pos-radius-lg);
    padding: var(--pos-space-6) var(--pos-space-7);
    color: var(--pos-text-on-dark);
}

.total-row,
.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--pos-space-2) 0;
    font-size: var(--pos-font-md);
}

/* Labels — slightly muted so values stand out */
.total-row span:first-child,
.status-row span:first-child {
    color: var(--pos-overlay-light-72);
}

/* Values — full white by default */
.total-row span:last-child,
.status-row span:last-child {
    color: var(--pos-text-on-dark);
    font-size: var(--pos-font-md);
}

/* Total Owed highlight row */
.total-row.highlight {
    border-top: 1px solid var(--pos-overlay-light-2);
    padding-top: var(--pos-space-5);
    margin-top: var(--pos-space-3);
    font-weight: var(--pos-weight-semibold);
}

.total-row.highlight span:first-child {
    color: var(--pos-text-on-dark);
}

/* ---- Payments table — dark theme --------------------------------------- */
.tender-dialog .mud-table {
    background: var(--pos-neutral-900) !important;
    box-shadow: none !important;
    border-radius: var(--pos-radius-lg);
    overflow: hidden;
}

.tender-dialog .mud-table-head .mud-table-cell {
    background: var(--pos-chrome-2) !important;
    color: var(--pos-text-on-dark) !important;
    font-size: var(--pos-font-base) !important;
    font-weight: var(--pos-weight-semibold) !important;
    border-bottom: 2px solid var(--pos-chrome-2) !important;
    padding: var(--pos-space-4) var(--pos-space-6) !important;
}

.tender-dialog .mud-table-body .mud-table-row {
    background: var(--pos-neutral-800) !important;
}

.tender-dialog .mud-table-body .mud-table-row:nth-child(even) {
    background: var(--pos-neutral-900) !important;
}

.tender-dialog .mud-table-body .mud-table-cell {
    color: var(--pos-text-on-dark) !important;
    font-size: var(--pos-font-base) !important;
    border-bottom: 1px solid var(--pos-overlay-light) !important;
    background: inherit !important;
    padding: var(--pos-space-4) var(--pos-space-6) !important;
}

.tender-dialog .mud-table-body .mud-table-row:hover .mud-table-cell {
    background: var(--pos-chrome-2) !important;
}

.tender-dialog .mud-table-row.mud-table-row-selected .mud-table-cell {
    background: var(--pos-chrome-2-hover) !important;
}

/* Empty state */
.tender-dialog .mud-table .mud-table-empty-row td {
    background: transparent !important;
    color: var(--pos-overlay-light-50) !important;
    font-style: italic;
    text-align: center;
    padding: var(--pos-space-9) !important;
}

/* ---- Right section — payment methods ----------------------------------- */
.tender-right-section {
    width: 65%;
    padding: var(--pos-space-9);
    display: flex;
    flex-direction: column;
    gap: var(--pos-space-9);
    background: var(--pos-surface);
}

.payment-methods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--pos-space-7);
    flex: 1;
    align-content: start;
}

/* ---- Quick cash -------------------------------------------------------- */
.quick-cash-section {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--pos-neutral-300);
    border-radius: var(--pos-radius-md);
    background: var(--pos-neutral-100);
    overflow: hidden;
}

.quick-cash-label {
    font-size: var(--pos-font-base);
    font-weight: var(--pos-weight-semibold);
    color: var(--pos-text-on-dark);
    background: var(--pos-surface-accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--pos-space-3) var(--pos-space-6);
}

.quick-cash-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--pos-space-5);
    padding: var(--pos-space-6);
}

.btn-quick-cash {
    background: var(--pos-success-strong) !important;
    color: var(--pos-text-on-dark) !important;
    border: 2px solid var(--pos-success) !important;
    border-radius: var(--pos-radius-lg) !important;
    font-size: 15px !important;
    font-weight: var(--pos-weight-semibold) !important;
    min-width: 72px !important;
    min-height: 44px !important;
    padding: var(--pos-space-3) var(--pos-space-7) !important;
    letter-spacing: 0.3px;
}

.btn-quick-cash:hover {
    background: var(--pos-success) !important;
    border-color: var(--pos-success) !important;
    transform: translateY(-2px);
    box-shadow: var(--pos-shadow-md) !important;
}

.btn-quick-cash:active {
    transform: translateY(0);
    box-shadow: var(--pos-shadow-sm) !important;
}

/* ---- Scrollbar --------------------------------------------------------- */
.tender-left-section::-webkit-scrollbar {
    width: 6px;
}

.tender-left-section::-webkit-scrollbar-track {
    background: var(--pos-neutral-900);
}

.tender-left-section::-webkit-scrollbar-thumb {
    background: var(--pos-surface-accent);
    border-radius: var(--pos-radius-sm);
}

.tender-left-section::-webkit-scrollbar-thumb:hover {
    background: var(--pos-chrome-2);
}

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 1024px) {
    .tender-modal-body {
        flex-direction: column;
    }

    .tender-left-section,
    .tender-right-section {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--pos-blue);
    }

    .tender-left-section {
        max-height: 40vh;
    }

    .payment-methods-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .tender-left-section,
    .tender-right-section {
        padding: var(--pos-space-7);
    }

    .payment-methods-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: var(--pos-space-6);
    }
}

@media (max-width: 480px) {
    .payment-methods-grid {
        grid-template-columns: 1fr;
        gap: var(--pos-space-5);
    }
}

/* =========================================================================
   TenderAmountDialog  (root: .tender-amount-dialog on the MudDialog)

   Dropped as dead — this dialog is now a MudDialog and the hand-rolled
   modal chrome and numeric keypad no longer exist in markup:
     .tender-amount-overlay / -content / -header / -footer, .close-button,
     .keypad-section / -grid / -btn, .clear-btn, .amount-display,
     .amount-input, .currency-label, .payment-instructions,
     .btn-force, .btn-accept
   .btn-cancel is anchored to .tender-amount-dialog: the same class is
   applied to Cancel buttons in AddItem / ChangeItem / PaymentOnAccount,
   which must keep the shared components.css treatment.
   ========================================================================= */
.tender-amount-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: var(--pos-surface-muted);
}

.amount-left-section {
    flex: 1;
    padding: var(--pos-space-10);
    display: flex;
    flex-direction: column;
    gap: var(--pos-space-9);
    background: var(--pos-surface);
}

.payment-method-label {
    background: var(--pos-surface-accent);
    color: var(--pos-text-on-dark);
    padding: var(--pos-space-5) var(--pos-space-9);
    text-align: center;
    font-size: var(--pos-font-2xl);
    font-weight: var(--pos-weight-normal);
    border-radius: var(--pos-radius-lg);
    letter-spacing: 1px;
    box-shadow: var(--pos-shadow-sm);
}

.amount-fields {
    display: flex;
    flex-direction: column;
    gap: var(--pos-space-6);
}

.amount-field {
    display: flex;
    flex-direction: column;
    gap: var(--pos-space-4);
}

.amount-field label {
    font-size: var(--pos-font-lg);
    font-weight: var(--pos-weight-semibold);
    color: var(--pos-text-black);
    letter-spacing: 0.3px;
}

/* Foreign-exchange: two fields side by side per row */
.fx-field-row {
    display: flex;
    gap: var(--pos-space-4);
    align-items: flex-start;
}

.fx-field-row > :first-child {
    flex: 1;
    font-weight: var(--pos-weight-bold);
}

/* Home-currency equivalent field: narrower and visually secondary */
.fx-home-field {
    width: 140px;
    flex-shrink: 0;
}

.required-mark {
    color: var(--pos-danger-strong);
    font-weight: var(--pos-weight-bold);
}

/* Credit card terminal hint — full-width, sits above the action buttons */
.card-payment-hint {
    margin: var(--pos-space-4) var(--pos-space-10) 0;
}

.tender-amount-dialog .btn-cancel {
    padding: var(--pos-space-5) var(--pos-space-8);
    border-radius: var(--pos-radius-lg);
    font-size: var(--pos-font-lg);
    font-weight: var(--pos-weight-semibold);
    cursor: pointer;
    transition: var(--pos-transition);
    min-height: 40px;
    letter-spacing: 0.3px;
    box-shadow: var(--pos-shadow-sm);
    background-color: var(--pos-danger-border);
    color: var(--pos-text-on-dark);
    border: 1px solid var(--pos-danger-border);
}

.tender-amount-dialog .btn-cancel:hover {
    background-color: var(--pos-danger-border);
    border-color: var(--pos-danger-light);
    transform: translateY(-2px);
}

.tender-amount-dialog .btn-cancel:active {
    transform: translateY(0);
    box-shadow: var(--pos-shadow-sm);
}

/* ---- Responsive -------------------------------------------------------- */
@media (max-width: 768px) {
    .tender-amount-body {
        flex-direction: column;
    }

    .amount-left-section {
        border-right: none;
        border-bottom: 2px solid var(--pos-blue);
        padding: var(--pos-space-9);
    }

    .payment-method-label {
        font-size: var(--pos-font-2xl);
        padding: var(--pos-space-5) var(--pos-space-9);
    }

    .tender-amount-dialog .btn-cancel {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .amount-left-section {
        padding: var(--pos-space-8);
        gap: var(--pos-space-8);
    }

    .payment-method-label {
        font-size: var(--pos-font-2xl);
        padding: var(--pos-space-6) var(--pos-space-8);
    }
}
