/*
 * Component styles for the server-rendered pages. These reproduce what MudBlazor rendered
 * (values taken from its computed styles), so the look is unchanged after removing it.
 * Tailwind (output.css) still supplies the layout utilities used in the markup.
 *
 * Breakpoints mirror MudBlazor's, not Tailwind's:
 *   960px  -- desktop filter panels vs. mobile bar + drawer (MudBlazor "md")
 *   1280px -- table rows vs. cards (MudTable Breakpoint.Md)
 */

:root {
    --text: #424242;
    --primary: #b5b898;
    --primary-hover: #a5a984;
    --tertiary: #ffe900;
    --error: #f44336;
    --success: #00c853;
    --lines: #e0e0e0;
    --grey-bg: #f4f4f4;
    --input-border: #bdbdbd;
    --action: rgba(0, 0, 0, 0.54);
    --action-disabled: rgba(0, 0, 0, 0.26);
    --tooltip: #616161;
    --scrim: rgba(33, 33, 33, 0.5);
    --elevation-1: 0 2px 1px -1px rgba(0,0,0,.2), 0 1px 1px 0 rgba(0,0,0,.14), 0 1px 3px 0 rgba(0,0,0,.12);
    --elevation-2: 0 3px 1px -2px rgba(0,0,0,.2), 0 2px 2px 0 rgba(0,0,0,.14), 0 1px 5px 0 rgba(0,0,0,.12);
    --elevation-4: 0 2px 4px -1px rgba(0,0,0,.2), 0 4px 5px 0 rgba(0,0,0,.14), 0 1px 10px 0 rgba(0,0,0,.12);
    --elevation-6: 0 3px 5px -1px rgba(0,0,0,.2), 0 6px 10px 0 rgba(0,0,0,.14), 0 1px 18px 0 rgba(0,0,0,.12);
    --elevation-24: 0 11px 15px -7px rgba(0,0,0,.2), 0 24px 38px 3px rgba(0,0,0,.14), 0 9px 46px 8px rgba(0,0,0,.12);
    --font: -apple-system, BlinkMacSystemFont, "San Francisco", "Helvetica Neue", Arial, sans-serif;
}

html, body {
    font-family: var(--font);
}

body {
    margin: 0;
    background: #fff;
    color: var(--text);
    font-size: 14px;
    line-height: 1.43;
    letter-spacing: .01071em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* MudBlazor's global scrollbar styling (the standard properties win over ::-webkit-scrollbar where supported). */
html, body * {
    scrollbar-color: #c4c4c4 transparent;
    scrollbar-width: thin;
}

.icon { width: 24px; height: 24px; fill: currentColor; flex-shrink: 0; }
.icon-sm { width: 20px; height: 20px; fill: currentColor; }

.tagline {
    color: #7E7F65;
    font-size: 14px;
    line-height: 1.43;
}

/* ---------- Buttons ---------- */

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border-radius: 50%;
    color: var(--action);
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: background-color 250ms cubic-bezier(.4, 0, .2, 1);
}
.icon-btn:hover { background-color: rgba(0, 0, 0, .04); }
.icon-btn-primary { color: var(--primary); }
.icon-btn-primary:hover { background-color: rgba(181, 184, 152, .04); }
.icon-btn-sm { padding: 5px; }

.chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* MudButton, Size.Small, rounded-pill */
.chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-width: 64px;
    padding: 4px 10px;
    border-radius: 9999px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.75;
    letter-spacing: .02857em;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: background-color 250ms cubic-bezier(.4, 0, .2, 1), box-shadow 250ms cubic-bezier(.4, 0, .2, 1);
}
.chip-filled {
    color: #fff;
    background-color: var(--primary);
    border: 0;
    box-shadow: var(--elevation-2);
}
.chip-filled:hover { background-color: var(--primary-hover); box-shadow: var(--elevation-4); }
.chip-outlined {
    color: var(--text);
    background-color: transparent;
    border: 1px solid var(--text);
    padding: 3px 9px;
}
.chip-outlined:hover { background-color: rgba(66, 66, 66, .04); }
/* Category chips carry inline colours; keep their hover from washing them out. */
.chip[style]:hover { filter: brightness(.97); }

.chip-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
    margin-left: -2px;
    margin-right: 8px;
}

.btn-error {
    display: inline-flex;
    align-items: center;
    padding: 6px 16px;
    border: 0;
    border-radius: 4px;
    background-color: var(--error);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.75;
    letter-spacing: .02857em;
    text-transform: uppercase;
    box-shadow: var(--elevation-2);
    cursor: pointer;
    transition: background-color 250ms cubic-bezier(.4, 0, .2, 1), box-shadow 250ms cubic-bezier(.4, 0, .2, 1);
}
.btn-error:hover { background-color: #f21f10; box-shadow: var(--elevation-4); }
.btn-error:disabled { opacity: .7; cursor: default; }

.btn-outlined {
    display: inline-flex;
    align-items: center;
    padding: 5px 15px;
    border: 1px solid var(--text);
    border-radius: 4px;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.75;
    letter-spacing: .02857em;
    text-transform: uppercase;
    cursor: pointer;
}
.btn-outlined:hover { background-color: rgba(66, 66, 66, .04); }

/* ---------- Search (MudTextField, outlined, dense) ---------- */

.search-field {
    position: relative;
    display: flex;
    align-items: center;
    height: 40px;
    box-sizing: border-box;
    padding-left: 13px;
    border: 1px solid var(--input-border);
    border-radius: 4px;
    background: #fff;
    cursor: text;
}
.search-field:hover { border-color: var(--text); }
.search-field:focus-within { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.search-icon { width: 24px; height: 24px; fill: var(--action); margin-right: 8px; flex-shrink: 0; }
.search-field input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0 14px 0 0;
    border: 0;
    outline: 0;
    background: transparent;
    font-family: inherit;
    font-size: 16px;
    letter-spacing: .00938em;
    color: var(--text);
}
.search-field input::placeholder { color: var(--text); opacity: .42; }

/* ---------- Header: mobile bar vs. desktop filters ---------- */

.mobile-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
}
.search-field-mobile { flex-grow: 1; }
.desktop-filters { display: none; padding-top: 8px; }

@media (min-width: 960px) {
    .mobile-bar { display: none; }
    .desktop-filters { display: block; }
}

/* MudExpansionPanel with gutters and header padding removed */
.panel > summary { list-style: none; }
.panel > summary::-webkit-details-marker { display: none; }
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 48px;
    cursor: pointer;
    user-select: none;
}
.panel-title {
    font-size: 20px;
    font-weight: 500;
    line-height: 32px;
    letter-spacing: .0075em;
    color: var(--text);
}
.panel-icon {
    width: 24px;
    height: 24px;
    fill: var(--text);
    transition: transform 300ms cubic-bezier(.25, .8, .5, 1);
}
.panel[open] .panel-icon { transform: rotate(180deg); }
/* Set by products.js on the toggle event only, so swapping a region inside an open panel doesn't replay it. */
.panel > .is-opening { animation: panel-open 200ms ease-in-out; }
@keyframes panel-open {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: none; }
}

/* ---------- Results ---------- */

.results-band { background-color: var(--grey-bg); }

.results { position: relative; }

.table-container {
    position: relative;
    height: calc(100vh - 290px);
    overflow-y: auto;
    padding: 8px;
    background-color: var(--grey-bg);
}

.products-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

/* Below 1280px every row is one card (MudTable's small-device layout). */
.products-table thead { display: none; }
.products-table,
.products-table tbody,
.products-table tr { display: block; }
.products-table .d-cell { display: none; }
.products-table .m-cell { display: flow-root; padding: 0; }

.card {
    margin: 4px 0;
    padding: 8px 8px 8px 10px;
    border: 1px solid var(--lines);
    border-left: 12px solid #808080;
    border-radius: 8px;
    background: #fff;
}
/* MudGrid Spacing=1 with xs=7 / xs=5 items: negative gutter on the grid, 4px padding on items.
   Kept as MudGrid's percentage model (not CSS grid) so text wraps at exactly the same widths. */
.card-grid {
    display: flex;
    flex-wrap: wrap;
    width: calc(100% + 4px);
    margin: -4px 0 0 -4px;
}
.card-grid > * { box-sizing: border-box; padding: 4px 0 0 4px; }
.card-grid > :nth-child(odd) { flex: 0 0 58.333333%; max-width: 58.333333%; }
.card-grid > :nth-child(even) { flex: 0 0 41.666667%; max-width: 41.666667%; }
.card-name { font-size: 16px; font-weight: 600; line-height: 1.3; letter-spacing: .00938em; }
.card-details { margin-top: 4px; }
.card-price-col { display: flex; flex-direction: column; align-items: flex-end; }
.card-price { font-size: 20px; font-weight: 600; line-height: 1.2; letter-spacing: .0075em; }
.card-row2 { margin-top: 8px; }
.card-meta { display: flex; justify-content: flex-end; align-items: center; }
.card-link {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    font-size: 12px;
    line-height: 1.66;
    letter-spacing: .03333em;
    text-align: right;
    text-decoration: underline;
    cursor: pointer;
}

.discount-chip,
.discount-chip-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 4px;
    background-color: var(--tertiary);
    color: var(--text);
    white-space: nowrap;
}
.discount-chip { height: 32px; padding: 0 12px; border-radius: 16px; font-size: 14px; }
.discount-chip-sm { height: 20px; padding: 0 8px; border-radius: 4px; font-size: 12px; font-weight: 600; }

.no-records td { display: block; padding: 16px; font-size: 16px; }

@media (min-width: 1280px) {
    .results-band { background-color: transparent; }

    .table-container {
        height: calc(100vh - 376px);
        padding: 0;
        background-color: transparent;
    }

    .products-table { display: table; table-layout: auto; }
    .products-table thead { display: table-header-group; }
    .products-table tbody { display: table-row-group; }
    .products-table tr { display: table-row; }
    .products-table tbody tr:hover { background-color: rgba(0, 0, 0, .04); }
    .products-table .d-cell { display: table-cell; }
    .products-table .m-cell { display: none; }

    .products-table th,
    .products-table td {
        padding: 6px 0 6px 8px;
        border-bottom: 1px solid var(--lines);
        text-align: left;
        vertical-align: middle;
    }
    .products-table th {
        position: sticky;
        top: 0;
        z-index: 1;
        background: #fff;
        font-weight: 500;
        line-height: 24px;
    }
    .no-records td { display: table-cell; padding: 16px; }

    .col-ribbon { width: 10px; min-width: 10px; max-width: 10px; padding: 0 !important; }
    .col-sm { width: 100px; min-width: 100px; max-width: 100px; }
    .col-lg { width: 250px; min-width: 250px; max-width: 250px; }
    .col-flexible { min-width: 200px; width: auto; }
}

/* MudTableSortLabel */
.sort-label {
    display: inline-flex;
    align-items: center;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
}
.sort-icon {
    width: 18px;
    height: 18px;
    margin: 0 4px;
    fill: currentColor;
    opacity: 0;
    transition: opacity 200ms cubic-bezier(.4, 0, .2, 1), transform 200ms cubic-bezier(.4, 0, .2, 1);
}
.sort-label:hover .sort-icon { opacity: .54; }
.sort-icon.sort-asc { opacity: 1; }
.sort-icon.sort-desc { opacity: 1; transform: rotate(180deg); }

.price { font-size: 16px; font-weight: 600; line-height: 1.5; letter-spacing: .00938em; }

.desc { max-width: 300px; white-space: normal; }
.desc .icon-btn { vertical-align: middle; }

.icon-btn-image { padding: 3px; }
.icon-image { width: 20px; height: 20px; fill: var(--tertiary); }
.icon-btn-image:hover { background-color: rgba(255, 233, 0, .04); }

/* MudTable LoadingProgress (indeterminate linear, Color.Info) */
.loading-bar {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 4px;
    z-index: 2;
    overflow: hidden;
    background-color: rgba(33, 150, 243, .3);
}
.loading-bar::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40%;
    background-color: #2196f3;
    animation: loading-bar 1.4s ease-in-out infinite;
}
@keyframes loading-bar {
    from { left: -40%; }
    to { left: 100%; }
}
.results.is-loading .loading-bar { display: block; }
@media (min-width: 1280px) {
    .loading-bar { top: 36px; }
}

/* MudTablePager */
.pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 52px;
    padding-right: 2px;
    border-top: 1px solid var(--lines);
}
.pager-caption { padding: 0 10px; }
.pager-actions { display: flex; margin-left: 24px; }
.pager-btn { color: var(--action); }
.pager-btn-disabled { color: var(--action-disabled); cursor: default; }
.pager-btn-disabled:hover { background: none; }

@media (max-width: 599.98px) {
    .pager {
        flex-wrap: wrap;
        justify-content: flex-start;
        min-height: 100px;
        padding: 16px 16px 0 0;
        box-sizing: border-box;
    }
    .pager-actions { margin-left: auto; }
    .pager-first, .pager-last { display: none; }
}

/* ---------- Tooltip (MudTooltip, placement bottom) ---------- */

.tooltip {
    position: fixed;
    z-index: 1600;
    max-width: 320px;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: var(--tooltip);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4em;
    text-align: center;
    pointer-events: none;
}

/* ---------- Drawer (MudDrawer, temporary, anchored top) ---------- */

.drawer { position: fixed; inset: 0; z-index: 1300; }
.drawer[hidden] { display: none; }
.drawer-scrim { position: absolute; inset: 0; background-color: var(--scrim); animation: fade-in 225ms ease-out; }
.drawer-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    max-height: 80vh;
    overflow-y: auto;
    background: #fff;
    box-shadow: var(--elevation-1);
    animation: drawer-in 225ms cubic-bezier(0, 0, .2, 1);
}
.drawer-header { display: flex; align-items: center; justify-content: flex-end; height: 64px; padding: 0 8px; }
.drawer-content { padding: 0 16px 16px; }
.drawer-title { margin-bottom: 8px; font-size: 20px; font-weight: 500; line-height: 32px; letter-spacing: .0075em; }

@keyframes drawer-in { from { transform: translateY(-100%); } to { transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Dialog (MudDialog) ---------- */

.dialog {
    /* Tailwind's preflight zeroes the UA margin that centres a modal <dialog>. */
    margin: auto;
    width: 80vw;
    max-width: 700px;
    max-height: 90vh;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: #fff;
    color: var(--text);
    box-shadow: var(--elevation-24);
    overflow: hidden;
}
.dialog[open] { display: flex; flex-direction: column; }
/* site.showDialog focuses the dialog itself, so no control shows a ring until the user tabs. */
.dialog:focus { outline: none; }
.dialog::backdrop { background-color: var(--scrim); }
.dialog-close { position: absolute; top: 8px; right: 8px; color: var(--action); z-index: 1; }
.dialog-content { overflow-y: auto; padding: 40px 24px 24px; }
.dialog-image-wrap { display: flex; align-items: center; justify-content: center; margin-top: 24px; padding: 0 18px; }
.dialog-image-wrap img { max-width: 100%; height: auto; object-fit: contain; }

.dialog-confirm { width: auto; min-width: 400px; max-width: 600px; }
.dialog-confirm .dialog-title { padding: 16px 24px; font-size: 20px; font-weight: 500; line-height: 1.6; letter-spacing: .0075em; }
.dialog-confirm .dialog-body { padding: 8px 24px; font-size: 16px; }
.dialog-confirm .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 8px; }

@media (max-width: 599.98px) {
    .dialog-confirm { min-width: 0; width: calc(100vw - 32px); }
}

/* ---------- Snackbar (MudSnackbar, top right) ---------- */

.snackbar-host {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1700;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}
.snackbar {
    display: flex;
    align-items: center;
    min-width: 288px;
    max-width: 500px;
    padding: 6px 16px;
    border-radius: 4px;
    color: #fff;
    font-size: 14px;
    line-height: 1.43;
    box-shadow: var(--elevation-6);
    pointer-events: auto;
    animation: fade-in 200ms ease-out;
    transition: opacity 500ms ease-in;
}
.snackbar-success { background-color: var(--success); }
.snackbar-error { background-color: var(--error); }
.snackbar-icon { width: 22px; height: 22px; margin-right: 12px; fill: currentColor; flex-shrink: 0; }
.snackbar-message { flex: 1; padding: 8px 0; }
.snackbar-close { padding: 6px; margin-left: 8px; color: inherit; }
.snackbar-close:hover { background-color: rgba(255, 255, 255, .1); }
.snackbar.is-leaving { opacity: 0; }

@media (max-width: 599.98px) {
    .snackbar-host { left: 16px; right: 16px; top: 16px; }
    .snackbar { min-width: 0; }
}

/* ---------- Date picker dialog (flatpickr inline, themed like MudDatePicker) ---------- */

.date-dialog { width: 308px; max-width: calc(100vw - 32px); }
.date-dialog-header {
    display: flex;
    flex-direction: column;
    padding: 16px 20px;
    background-color: var(--primary);
    color: #fff;
}
.date-dialog-year { font-size: 16px; font-weight: 400; line-height: 1.5; opacity: .7; }
.date-dialog-date { font-size: 34px; font-weight: 400; line-height: 1.235; letter-spacing: .00735em; }

/* flatpickr re-types the bound input as a text field; only the inline calendar should show. */
.date-dialog input.flatpickr-input { display: none; }
.date-dialog .flatpickr-calendar.inline {
    top: 0;
    width: 100%;
    margin: 0;
    padding-bottom: 8px;
    border-radius: 0;
    box-shadow: none;
    font-family: inherit;
    color: var(--text);
}
.date-dialog .flatpickr-innerContainer,
.date-dialog .flatpickr-rContainer,
.date-dialog .flatpickr-days,
.date-dialog .dayContainer { width: 100%; min-width: 0; max-width: none; }
.date-dialog .flatpickr-months { padding: 8px 0 4px; }
.date-dialog .flatpickr-months .flatpickr-prev-month,
.date-dialog .flatpickr-months .flatpickr-next-month { top: 8px; padding: 10px 14px; fill: var(--action); }
.date-dialog .flatpickr-months .flatpickr-prev-month:hover svg,
.date-dialog .flatpickr-months .flatpickr-next-month:hover svg { fill: var(--primary); }
.date-dialog .flatpickr-current-month { font-size: 16px; font-weight: 500; }
.date-dialog .flatpickr-current-month .flatpickr-monthDropdown-months,
.date-dialog .flatpickr-current-month input.cur-year { font-weight: 500; }
.date-dialog span.flatpickr-weekday { color: rgba(0, 0, 0, .54); font-size: 12px; font-weight: 400; }
.date-dialog .flatpickr-day {
    max-width: 36px;
    height: 36px;
    line-height: 36px;
    margin: 2px 3px;
    border-radius: 50%;
    font-size: 14px;
    color: var(--text);
}
.date-dialog .flatpickr-day:hover,
.date-dialog .flatpickr-day:focus { background: rgba(181, 184, 152, .15); border-color: transparent; }
.date-dialog .flatpickr-day.today { border-color: var(--primary); }
.date-dialog .flatpickr-day.today:hover { background: rgba(181, 184, 152, .15); color: var(--text); }
.date-dialog .flatpickr-day.selected,
.date-dialog .flatpickr-day.selected:hover,
.date-dialog .flatpickr-day.selected:focus {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.date-dialog .flatpickr-day.flatpickr-disabled,
.date-dialog .flatpickr-day.flatpickr-disabled:hover,
.date-dialog .flatpickr-day.prevMonthDay,
.date-dialog .flatpickr-day.nextMonthDay { color: rgba(0, 0, 0, .26); background: transparent; border-color: transparent; }
