/* The side menu and top bar. In the Blazor app these rules are scoped to MainLayout.razor.css and NavMenu.razor.css;
   here they are plain CSS, so ::deep is dropped and the menu rules are prefixed with .sidebar. Colours come from app.css. */

.page {
    position: relative;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    min-width: 0;
}

.sidebar {
    background-image: linear-gradient(180deg, color-mix(in srgb, var(--brand) 88%, #fff) 0%, var(--brand) 45%, var(--brand-dark) 100%);
}

main > .top-row {
    background-color: rgba(255, 248, 240, 0.9);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid #f1e6d8;
    justify-content: flex-end;
    height: 3.5rem;
    display: flex;
    align-items: center;
}

    main > .top-row a, main > .top-row .btn-link {
        white-space: nowrap;
        margin-inline-start: 1.25rem;
        text-decoration: none;
    }

    main > .top-row a:hover, main > .top-row .btn-link:hover {
        text-decoration: underline;
    }

    main > .top-row a:first-child {
        overflow: hidden;
        text-overflow: ellipsis;
    }

@media (max-width: 640.98px) {
    main > .top-row {
        justify-content: space-between;
    }

    main > .top-row a, main > .top-row .btn-link {
        margin-inline-start: 0;
    }
}

@media (min-width: 641px) {
    .page {
        flex-direction: row;
    }

    .sidebar {
        width: 250px;
        height: 100vh;
        position: sticky;
        top: 0;
    }

    main > .top-row {
        position: sticky;
        top: 0;
        z-index: 1;
    }

    main > .top-row, article {
        padding-inline-start: 2rem !important;
        padding-inline-end: 1.5rem !important;
    }
}

/* Side menu (NavMenu.razor.css) */

.sidebar .navbar-toggler {
    appearance: none;
    cursor: pointer;
    width: 3.5rem;
    height: 2.5rem;
    color: white;
    position: absolute;
    top: 0.5rem;
    inset-inline-end: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") no-repeat center/1.75rem rgba(255, 255, 255, 0.1);
}

.sidebar .navbar-toggler:checked {
    background-color: rgba(255, 255, 255, 0.5);
}

.sidebar .top-row {
    min-height: 3.5rem;
    background-color: rgba(0,0,0,0.4);
}

.sidebar .navbar-brand {
    font-size: 1.1rem;
}

/* Bootstrap Icons font; margin follows the text direction (left-to-right or right-to-left). */
.sidebar .bi {
    font-size: 1.1rem;
    margin-inline-end: 0.75rem;
}

.sidebar .nav-section {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-top: 0.75rem;
    padding-bottom: 0.25rem;
}

.sidebar .nav-item {
    font-size: 0.9rem;
    padding-bottom: 0.25rem;
}

    .sidebar .nav-item:first-of-type {
        padding-top: 1rem;
    }

    .sidebar .nav-item:last-of-type {
        padding-bottom: 1rem;
    }

    .sidebar .nav-item .nav-link {
        color: #d7d7d7;
        background: none;
        border: none;
        border-radius: 4px;
        height: 2.5rem;
        display: flex;
        align-items: center;
        line-height: 2.5rem;
        width: 100%;
    }

.sidebar .nav-item a.active {
    background-color: rgba(255,255,255,0.37);
    color: white;
}

.sidebar .nav-item .nav-link:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
}

.sidebar .nav-scrollable {
    display: none;
}

.sidebar .navbar-toggler:checked ~ .nav-scrollable {
    display: block;
}

@media (min-width: 641px) {
    .sidebar .navbar-toggler {
        display: none;
    }

    .sidebar .nav-scrollable {
        /* Never collapse the sidebar for wide screens */
        display: block;
        /* Allow sidebar to scroll for tall menus */
        height: calc(100vh - 3.5rem);
        overflow-y: auto;
    }
}

/* Fields that failed validation (Blazor marks them with .invalid). */
.input-validation-error {
    border-color: var(--bs-form-invalid-border-color);
}

/* Validation messages from the tag helpers (Blazor's FieldError). */
.field-validation-error {
    display: block;
    color: var(--bs-danger);
    font-size: 0.875em;
    margin-top: 0.25rem;
}

/* A form around one list item or button (MVC posts each click as a form; Blazor used @onclick on the button itself):
   the form takes no box of its own, so the list keeps its layout. */
.d-contents {
    display: contents;
}

    .list-group > .d-contents > .list-group-item + .list-group-item,
    .list-group > .d-contents + .d-contents > .list-group-item {
        border-top-width: 0;
    }
