﻿/* ============================================================================
   HotelTRS content cards

   Two feed-style screens that had nothing to do with each other except shape:
   the noticeboard feed and the recipe preview card. Both were <style> blocks
   with unique prefixes, so this is a lift - what changes is that the colours
   become tokens, including the last of the pre-rebrand navy (#003665) in the
   recipe header.
   ============================================================================ */

/* ----------------------------------------------------------------------------
   NOTICEBOARD
   ---------------------------------------------------------------------------- */

.noticeboard-feed {
    display: flex;
    flex-direction: column;
    gap: var(--trs-space-3);
    padding-top: var(--trs-space-3);
}

.noticeboard-card {
    border: 1px solid var(--trs-border);
    border-radius: var(--trs-radius-sm);
    background: var(--trs-surface);
}

.noticeboard-card-header {
    padding: var(--trs-space-3) var(--trs-space-4);
    background: var(--trs-surface-sunken);
    border-bottom: 1px solid var(--trs-border);
}

.noticeboard-card-date {
    font-size: var(--trs-text-sm);
}

.noticeboard-card-body {
    padding: var(--trs-space-4);
}

/* Notices are authored in a rich-text editor, so the content is arbitrary HTML
   pasted by staff - it has to be forced to stay inside the card. */
.noticeboard-card-message {
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: break-word;
}

.noticeboard-card-message img {
    max-width: 100%;
    height: auto;
}

.noticeboard-card-message p:last-child {
    margin-bottom: 0;
}

.noticeboard-read-more {
    font-size: var(--trs-text-sm);
    text-decoration: none;
}

.noticeboard-card-images {
    display: flex;
    flex-wrap: wrap;
    gap: var(--trs-space-2);
}

.noticeboard-card-image-wrapper {
    width: 110px;
    height: 110px;
    border: 1px solid var(--trs-border);
    border-radius: 0.375rem;
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--trs-motion-fast) var(--trs-ease);
    background: var(--trs-surface-sunken);
}

.noticeboard-card-image-wrapper:hover {
    transform: scale(1.03);
}

.noticeboard-card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.noticeboard-card-docs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--trs-space-2);
}

.noticeboard-doc-chip {
    display: inline-flex;
    align-items: center;
}

.noticeboard-card-footer {
    padding: var(--trs-space-2) var(--trs-space-4);
    background: var(--trs-surface-sunken);
    border-top: 1px solid var(--trs-border);
}

.noticeboard-empty {
    text-align: center;
    padding: 3rem var(--trs-space-4);
    color: var(--trs-text-secondary);
}

.noticeboard-empty-icon {
    font-size: 3rem;
    color: var(--trs-border-strong);
}

@media (prefers-reduced-motion: reduce) {
    .noticeboard-card-image-wrapper,
    .noticeboard-card-image-wrapper:hover {
        transition: none;
        transform: none;
    }
}

/* ----------------------------------------------------------------------------
   RECIPE AND MENU PREVIEW

   MenuPreviewCard is the same card with menu items where the ingredients are,
   so it shares these rules under its own class names.
   ---------------------------------------------------------------------------- */

.recipe-preview-card,
.menu-preview-card {
    border: 1px solid var(--trs-border);
    border-radius: var(--trs-radius-sm);
    background: var(--trs-surface-sunken);
}

/* Header was #003665 - the pre-rebrand navy. */
.recipe-preview-header,
.menu-preview-header {
    padding: var(--trs-space-3) var(--trs-space-4);
    background: var(--trs-fill);
    color: var(--trs-on-primary);
    font-weight: var(--trs-weight-medium);
    border-radius: var(--trs-radius-sm) var(--trs-radius-sm) 0 0;
    font-size: var(--trs-text-sm);
}

.recipe-preview-body,
.menu-preview-body {
    padding: var(--trs-space-4);
}

.recipe-preview-name,
.menu-preview-name {
    font-size: var(--trs-text-xl);
    font-weight: var(--trs-weight-bold);
    margin-bottom: var(--trs-space-3);
    word-break: break-word;
}

.recipe-preview-row,
.menu-preview-row {
    display: flex;
    align-items: center;
    gap: var(--trs-space-2);
    padding: 0.2rem 0;
    font-size: var(--trs-text-base);
}

.recipe-preview-icon,
.menu-preview-icon {
    color: var(--trs-text-secondary);
    width: 1rem;
    text-align: center;
    flex-shrink: 0;
}

.recipe-preview-divider,
.menu-preview-divider {
    border-top: 1px solid var(--trs-border);
    margin: var(--trs-space-3) 0;
}

.recipe-preview-times {
    display: flex;
    gap: var(--trs-space-4);
    justify-content: center;
}

.recipe-preview-time-item {
    text-align: center;
    min-width: 3.5rem;
}

.recipe-preview-time-value {
    font-size: var(--trs-text-xl);
    font-weight: var(--trs-weight-bold);
    color: var(--trs-text-primary);
    font-variant-numeric: tabular-nums;
}

.recipe-preview-time-label {
    font-size: var(--trs-text-xs);
    color: var(--trs-text-secondary);
    text-transform: uppercase;
}

.recipe-preview-section-title,
.menu-preview-section-title {
    font-weight: var(--trs-weight-medium);
    font-size: var(--trs-text-base);
    margin-bottom: var(--trs-space-2);
}

.recipe-preview-ingredients,
.menu-preview-items {
    display: flex;
    flex-direction: column;
    gap: var(--trs-space-1);
}

.recipe-preview-ingredient,
.menu-preview-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem var(--trs-space-2);
    background: var(--trs-surface);
    border: 1px solid var(--trs-border);
    border-radius: var(--trs-radius-sm);
    font-size: var(--trs-text-sm);
}

.recipe-preview-ingredient-name,
.menu-preview-item-name {
    font-weight: var(--trs-weight-medium);
}

.recipe-preview-ingredient-qty,
.menu-preview-item-price {
    color: var(--trs-text-secondary);
    font-size: var(--trs-text-sm);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.menu-preview-item-icon {
    color: var(--trs-text-secondary);
    margin-right: 0.4rem;
}

/* ----------------------------------------------------------------------------
   KITCHEN ORDERS

   The filter row is .trs-filter-row from components.css - the two were the same
   rule written twice - so what stays here is only the widths, which are about
   these particular controls and not about filter rows in general.
   ---------------------------------------------------------------------------- */

.kitchen-order-filters {
    margin-top: var(--trs-space-3);
}

.kitchen-order-filters .form-control {
    max-width: 130px;
}

.kitchen-order-filters .kitchen-order-search {
    max-width: 220px;
}

/* AN ORDER CARD THAT ENDS IN A DIVIDER AND NOTHING ELSE.

   KitchenOrderCard renders its <Divider /> and the action group unconditionally,
   but the group's contents are a chain of @if on ServiceOrderStatus: Pending,
   Confirmed and InProgress each produce a button, and Completed, Declined and
   Guest Cancelled produce nothing at all. MEASURED on /KitchenOrders with the
   All tab open - all five cards had an action group with zero children and zero
   height, sitting under a full-width rule, so every finished order looked like a
   card that had been cut off.

   Done here rather than with a second @if around the divider: the status list
   would then be written twice and would drift the first time a status is added.
   :empty asks the question the markup actually cares about - did anything render
   - and stays right whatever the statuses become. MEASURED: the group's
   childNodes is 0, so Razor leaves no whitespace text node behind for :empty to
   trip over.

   Two things this took a second attempt to get right. :has() CANNOT BE NESTED -
   `hr:has(+ .x:not(:has(*)))` is invalid and the browser drops the whole rule,
   silently; it was simply missing from document.styleSheets. And the group
   carries Bootstrap's .d-flex, which is `display: flex !important`, so hiding it
   needs !important of its own - the first pass matched the element and still
   computed `display: flex`. */
.kitchen-order-actions-group:empty {
    display: none !important;
}

hr.divider:has(+ .kitchen-order-actions-group:empty) {
    display: none;
}

/* Two actions on an order card share the width evenly, however long their
   labels are in the current language. */
.kitchen-order-actions > * {
    flex: 1 1 0;
    width: 50%;
    min-width: 0;
}
