/* ==========================================================================
   Application shell styles. Design tokens live in variables.css; calendar
   layout lives in calendar.css. Everything here is chrome shared by all pages.
   ========================================================================== */

html,
body,
#app {
    height: 100%;
    margin: 0;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--brand-bg);
    color: var(--brand-text);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--brand-primary);
}

a:hover {
    color: var(--brand-primary-hover);
}

/* Boot spinner shown before the runtime takes over #app */
.app-boot {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

/* Brand-tinted Bootstrap buttons */
.btn-primary {
    --bs-btn-bg: var(--brand-primary);
    --bs-btn-border-color: var(--brand-primary);
    --bs-btn-hover-bg: var(--brand-primary-hover);
    --bs-btn-hover-border-color: var(--brand-primary-hover);
    --bs-btn-active-bg: var(--brand-primary-hover);
    --bs-btn-active-border-color: var(--brand-primary-hover);
}

.btn-outline-primary {
    --bs-btn-color: var(--brand-primary);
    --bs-btn-border-color: var(--brand-primary);
    --bs-btn-hover-bg: var(--brand-primary);
    --bs-btn-hover-border-color: var(--brand-primary);
}

/* --- Navigation ---------------------------------------------------------- */

.navbar {
    --bs-navbar-padding-y: 0;
    min-height: 60px;
}

/*
   Brand. logo.svg is a full lockup whose wordmark renders ~7px tall at nav
   size, so the mark is cropped out of it (measured against the 1280x756
   viewBox) and the name is set as live text beside it.
*/
.brand-mark {
    display: block;
    position: relative;
    width: 46px;
    height: 34px;
    overflow: hidden;
    flex: 0 0 auto;
}

.brand-mark img {
    position: absolute;
    left: -23.6px;
    top: -4px;
    height: 55px;
    width: auto;
    max-width: none;
}

.brand-name {
    font: 600 15px/1 system-ui, sans-serif;
    color: var(--brand-text);
}

.brand-sub {
    font: 600 9.5px/1 system-ui, sans-serif;
    letter-spacing: .11em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.app-logo-lg {
    height: 96px;
    width: auto;
}

/* Hairline divider used between the brand, the nav and the identity cluster. */
.nav-sep {
    width: 1px;
    height: 20px;
    background: #e4eae1;
    flex: 0 0 auto;
}

/* Top-level nav item: icon + label (+ caret on a menu). */
.nav-group {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 11px;
    border: 0;
    background: none;
    border-radius: var(--r-md);
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    font: 500 14px/1 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    transition: background-color .12s ease, color .12s ease;
}

.nav-group:hover {
    background: var(--surface-muted);
    color: var(--brand-text);
}

.nav-group .bi {
    font-size: 16px;
    line-height: 1;
}

.nav-group .nav-caret {
    font-size: 11px;
    line-height: 1;
    opacity: .55;
    transition: transform .15s ease;
}

.nav-group.is-open {
    background: var(--surface-muted);
    color: var(--brand-text);
}

.nav-group.is-open .nav-caret {
    transform: rotate(180deg);
}

/* NavLink stamps .active on the current route. */
.nav-group.active {
    background: rgba(47, 107, 53, .09);
    color: var(--brand-primary);
    font-weight: 600;
}

/* Icon-only actions: the settings gear and the notification bell. */
.icon-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    background: none;
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: background-color .12s ease, color .12s ease;
}

.icon-btn:hover,
.icon-btn.is-open {
    background: var(--surface-muted);
    color: var(--brand-text);
}

.icon-btn .bi {
    font-size: 18px;
    line-height: 1;
}

/* Unread count on the bell. */
.badge-count {
    position: absolute;
    top: 1px;
    right: 1px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    border: 2px solid var(--surface);
    background: var(--shift-open);
    color: #fff;
    font: 700 10px/13px system-ui, sans-serif;
    text-align: center;
    box-sizing: border-box;
    pointer-events: none;
}

/* Identity chip; Sign out lives inside its menu. */
.user-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 4px 9px 4px 4px;
    border: 0;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color .12s ease;
}

.user-chip:hover,
.user-chip.is-open {
    background: var(--surface-muted);
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex: 0 0 auto;
    background: var(--brand-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font: 700 12px/1 system-ui, sans-serif;
}

.user-name {
    font: 600 13px/1.25 system-ui, sans-serif;
    color: var(--brand-text);
}

.user-role {
    font: 500 10px/1.3 system-ui, sans-serif;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* --- Dropdown panels ----------------------------------------------------- */

/* Invisible click-away layer beneath an open dropdown. */
.dropdown-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.dropdown-menu {
    --bs-dropdown-min-width: 236px;
    --bs-dropdown-padding-x: 6px;
    --bs-dropdown-padding-y: 6px;
    --bs-dropdown-border-color: var(--border);
    --bs-dropdown-border-radius: var(--r-lg);
    --bs-dropdown-link-color: var(--brand-text);
    --bs-dropdown-link-hover-bg: var(--surface-muted);
    --bs-dropdown-link-hover-color: var(--brand-text);
    --bs-dropdown-link-active-bg: rgba(47, 107, 53, .09);
    --bs-dropdown-link-active-color: var(--brand-primary);
    --bs-dropdown-header-color: var(--text-muted);
    box-shadow: 0 10px 28px rgba(28, 37, 32, .12);
    margin-top: 6px;
}

.dropdown-menu.show {
    z-index: 1001;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--r-md);
    font-size: 14px;
}

/* Leading icon: a fixed 16px box so every label in a menu starts on the same line. */
.dropdown-item > .bi:first-child {
    flex: 0 0 16px;
    width: 16px;
    font-size: 16px;
    line-height: 1;
    text-align: center;
    color: var(--text-muted);
    transition: color .12s ease;
}

.dropdown-item:hover > .bi:first-child,
.dropdown-item:focus > .bi:first-child {
    color: var(--brand-text);
}

.dropdown-item.active > .bi:first-child {
    color: var(--brand-primary);
}

/* Rows that carry their own colour (Sign out, Review all) keep the icon in step. */
.dropdown-item.text-danger > .bi:first-child,
.dropdown-item.menu-action > .bi:first-child {
    color: inherit;
}

.dropdown-item.menu-action {
    color: var(--brand-primary);
    font-weight: 600;
}

/* The label absorbs the slack, so a pill or the current-page check sits at the right edge. */
.menu-label {
    flex: 1 1 auto;
    min-width: 0;
}

.dropdown-item.active {
    font-weight: 600;
}

/* Mark the current route in an open menu without needing extra markup. */
.dropdown-item.active::after {
    content: "\f272";
    font-family: bootstrap-icons, sans-serif;
    font-size: 15px;
    line-height: 1;
}

.dropdown-header {
    padding: 9px 10px 5px;
    font: 700 11px/1 system-ui, sans-serif;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.dropdown-divider {
    margin: 5px 8px;
    border-top-color: #e4eae1;
    opacity: 1;
}

/* Count of pending items shown on a menu row. */
.menu-pill {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--shift-open);
    color: #fff;
    font: 700 10px/18px system-ui, sans-serif;
    text-align: center;
    box-sizing: border-box;
}

/* --- Surfaces ------------------------------------------------------------ */

.surface {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
}

.muted {
    color: var(--text-muted);
}

.collapse-card__header {
    cursor: pointer;
}

/* --- Sign-in ------------------------------------------------------------- */

.signed-out-shell {
    min-height: 100vh;
    background: var(--brand-bg);
}

.login-card {
    width: 380px;
    max-width: 90vw;
}

/* --- Status badge -------------------------------------------------------- */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: var(--r-sm);
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* --- Accessibility ------------------------------------------------------- */

:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* --- Runtime error banner ------------------------------------------------ */

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1100;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}
/* Payroll processing grid: one line per shift; a cell becomes its editor when clicked. */
.payroll-grid th,
.payroll-grid td {
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
    white-space: nowrap;
}

.payroll-grid th[role="button"] {
    cursor: pointer;
    user-select: none;
}

.payroll-grid tbody tr.muted-row td {
    background-color: rgba(28, 37, 32, 0.02);
}

.payroll-grid tr.group-head td {
    background-color: #eef1ec;
    font-weight: 600;
}

/* Cells read as plain text; the dotted underline on hover is the only hint. */
.payroll-grid .cell {
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
    font: inherit;
    text-align: inherit;
    width: 100%;
}

.payroll-grid .cell:not(:disabled):hover {
    text-decoration: underline dotted;
    cursor: text;
}

/* Room for the ↷ next-day arrow in front of an end time, kept empty on other rows so the times line up. */
.payroll-grid .next-day {
    display: inline-block;
    width: 1.1em;
    text-align: center;
}

/* The End heading starts where the times do, past the arrow slot. */
.payroll-grid th.end-time {
    padding-left: calc(0.25rem + 1.1em);
}

.payroll-grid .rate {
    font-size: 0.75rem;
    margin-left: 0.35rem;
}

/* A table row that opens its item when clicked anywhere (Users). The first cell also
   carries a real button, so the row is reachable by keyboard. */
tr.row-clickable {
    cursor: pointer;
}

/* A button that looks exactly like the app's links, for a grid row that opens a dialog rather
   than a page (Users). Other grids link their names to a detail page with a plain <a>. */
.link-button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--brand-primary);
    text-decoration: underline;
    text-align: start;
}

.link-button:hover {
    color: var(--brand-primary-hover);
}

/* Payroll grid: what the caregiver logged for a Start/End cell (PunchHover). The card opens on
   hover or keyboard focus and stays open while the pointer is over it, so "Use this time" can be
   clicked. */
.punch-hover {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}

.punch-hover__mark {
    font-size: .75rem;
    cursor: default;
}

.punch-hover__card {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 20;
    min-width: 12rem;
    padding: .5rem .625rem;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    font-size: .8125rem;
    white-space: normal;
}

.punch-hover:hover .punch-hover__card,
.punch-hover:focus-within .punch-hover__card {
    display: block;
}

/* A shift a caregiver reported they couldn't start, on the schedule chips and blocks. */
.couldnt-start-marker {
    color: #b45309;
}
