/* RoomCard Molecule */
/* Room status card for housekeeping allocation boards */
/* State-driven background + border. Composes Badge atom for clean type. */

.room-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-1);
    padding: var(--space-2);
    border-radius: var(--border-radius-md);
    border: var(--border-width-1) solid var(--border-subtle);
    background: var(--bg-surface);
    text-align: left;
    min-width: 80px;
    transition: border-color var(--duration-200) var(--easing-out);
}

/* Line one: number and type on one baseline, the situation glyph pushed to the right
   edge (PO 2026-09-10 -- two lines, not three). */
.room-card-head {
    display: flex;
    align-items: baseline;
    gap: var(--space-1);
    min-width: 0;
}

/* Room number */
.room-card-number {
    font-size: var(--text-sm);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    line-height: 1;
}

/* Room type code */
.room-card-type {
    font-size: var(--text-2xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Occupancy context: a glyph at the right of line one, its word in the title. */
.room-card-context {
    display: inline-flex;
    align-items: center;
    align-self: center;
    margin-left: auto;
    color: var(--text-secondary);
    line-height: 1;
}

/* Allergies on file for tonight's guests: the Allergy Guardian shield (its own teal), just
   left of the situation glyph. It takes the push to the right edge, so the two sit
   together; the names are its title. Line one has room for it because the clean-type
   badge below sets the card's width (measured 2026-09-30: never taller, rows wrap as before). */
.room-card-allergy {
    display: inline-flex;
    align-items: center;
    align-self: center;
    margin-left: auto;
    line-height: 1;
}

.room-card-allergy + .room-card-context {
    margin-left: 0;
}

/* OOO/OOS overlay label */
.room-card-overlay {
    font-size: var(--text-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
}

/* ===================================
   STATES (background + border)
   =================================== */

/* Needs cleaning - dirty/pickup, unassigned */
.room-card--needs-cleaning {
    background: var(--color-warning-light);
    border-color: var(--color-warning);
}

/* Already clean - no action needed */
.room-card--clean {
    background: var(--bg-surface);
    border-color: var(--border-subtle);
    opacity: 0.6;
}

.room-card--clean .room-card-number {
    color: var(--text-muted);
}

/* Out of Order */
.room-card--ooo {
    background: var(--color-error-light);
    border-color: var(--color-error);
}

/* Out of Service */
.room-card--oos {
    background: var(--bg-muted);
    border-color: var(--border-default);
    opacity: 0.5;
}

/* Ghost - room known from config, status not yet fetched */
.room-card--ghost {
    background: var(--bg-surface);
    border-color: var(--border-subtle);
    border-style: dashed;
    opacity: 0.4;
}

.room-card--ghost .room-card-number {
    color: var(--text-muted);
}

.room-card--ghost .room-card-type,
.room-card--ghost .room-card-context {
    display: none;
}

/* ===================================
   VIP ACCENT
   =================================== */

.room-card--vip {
    border-left: 3px solid var(--color-warning);
}

/* ===================================
   COMPACT VARIANT
   =================================== */

.room-card--compact {
    padding: var(--space-1) var(--space-1_5);
    min-width: 64px;
    gap: 0;
}

.room-card--compact .room-card-type,
.room-card--compact .room-card-context {
    display: none;
}

/* ===================================
   GRID LAYOUT
   =================================== */

.room-card-grid {
    display: grid;
    /* Line one now carries number, type AND the glyph: 96px keeps "1006 DBL" and the
       icon on one line at the sm/2xs sizes; 88 wrapped the type under the number. */
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: var(--space-2);
}

/* ===================================
   RESPONSIVE
   =================================== */

@media (max-width: 640px) {
    .room-card-grid {
        grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
    }

    .room-card {
        min-width: 64px;
        padding: var(--space-1_5);
    }
}

/* ===================================
   BOARD STATES
   Selected, sent, and the two board gestures. Every one of these is opt-in from
   RoomCard.build(), so a card built without them is byte-identical to before.
   =================================== */

/* Picked for a partial send. The ring is the selection, not a colour change, so a
   selected checkout still reads as a checkout. */
.room-card--selectable,
.room-card--openable {
    cursor: pointer;
}

.room-card--selectable:hover,
.room-card--openable:hover {
    border-color: var(--border-default);
}

.room-card--selected {
    box-shadow: 0 0 0 var(--border-width-2) var(--color-primary);
    border-color: var(--color-primary);
}

.room-card--selectable:focus-visible,
.room-card--openable:focus-visible {
    outline: var(--border-width-2) solid var(--border-focus);
    outline-offset: var(--space-1);
}

/* Already sent to a team today. Marked, never removed: the manager needs to see that
   the room IS handled rather than watch it disappear from her morning. */
.room-card--sent {
    opacity: 0.55;
}

.room-card-sent {
    font-size: var(--text-2xs);
    font-weight: var(--font-weight-semibold);
    color: var(--color-success);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
}

/* ===================================
   ROW LAYOUT
   Cards at their natural width, flowing and wrapping -- the same shape as
   AvailabilityStrip's `.as-slot-cells`, because a labelled run of cells reads as
   one unit of work. On the room-turn board that unit is a cleaner's round.
   =================================== */

.room-card-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: flex-start;
    /* Explicit, not inherited. Something in the ambient layout resolves this row to
       space-between, which strings a short last line of rooms across the full width --
       three rooms at the left, middle and right edge of a 1264px row read as three
       unrelated things rather than the tail of one section. A row of rooms packs from
       the left, always. */
    justify-content: flex-start;
}

/* ===================================
   TILE (Room Board, TLP-1234)
   The room number over the fixed eight-slot icon row, coloured by today's clean. Opt-in
   from RoomCard.build({ signals }); nothing here touches the two-line card.
   =================================== */

/* The number at the tile's left edge, over the row's first icon (PO 2026-10-02, TLP-1254). */
.room-card--tile {
    align-items: flex-start;
    gap: var(--space-0_5);
    padding: var(--space-1) var(--space-0_5);
    min-width: 0;
    background: var(--bg-surface);
    border-color: var(--border-default);
}

.room-card--tile .room-card-number {
    font-family: var(--font-family-mono);
    font-weight: var(--font-weight-medium);
}

/* The PMS's own status of the room (TLP-1031), beside its number: the PMS's two-letter code,
   its word in the tile's name. Out of order and out of service are the two to see from across
   the board; the rest stay quiet, so the tile's colour -- today's clean -- still leads. The code
   is in the sans face: in the number's mono face its I read as a 1 ("D1" for DI, PO 2026-10-02,
   TLP-1254). */
.room-card-tile-head {
    display: inline-flex;
    align-items: baseline;
    gap: var(--space-1);
}

.room-card-pms {
    font-family: var(--font-family-sans);
    font-size: var(--text-xs);
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    line-height: 1;
}

.room-card-pms--out-of-order,
.room-card-pms--out-of-service {
    color: var(--color-error);
    font-weight: var(--font-weight-semibold);
}

/* Two rows of four, always in the same order: one place, one fact. */
.room-card-signals {
    display: grid;
    grid-template-columns: repeat(4, var(--icon-size-xs));
    gap: var(--space-0_5);
}

.room-card-signal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Lit facts are ink; the allergy is the Allergy Guardian's own teal (its badge); a repair is
   amber open, red on hold, green fixed today. Off is the Icon atom's disabled state, greyed. */
.room-card-signal .icon {
    color: var(--text-primary);
}

.room-card-signal.room-card-signal--off .icon {
    color: var(--text-muted);
}

.room-card-signal.room-card-signal--open .icon {
    color: var(--color-warning);
}

.room-card-signal.room-card-signal--on-hold .icon {
    color: var(--color-error);
}

.room-card-signal.room-card-signal--fixed-today .icon {
    color: var(--color-success);
}

/* The allergy shield is an outline among mostly solid glyphs, and at the tile's size its line
   was under a pixel -- hard to spot (PO 2026-10-02, TLP-1254). Heavier in this slot only, so the
   tile, the room panel, the board's key and the help's Key agree; the Allergy Guardian badge
   everywhere else keeps its own line. */
.room-card-signal--allergy .guardian-badge svg {
    stroke-width: 2;
}

/* The tile's colour as a small swatch, for a key that names the stages. Its border colour
   and style come from the fill rules below, like the tile's. */
.room-card-swatch {
    display: inline-block;
    flex: none;
    width: var(--icon-size-sm);
    height: var(--space-3);
    border: var(--border-width-1) solid;
    border-radius: var(--border-radius-sm);
}

/* Today's clean -- the tile's one colour. */
.room-card--fill-not-sent {
    background: var(--color-warning-light);
    border-color: var(--color-warning);
    border-style: dashed;
}

.room-card--fill-to-do {
    background: var(--color-warning-light);
    border-color: var(--color-warning);
}

.room-card--fill-under-way {
    background: var(--color-info-light);
    border-color: var(--color-info);
}

.room-card--fill-done {
    background: var(--color-success-light);
    border-color: var(--color-success);
}

.room-card--fill-none {
    background: var(--bg-surface);
    border-color: var(--border-default);
}

/* A room not read yet (TLP-1235): the ghost card's grey dashed outline and faded number. The
   row keeps its space, so nothing moves when the day fills in, but draws nothing: a ghost
   never reads as vacant. */
.room-card--tile.room-card--ghost .room-card-signals {
    visibility: hidden;
}

/* Tiles on a fixed grid, as many to a line as fit. A column is exactly one tile: the
   eight-slot row plus the tile's own padding and border. */
.room-card-tiles {
    --room-card-tile-width: calc(4 * var(--icon-size-xs) + 5 * var(--space-0_5) + 2 * var(--border-width-1));
    display: grid;
    grid-template-columns: repeat(auto-fill, var(--room-card-tile-width));
    gap: var(--space-1);
}
