:root {
    /* POS brand palette */
    --pos-blue: #2563eb;         /* primary brand blue */
    --pos-blue-dark: #1d4fc4;    /* hover / active / gradient end */
    --pos-blue-light: #7ea2f2;   /* tints, badges, subtle accents */
    --pos-cream: #eef3fd;        /* soft cool background tint */
    --pos-charcoal: #20242c;     /* dark neutral for body text */
    /* Inter renders noticeably crisper than the system-UI default at small
       dashboard sizes; the stack falls back gracefully if the CDN is unreachable. */
    --pos-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: #f4f6f9;
    font-family: var(--pos-font);
    color: var(--pos-charcoal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6,
.navbar-brand, .stat-value, .card-title, .btn {
    letter-spacing: -0.01em;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--pos-charcoal);
}

/* ---------- Login screen ---------- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--pos-blue) 0%, var(--pos-blue-dark) 100%);
}

.login-card {
    width: 100%;
    max-width: 380px;
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.25);
}

.login-logo {
    width: auto;
    height: 88px;
    max-width: 220px;
}

/* ---------- Top navbar ---------- */
.pos-navbar {
    background-color: var(--pos-blue);
}

.pos-navbar .navbar-brand {
    font-weight: 700;
    color: #fff !important;
    letter-spacing: 0.02em;
}

.pos-navbar .navbar-brand small {
    display: block;
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--pos-cream);
    letter-spacing: 0.08em;
}

/* ---------- Sidebar ---------- */
.pos-sidebar {
    width: 250px;
    min-height: calc(100vh - 56px);
    background-color: #fff;
    border-right: 1px solid #e3e6ea;
    flex-shrink: 0;
    position: relative;
    transition: width 0.15s ease;
}

.pos-sidebar .nav-link {
    color: #33404d;
    border-radius: 0.375rem;
    padding: 0.55rem 0.9rem;
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pos-sidebar .nav-link.active {
    background-color: var(--pos-blue);
    color: #fff !important;
}

.pos-sidebar .nav-link:hover:not(.active) {
    background-color: var(--pos-cream);
}

.pos-sidebar .sidebar-section {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9aa5b1;
    margin: 0.9rem 0.9rem 0.3rem;
    white-space: nowrap;
    overflow: hidden;
}

/* ---------- Sidebar collapse toggle ---------- */
.sidebar-collapse-btn {
    position: absolute;
    top: 1.5rem;
    right: -14px;
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #e3e6ea;
    border-radius: 50%;
    background: #fff;
    color: #6c757d;
    box-shadow: 0 0.125rem 0.35rem rgba(32, 36, 44, 0.15);
    z-index: 5;
}

.sidebar-collapse-btn:hover {
    background-color: var(--pos-cream);
    color: var(--pos-charcoal);
}

.pos-sidebar.collapsed {
    width: 64px;
}

.pos-sidebar.collapsed .sidebar-toggle-row {
    justify-content: center;
}

.pos-sidebar.collapsed .nav-label,
.pos-sidebar.collapsed .sidebar-section {
    display: none;
}

.pos-sidebar.collapsed .nav-link {
    text-align: center;
    padding: 0.55rem 0;
}

.pos-sidebar.collapsed .nav-link i {
    margin-right: 0 !important;
    font-size: 1.05rem;
}

.pos-content {
    flex-grow: 1;
    padding: 1rem 1.75rem 1.75rem;
    min-width: 0; /* let a collapsed sidebar actually free up space instead of the flex item refusing to shrink/grow */
}

/* ---------- Reusable bits ---------- */
.stat-card {
    border: none;
    border-radius: 0.6rem;
    box-shadow: 0 0.125rem 0.5rem rgba(32, 36, 44, 0.08);
    height: 100%;
}

.stat-card .stat-value {
    font-size: 1.9rem;
    font-weight: 700;
}

.table-responsive-card {
    background: #fff;
    border-radius: 0.6rem;
    box-shadow: 0 0.125rem 0.5rem rgba(32, 36, 44, 0.06);
    padding: 1.25rem;
}

/* ---------- Password field with an inline show/hide toggle ---------- */
.password-field {
    position: relative;
}

.password-field .form-control {
    padding-right: 2.75rem;
}

.password-toggle-btn {
    position: absolute;
    top: 0;
    right: 0;
    width: 2.75rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #6c757d;
    padding: 0;
}

.password-toggle-btn:hover,
.password-toggle-btn:focus {
    color: var(--pos-charcoal);
}

.password-toggle-btn:focus {
    outline: none;
    box-shadow: none;
}

/* ---------- Table tiles (tables/index.php, dine-in picker) ---------- */
.table-tile {
    border-radius: 0.5rem;
    padding: 0.9rem;
    color: #fff;
    min-height: 90px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.table-tile .table-number {
    font-size: 1.3rem;
    font-weight: 700;
}

.table-tile.status-available { background-color: #1e9e63; }
.table-tile.status-occupied  { background-color: #c0392b; }
.table-tile.status-reserved  { background-color: #d7a52b; }

/* ---------- Product / catalog list (products/index.php) ----------
   A flex row per item instead of a per-category <table> — a fixed-width
   flex column keeps prices aligned across every category and wraps
   cleanly on narrow screens instead of squeezing. */
.menu-item-list {
    display: flex;
    flex-direction: column;
}

.menu-item-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid #eef0f2;
}

.menu-item-row:last-child {
    border-bottom: none;
}

.menu-item-row.menu-item-unavailable {
    opacity: 0.6;
}

.menu-item-photo {
    width: 52px;
    height: 52px;
    border-radius: 0.5rem;
    object-fit: cover;
    flex: 0 0 auto;
}

.menu-item-photo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--pos-cream);
    color: var(--pos-blue);
    font-size: 1.3rem;
}

.menu-item-info {
    flex: 1 1 220px;
    min-width: 0;
}

.menu-item-name {
    font-weight: 600;
}

.menu-item-desc {
    margin-top: 0.1rem;
}

.menu-item-price {
    flex: 0 0 auto;
    width: 100px;
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.menu-item-actions {
    flex: 0 0 auto;
    display: flex;
    gap: 0.35rem;
    margin-left: auto;
}

@media (max-width: 480px) {
    .menu-item-row { justify-content: space-between; }
    .menu-item-info { flex: 1 1 100%; order: 1; }
    .menu-item-price { order: 2; width: auto; margin-right: auto; }
    .menu-item-actions { order: 3; margin-left: 0; }
}

/* ---------- POS Terminal (pos/terminal.php) ---------- */
.pos-terminal {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.pos-catalog {
    flex: 1 1 auto;
    min-width: 0;
}

.pos-category-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.pos-category-pills .btn {
    border-radius: 2rem;
    font-size: 0.85rem;
    padding: 0.35rem 0.9rem;
}

.pos-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.pos-product-tile {
    background: #fff;
    border: 1px solid #e3e6ea;
    border-radius: 0.6rem;
    padding: 0.85rem 0.75rem;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.1s ease, box-shadow 0.1s ease, transform 0.05s ease;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-height: 96px;
}

.pos-product-tile:hover {
    border-color: var(--pos-blue);
    box-shadow: 0 0.25rem 0.6rem rgba(37, 99, 235, 0.12);
}

.pos-product-tile:active {
    transform: scale(0.98);
}

.pos-product-tile:disabled,
.pos-product-tile.out-of-stock {
    opacity: 0.45;
    cursor: not-allowed;
}

.pos-product-tile .pos-product-name {
    font-weight: 600;
    font-size: 0.92rem;
    line-height: 1.25;
}

.pos-product-tile .pos-product-price {
    color: var(--pos-blue);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.pos-product-tile .pos-product-stock {
    font-size: 0.72rem;
    color: #8a93a0;
}

.pos-cart-panel {
    flex: 0 0 360px;
    background: #fff;
    border-radius: 0.6rem;
    box-shadow: 0 0.125rem 0.5rem rgba(32, 36, 44, 0.08);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 90px);
}

.pos-cart-header {
    padding: 1rem 1rem 0.5rem;
    border-bottom: 1px solid #eef0f2;
}

.pos-cart-items {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0.5rem 1rem;
    min-height: 120px;
}

.pos-cart-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid #f2f3f5;
}

.pos-cart-row:last-child {
    border-bottom: none;
}

.pos-cart-row .cart-item-name {
    font-weight: 600;
    font-size: 0.88rem;
}

.pos-cart-row .cart-item-price {
    font-size: 0.78rem;
    color: #8a93a0;
}

.pos-cart-qty {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.pos-cart-qty button {
    width: 24px;
    height: 24px;
    line-height: 1;
    padding: 0;
    border-radius: 50%;
}

.pos-cart-qty input {
    width: 42px;
    text-align: center;
    padding: 0.1rem;
    font-size: 0.85rem;
}

.pos-cart-totals {
    padding: 0.75rem 1rem;
    border-top: 1px solid #eef0f2;
    font-size: 0.92rem;
}

.pos-cart-totals .grand-total {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--pos-blue);
}

.pos-cart-footer {
    padding: 0.75rem 1rem 1rem;
    border-top: 1px solid #eef0f2;
}

.pos-cart-empty {
    text-align: center;
    color: #9aa5b1;
    padding: 2.5rem 1rem;
}

/* ---------- Kitchen / prep ticket board (kitchen/index.php) ---------- */
.ticket-board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.kitchen-ticket {
    background: #fff;
    border-radius: 0.6rem;
    box-shadow: 0 0.125rem 0.5rem rgba(32, 36, 44, 0.1);
    border-top: 4px solid var(--pos-blue);
    overflow: hidden;
}

.kitchen-ticket .ticket-header {
    padding: 0.7rem 0.9rem;
    background: var(--pos-cream);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.kitchen-ticket .ticket-body {
    padding: 0.75rem 0.9rem;
}

.kitchen-ticket .ticket-item {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.3rem 0;
    border-bottom: 1px dashed #eef0f2;
    font-size: 0.9rem;
}

.kitchen-ticket .ticket-item:last-child {
    border-bottom: none;
}

/* ---------- Service queue board (laundry-style order tracking) ---------- */
.queue-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

@media (max-width: 992px) {
    .queue-board { grid-template-columns: repeat(2, 1fr); }
    .pos-terminal { flex-direction: column; }
    .pos-cart-panel { flex: 1 1 auto; position: static; max-height: none; width: 100%; }
}

@media (max-width: 576px) {
    .queue-board { grid-template-columns: 1fr; }
}

.queue-column {
    background: #f4f6f9;
    border-radius: 0.6rem;
    padding: 0.75rem;
}

.queue-column-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    font-weight: 700;
    margin-bottom: 0.6rem;
}

.queue-card {
    background: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 0.0625rem 0.25rem rgba(32, 36, 44, 0.08);
    padding: 0.75rem;
    margin-bottom: 0.6rem;
}

/* ---------- Receipt (printable) ---------- */
.receipt-paper {
    width: 320px;
    margin: 0 auto;
    background: #fff;
    padding: 1rem 1.1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.receipt-paper hr {
    border-top: 1px dashed #333;
}

.receipt-paper .receipt-total {
    font-weight: 700;
    font-size: 1rem;
}

/* ---------- Print ---------- */
@media print {
    .pos-navbar, .pos-sidebar, .no-print { display: none !important; }
    .pos-content { padding: 0; }
    .table-responsive-card { box-shadow: none; padding: 0; margin-bottom: 1rem !important; }
    body { background: #fff; }
}
