/* ==========================================================================
   POS / Cash Register - Layout
   Everything fits within the viewport — zero page-level scroll.
   The .app-content padding is neutralised so the POS fills edge-to-edge.
   ========================================================================== */

/* Kill the page-level content padding when POS is active */
.pos-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    height: calc(100vh - var(--header-height, 64px));
    overflow: hidden;
    margin: -1.5rem -2rem;          /* neutralise .app-content padding */
}

/* LEFT panel - flex column, NO scroll */
.pos-left {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height, 64px));
    overflow: hidden;
    padding: 0.25rem 0.5rem;
    gap: 0.25rem;
}

/* RIGHT panel */
.pos-right {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--header-height, 64px));
    overflow: hidden;
    border-left: 1px solid var(--rz-base-200);
}

/* ===== Payment tile grid (payment dialog) ===== */
.pos-pay-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
}

/* ===== Square action tile grid ===== */
.pos-action-grid-square {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 1fr 1fr;
    gap: 0.25rem;
    flex: 1;
    min-height: 0;
}
.pos-action-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 0.2rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s ease, box-shadow 0.15s ease;
    text-align: center;
    min-height: 0;
    overflow: hidden;
}
.pos-action-tile:hover {
    background: var(--rz-base-100);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.pos-action-tile.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ===== Search wrapper with floating results ===== */
.pos-search-wrapper {
    position: relative;
    flex-shrink: 0;
}
.pos-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--rz-base-background-color);
    border: 1px solid var(--rz-base-200);
    border-radius: 0 0 8px 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    z-index: 100;
}

/* ===== Cart scroll area ===== */
.pos-cart-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0.35rem 0.5rem;
}

/* ===== Gate Screen ===== */
.pos-gate-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--header-height, 64px));
    padding: 2rem;
    margin: -1.5rem -2rem;
}

/* ===== Sales slide-out panel ===== */
.pos-sales-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4); z-index: 1000;
    opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s;
}
.pos-sales-backdrop.open { opacity: 1; visibility: visible; }
.pos-sales-panel {
    position: fixed; top: 0; right: 0;
    width: 420px; height: 100vh;
    background: var(--rz-base-background-color);
    border-left: 1px solid var(--rz-base-200);
    box-shadow: -8px 0 32px rgba(0,0,0,0.15);
    z-index: 1001; transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    display: flex; flex-direction: column;
}
.pos-sales-panel.open { transform: translateX(0); }
.pos-sales-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 1rem; border-bottom: 1px solid var(--rz-base-200); flex-shrink: 0;
}
.pos-sales-panel-body { flex: 1; overflow-y: auto; padding: 0.5rem 1rem; }
.pos-sales-panel-footer {
    padding: 0.5rem 1rem; border-top: 1px solid var(--rz-base-200);
    flex-shrink: 0; background: var(--rz-base-100);
}

/* ===== Receipt ===== */
.pos-receipt { font-family: 'Courier New',monospace; max-width: 400px; margin: 0 auto; padding: 1.5rem; border: 2px dashed var(--rz-base-300); border-radius: 4px; font-size: 0.85rem; line-height: 1.5; }
.pos-receipt-header { text-align: center; padding-bottom: 0.75rem; border-bottom: 1px dashed var(--rz-base-300); margin-bottom: 0.75rem; }
.pos-receipt-line { display: flex; justify-content: space-between; padding: 0.15rem 0; }
.pos-receipt-divider { border: none; border-top: 1px dashed var(--rz-base-300); margin: 0.5rem 0; }
.pos-receipt-total-line { display: flex; justify-content: space-between; font-weight: 700; font-size: 1.1rem; padding: 0.35rem 0; }
.pos-receipt-footer { text-align: center; padding-top: 0.75rem; border-top: 1px dashed var(--rz-base-300); margin-top: 0.75rem; font-style: italic; color: var(--rz-text-secondary-color); }

/* ===== Payment dialog overlay ===== */
.payment-dialog-backdrop {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
}
.payment-dialog-content {
    background: var(--rz-base-background-color);
    border-radius: 18px;
    padding: 2rem;
    width: 750px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 16px 48px rgba(0,0,0,0.2);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .pos-layout { grid-template-columns: 1fr; height: auto; margin: 0; }
    .pos-left { height: auto; overflow-y: auto; }
    .pos-right { height: auto; min-height: 50vh; border-left: none; border-top: 1px solid var(--rz-base-200); }
    .pos-sales-panel { width: 100%; }
    .pos-gate-container { margin: 0; }
}
