/* The login screens: a bar with SINTEF's logo, and one card on a tinted page, in Designsystemet with the Fundament theme. */

@font-face {
    font-family: Inter;
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: Inter;
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

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

body {
    /* The side gutter at the body's size: the admin content is data-size="sm" but still lines up with the top bar. */
    --page-gutter: var(--ds-size-5);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--ds-font-family), system-ui, sans-serif;
    background: var(--ds-color-neutral-background-tinted);
    color: var(--ds-color-neutral-text-default);
}

/* The bar and logo as on the new byggforsk.no (byggforskportal, src/frontend/app/features/layout), there with the logo in
   a centred column. */
.topbar {
    display: flex;
    align-items: center;
    height: 66px;
    padding: 0 var(--page-gutter);
    background: var(--ds-color-neutral-surface-default);
    border-bottom: 1px solid var(--ds-color-neutral-border-subtle);
}

.topbar__actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--ds-size-2);
}

.topbar__admin {
    display: flex;
    padding: var(--ds-size-2);
    border-radius: var(--ds-border-radius-md);
    color: var(--ds-color-neutral-text-default);
    font-size: var(--ds-size-6);
}

.topbar__admin:hover {
    background: var(--ds-color-neutral-surface-hover);
}

/* The admin pages: wide, with the top bar's side padding. */
.container {
    flex: 1;
    width: 100%;
    max-width: 80rem;
    margin: 0 auto;
    padding: var(--ds-size-6) var(--page-gutter);
    display: flex;
    flex-direction: column;
    gap: var(--ds-size-5);
}

.container > .ds-card {
    padding: var(--ds-size-6);
    display: flex;
    flex-direction: column;
    gap: var(--ds-size-4);
}

/* A heading with its buttons on the right: the page title and its actions, a card's title and Edit. */
.page-head,
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ds-size-3);
    flex-wrap: wrap;
}

.scope-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0 var(--ds-size-3);
}

/* A sortable header keeps its name and arrow on one line, also on a narrow column. */
.ds-table th[aria-sort] button {
    white-space: nowrap;
}

/* The confirm dialogs (delete, log out everywhere): spaced like a card. */
.ds-dialog[open] {
    display: flex;
    flex-direction: column;
    gap: var(--ds-size-4);
    max-width: 34rem;
}

/* An audit entry's changes in full: wide enough for URI lists, which wrap anywhere. */
.ds-dialog.changes-dialog[open] {
    max-width: 60rem;
    width: calc(100% - 2 * var(--page-gutter));
}

/* Old and New share the width evenly, so a short value isn't squeezed by a long one beside it. */
.changes-table {
    table-layout: fixed;
    width: 100%;
}

.changes-table .changes-field {
    width: 12rem;
}

.changes-table td {
    overflow-wrap: anywhere;
}

@media (max-width: 768px) {
    .changes-table .changes-field {
        width: 30%;
    }
}

/* A row of links, the current one bold (New client's presets). */
.admin-nav {
    display: flex;
    gap: var(--ds-size-5);
    align-items: baseline;
    flex-wrap: wrap;
}

.admin-nav a[aria-current="page"] {
    font-weight: var(--ds-font-weight-semibold, 600);
    text-decoration: none;
}

.admin-tabs {
    display: flex;
    overflow-x: auto;
    border-bottom: var(--dsc-tabs-list-border-bottom-width) var(--dsc-tabs-list-border-bottom-style) var(--dsc-tabs-list-border-color);
}

/* Designsystemet's tab (vendor/designsystemet.css, [role=tab]) on a link: the line under it shows the current page. */
.admin-tabs a {
    position: relative;
    flex-shrink: 0;
    padding: var(--dsc-tabs-tab-padding);
    color: var(--dsc-tabs-tab-color);
    line-height: var(--ds-line-height-sm);
    text-decoration: none;
    white-space: nowrap;
}

.admin-tabs a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: .15em;
}

.admin-tabs a[aria-current="page"] {
    color: var(--dsc-tabs-tab-color--selected);
}

.admin-tabs a[aria-current="page"]::after {
    background: var(--dsc-tabs-tab-color--selected);
}

.admin-tabs a:hover:not([aria-current="page"]) {
    color: var(--dsc-tabs-tab-color--hover);
}

.admin-tabs a:hover:not([aria-current="page"])::after {
    background: var(--dsc-tabs-list-border-color);
}

.admin-tabs a:focus-visible {
    outline: var(--ds-border-width-focus) solid var(--ds-color-focus-outer);
    outline-offset: calc(-1 * var(--ds-border-width-focus));
}

/* The audit log: its filters on one line, its changes as a compact list. */
.filters {
    flex-wrap: wrap;
}

.filters .ds-field:has(select) {
    flex: 0 0 auto;
}

.changes {
    margin: 0;
    padding-left: var(--ds-size-4);
    font-size: var(--ds-body-sm-font-size);
    overflow-wrap: anywhere;
}

.subtle {
    color: var(--ds-color-neutral-text-subtle);
    font-size: var(--ds-body-sm-font-size);
}

.nowrap {
    white-space: nowrap;
}

/* A form's lists of checkboxes (scopes, identity providers) in columns. */
.choices {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: var(--ds-size-2) var(--ds-size-4);
}

/* Long names (ByggforskAppsInternal.Write) wrap instead of running into the next column. */
.choices .ds-label {
    min-width: 0;
    overflow-wrap: anywhere;
}

.choices > legend,
.choices > [data-field="description"] {
    grid-column: 1 / -1;
}

/* A search box and its button on one line. */
.search {
    flex-direction: row;
    align-items: flex-end;
    gap: var(--ds-size-3);
}

.search .ds-field {
    flex: 1;
    max-width: 32rem;
}

/* White rows on the tinted page, for reading; the header a shade apart. */
.ds-table {
    width: 100%;
    --dsc-table-background: var(--ds-color-neutral-background-default);
    --dsc-table-header-background: var(--ds-color-neutral-surface-tinted);
}

/* A table wider than a phone scrolls sideways in its own box, not the page. */
.table-scroll {
    overflow-x: auto;
}

/* The text and the button in a "Er du sikker?" box. */
.ds-details > div {
    display: flex;
    flex-direction: column;
    gap: var(--ds-size-3);
}

/* Label and value pairs in a details card. */
.facts {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: var(--ds-size-2) var(--ds-size-6);
    margin: 0;
}

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

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

.logo {
    display: block;
    height: 32px;
    aspect-ratio: 511 / 106;
    background: var(--ds-color-sintefblaa-base-default);
    -webkit-mask: url("../images/sintef-logo.svg") center / contain no-repeat;
    mask: url("../images/sintef-logo.svg") center / contain no-repeat;
}

.page {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: var(--ds-size-8) var(--ds-size-4);
}

.card {
    width: 100%;
    max-width: 31rem;
    padding: var(--ds-size-8);
    display: flex;
    flex-direction: column;
    gap: var(--ds-size-5);
    box-shadow: var(--ds-shadow-sm);
}

.card--wide {
    max-width: 40rem;
}

/* The heading and the line under it belong together. */
.card > .ds-heading + .ds-paragraph {
    margin-top: calc(-1 * var(--ds-size-3));
    color: var(--ds-color-neutral-text-subtle);
}

form {
    display: flex;
    flex-direction: column;
    gap: var(--ds-size-5);
}

/* Also on a form of only buttons, which would otherwise be a column. */
.actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: var(--ds-size-3);
    flex-wrap: wrap;
}

/* Husk meg on the left, Glemt passord on the right. */
.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ds-size-3);
    flex-wrap: wrap;
}

.field-row {
    display: flex;
    align-items: center;
    gap: var(--ds-size-2);
}

.ds-field [data-field="description"] {
    color: var(--ds-color-neutral-text-subtle);
}

/* The icon in front of a field, and the show-password button after it. */
.ds-field-affix svg {
    font-size: var(--ds-size-6);
}

.toggle-password {
    cursor: pointer;
    color: inherit;
    font: inherit;
}

.ds-input[aria-invalid="true"] {
    border-color: var(--ds-color-danger-border-default);
}

pre {
    white-space: pre-wrap;
    word-break: break-all;
    font-size: var(--ds-body-xs-font-size);
    background: var(--ds-color-neutral-background-tinted);
    padding: var(--ds-size-3);
    border-radius: var(--ds-border-radius-md);
    margin: 0;
}

@media (max-width: 768px) {
    body {
        --page-gutter: var(--ds-size-3);
    }

    .container {
        padding-block: var(--ds-size-4);
    }

    .facts {
        grid-template-columns: 1fr;
        gap: 0 0;
    }

    .facts dd {
        margin-bottom: var(--ds-size-3);
    }
}

@media (max-width: 40rem) {
    .page {
        padding: var(--ds-size-4) var(--ds-size-2);
    }

    .card {
        padding: var(--ds-size-6) var(--ds-size-5);
    }
}
