/* QBF POS theme — gold + black brand + modern cashier layout */

:root {
    --qbf-orange: #E2A927;
    --qbf-orange-dark: #C48F12;
    --qbf-orange-soft: #FFF8E7;
    --qbf-ink: #1A1A1A;
    --qbf-muted: #6B7280;
    --qbf-surface: #F5F4F1;
    --qbf-panel: #FFFFFF;
    --qbf-sidebar: #000000;
    --qbf-sidebar-hover: #1A1A1A;
    --qbf-success: #16A34A;
    --qbf-radius: 14px;
    --qbf-shadow: 0 8px 24px rgba(28, 25, 23, 0.08);
    --qbf-sidebar-width: 15rem;
    --qbf-sidebar-collapsed-width: 4.5rem;
    --tblr-primary: #E2A927;
    --tblr-primary-rgb: 226, 169, 39;
}

body {
    background: var(--qbf-surface);
    color: var(--qbf-ink);
}

/* ---- App shell: override Tabler vertical-nav conflicts ---- */
.page {
    padding-left: 0 !important;
}

@media (min-width: 992px) {
    .qbf-sidebar.navbar-vertical.navbar-expand-lg {
        width: var(--qbf-sidebar-width) !important;
        max-width: var(--qbf-sidebar-width) !important;
        min-width: var(--qbf-sidebar-width) !important;
        position: fixed !important;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1030;
        overflow-x: visible;
        overflow-y: auto;
        transition:
            width 0.32s cubic-bezier(0.4, 0, 0.2, 1),
            min-width 0.32s cubic-bezier(0.4, 0, 0.2, 1),
            max-width 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .qbf-sidebar.navbar-vertical.navbar-expand-lg ~ .page-wrapper {
        margin-left: var(--qbf-sidebar-width) !important;
        width: auto !important;
        min-height: 100vh;
        transition: margin-left 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    }

    html.qbf-sidebar-collapsed .qbf-sidebar.navbar-vertical.navbar-expand-lg {
        width: var(--qbf-sidebar-collapsed-width) !important;
        max-width: var(--qbf-sidebar-collapsed-width) !important;
        min-width: var(--qbf-sidebar-collapsed-width) !important;
    }

    html.qbf-sidebar-collapsed .qbf-sidebar.navbar-vertical.navbar-expand-lg ~ .page-wrapper {
        margin-left: var(--qbf-sidebar-collapsed-width) !important;
    }
}

.qbf-sidebar.navbar-vertical {
    background: var(--qbf-sidebar) !important;
    border-right: none;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
}

.qbf-sidebar-brand-row {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.75rem 0.5rem 0.25rem;
}

.qbf-sidebar .navbar-brand {
    padding: 0;
    justify-content: center;
    margin: 0;
    width: 100%;
}

.qbf-brand-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #000;
    border-radius: 10px;
    padding: 0.2rem 0.35rem;
    max-width: 100%;
    position: relative;
    transition: padding 0.28s ease, background 0.28s ease;
}

.qbf-logo {
    height: 44px;
    width: auto;
    max-width: 168px;
    object-fit: contain;
    opacity: 1;
    transition: opacity 0.2s ease, transform 0.28s ease;
}

.qbf-logo-mark {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #000 url("../img/qbf_favicon.png") center / cover no-repeat;
    color: transparent;
    font-weight: 800;
    font-size: 1.05rem;
    align-items: center;
    justify-content: center;
    line-height: 1;
    position: absolute;
    opacity: 0;
    transform: scale(0.85);
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.qbf-sidebar .nav-link {
    border-radius: 10px;
    margin: 2px 0.5rem;
    color: rgba(255, 255, 255, 0.78) !important;
    justify-content: flex-start;
    transition: margin 0.28s ease, padding 0.28s ease, background-color 0.2s ease;
}

.qbf-sidebar .nav-link-title {
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    max-width: 12rem;
    opacity: 1;
    transition: opacity 0.2s ease, max-width 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.qbf-sidebar .dropdown-toggle::after {
    transition: opacity 0.18s ease;
}

.qbf-sidebar .nav-link-icon {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
}

.qbf-sidebar .nav-link:hover,
.qbf-sidebar .nav-item.active > .nav-link {
    background: var(--qbf-sidebar-hover) !important;
    color: #fff !important;
}

.qbf-sidebar .nav-item.active > .nav-link {
    box-shadow: inset 3px 0 0 var(--qbf-orange);
}

.qbf-sidebar .dropdown-menu {
    background: #292524;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.qbf-sidebar .dropdown-item {
    color: rgba(255, 255, 255, 0.85);
}

.qbf-sidebar .dropdown-item:hover {
    background: rgba(226, 169, 39, 0.2);
    color: #fff;
}

/* Prominent edge toggle — large, high-contrast */
.qbf-sidebar-edge-toggle {
    position: absolute;
    top: 50%;
    right: -18px;
    transform: translateY(-50%);
    z-index: 1040;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 2px solid var(--qbf-orange);
    background: #fff;
    color: var(--qbf-orange-dark);
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(226, 169, 39, 0.35), 0 2px 6px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    padding: 0;
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

@media (min-width: 992px) {
    .qbf-sidebar-edge-toggle {
        display: flex !important;
    }
}

.qbf-sidebar-edge-toggle:hover {
    background: var(--qbf-orange);
    border-color: var(--qbf-orange);
    color: #fff;
    box-shadow: 0 8px 22px rgba(226, 169, 39, 0.45);
}

.qbf-sidebar-edge-toggle .icon {
    width: 18px;
    height: 18px;
    stroke-width: 2.75;
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

html.qbf-sidebar-collapsed .qbf-sidebar-edge-toggle {
    background: var(--qbf-orange);
    border-color: var(--qbf-orange);
    color: #fff;
}

html.qbf-sidebar-collapsed .qbf-sidebar-edge-toggle .qbf-chevron-collapse {
    transform: rotate(180deg);
}

/* Top-bar Menu button — always obvious */
.qbf-menu-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 40px;
    padding: 0 0.9rem;
    border-radius: 10px;
    border: 2px solid var(--qbf-orange);
    background: #fff;
    color: var(--qbf-orange-dark);
    font-weight: 700;
    font-size: 0.875rem;
    box-shadow: 0 4px 12px rgba(226, 169, 39, 0.18);
    cursor: pointer;
    transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.qbf-menu-btn:hover {
    background: var(--qbf-orange);
    color: #fff;
}

.qbf-menu-btn .icon {
    width: 18px;
    height: 18px;
}

html.qbf-sidebar-collapsed .qbf-menu-btn {
    background: var(--qbf-orange);
    color: #fff;
}

/* Icon-rail minimized extras */
@media (min-width: 992px) {
    html.qbf-sidebar-collapsed .qbf-sidebar .container-fluid {
        padding-left: 0.35rem;
        padding-right: 0.35rem;
    }

    html.qbf-sidebar-collapsed .qbf-sidebar .nav-link-title {
        opacity: 0;
        max-width: 0;
        margin: 0;
        pointer-events: none;
    }

    html.qbf-sidebar-collapsed .qbf-sidebar .dropdown-toggle::after {
        opacity: 0;
        width: 0;
        margin: 0;
        border: none;
    }

    html.qbf-sidebar-collapsed .qbf-sidebar .nav-link {
        justify-content: center;
        margin: 0.2rem 0.35rem;
        padding: 0.65rem 0.4rem;
        position: relative;
    }

    html.qbf-sidebar-collapsed .qbf-sidebar .nav-link-icon {
        margin: 0 !important;
    }

    html.qbf-sidebar-collapsed .qbf-sidebar .nav-item.active > .nav-link {
        box-shadow: none;
        background: rgba(255, 255, 255, 0.1) !important;
        border-radius: 12px;
    }

    html.qbf-sidebar-collapsed .qbf-logo {
        opacity: 0;
        transform: scale(0.85);
        pointer-events: none;
    }

    html.qbf-sidebar-collapsed .qbf-logo-mark {
        display: inline-flex;
        opacity: 1;
        transform: scale(1);
        pointer-events: auto;
        position: static;
    }

    html.qbf-sidebar-collapsed .qbf-brand-link {
        padding: 0;
        background: transparent;
        border-radius: 0;
    }

    html.qbf-sidebar-collapsed .qbf-sidebar .dropdown-menu {
        position: absolute !important;
        left: calc(100% + 0.35rem) !important;
        top: 0 !important;
        inset-inline-start: auto !important;
        min-width: 12rem;
        margin: 0;
        z-index: 1050;
    }
}

@media (prefers-reduced-motion: reduce) {
    .qbf-sidebar.navbar-vertical.navbar-expand-lg,
    .qbf-sidebar.navbar-vertical.navbar-expand-lg ~ .page-wrapper,
    .qbf-sidebar .nav-link,
    .qbf-sidebar .nav-link-title,
    .qbf-logo,
    .qbf-logo-mark,
    .qbf-brand-link,
    .qbf-sidebar-edge-toggle,
    .qbf-sidebar-edge-toggle .icon,
    .qbf-menu-btn {
        transition: none !important;
    }
}

/* Slim top bar — NOT a Tabler .navbar (avoids flex growth bug) */
.qbf-topbar {
    flex: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid rgba(28, 25, 23, 0.06);
    background: transparent;
}

.qbf-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
}

.qbf-user-chip {
    gap: 0.15rem;
}

.qbf-page-body {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding: 0;
}

.btn-primary,
.btn-success.add-list,
.qbf-btn-primary {
    background: var(--qbf-orange) !important;
    border-color: var(--qbf-orange) !important;
    color: #111 !important;
}

.btn-primary:hover,
.qbf-btn-primary:hover {
    background: var(--qbf-orange-dark) !important;
    border-color: var(--qbf-orange-dark) !important;
    color: #111 !important;
}

/* ---------- POS three-panel layout ---------- */

.pos-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 1rem;
    align-items: start;
    padding: 0.75rem 1rem 1.25rem;
}

@media (max-width: 991.98px) {
    .pos-shell {
        grid-template-columns: 1fr;
    }
}

.pos-main {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.85rem;
    min-width: 0;
}

.pos-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    background: var(--qbf-panel);
    border-radius: var(--qbf-radius);
    padding: 0.85rem 1rem;
    box-shadow: var(--qbf-shadow);
}

.pos-toolbar .form-select,
.pos-toolbar .form-control {
    border-radius: 10px;
    min-height: 42px;
}

.pos-search-wrap {
    flex: 1 1 240px;
}

.pos-categories {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    -webkit-overflow-scrolling: touch;
}

.pos-cat-chip {
    flex: 0 0 auto;
    border: 1px solid rgba(28, 25, 23, 0.1);
    background: #fff;
    color: var(--qbf-ink);
    border-radius: 999px;
    padding: 0.45rem 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.pos-cat-chip:hover {
    border-color: var(--qbf-orange);
    color: var(--qbf-orange);
}

.pos-cat-chip.is-active {
    background: var(--qbf-orange);
    border-color: var(--qbf-orange);
    color: #fff;
    box-shadow: 0 6px 16px rgba(226, 169, 39, 0.28);
}

.pos-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.85rem;
    align-content: start;
}

.pos-product-card {
    background: var(--qbf-panel);
    border-radius: var(--qbf-radius);
    overflow: hidden;
    box-shadow: var(--qbf-shadow);
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
    text-align: left;
    padding: 0;
    width: 100%;
    color: inherit;
}

.pos-product-card:hover:not(:disabled) {
    transform: translateY(-2px);
    border-color: rgba(226, 169, 39, 0.35);
    box-shadow: 0 12px 28px rgba(28, 25, 23, 0.12);
}

.pos-product-card:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.pos-product-media {
    aspect-ratio: 4 / 3;
    background: linear-gradient(145deg, #fff7ed, #ffedd5);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.pos-product-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pos-product-media .pos-product-initials {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--qbf-orange);
}

.pos-product-body {
    padding: 0.75rem 0.85rem 0.9rem;
}

.pos-product-name {
    font-weight: 700;
    font-size: 0.92rem;
    line-height: 1.25;
    margin-bottom: 0.2rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pos-product-meta {
    font-size: 0.75rem;
    color: var(--qbf-muted);
    margin-bottom: 0.45rem;
}

.pos-product-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.pos-product-price {
    font-weight: 800;
    color: var(--qbf-orange-dark);
    font-size: 0.95rem;
}

.pos-product-price .old {
    text-decoration: line-through;
    color: var(--qbf-muted);
    font-weight: 500;
    font-size: 0.75rem;
    margin-right: 0.25rem;
}

.pos-add-hint {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--qbf-success);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.pos-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--qbf-muted);
    background: var(--qbf-panel);
    border-radius: var(--qbf-radius);
}

/* Cart panel */
.pos-cart {
    background: var(--qbf-panel);
    border-radius: var(--qbf-radius);
    box-shadow: var(--qbf-shadow);
    display: flex;
    flex-direction: column;
    align-self: stretch;
    min-height: calc(100vh - 4rem);
    max-height: calc(100vh - 4rem);
    position: sticky;
    top: 0.75rem;
    overflow: hidden;
}

.pos-cart-header {
    padding: 1rem 1.1rem 0.75rem;
    border-bottom: 1px solid rgba(28, 25, 23, 0.06);
}

.pos-cart-header h2 {
    font-size: 1.1rem;
    font-weight: 800;
    margin: 0;
}

.pos-cart-items {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.75rem 1rem;
}

.pos-cart-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.35rem 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(28, 25, 23, 0.06);
}

.pos-cart-item-name {
    font-weight: 700;
    font-size: 0.9rem;
}

.pos-cart-item-sku {
    font-size: 0.72rem;
    color: var(--qbf-muted);
}

.pos-cart-includes {
    list-style: none;
    margin: 0.25rem 0 0;
    padding: 0;
    font-size: 0.75rem;
    line-height: 1.35;
    color: var(--qbf-muted);
}

.pos-cart-includes li {
    padding-left: 0.65rem;
    position: relative;
}

.pos-cart-includes li::before {
    content: "+";
    position: absolute;
    left: 0;
    font-weight: 700;
    color: var(--qbf-gold, #E2A927);
}

.pos-cart-item-price {
    font-weight: 700;
    text-align: right;
    font-size: 0.9rem;
}

.pos-qty {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.pos-qty button {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid rgba(28, 25, 23, 0.12);
    background: #fff;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.pos-qty button:hover {
    border-color: var(--qbf-orange);
    color: var(--qbf-orange);
}

.pos-qty span {
    min-width: 1.5rem;
    text-align: center;
    font-weight: 700;
}

.pos-cart-remove {
    border: none;
    background: transparent;
    color: #dc2626;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.pos-cart-footer {
    border-top: 1px solid rgba(28, 25, 23, 0.08);
    padding: 1rem 1.1rem 1.15rem;
    background: linear-gradient(180deg, #fff, #fffaf5);
}

.pos-totals-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    color: var(--qbf-muted);
}

.pos-discount-row .form-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--qbf-muted);
    margin-bottom: 0.25rem;
}

.pos-discount-type-chips {
    flex-shrink: 0;
}

.pos-discount-type-chips .pos-order-type-chip {
    min-width: 2.1rem;
    padding: 0.2rem 0.45rem;
    font-size: 0.72rem;
}

.pos-totals-row.text-success {
    color: #15803d;
    font-weight: 600;
}

.pos-totals-row.total {
    color: var(--qbf-ink);
    font-size: 1.25rem;
    font-weight: 800;
    margin-top: 0.5rem;
    margin-bottom: 0.85rem;
}

.pos-totals-row.total span:last-child {
    color: var(--qbf-orange-dark);
}

.pos-pay-btn {
    width: 100%;
    min-height: 52px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--qbf-orange), var(--qbf-orange-dark));
    color: #111;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
    box-shadow: 0 10px 22px rgba(226, 169, 39, 0.4);
    cursor: pointer;
}

.pos-pay-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.pos-order-type {
    margin-top: 0.35rem;
}

.pos-order-type-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--qbf-muted);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.pos-order-type-chips {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
}

.pos-delivery-mode-chips {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.pos-delivery-mode {
    margin-top: 0.5rem;
}

.pos-customer-fields .form-control {
    font-size: 0.82rem;
}

.pos-customer-fields textarea.form-control {
    resize: vertical;
    min-height: 56px;
}


.pos-order-type-chip {
    border: 1.5px solid #e5e7eb;
    background: #fff;
    color: var(--qbf-ink);
    border-radius: 10px;
    min-height: 38px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0.35rem 0.25rem;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.pos-order-type-chip.is-active,
.pos-order-type-chip:hover {
    border-color: var(--qbf-orange);
    background: var(--qbf-orange-soft);
    color: var(--qbf-orange-dark);
}

.pos-pay-summary {
    text-align: center;
    padding: 0.75rem;
    background: var(--qbf-orange-soft);
    border-radius: 12px;
}

.pos-pay-due {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--qbf-orange-dark);
    line-height: 1.2;
}

.pos-confirm-pay {
    min-width: 160px;
    font-weight: 700;
}

.pos-cart-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--qbf-muted);
}

.pos-alert {
    border-radius: 10px;
    margin-bottom: 0.75rem;
}

@media (max-width: 991.98px) {
    .pos-cart {
        position: relative;
        max-height: none;
        order: 2;
    }
}

/* PWA install */
.qbf-pwa-install-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 700;
    white-space: nowrap;
}

.qbf-pwa-install-btn .icon {
    width: 1.1rem;
    height: 1.1rem;
}
