/*
 * MVD OPS — Dashboard shell
 *
 * Presentation only. Every colour comes from the mvd-core palette through the
 * `--mvd-*` custom properties; no literal colours are defined here. Tints are
 * derived with color-mix() from palette tokens, so changing the palette flows
 * through the dashboard without touching this file.
 *
 * Encapsulated under .mvd-shell so nothing leaks into other pages or plugins.
 */

.mvd-shell {
    container-type: inline-size;
    margin: 0 auto;
    max-width: 100%;
}

/* Quick Links: full-width strip above the grid, never a card. */
.mvd-shell__bar {
    margin: 0 0 var(--mvd-space-4, 1rem);
}

/* ---- card grid ---- */

.mvd-shell__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--mvd-space-4, 1rem);
    /* Stretch, not start: every card in a row gets the same height without any
     * fixed height and without truncating content. The body below is the flexible
     * part, so the extra space goes to the content area instead of the header. */
    align-items: stretch;
}

@container (min-width: 640px) {
    .mvd-shell__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@container (min-width: 1024px) {
    .mvd-shell__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* ---- card ---- */

.mvd-shell__card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    background: var(--mvd-bg);
    border: 1px solid var(--mvd-border);
    border-radius: calc(var(--mvd-radius, 4px) * 2);
    box-sizing: border-box;
}

.mvd-shell__card--span-2 {
    grid-column: span 1;
}

.mvd-shell__card--span-3 {
    grid-column: span 1;
}

@container (min-width: 1024px) {
    .mvd-shell__card--span-2 {
        grid-column: span 2;
    }

    .mvd-shell__card--span-3 {
        grid-column: span 3;
    }
}

/* ---- card header: tinted band, dark blue title, icon ---- */

.mvd-shell__head {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    /* One header height for every card, whatever the title length. */
    min-height: 3rem;
    margin: 0;
    padding: 0.75rem 1rem;
    box-sizing: border-box;
    background: color-mix(in srgb, var(--mvd-primary) 9%, var(--mvd-bg));
    border-bottom: 1px solid var(--mvd-border);
}

.mvd-shell__icon {
    color: var(--mvd-primary);
    font-size: 1.15rem;
    line-height: 1;
    /* Fixed box so a wider glyph never shifts the title between cards. */
    flex: 0 0 1.5rem;
    width: 1.5rem;
    height: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Kadence sets a top margin on h2 (measured: 25.2px), which pushed the title
 * below the icon's centre. The shell's own selector has to out-specify it. */
.mvd-shell .mvd-shell__head .mvd-shell__title {
    margin: 0;
    line-height: 1.3;
}

.mvd-shell__body {
    min-width: 0;
    flex: 1 1 auto;
    padding: 1rem;
    color: var(--mvd-text);
}

/* Lead block (the live date and time inside My Shift): part of the card, not a
 * second card inside it. */
.mvd-shell__lead {
    margin: 0 0 0.75rem;
    text-align: center;
}

.mvd-shell__lead .mvd-clock-widget {
    margin: 0;
}

/* My Time Off: its rows are a non-wrapping flexbox and the label uses
 * flex: 1 1 0%, so in a 512px card the label collapsed to 12px and broke word
 * by word. Allow the row to wrap and give the label a real minimum. Scoped to
 * the shell: the widget's own pages are untouched. */
.mvd-shell__body .mvd-to-row {
    flex-wrap: wrap;
    row-gap: 0.25rem;
}

.mvd-shell__body .mvd-to-row__label {
    flex: 1 1 auto;
    min-width: 7rem;
}

/* ---- inner scrollbars: soft, palette-derived, dashboard-only ---- */

.mvd-shell__body {
    /* Long lists scroll inside the card instead of stretching the whole row. */
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--mvd-border) var(--mvd-bg);
}

.mvd-shell__body::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.mvd-shell__body::-webkit-scrollbar-track {
    background: var(--mvd-bg);
}

.mvd-shell__body::-webkit-scrollbar-thumb {
    background: var(--mvd-border);
    border-radius: 999px;
    border: 2px solid var(--mvd-bg);
}

.mvd-shell__body::-webkit-scrollbar-thumb:hover {
    background: var(--mvd-border-dark);
}

/* ---- stats widgets (Title Requests, Translations, Bonded Titles) ----
 * The three plugins already share one markup contract (.mvd-stat-list /
 * .mvd-stat-row / __key / __value / .mvd-badge). Styling it here, scoped to the
 * shell, standardises all three at once without touching a single plugin and
 * without leaking into the pages that render those widgets on their own. */

.mvd-shell__body .mvd-stat-list {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

.mvd-shell__body .mvd-stat-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 3rem;
    padding: 0.5rem 0.25rem;
    border: 0;
    border-radius: 0;
    background: none;
    font-size: 0.95rem;
    line-height: 1.35;
}

.mvd-shell__body .mvd-stat-row + .mvd-stat-row {
    border-top: 1px solid var(--mvd-border);
}

.mvd-shell__body .mvd-stat-row__key {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--mvd-text);
    overflow-wrap: break-word;
}

.mvd-shell__body .mvd-stat-row__value {
    flex: 0 0 auto;
    margin-left: auto;
    color: var(--mvd-text);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    text-align: right;
}

/* Softer pills: same semantic colours, less saturated surfaces. */
.mvd-shell__body .mvd-stat-row .mvd-badge {
    flex: 0 0 auto;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* The card owns the header: any heading a widget emits for itself is not shown
 * when it is hosted here. This is presentation only and reversible. */
.mvd-shell__body > h1,
.mvd-shell__body > h2,
.mvd-shell__body > h3 {
    display: none;
}

@media (prefers-reduced-motion: no-preference) {
    .mvd-shell__card {
        transition: border-color 120ms ease;
    }

    .mvd-shell__card:hover {
        border-color: var(--mvd-primary);
    }
}

/* ==========================================================================
 * Visual alignment with the rest of the portal (Title Request, Translations,
 * Bonded Titles). Presentation only: no markup, query, calculation, permission
 * or behaviour changes. Everything is scoped to .mvd-shell and uses mvd-core
 * tokens; the widgets that belong to other plugins are restyled from here so
 * those plugins stay untouched and their own pages are not affected.
 * ========================================================================== */

/* ---- cards: same radius / shadow as the module cards ---- */

.mvd-shell .mvd-shell__card {
    border-radius: var(--mvd-radius);
    box-shadow: var(--mvd-shadow);
}

/* ---- card header: module-card heading scale (the theme's 28px h2 leaked in) ---- */

.mvd-shell .mvd-shell__head {
    min-height: 2.75rem;
    padding: 0.625rem 1rem;
}

.mvd-shell .mvd-shell__head .mvd-shell__title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--mvd-text-strong);
}

.mvd-shell .mvd-shell__icon {
    font-size: 1rem;
    flex-basis: 1.25rem;
    width: 1.25rem;
    height: 1.25rem;
}

/* ---- body type scale ---- */

.mvd-shell .mvd-shell__body {
    font-size: 14px;
    line-height: 1.45;
}

.mvd-shell .mvd-shell__body .mvd-stat-row {
    min-height: 2.5rem;
    font-size: 14px;
}

.mvd-shell .mvd-shell__body .mvd-to-row__label {
    font-size: 13px;
}

/* ---- buttons: module button radius / scale ---- */

.mvd-shell .mvd-shell__body .mvd-btn-self-service,
.mvd-shell .mvd-shell__body .mvd-timeoff-new-btn {
    border-radius: var(--mvd-radius);
    font-size: 13px;
    font-weight: 500;
}

.mvd-shell .mvd-shell__body .mvd-btn-punch {
    border-radius: var(--mvd-radius);
}

.mvd-shell .mvd-shell__body select {
    border-radius: var(--mvd-radius);
}

/* ---- calendar widget: cells and navigation use the token radius ---- */

.mvd-shell .mvd-shell__body .mvd-cal-w__cell,
.mvd-shell .mvd-shell__body .mvd-cal-w__nav-btn {
    border-radius: var(--mvd-radius);
}

/* ---- announcements inside the shell ---- */

.mvd-shell .mvd-shell__body .mvd-announcements__scroll {
    padding-left: 0;
    padding-right: 0;
}

@media (max-width: 480px) {
    .mvd-shell .mvd-shell__head { padding: 0.5rem 0.75rem; }
    .mvd-shell .mvd-shell__body { padding: 0.75rem; }
}

/* ---- stats widgets: the card is the container, so the widget's own boxed
 * look (grey fill, border, radius, 520px cap) is dropped instead of nesting a
 * second card inside it. ---- */

.mvd-shell .mvd-shell__body .mvd-stat-list {
    background: none;
    border: 0;
    border-radius: 0;
    max-width: none;
}

.mvd-shell .mvd-shell__body .mvd-stat-row {
    align-items: center;
}
