/* ============================================
   QuickBite POS - Professional Sales Workspace
   ============================================ */

.pos-layout {
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-columns: var(--pos-cat-width) minmax(320px, 1fr) var(--pos-cart-width);
    grid-template-rows: 88px minmax(0, 1fr);
    grid-template-areas:
        "types types cart"
        "categories items cart";
    overflow: hidden;
    background:
        radial-gradient(circle at 55% -20%, rgba(255,107,61,.08), transparent 33%),
        var(--bg-primary);
}

/* ---- Order type switcher ---- */
.order-type-tabs {
    grid-area: types;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: rgba(16,19,31,.74);
}

.order-type-label {
    margin-right: 8px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.ot-tab {
    min-width: 132px;
    height: 52px;
    padding: 0 18px;
    border: 1px solid var(--border);
    border-radius: 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    transition: all 160ms ease;
}

.ot-tab:hover {
    color: var(--text-primary);
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.ot-tab.active {
    color: #fff;
    border-color: rgba(255,107,61,.72);
    background: linear-gradient(135deg, var(--accent), #ff8058);
    box-shadow: 0 10px 24px rgba(255,107,61,.2);
}

/* ---- Category column ---- */
.pos-categories {
    grid-area: categories;
    min-height: 0;
    padding: 18px 12px;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    background: rgba(16,19,31,.7);
}

.pos-section-kicker {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px 13px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.pos-cat-btn {
    width: 100%;
    min-height: 47px;
    margin-bottom: 5px;
    padding: 0 12px;
    border: 1px solid transparent;
    border-radius: 13px;
    display: flex;
    align-items: center;
    gap: 11px;
    background: transparent;
    color: var(--text-secondary);
    text-align: left;
    font-size: 13px;
    font-weight: 650;
    transition: all 140ms ease;
}

.pos-cat-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.pos-cat-btn.active {
    color: #fff;
    border-color: rgba(255,107,61,.16);
    background: linear-gradient(90deg, rgba(255,107,61,.18), rgba(255,107,61,.055));
}

.pos-cat-btn .dot {
    width: 9px;
    height: 9px;
    min-width: 9px;
    border-radius: 3px;
    box-shadow: 0 0 0 4px rgba(255,255,255,.025);
}

.pos-cat-btn .cat-count {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 10px;
}

/* ---- Product catalogue ---- */
.pos-items {
    grid-area: items;
    min-width: 0;
    min-height: 0;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.pos-items-header {
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-shrink: 0;
}

.menu-heading h3 {
    margin-bottom: 3px;
    font-size: 18px;
    letter-spacing: -.025em;
}

.menu-heading p {
    color: var(--text-secondary);
    font-size: 11px;
}

.pos-items-header .search-box {
    width: min(340px, 48%);
}

.pos-items-header .search-box input {
    height: 46px;
    padding-left: 42px;
    border-color: var(--border);
    border-radius: 14px;
    background: rgba(16,19,31,.78);
}

.pos-items-header .search-box i { left: 15px; }

.pos-item-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(124px, 142px));
    gap: 9px;
    align-content: start;
}

.pos-item-card {
    --item-accent: var(--accent);
    min-width: 0;
    min-height: 0;
    aspect-ratio: 1 / 1;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: linear-gradient(145deg, rgba(29,34,51,.96), rgba(20,24,38,.96));
    cursor: pointer;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.pos-item-card::after {
    content: "";
    position: absolute;
    right: -30px;
    bottom: -40px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--item-accent);
    opacity: .055;
}

.pos-item-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--item-accent) 58%, var(--border));
    box-shadow: 0 15px 35px rgba(0,0,0,.24);
}

.pos-item-card:active { transform: scale(.985); }
.pos-item-card.unavailable { opacity: .38; pointer-events: none; }

.item-visual {
    width: 38px;
    height: 38px;
    margin-bottom: 11px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    color: var(--item-accent);
    background: color-mix(in srgb, var(--item-accent) 13%, transparent);
    font-size: 15px;
}

.pos-item-card.has-photo {
    min-height: 0;
}

.item-visual.has-image {
    width: calc(100% + 20px);
    height: 60px;
    min-height: 60px;
    margin: -10px -10px 8px;
    border-radius: 13px 13px 9px 9px;
    overflow: hidden;
    background: var(--bg-primary);
}

.item-visual.has-image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.pos-item-card.has-photo .item-badges {
    padding: 4px;
    border-radius: 10px;
    background: rgba(9, 11, 19, .72);
    backdrop-filter: blur(7px);
}

.pos-item-card .item-name {
    max-width: calc(100% - 20px);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 750;
    line-height: 1.25;
}

.pos-item-card .item-category {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 8px;
}

.pos-item-card .item-price {
    margin-top: auto;
    padding-top: 7px;
    color: var(--item-accent);
    font-size: 12px;
    font-weight: 800;
}

.item-badges {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
}

.pos-item-card .item-badge {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 9px;
}

.item-add {
    position: absolute;
    right: 9px;
    bottom: 9px;
    width: 24px;
    height: 24px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: var(--item-accent);
    background: color-mix(in srgb, var(--item-accent) 13%, transparent);
    font-size: 10px;
}

.pos-empty {
    grid-column: 1 / -1;
    min-height: 240px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    color: var(--text-secondary);
    text-align: center;
}
.pos-empty i { color: var(--text-muted); font-size: 30px; }

/* ---- Order panel ---- */
.pos-cart {
    grid-area: cart;
    min-width: 0;
    min-height: 0;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(16,19,31,.94);
    box-shadow: -18px 0 40px rgba(0,0,0,.12);
}

.cart-header {
    min-height: 88px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cart-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cart-title-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: var(--accent);
    background: var(--accent-subtle);
}

.cart-header h3 {
    font-size: 16px;
    letter-spacing: -.02em;
}

.cart-header small {
    display: block;
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 10px;
}

.cart-count {
    min-width: 30px;
    height: 30px;
    padding: 0 9px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 800;
}

.cart-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.counter-register-btn {
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid rgba(77,199,116,.28);
    border-radius: 10px;
    color: var(--success);
    background: rgba(77,199,116,.1);
    font: inherit;
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
}

.counter-register-btn.not_open,
.counter-register-btn.closed {
    border-color: rgba(255,102,51,.3);
    color: var(--accent);
    background: var(--accent-subtle);
}

.counter-register-btn i { margin-right: 5px; }

.register-open-intro {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 20px;
    padding: 14px;
    border-radius: 14px;
    background: var(--bg-tertiary);
}

.register-open-intro > i { color: var(--accent); font-size: 24px; }
.register-open-intro p { margin: 4px 0 0; color: var(--text-secondary); font-size: 12px; }

.register-cash-report {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg-tertiary);
}

.register-report-date {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 12px;
}

.register-report-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 15px 16px;
    border-bottom: 1px solid var(--border);
}

.register-report-row small { display: block; margin-top: 3px; color: var(--text-secondary); }
.register-report-row.total { border: 0; color: var(--success); font-size: 17px; }

.cart-items {
    flex: 1;
    min-height: 0;
    padding: 14px;
    overflow-y: auto;
}

.cart-item {
    margin-bottom: 10px;
    padding: 13px;
    border: 1px solid rgba(255,255,255,.04);
    border-radius: 14px;
    position: relative;
    background: var(--bg-tertiary);
}

.cart-item .ci-name {
    padding-right: 28px;
    font-size: 13px;
    font-weight: 700;
}

.cart-item .ci-details {
    margin: 3px 0 11px;
    color: var(--text-secondary);
    font-size: 10px;
}

.ci-price-breakdown {
    margin: 6px 0 11px;
    display: grid;
    gap: 5px;
}

.ci-mod-breakdown {
    display: grid;
    gap: 5px;
}

.ci-base-line {
    padding: 6px 8px;
    border: 1px solid rgba(255,255,255,.055);
    border-radius: 8px;
    background: rgba(255, 107, 61, .08);
    color: var(--text-primary);
    font-size: 10px;
    font-weight: 800;
}

.ci-base-line strong {
    color: var(--text-primary);
    font-size: 10px;
    white-space: nowrap;
}

.ci-mod-group {
    padding: 6px 8px;
    border: 1px solid rgba(255,255,255,.055);
    border-radius: 8px;
    background: rgba(9, 11, 19, .28);
}

.ci-mod-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.ci-mod-line span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ci-mod-group-line {
    color: var(--gold);
    font-size: 10px;
    font-weight: 800;
}

.ci-mod-group-line strong {
    color: var(--gold);
    font-size: 10px;
    white-space: nowrap;
}

.ci-mod-item-line {
    margin-top: 3px;
    padding-left: 8px;
    color: var(--text-secondary);
    font-size: 9px;
}

.ci-mod-item-line em {
    color: var(--accent);
    font-style: normal;
    white-space: nowrap;
}

.cart-item .ci-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cart-item .ci-price {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 800;
}

.cart-item .ci-qty {
    display: flex;
    align-items: center;
    gap: 5px;
}

.cart-item .ci-qty button {
    width: 26px;
    height: 26px;
    border: 1px solid var(--border);
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--bg-primary);
    color: var(--text-secondary);
}

.cart-item .ci-qty button:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.cart-item .ci-qty span {
    min-width: 25px;
    text-align: center;
    font-size: 12px;
    font-weight: 800;
}

.cart-item .ci-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 25px;
    height: 25px;
    border-radius: 8px;
    color: var(--text-muted);
}
.cart-item .ci-remove:hover { color: var(--danger); background: var(--danger-subtle); }

.cart-empty {
    height: 100%;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-secondary);
}
.cart-empty i { color: var(--text-muted); font-size: 34px; opacity: .6; }
.cart-empty span { font-size: 12px; }

.cart-footer {
    padding: 15px 18px 18px;
    border-top: 1px solid var(--border);
    background: rgba(9,11,19,.38);
}

.cart-totals { margin-bottom: 13px; }
.cart-totals .row {
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 11px;
}
.cart-totals .row.total {
    margin-top: 9px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-hover);
    color: var(--text-primary);
    font-size: 19px;
    font-weight: 800;
}

.cart-actions {
    margin-bottom: 7px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
}

.cart-actions.secondary { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.cart-actions .btn {
    min-width: 0;
    height: 35px;
    padding: 0 7px;
    gap: 5px;
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
}

.cart-pay {
    width: 100%;
    min-height: 48px;
    margin-top: 3px;
    border-radius: 14px;
    background: linear-gradient(135deg, #2fbd6c, var(--success));
    box-shadow: 0 10px 22px rgba(55,201,120,.16);
}

/* Existing modal components used by POS */
.pay-methods { display: flex; gap: 12px; margin-bottom: 20px; }
.pay-method {
    flex: 1;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: 14px;
    text-align: center;
    cursor: pointer;
}
.pay-method:hover { border-color: var(--border-hover); }
.pay-method.selected { border-color: var(--success); background: var(--success-subtle); }
.pay-method i { display: block; margin-bottom: 8px; color: var(--text-secondary); font-size: 24px; }
.pay-method.selected i { color: var(--success); }
.pay-method span { font-size: 12px; font-weight: 700; }

.change-display {
    margin-top: 16px;
    color: var(--success);
    font-size: 24px;
    font-weight: 800;
    text-align: center;
}

.hold-item {
    margin-bottom: 8px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-primary);
    cursor: pointer;
}
.hold-item:hover { border-color: var(--accent); background: var(--accent-subtle); }

@media (max-width: 1250px) {
    .pos-layout {
        grid-template-columns: 150px minmax(290px, 1fr) 340px;
    }
    .pos-item-grid { grid-template-columns: repeat(auto-fill, minmax(116px, 132px)); }
    .item-visual.has-image { height: 55px; min-height: 55px; }
    .ot-tab { min-width: 112px; }
}

@media (max-width: 900px) {
    .pos-layout {
        height: auto;
        min-height: 100%;
        grid-template-columns: 1fr;
        grid-template-rows: auto auto minmax(420px, auto) auto;
        grid-template-areas:
            "types"
            "categories"
            "items"
            "cart";
        overflow: visible;
    }
    .order-type-tabs {
        position: sticky;
        top: 0;
        z-index: 5;
        padding: 10px;
        overflow-x: auto;
    }
    .order-type-label { display: none; }
    .ot-tab { min-width: 118px; height: 46px; }
    .pos-categories {
        padding: 9px;
        border-right: 0;
        border-bottom: 1px solid var(--border);
        display: flex;
        gap: 6px;
        overflow-x: auto;
        overflow-y: hidden;
    }
    .pos-section-kicker { display: none; }
    .pos-cat-btn {
        width: auto;
        min-width: max-content;
        min-height: 40px;
        margin: 0;
    }
    .pos-cat-btn .cat-count { display: none; }
    .pos-items { min-height: 440px; padding: 16px; }
    .pos-items-header { align-items: flex-start; flex-direction: column; }
    .pos-items-header .search-box { width: 100%; }
    .pos-item-grid { grid-template-columns: repeat(auto-fill, minmax(122px, 140px)); }
    .pos-cart {
        min-height: 520px;
        border-top: 1px solid var(--border);
        border-left: 0;
        box-shadow: none;
    }
}

@media (max-width: 520px) {
    .pos-item-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
    .pos-item-card { min-height: 0; padding: 10px; }
    .item-visual.has-image {
        width: calc(100% + 20px);
        margin: -10px -10px 8px;
    }
    .cart-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
