/* ============================================================
   Platform Theme — extends Singularidade Design System
   Only project-specific overrides below.
   Base theme: singularidade-ui-vaadin (loaded via parent in theme.json)
   ============================================================ */

/* ---- Header: the Integras product logo ---- */

/*
 * The name beside the symbol (IntegrasBrand, brand-label) keeps its own width:
 * the library lets the header's title shrink with an ellipsis, for a
 * customer's long name, and "INTEGRAS" came out as "INTEG…". On a phone only
 * the symbol stays, as on the Integras Hub: the name does not fit beside the
 * language, the theme and the menu.
 */
.singularidade-navbar__title.integras-brand-label {
    flex-shrink: 0;
    max-width: none;
    overflow: visible;
}

@media (max-width: 600px) {
    .singularidade-navbar__title.integras-brand-label {
        display: none;
    }
}

/* ---- Dashboard stat cards ---- */

/*
 * Cards live in a grid, not a wrapping flex row. With flex the cards grew to
 * fill whatever space was left, so a short row stretched its cards wider than
 * the row above and the whole block read as crooked. Fixed tracks give every
 * card the same width, and `auto-fill` keeps the empty columns of the last row
 * reserved instead of handing that space to the cards that are there.
 */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
    gap: var(--lumo-space-m);
    width: 100%;
    /*
     * Capped so a wide monitor gives four columns instead of eight. Without the
     * cap the cards keep their width but scatter across the screen, and a block
     * of two ends up as two small boxes adrift in a very long empty row.
     */
    max-width: 58rem;
}

.stat-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: var(--lumo-space-xs);
    min-height: 6.5rem;
    padding: var(--lumo-space-l);
    border-radius: var(--lumo-border-radius-l);
    background: var(--lumo-base-color);
    border: 1px solid var(--lumo-contrast-10pct);
    box-shadow: var(--lumo-box-shadow-xs);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/*
 * The number is the thing being read; it gets a fixed size so a long value
 * ("R$ 898,00") and a short one ("0") sit on the same baseline across cards.
 */
.stat-card__value {
    margin: 0;
    font-size: var(--lumo-font-size-xxl);
    font-weight: 600;
    line-height: 1.1;
    white-space: nowrap;
}

.stat-card:hover {
    box-shadow: var(--lumo-box-shadow-m);
    transform: translateY(-2px);
}

.stat-card--error {
    border-color: var(--lumo-error-color);
    background: var(--lumo-error-color-10pct);
}

/*
 * The design system's warning surface (amber 50 on the light theme). The Lumo
 * warning tint at 10 % is amber 700 over the pink-white base and came out
 * salmon, next to the error card's pink. The dark theme has its own rule below,
 * with the Lumo tint the screens were approved with: the 2.0 library left this
 * token at its light value there (DS 1.0.0 gives it a dark one).
 */
.stat-card--warning {
    border-color: var(--lumo-warning-color);
    background: var(--color-feedback-warning-surface);
}

/* ---- Admin grids ---- */

/*
 * Cells whose text may break inside a word rather than end in "…": an e-mail,
 * a subdomain or a technical name may have no space to wrap at. The grid's
 * wrap-cell-content variant wraps at spaces first; this only splits a word that
 * does not fit its column on its own (AdminGridColumns.WRAP_ANYWHERE).
 */
vaadin-grid::part(wrap-anywhere) {
    overflow-wrap: anywhere;
}

/*
 * The admin lists with many columns (tenants, marketplace), whose fixed
 * columns fit their widest value in the three languages: with 16 px on each
 * side of a cell, the marketplace's ten columns add up to more than the
 * 1052 px a 1280 px screen leaves beside the menu, and the tenants' names and
 * e-mails broke inside their words. 8 px on each side gives back 16 px per
 * column (AdminGridColumns.DENSE).
 */
vaadin-grid.admin-grid-dense {
    --vaadin-grid-cell-padding: var(--lumo-space-xs) var(--lumo-space-s);
}

/* ---- Admin notices, empty states and summaries ---- */

/*
 * A notice box (Notice.java): the reports screen's queue notice — tinted
 * surface, medium radius, small text — with an icon in the tone's colour.
 * Warning blocks or needs attention; info only explains.
 */
.admin-notice {
    display: flex;
    align-items: flex-start;
    gap: var(--lumo-space-s);
    width: 100%;
    box-sizing: border-box;
    padding: var(--lumo-space-s) var(--lumo-space-m);
    border-radius: var(--lumo-border-radius-m);
    font-size: var(--lumo-font-size-s);
    line-height: var(--lumo-line-height-s);
    color: var(--lumo-body-text-color);
}

.admin-notice--warning {
    background: var(--lumo-warning-color-10pct);
}

.admin-notice--info {
    background: var(--lumo-contrast-5pct);
}

.admin-notice__icon {
    flex-shrink: 0;
    width: var(--lumo-icon-size-s);
    height: var(--lumo-icon-size-s);
    margin-top: 0.1em;
}

.admin-notice--warning .admin-notice__icon {
    color: var(--lumo-warning-text-color, var(--lumo-warning-color));
}

.admin-notice--info .admin-notice__icon {
    color: var(--lumo-secondary-text-color);
}

.admin-notice__body {
    display: flex;
    flex-direction: column;
    gap: var(--lumo-space-s);
    min-width: 0;
}

/*
 * Where a list's grid would be when there is nothing to list yet
 * (EmptyState.java): a centered, muted message on a dashed frame.
 */
.admin-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--lumo-space-s);
    width: 100%;
    box-sizing: border-box;
    padding: var(--lumo-space-xl) var(--lumo-space-m);
    border: 1px dashed var(--lumo-contrast-20pct);
    border-radius: var(--lumo-border-radius-l);
    color: var(--lumo-secondary-text-color);
    font-size: var(--lumo-font-size-s);
    text-align: center;
}

.admin-empty-state__icon {
    width: var(--lumo-icon-size-l);
    height: var(--lumo-icon-size-l);
    color: var(--lumo-contrast-30pct);
}

/*
 * Label and value pairs in two aligned columns (LabelValueList.java): the
 * label muted, the value in the body colour; an amount right-aligned with
 * tabular digits so the amounts of one list line up.
 */
.label-value-list {
    display: grid;
    grid-template-columns: max-content minmax(0, max-content);
    column-gap: var(--lumo-space-l);
    row-gap: var(--lumo-space-xs);
    align-items: baseline;
    font-size: var(--lumo-font-size-m);
}

.label-value-list__label {
    color: var(--lumo-secondary-text-color);
}

.label-value-list__value {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.label-value-list__value--amount {
    justify-self: end;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

/* ---- Welcome card (tenant dashboard) ---- */

.welcome-card {
    text-align: center;
    max-width: 480px;
    padding: var(--lumo-space-xl);
}

.welcome-card__icon {
    color: var(--lumo-success-color);
}

/* ---- Mobile responsive ---- */

@media (max-width: 768px) {
    .stat-grid {
        grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
    }

    .stat-card {
        min-height: 5.5rem;
        padding: var(--lumo-space-m);
    }
}

/* ---- Dark mode ---- */

/*
 * Every colour above comes from the theme's variables (--lumo-* and the design
 * system's --color-*), which the current library and the next one (design
 * system v2) both define — so the cards follow the theme with no colour of
 * their own. On the dark theme a plain card is lifted one step above the page by
 * the theme's own 5 % contrast: the same warm hue as the background, where the
 * fixed cool blue-grey it had before read as a blue box on a warm page. The
 * error card keeps its 10 % tint, right in both themes; the warning card takes
 * the Lumo 10 % tint here, the amber at 16 % of the dark theme.
 */
[theme~="dark"] .stat-card:not(.stat-card--error):not(.stat-card--warning) {
    background-image: linear-gradient(var(--lumo-contrast-5pct), var(--lumo-contrast-5pct));
}

[theme~="dark"] .stat-card--warning {
    background: var(--lumo-warning-color-10pct);
}
