/*
 * BBTPOS application styles — plain CSS, no build step, loaded by
 * resources/views/layouts/app.blade.php.
 */

* { box-sizing: border-box; }

body {
    font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    background: #f5f6f8;
    color: #1f2933;
    margin: 0;
    padding: 0;
}

/* Small branding box in the top-left corner, rather than a full-width
   bar, per BBT Systems' design request. */
.brand-box {
    display: inline-block;
    background: #1f2933;
    color: #fff;
    padding: 0.6rem 1.2rem;
    margin: 1rem 0 0 1rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 1.1rem;
}
.brand-box a { color: #fff; text-decoration: none; }

.clock {
    display: inline-block;
    float: right;
    background: #fff;
    color: #1f2933;
    padding: 0.6rem 1.2rem;
    margin: 1rem 1rem 0 0;
    border-radius: 6px;
    font-weight: 600;
    font-size: 1.1rem;
    font-variant-numeric: tabular-nums;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Signed-in user badge + Log Out, next to the clock. Both float right;
   the clock is first in the markup so it keeps the rightmost spot. */
.user-box {
    display: inline-block;
    float: right;
    background: #fff;
    color: #1f2933;
    padding: 0.35rem 0.8rem;
    margin: 1rem 1rem 0 0;
    border-radius: 6px;
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.user-box form { margin-left: 0.5rem; }

/* Cap the login form's width so it doesn't stretch across the whole
   content column. */
.login-form { max-width: 360px; }

.page-body {
    display: flex;
    align-items: flex-start;
    clear: both;
}

/* Sized to match .brand-box (same padding, radius, weight, size) so the
   nav reads as part of the same button family. */
.side-nav {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex-shrink: 0;
    margin: 1rem 0 0 1rem;
}
.side-nav a {
    display: inline-block;
    background: #1f2933;
    color: #fff;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 1.1rem;
    text-decoration: none;
    text-align: center;
}
.side-nav a:hover { background: #324150; }

/* Per-page action panel — the right-hand counterpart to .side-nav, fed
   by @stack('page-actions') (see layouts/app.blade.php and
   components/nav-action.blade.php). Home is always the first button;
   everything after it is contextual to whatever page is open. */
.page-actions-panel {
    flex-shrink: 0;
    width: 12rem;
    margin: 2rem 1rem 0 0;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 1rem;
}
.page-actions-panel h2 {
    margin: 0 0 0.75rem;
    font-size: 0.8rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.page-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.page-actions .btn {
    text-align: center;
}

main {
    flex: 1;
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 1rem;
}

h1 { margin-top: 0; }

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
th, td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid #e4e7eb;
}
th { background: #eef1f4; }
tr:last-child td { border-bottom: none; }

/* Gap between two separate tables (e.g. the new-record table and the
   existing-records table on the bulk add page) — no background of its
   own, so the page background shows through and the two tables read as
   distinct. Height approximates one table row. */
.table-gap {
    height: 2.6rem;
}

.btn {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    border: 1px solid transparent;
}
.btn-primary { background: #2563eb; color: #fff; }
.btn-secondary { background: #e4e7eb; color: #1f2933; }
.btn-danger { background: #dc2626; color: #fff; }

form.inline { display: inline; }

.status {
    background: #dcfce7;
    border: 1px solid #22c55e;
    color: #14532d;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    /* Pinned to the bottom-left of the viewport instead of flowing with
       the page content, so it reads like a toast/notification. */
    position: fixed;
    left: 1rem;
    bottom: 1rem;
    max-width: 320px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 100;
}

.errors {
    background: #fee2e2;
    border: 1px solid #dc2626;
    color: #7f1d1d;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.field input,
.field select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #cbd2d9;
    border-radius: 4px;
    font-size: 1rem;
    background: #fff;
}
.field small { color: #6b7280; }

/* Eye-icon toggle overlaid on the login password field — see
   resources/views/auth/login.blade.php. */
.password-field { position: relative; }
.password-field input { padding-right: 2.5rem; }
.password-toggle {
    position: absolute;
    top: 50%;
    right: 0.5rem;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.2rem;
    margin: 0;
    line-height: 0;
    color: #6b7280;
    cursor: pointer;
}
.password-toggle:hover { color: #1f2933; }
.password-toggle svg[hidden] { display: none; }

.actions { margin-top: 1.5rem; }
.text-right { text-align: right; }

/* The checkbox column on the product list, and the toolbar of
   View/Edit/Delete buttons above it. */
.bulk-actions {
    margin-top: 0;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}
/* Fixed gap between View/Edit/Add Product; the space after Add Product
   is controlled entirely by .bulk-spacer's JS-set width, so no
   gap/margin is added there. */
.bulk-actions > .btn {
    margin-right: 0.6rem;
}
.bulk-actions #add-product-btn {
    margin-right: 0;
}
.bulk-spacer {
    flex-shrink: 0;
}

table th:first-child,
table td:first-child {
    width: 2rem;
    text-align: center;
}

/* Inputs placed directly inside table cells, like on the bulk edit
   pages, need their own sizing since the .field styles above only apply
   to inputs inside a .field div. */
table input[type="text"],
table input[type="number"],
table select {
    width: 100%;
    min-width: 6rem;
    padding: 0.4rem;
    border: 1px solid #cbd2d9;
    border-radius: 4px;
    font-size: 1rem;
    background: #fff;
}

/* Point of sale — search box, fuzzy-match dropdown, and the cart table.
   See resources/views/components/pos/product-search.blade.php. */
.pos-search {
    position: relative;
    margin-bottom: 2rem;
}
.pos-search-field { position: relative; }
.pos-search-error { color: #dc2626; }

.pos-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 10;
    background: #fff;
    border: 1px solid #cbd2d9;
    border-radius: 4px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    max-height: 20rem;
    overflow-y: auto;
}

/* A real table, laid out to match the cart table below it (same
   Product/Qty/Price column order and alignment) — shorter row padding
   than the app's default table rows so more matches fit before
   scrolling kicks in. */
.pos-search-table { box-shadow: none; }
.pos-search-table th,
.pos-search-table td {
    padding: 0.3rem 0.8rem;
}
.pos-search-table tbody tr { cursor: pointer; }
.pos-search-table tbody tr:last-child td { border-bottom: none; }
.pos-search-table tbody tr.is-highlighted { background: #eef1f4; }

.pos-search-empty {
    padding: 0.5rem 0.8rem;
    color: #6b7280;
}

/* The product column on both the search results and the cart below it —
   overrides the generic table th/td:first-child rule above (meant for
   the checkbox column elsewhere) and keeps the two tables' first column
   the same width so they read as one aligned block. */
.pos-search-table th:first-child,
.pos-search-table td:first-child,
.pos-cart th:first-child,
.pos-cart td:first-child {
    width: 20ch;
    text-align: left;
    white-space: nowrap;
}
.pos-cart-qty button {
    padding: 0.1rem 0.6rem;
    font-size: 1rem;
    line-height: 1.2;
}
.pos-cart-qty span {
    display: inline-block;
    min-width: 1.5rem;
    text-align: center;
}

/* Serial number inputs stacked under a serialized cart line's
   description — one per unit, count kept in sync with qty (see
   incrementLine/decrementLine in public/js/pos.js). */
.pos-cart-serials {
    white-space: normal;
    margin-top: 0.3rem;
}
.pos-cart-serials input {
    display: block;
    width: 100%;
    min-width: 0;
    margin-bottom: 0.2rem;
    font-size: 0.85rem;
    padding: 0.2rem 0.4rem;
}

/* One row per split-tender payment on the checkout section below the
   cart — method + amount + remove, inline rather than stacked like a
   plain .field. */
.pos-payment-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}
.pos-payment-row select {
    flex: 0 0 auto;
}
.pos-payment-row input {
    flex: 0 0 auto;
    width: 8rem;
}
