/*
    Akunje design system - global styles shared by every layout.

    MudBlazor supplies colours through CSS custom properties (--mud-palette-*), so everything
    here is expressed in terms of the active palette and automatically follows the light/dark
    switch. Surfaces use 1px borders instead of drop shadows, and spacing is kept on a
    4/8px rhythm (16px, 24px, 32px).
*/

/* ---------- Typography ---------- */

html,
body,
.mud-typography {
    /* System stack only: no external font request, the app must work offline. */
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* MudBlazor uppercases buttons by default; the Akunje look is sentence case. */
.mud-button-root {
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
}

.mud-typography-h4,
.mud-typography-h5 {
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* ---------- Brand ---------- */

/* Logo used as the app-bar brand mark; width derives from the intrinsic aspect ratio. */
.brand-logo {
    display: block;
    height: 56px;
    width: auto;
}

/* ---------- Auth shell (EmptyLayout) ---------- */

.auth-shell {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 100dvh;
    padding: 24px;
    background-color: var(--mud-palette-background);
}

.auth-shell__toggle {
    position: absolute;
    top: 16px;
    right: 16px;
}

/* Brand mark pinned to the corner opposite the theme toggle. */
.auth-shell__brand {
    position: absolute;
    top: 16px;
    left: 16px;
}

.auth-shell__logo {
    display: block;
    height: 56px;
    width: auto;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 32px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 16px;
}

.auth-card__mark {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    text-align: center;
}

/* Landing-page hero logo, deliberately larger than the app-bar mark. */
.auth-card__logo {
    display: block;
    height: 112px;
    width: auto;
}

.auth-card__footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--mud-palette-lines-default);
    text-align: center;
}

/* ---------- Page shell ---------- */

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.page-header__title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

/* ---------- Tables ---------- */

.table-card {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 14px;
    overflow: hidden;
}

.table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.table-toolbar__search {
    flex: 1 1 240px;
    max-width: 360px;
}

.table-toolbar__status {
    flex: 0 0 180px;
    max-width: 180px;
}

/* Keep the header visible while a long result set is scrolled. */
.akunje-grid .mud-table-head th {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: var(--mud-palette-surface);
    font-weight: 600;
}

.akunje-grid .mud-table-row:hover {
    background-color: var(--mud-palette-action-default-hover);
}

.cell-identity {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.status-chip {
    font-weight: 600;
}

/* ---------- Mobile record cards ---------- */

.record-card {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    background-color: var(--mud-palette-surface);
}

.record-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 12px;
}

.record-card__row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 3px 0;
    font-size: 0.8125rem;
    color: var(--mud-palette-text-secondary);
}

.record-card__row span:last-child {
    color: var(--mud-palette-text-primary);
    font-weight: 600;
    text-align: right;
}

/* ---------- Stat / role cards ---------- */

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
    padding: 20px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 14px;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.stat-card__icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background-color: var(--mud-palette-primary-hover);
    color: var(--mud-palette-primary);
}

a.stat-card-link {
    display: block;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

a.stat-card-link:hover .stat-card {
    border-color: var(--mud-palette-primary);
    transform: translateY(-1px);
}

/* ---------- Responsive ---------- */

.only-mobile {
    display: none;
}

@media (max-width: 959.98px) {
    .only-desktop {
        display: none !important;
    }

    .only-mobile {
        display: block;
    }

    .auth-card {
        padding: 24px;
        border-radius: 12px;
    }

    .auth-shell {
        padding: 16px;
    }

    .table-toolbar__search,
    .table-toolbar__status {
        flex: 1 1 100%;
        max-width: none;
    }

    .page-header {
        margin-bottom: 16px;
    }
}
