/* Shared components for every page of the accounts host: base typography, buttons and form
 * controls (the .btn / .form-control vocabulary of HRLocker.UI/mvc/bootstrap), the card, lists,
 * status pills, tables, the colour-scheme switcher and a few utilities.
 *
 * Block__element naming as in HRLocker.Core.Web/wwwroot/css/pages; tokens from root.css only.
 * Page-specific layout lives in pages/<page>.css, the signed-in shell in layout.css.
 */

/* ---------------------------------------------------------------------
   Base
   --------------------------------------------------------------------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--hrl-font-family-base);
    font-size: var(--hrl-font-size-base);
    font-weight: var(--hrl-font-weight-base);
    line-height: var(--hrl-line-height-base);
    color: var(--hrl-text);
    background-color: var(--hrl-canvas);
}

h1, h2, h3, h4 {
    margin: 0;
    font-weight: var(--hrl-font-weight-heading);
    line-height: var(--hrl-line-height-heading);
    letter-spacing: var(--hrl-letter-spacing-heading);
    color: var(--hrl-text);
    text-wrap: balance;
}

h1 { font-size: var(--hrl-font-size-h2); }
h2 { font-size: var(--hrl-font-size-h3); }
h3 { font-size: var(--hrl-font-size-medium); }

p {
    margin: 0 0 var(--hrl-space-l);
}

a {
    color: var(--hrl-link);
    text-decoration: none;
}

a:hover,
a:focus-visible {
    color: var(--hrl-link-hover);
    text-decoration: underline;
}

code {
    font-family: var(--hrl-font-family-monospace);
    font-size: var(--hrl-font-size-tiny);
    color: var(--hrl-text);
}

/* The authenticator shared key, typed by hand when the QR cannot be scanned. */
.key {
    overflow-wrap: anywhere;
}

small {
    font-size: var(--hrl-font-size-tiny);
    line-height: var(--hrl-line-height-tiny);
}

svg {
    display: block;
}

/* One focus treatment for everything interactive: outline (survives forced-colors), offset so it
   sits clear of the control's own border. Fields keep their border-colour change as well. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 3px solid var(--hrl-focus-ring);
    outline-offset: 2px;
}

/* ---------------------------------------------------------------------
   Buttons — HRLocker.UI/mvc/bootstrap/buttons.less
   --------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--hrl-space-s);
    padding: calc(var(--hrl-space-s) - 1px) calc(var(--hrl-space-l) - 1px);
    border: 1px solid transparent;
    border-radius: var(--hrl-border-radius-base);
    font-family: inherit;
    font-size: var(--hrl-font-size-base);
    font-weight: var(--hrl-font-weight-heading);
    line-height: var(--hrl-space-xl);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.3s ease-out, color 0.3s ease-out, border-color 0.3s ease-out;
}

.btn:hover,
.btn:focus-visible {
    text-decoration: none;
}

.btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.btn__icon {
    flex-shrink: 0;
    width: var(--hrl-font-size-medium);
    height: var(--hrl-font-size-medium);
}

.btn-primary {
    background-color: var(--hrl-primary);
    border-color: var(--hrl-primary);
    color: var(--hrl-on-primary);
}

.btn-primary:hover,
.btn-primary:focus-visible {
    background-color: var(--hrl-primary-hover);
    border-color: var(--hrl-primary-hover);
    color: var(--hrl-on-primary);
}

.btn-primary:active {
    background-color: var(--hrl-primary-active);
    border-color: var(--hrl-primary-active);
}

.btn-secondary {
    background-color: var(--hrl-grey-700);
    border-color: var(--hrl-grey-700);
    color: var(--hrl-white);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
    background-color: var(--hrl-grey-800);
    border-color: var(--hrl-grey-800);
    color: var(--hrl-white);
}

.btn-green {
    background-color: var(--hrl-green-500);
    border-color: var(--hrl-green-500);
    color: var(--hrl-white);
}

.btn-green:hover,
.btn-green:focus-visible {
    background-color: var(--hrl-green-600);
    border-color: var(--hrl-green-600);
    color: var(--hrl-white);
}

/* The white, ink-bordered "secondary" of the login mockup and the dashboard cards. */
.btn-outline-primary {
    background-color: var(--hrl-surface);
    border-color: var(--hrl-text);
    color: var(--hrl-text);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus-visible {
    background-color: var(--hrl-surface-muted);
    color: var(--hrl-text);
}

/* Provider buttons (Continue with … SSO, Sign in with HireHive): hairline border, mark left. */
.btn-outline-secondary {
    background-color: var(--hrl-surface);
    border-color: var(--hrl-border-strong);
    color: var(--hrl-text);
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus-visible {
    background-color: var(--hrl-surface-muted);
    color: var(--hrl-text);
}

/* Accounts: destructive actions (the design system has no danger variant). */
.btn-outline-danger {
    background-color: var(--hrl-surface);
    border-color: var(--hrl-danger);
    color: var(--hrl-danger);
}

.btn-outline-danger:hover,
.btn-outline-danger:focus-visible {
    background-color: var(--hrl-danger);
    color: var(--hrl-white);
}

.btn-link {
    padding-inline: 0;
    border-color: transparent;
    background: none;
    color: var(--hrl-link);
    font-weight: var(--hrl-font-weight-base);
}

.btn-link:hover,
.btn-link:focus-visible {
    color: var(--hrl-link-hover);
    text-decoration: underline;
}

.btn-sm {
    padding: calc(var(--hrl-space-xs) - 1px) calc(var(--hrl-space-m) - 1px);
    font-size: var(--hrl-font-size-tiny);
    line-height: var(--hrl-space-l);
}

.btn-icon-only {
    padding: calc(var(--hrl-space-s) - 1px);
}

.btn-block {
    width: 100%;
}

.btn-tall {
    min-height: calc(var(--hrl-space-xl) + var(--hrl-space-l) + var(--hrl-space-xs));
}

/* ---------------------------------------------------------------------
   Forms — HRLocker.UI/mvc/bootstrap/forms.less (.form-control) plus the login mockup's spacing
   --------------------------------------------------------------------- */

.form-group {
    margin-bottom: var(--hrl-space-l);
}

.form-label {
    display: block;
    margin-bottom: var(--hrl-space-xs);
    font-weight: 700;
    color: var(--hrl-text);
}

/* Label with a link on its trailing edge (the "Change" next to the email). */
.form-label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--hrl-space-l);
    margin-bottom: var(--hrl-space-xs);
}

.form-label-row .form-label {
    margin-bottom: 0;
}

.form-label-row a {
    font-size: var(--hrl-font-size-tiny);
}

.form-control {
    display: block;
    width: 100%;
    min-height: calc(var(--hrl-space-xl) + var(--hrl-space-l) - 1px);
    padding: var(--hrl-space-s) var(--hrl-space-l);
    border: 1px solid var(--hrl-control-border);
    border-radius: var(--hrl-border-radius-base);
    background-color: var(--hrl-control-bg);
    color: var(--hrl-text);
    font-family: inherit;
    font-size: var(--hrl-font-size-base);
    line-height: var(--hrl-line-height-base);
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}

.form-control::placeholder {
    color: var(--hrl-grey-500);
}

.form-control:focus {
    border-color: var(--hrl-primary);
    box-shadow: inset 0 0 0 1px var(--hrl-primary);
    outline: none;
}

.form-control[readonly] {
    background-color: var(--hrl-surface-muted);
    border-color: var(--hrl-border-strong);
    color: var(--hrl-text-muted);
    box-shadow: none;
    text-overflow: ellipsis;
}

.form-control:disabled {
    background-color: var(--hrl-surface-muted);
    cursor: not-allowed;
}

/* Rejected by the server, or by the browser once the person has been in the field. */
.form-control[aria-invalid="true"],
.form-control:user-invalid {
    border-color: var(--hrl-danger);
}

textarea.form-control {
    min-height: auto;
    font-family: var(--hrl-font-family-monospace);
    font-size: var(--hrl-font-size-tiny);
    resize: vertical;
}

/* Native carets sit on the control's edge; draw one with room to breathe. The glyph is a
   mid-grey that reads on both schemes (a data URI cannot use currentColor). */
select.form-control {
    appearance: none;
    padding-inline-end: var(--hrl-space-3xl);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236E6E6E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--hrl-space-m) center;
    background-size: var(--hrl-font-size-medium);
}

select.form-control[multiple],
select.form-control[size] {
    padding-inline-end: var(--hrl-space-l);
    background-image: none;
}

.form-help {
    display: block;
    margin-top: var(--hrl-space-xs);
    color: var(--hrl-text-subtle);
    font-size: var(--hrl-font-size-tiny);
}

.form-check {
    display: flex;
    align-items: center;
    gap: var(--hrl-space-s);
    margin-bottom: var(--hrl-space-l);
    color: var(--hrl-text-muted);
    font-weight: var(--hrl-font-weight-base);
}

.form-check input {
    width: var(--hrl-space-l);
    height: var(--hrl-space-l);
    margin: 0;
    accent-color: var(--hrl-primary);
}

fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

/* Server-side validation summary and per-field messages: text and a glyph, never colour alone. */
.form-errors {
    margin: 0 0 var(--hrl-space-l);
    color: var(--hrl-danger);
    font-size: var(--hrl-font-size-tiny);
}

.form-errors:empty,
.form-errors.validation-summary-valid {
    display: none;
}

.form-errors ul {
    margin: 0;
    padding-inline-start: var(--hrl-space-l);
}

.form-errors li::marker,
.form-errors > p::before {
    content: "⚠ " / "";
}

.form-errors > p {
    margin: 0;
}

/* Password field with a Show/Hide toggle (accounts.js inserts the button). */
.password-field {
    position: relative;
}

.password-field .form-control {
    padding-inline-end: var(--hrl-space-6xl);
}

.password-field__toggle {
    position: absolute;
    inset-block-start: 50%;
    inset-inline-end: var(--hrl-space-s);
    translate: 0 -50%;
}

/* Primary action on the trailing edge, secondary link on the leading edge (login mockup). */
.actions {
    display: flex;
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: center;
    gap: var(--hrl-space-xl);
}

.actions--start {
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--hrl-space-m);
}

.actions--center {
    justify-content: center;
}

.actions--stack {
    flex-direction: column;
    align-items: stretch;
    gap: var(--hrl-space-s);
}

.actions--stack form {
    margin: 0;
}

/* ---------------------------------------------------------------------
   Card — HRLocker.UI/mvc/components/card.less
   --------------------------------------------------------------------- */

.card {
    display: flex;
    flex-direction: column;
    gap: var(--hrl-space-l);
    padding: var(--hrl-space-xl);
    background-color: var(--hrl-surface);
    border-radius: var(--hrl-border-radius-xl);
    box-shadow: 0 2px 0 var(--hrl-surface-shadow);
}

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--hrl-space-l);
}

.card__title {
    margin: 0;
    font-size: var(--hrl-font-size-large);
}

.card__text {
    margin: 0;
    font-size: var(--hrl-font-size-medium);
    line-height: var(--hrl-line-height-base);
    color: var(--hrl-text-muted);
}

.card__note {
    margin: 0;
    color: var(--hrl-text-subtle);
    font-size: var(--hrl-font-size-tiny);
}

.card__empty {
    margin: 0;
    color: var(--hrl-text-subtle);
}

.card--row {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.card--green {
    background-color: var(--hrl-green-800);
    box-shadow: none;
}

.card--green .card__title { color: var(--hrl-white); }
.card--green .card__text { color: var(--hrl-grey-100); }

.card--narrow {
    max-width: 640px;
}

/* Cards in two tracks; single column below the desktop breakpoint (@screen-md-max). */
.columns {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: var(--hrl-space-xl);
    align-items: start;
}

.columns--even {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.columns__column {
    display: flex;
    flex-direction: column;
    gap: var(--hrl-space-xl);
    min-width: 0;
}

@media (max-width: 991px) {
    .columns,
    .columns--even {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---------------------------------------------------------------------
   Lists and facts
   --------------------------------------------------------------------- */

/* Rows of "icon, title + subline, action", divided by hairlines. */
.row-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.row-list__item {
    display: flex;
    align-items: center;
    gap: var(--hrl-space-m);
    padding-block: var(--hrl-space-m);
}

.row-list__item:not(:last-child) {
    border-bottom: 1px solid var(--hrl-border);
}

.row-list__item:first-child { padding-top: 0; }
.row-list__item:last-child { padding-bottom: 0; }

.row-list__main {
    flex: 1;
    min-width: 0;
}

.row-list__title {
    display: block;
    font-weight: var(--hrl-font-weight-heading);
}

.row-list__sub {
    display: block;
    color: var(--hrl-text-subtle);
    font-size: var(--hrl-font-size-tiny);
    overflow-wrap: anywhere;
}

/* Term / value pairs. */
.facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: var(--hrl-space-s) var(--hrl-space-l);
    margin: 0;
}

.facts dt {
    color: var(--hrl-text-subtle);
}

.facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------------
   Status pills — cf. document-card__pill
   --------------------------------------------------------------------- */

.status-pill {
    display: inline-block;
    padding: var(--hrl-space-2xs) var(--hrl-space-s);
    border-radius: var(--hrl-border-radius-pill);
    background-color: var(--hrl-surface-muted);
    color: var(--hrl-text-subtle);
    font-size: var(--hrl-font-size-tiny);
    font-weight: var(--hrl-font-weight-heading);
    line-height: var(--hrl-line-height-tiny);
    white-space: nowrap;
    text-decoration: none;
}

.status-pill--ok {
    background-color: color-mix(in srgb, var(--hrl-green-100) 52%, var(--hrl-surface));
    color: var(--hrl-green-700);
}

.status-pill--warn {
    background-color: var(--hrl-yellow-100);
    color: var(--hrl-yellow-700);
}

.status-pill--bad {
    background-color: var(--hrl-red-100);
    color: var(--hrl-red-700);
}

/* ---------------------------------------------------------------------
   Avatar and product marks
   --------------------------------------------------------------------- */

.avatar {
    display: inline-grid;
    place-items: center;
    width: var(--hrl-space-2xl);
    height: var(--hrl-space-2xl);
    border-radius: 50%;
    background-color: var(--hrl-maroon-700);
    color: var(--hrl-white);
    font-size: var(--hrl-font-size-tiny);
    font-weight: var(--hrl-font-weight-heading);
}

.avatar--xlarge {
    width: var(--hrl-space-4xl);
    height: var(--hrl-space-4xl);
    font-size: var(--hrl-font-size-medium);
}

.product-mark {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: var(--hrl-space-3xl);
    height: var(--hrl-space-3xl);
    border-radius: var(--hrl-border-radius-xl);
}

/* Each product owns its colour (brand guidelines). */
.product-mark--core { background-color: var(--hrl-blue-100); }
.product-mark--recruit { background-color: var(--hrl-orange-100); }
.product-mark--perform { background-color: var(--hrl-orange-500); }
.product-mark--onboard { background-color: color-mix(in srgb, var(--hrl-green-100) 52%, var(--hrl-white)); }

/* ---------------------------------------------------------------------
   Tables — cf. document-card__table
   --------------------------------------------------------------------- */

/* The scroll container is also the white panel, so the table itself stays a plain table. */
.table-scroll {
    margin-bottom: var(--hrl-space-xl);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    background-color: var(--hrl-surface);
    border-radius: var(--hrl-border-radius-xl);
    box-shadow: 0 2px 0 var(--hrl-surface-shadow);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table caption {
    padding: var(--hrl-space-m) var(--hrl-space-xl) 0;
    color: var(--hrl-text-subtle);
    font-size: var(--hrl-font-size-tiny);
    text-align: start;
}

.data-table thead th {
    padding: var(--hrl-space-m) var(--hrl-space-xl);
    border-bottom: 1px solid var(--hrl-border);
    background-color: var(--hrl-surface-tint);
    color: var(--hrl-text-subtle);
    font-size: var(--hrl-font-size-tiny);
    font-weight: var(--hrl-font-weight-heading);
    letter-spacing: 0.04em;
    text-align: start;
    text-transform: uppercase;
    white-space: nowrap;
}

.data-table tbody td {
    padding: var(--hrl-space-m) var(--hrl-space-xl);
    border-bottom: 1px solid var(--hrl-border);
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Ruled columns. */
.data-table--bordered :where(th, td):not(:first-child) {
    border-inline-start: 1px solid var(--hrl-border);
}

.data-table code {
    overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------------
   Notice
   --------------------------------------------------------------------- */

.notice {
    margin: 0 0 var(--hrl-space-l);
    padding: var(--hrl-space-m) var(--hrl-space-l);
    border-inline-start: 4px solid var(--hrl-primary);
    border-radius: var(--hrl-border-radius-base);
    background-color: var(--hrl-surface);
    box-shadow: 0 2px 0 var(--hrl-surface-shadow);
    color: var(--hrl-text-muted);
}

.notice--bad {
    border-inline-start-color: var(--hrl-danger);
}

/* ---------------------------------------------------------------------
   Colour-scheme picker — a <details> dropdown; System / Light / Dark are one form post each
   --------------------------------------------------------------------- */

.theme-menu {
    position: relative;
    display: inline-block;
}

.theme-menu__summary {
    display: inline-flex;
    align-items: center;
    gap: var(--hrl-space-s);
    padding: calc(var(--hrl-space-xs) - 1px) var(--hrl-space-m);
    border: 1px solid var(--hrl-border-strong);
    border-radius: var(--hrl-border-radius-base);
    background-color: var(--hrl-surface);
    color: var(--hrl-text-muted);
    font-size: var(--hrl-font-size-tiny);
    line-height: var(--hrl-space-xl);
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.theme-menu__summary::-webkit-details-marker {
    display: none;
}

.theme-menu__summary:hover,
.theme-menu[open] .theme-menu__summary {
    color: var(--hrl-text);
}

.theme-menu__chevron {
    width: var(--hrl-font-size-base);
    height: var(--hrl-font-size-base);
    transition: transform 0.15s ease;
}

.theme-menu[open] .theme-menu__chevron {
    transform: rotate(180deg);
}

.theme-switch {
    position: absolute;
    inset-block-start: calc(100% + var(--hrl-space-xs));
    inset-inline-end: 0;
    z-index: 110;
    display: flex;
    flex-direction: column;
    min-width: 160px;
    margin: 0;
    padding: var(--hrl-space-xs);
    border: 1px solid var(--hrl-border);
    border-radius: var(--hrl-border-radius-large);
    background-color: var(--hrl-surface);
    box-shadow: var(--hrl-shadow-dropdown);
}

/* Under the login box the menu opens centred rather than off the trailing edge. */
.theme-menu--center .theme-switch {
    inset-inline-end: auto;
    inset-inline-start: 50%;
    translate: -50% 0;
}

.theme-switch__option {
    display: flex;
    align-items: center;
    gap: var(--hrl-space-s);
    width: 100%;
    padding: var(--hrl-space-s) var(--hrl-space-m);
    border: 0;
    border-radius: var(--hrl-border-radius-base);
    background: none;
    color: var(--hrl-text);
    font-family: inherit;
    font-size: var(--hrl-font-size-small);
    text-align: start;
    cursor: pointer;
}

.theme-switch__option:hover {
    background-color: var(--hrl-surface-tint);
}

.theme-switch__option[aria-pressed="true"] {
    font-weight: var(--hrl-font-weight-heading);
}

/* The tick on the chosen option, so the state is not colour alone. */
.theme-switch__option[aria-pressed="true"]::after {
    content: "\2713";
    margin-inline-start: auto;
    color: var(--hrl-primary);
}

.theme-switch__option .icon,
.theme-menu__summary .icon {
    width: var(--hrl-font-size-base);
    height: var(--hrl-font-size-base);
}

/* ---------------------------------------------------------------------
   Utilities — HRLocker.UI/mvc/app/utilities.less plus the accessibility helpers
   --------------------------------------------------------------------- */

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.text-center {
    text-align: center;
}

.icon {
    width: var(--hrl-space-l);
    height: var(--hrl-space-l);
    flex-shrink: 0;
}

.visually-hidden:where(:not(:focus-within, :active)) {
    position: absolute !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    white-space: nowrap !important;
}

.skip-link:focus-visible {
    position: fixed;
    inset-block-start: var(--hrl-space-s);
    inset-inline-start: var(--hrl-space-s);
    z-index: 200;
    padding: var(--hrl-space-s) var(--hrl-space-m);
    border-radius: var(--hrl-border-radius-base);
    background-color: var(--hrl-surface);
    color: var(--hrl-link);
}
