/* XchangePoint - custom styles. Interactive pages use MudBlazor's palette variables so light/dark both work;
   only the static sign-in pages (no MudBlazor) define their own colours, keyed off <html data-theme> set by theme.js. */

html, body, input, button, select, textarea { font-family: 'Inter', 'Segoe UI', 'Arial', sans-serif; }

#blazor-error-ui {
  background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); display: none; left: 0;
  padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.muted { color: var(--mud-palette-text-secondary); }
.mono { font-family: Consolas, 'Cascadia Mono', monospace; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- page structure ---- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-bottom: 1rem; }
.page-head h1 { font-size: 1.5rem; font-weight: 600; margin: 0; }
.page-head .spacer { flex: 1 1 auto; }

/* Parts enquiry: catalogue on the left, active cart docked on the right (stacks on narrow screens). */
.shop-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1rem; align-items: start; }
.shop-cart { position: sticky; top: 76px; }
@media (max-width: 1100px) { .shop-grid { grid-template-columns: minmax(0, 1fr); } .shop-cart { position: static; } }

.filter-chips { display: flex; flex-wrap: wrap; gap: .25rem .4rem; }
.filter-chips .group-break { flex-basis: 100%; height: 0; }

.qty-input { width: 5.5rem; }
.qty-input input { text-align: center; }

.part-details dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--mud-palette-text-secondary); margin-top: .5rem; }
.part-details dd { margin: 0; white-space: pre-line; }
.part-thumb { width: 40px; height: 40px; object-fit: contain; vertical-align: middle; margin-right: .5rem; border-radius: 4px; background: #fff; border: 1px solid var(--mud-palette-lines-default); cursor: pointer; }
.part-thumb.small { width: 28px; height: 28px; margin-right: .35rem; }
.part-thumb.empty { display: inline-block; border-color: transparent; background: none; cursor: default; }
.part-photo { display: block; max-width: 100%; max-height: 320px; object-fit: contain; border-radius: 6px; background: #fff; border: 1px solid var(--mud-palette-lines-default); }

.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.tile { display: block; text-decoration: none; color: inherit; height: 100%; }
.tile .mud-paper { height: 100%; transition: transform .1s ease, box-shadow .1s ease; }
.tile:hover .mud-paper { transform: translateY(-2px); box-shadow: var(--mud-elevation-4); }

.stat { font-size: 1.75rem; font-weight: 600; line-height: 1.1; }

/* Status chips keep the same meaning everywhere. */
.status-received { background: var(--mud-palette-info) !important; color: var(--mud-palette-info-text) !important; }
.status-progress { background: var(--mud-palette-primary) !important; color: var(--mud-palette-primary-text) !important; }
.status-hold, .status-cancelreq { background: var(--mud-palette-warning) !important; color: var(--mud-palette-warning-text) !important; }
.status-ready { background: var(--mud-palette-tertiary) !important; color: var(--mud-palette-tertiary-text) !important; }
.status-done { background: var(--mud-palette-success) !important; color: var(--mud-palette-success-text) !important; }
.status-cancelled { background: var(--mud-palette-gray-default) !important; color: var(--mud-palette-white) !important; }

/* BOM tree */
.bom-node { display: flex; align-items: center; gap: .5rem; width: 100%; min-width: 0; }
.bom-node .pn { font-weight: 600; white-space: nowrap; }
.bom-node .desc { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bom-node .qty { white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.bom-hit > td { background: rgba(245, 184, 46, .16); }

/* Shopping-as banner (staff impersonating a dealer) */
.shop-as { background: var(--mud-palette-secondary); color: var(--mud-palette-secondary-text); padding: .35rem 1rem; font-size: .875rem; display: flex; align-items: center; gap: .5rem; }

pre.import-log { white-space: pre-wrap; word-break: break-word; max-height: 24rem; overflow: auto; background: var(--mud-palette-background-gray); padding: .75rem; border-radius: 6px; font-size: .8rem; }

/* ---- print: carts and orders print as clean documents ---- */
@media print {
  .mud-appbar, .mud-drawer, .no-print, .shop-as, .mud-snackbar-provider { display: none !important; }
  .mud-main-content { padding-top: 0 !important; margin: 0 !important; }
  .print-only { display: block !important; }
  .mud-paper { box-shadow: none !important; }
}
.print-only { display: none; }

/* ---- static sign-in pages ---- */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; background: #f5f5f6; color: #1d1f23; }
.auth-card { width: min(100%, 400px); padding: 2rem; background: #fff; border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .10); }
/* The DBE mark has dark grey bars, so it always sits on a white tile (blue app bar, dark mode). */
.brand-tile { display: inline-flex; align-items: center; justify-content: center; background: #fff; border-radius: 8px; box-shadow: 0 1px 2px rgba(0, 0, 0, .15); }
.brand-tile img { height: 100%; width: auto; display: block; }
.brand-tile-sm { height: 34px; padding: 4px 7px; }
.auth-logo { height: 64px; padding: 8px 12px; margin-bottom: .75rem; }
.auth-card h1 { margin: 0 0 .25rem; font-size: 1.5rem; font-weight: 600; }
.auth-card label { display: block; margin: .9rem 0 .3rem; font-size: .85rem; font-weight: 500; }
.auth-card label.remember { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
.auth-card .muted { color: #5c6068; margin-top: 0; }
.auth-card a { color: #aa0000; }
.auth-foot { margin: 1rem 0 0; font-size: .875rem; }
.auth-error { color: #c62828; background: rgba(198, 40, 40, .08); padding: .5rem .75rem; border-radius: 6px; }
.auth-input { width: 100%; box-sizing: border-box; background: #fff; border: 1px solid #8a8e96; border-radius: 8px; color: #1d1f23; font: inherit; padding: .6rem .75rem; }
.auth-input:focus { border-color: #aa0000; outline: 2px solid rgba(170, 0, 0, .2); }
.auth-button { width: 100%; margin-top: 1.25rem; padding: .7rem; border: 0; border-radius: 8px; background: #aa0000; color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.auth-button:hover { background: #8c0000; }
.auth-password-field { position: relative; }
.auth-password-field .auth-input { padding-right: 2.5rem; }
.auth-password-toggle { align-items: center; background: none; border: none; border-radius: 6px; color: #5c6068; cursor: pointer; display: flex; padding: .35rem; position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); }
.auth-password-toggle:hover, .auth-password-toggle:focus-visible { color: #1d1f23; }
.auth-password-toggle-slash { opacity: 0; }
.auth-password-toggle[aria-pressed="true"] .auth-password-toggle-slash { opacity: 1; }

html[data-theme='dark'] .auth-shell { background: #141518; color: #e7e8ea; }
html[data-theme='dark'] .auth-card { background: #1d1f23; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
html[data-theme='dark'] .auth-card .muted { color: #a4a8af; }
html[data-theme='dark'] .auth-card a { color: #f26b65; }
html[data-theme='dark'] .auth-input { background: #141518; color: #e7e8ea; border-color: #6b7079; }
html[data-theme='dark'] .auth-input:focus { border-color: #f26b65; outline-color: rgba(242, 107, 101, .25); }
html[data-theme='dark'] .auth-button { background: #f26b65; color: #1b1b1b; }
html[data-theme='dark'] .auth-button:hover { background: #f48a85; }
html[data-theme='dark'] .auth-password-toggle { color: #a4a8af; }
html[data-theme='dark'] .auth-password-toggle:hover { color: #e7e8ea; }
html[data-theme='dark'] .auth-error { color: #ff8a80; background: rgba(255, 138, 128, .1); }
