/* ================================================================
   Pinnable sidebar navigation (Client/Layout/AppNavigation.razor)
   and the group landing page (Client/Pages/NavSection.razor).

   Theme colours come from the Radzen variables the rest of the app
   uses, so the sidebar follows whichever Radzen theme is loaded.
   Icons are Font Awesome glyphs (FontAwesomeIconMapping.GetUnicode)
   rendered on a plain <i> in the solid face declared in site.css.
   ================================================================ */

.app-nav-sidebar {
    transition: width 0.2s ease;
}

.app-nav-sidebar .rz-sidebar-content,
.app-nav-sidebar > div {
    height: 100%;
}

.app-nav {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem 0.5rem 1.5rem;
    font-size: 0.875rem;
    color: var(--rz-text-color, #1f2933);
    --app-nav-hover: var(--rz-base-200, rgba(0, 0, 0, 0.05));
    --app-nav-active: var(--rz-primary-lighter, rgba(33, 150, 243, 0.12));
    --app-nav-muted: var(--rz-text-secondary-color, #5f6b7a);
}

.app-nav-icon {
    font-family: "MeditalkFaSolid", "Font Awesome 6 Pro", "Font Awesome 6 Free";
    font-weight: 900;
    font-style: normal;
    font-size: 0.95em;
    line-height: 1;
    width: 1.35rem;
    flex: 0 0 1.35rem;
    text-align: center;
    display: inline-block;
}

/* ---- toolbar: search + compact toggle ---- */
.app-nav-toolbar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.app-nav-search {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
}

.app-nav-search-icon {
    position: absolute;
    left: 0.5rem;
    color: var(--app-nav-muted);
    pointer-events: none;
}

.app-nav-search-input {
    width: 100%;
    padding: 0.45rem 2rem 0.45rem 2.1rem;
    border: 1px solid var(--rz-border-color, #d5dae1);
    border-radius: 6px;
    background: var(--rz-base-background-color, #fff);
    color: inherit;
    font: inherit;
}

.app-nav-search-input::-webkit-search-cancel-button {
    display: none;
}

.app-nav-search-clear {
    position: absolute;
    right: 0.15rem;
}

.app-nav-tool {
    border: none;
    background: transparent;
    color: var(--app-nav-muted);
    border-radius: 6px;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: 0 0 auto;
}

.app-nav-tool:hover {
    background: var(--app-nav-hover);
    color: var(--rz-text-color, #1f2933);
}

/* ---- sections ----
   A section header is a band, not a row: full-width tinted background, a hairline above,
   small muted glyph, uppercase label, chevron on the right. The pages under it are indented
   and hang off a rail, so heading and page never line up as equals. */
.app-nav-section {
    margin-bottom: 0.35rem;
}

.app-nav-heading,
.app-nav-section-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    margin: 0.35rem 0 0.15rem;
    padding: 0.4rem 0.5rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--app-nav-muted);
    background: var(--rz-base-100, rgba(0, 0, 0, 0.035));
    border: none;
    border-top: 1px solid var(--rz-border-color, #e3e7ec);
    border-radius: 6px;
    text-align: left;
}

.app-nav-heading .app-nav-icon,
.app-nav-section-toggle > .app-nav-icon:first-child {
    font-size: 0.8em;
    color: var(--app-nav-muted);
}

.app-nav-section-toggle {
    cursor: pointer;
}

.app-nav-section-toggle:hover {
    background: var(--app-nav-hover);
    color: var(--rz-text-color, #1f2933);
}

.app-nav-section-toggle .app-nav-text {
    flex: 1 1 auto;
}

.app-nav-chevron {
    font-size: 0.7em;
    color: var(--app-nav-muted);
}

.app-nav-list {
    list-style: none;
    margin: 0 0 0 0.9rem;
    padding: 0 0 0 0.35rem;
    border-left: 2px solid var(--rz-border-color, #e3e7ec);
}

.app-nav-empty {
    margin: 0.15rem 0.4rem 0.5rem;
    font-size: 0.78rem;
    color: var(--app-nav-muted);
}

/* ---- rows: link + separate pin button ---- */
.app-nav-row {
    display: flex;
    align-items: stretch;
    border-radius: 6px;
}

.app-nav-row:hover,
.app-nav-row:focus-within {
    background: var(--app-nav-hover);
}

.app-nav-link {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.3rem;
    color: inherit;
    text-decoration: none;
    border-radius: 6px;
}

.app-nav-link:hover {
    color: inherit;
    text-decoration: none;
}

.app-nav-link.is-active {
    background: var(--app-nav-active);
    color: var(--rz-primary, #2196f3);
    font-weight: 600;
}

.app-nav-link .app-nav-icon {
    color: var(--rz-primary, #2196f3);
    opacity: 0.85;
}

/* A group row opens a landing page, not a page of its own: muted glyph, chevron on the right. */
.app-nav-row-group .app-nav-link .app-nav-icon:first-child {
    color: var(--app-nav-muted);
}

.app-nav-row-group .app-nav-link .app-nav-text {
    font-weight: 500;
}

.app-nav-link .app-nav-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.app-nav-breadcrumb {
    font-size: 0.72rem;
    font-weight: 400;
    color: var(--app-nav-muted);
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-nav-pin {
    flex: 0 0 auto;
    border: none;
    background: transparent;
    color: var(--app-nav-muted);
    border-radius: 6px;
    width: 1.7rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.12s ease;
}

.app-nav-row:hover .app-nav-pin,
.app-nav-row:focus-within .app-nav-pin,
.app-nav-pin:focus-visible,
.app-nav-pin.is-pinned {
    opacity: 1;
}

.app-nav-pin.is-pinned {
    color: var(--rz-primary, #2196f3);
    opacity: 0.45;
}

.app-nav-row:hover .app-nav-pin.is-pinned,
.app-nav-row:focus-within .app-nav-pin.is-pinned,
.nav-section-tile:hover .app-nav-pin.is-pinned,
.nav-section-tile:focus-within .app-nav-pin.is-pinned {
    opacity: 1;
}

.app-nav-pin:hover {
    background: var(--rz-base-300, rgba(0, 0, 0, 0.08));
    color: var(--rz-text-color, #1f2933);
}

/* Keyboard users see where they are. */
.app-nav-link:focus-visible,
.app-nav-pin:focus-visible,
.app-nav-tool:focus-visible,
.app-nav-section-toggle:focus-visible,
.app-nav-search-input:focus-visible {
    outline: 2px solid var(--rz-primary, #2196f3);
    outline-offset: -2px;
}

/* ---- compact (icon-only) mode ---- */
.app-nav-compact {
    padding-left: 0.25rem;
    padding-right: 0.25rem;
}

.app-nav-compact .app-nav-toolbar {
    flex-direction: column;
}

.app-nav-compact .app-nav-text,
.app-nav-compact .app-nav-chevron,
.app-nav-compact .app-nav-pin,
.app-nav-compact .app-nav-empty {
    display: none;
}

.app-nav-compact .app-nav-heading,
.app-nav-compact .app-nav-section-toggle,
.app-nav-compact .app-nav-link {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.app-nav-compact .app-nav-list {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
}

.app-nav-compact .app-nav-section-toggle .app-nav-icon {
    color: var(--app-nav-muted);
}

/* ---- group landing page ---- */
.nav-section-page {
    max-width: 1100px;
    padding: 0.5rem 0.25rem 2rem;
}

.nav-section-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.nav-section-header-icon {
    width: 3rem;
    height: 3rem;
    flex-basis: 3rem;
    font-size: 1.4rem;
    line-height: 3rem;
    border-radius: 12px;
    background: var(--app-nav-active, rgba(33, 150, 243, 0.12));
    color: var(--rz-primary, #2196f3);
}

.nav-section-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.nav-section-count,
.nav-section-loading,
.nav-section-empty p {
    margin: 0.15rem 0 0;
    color: var(--rz-text-secondary-color, #5f6b7a);
}

.nav-section-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}

.nav-section-tile {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--rz-border-color, #d5dae1);
    border-radius: 10px;
    background: var(--rz-base-background-color, #fff);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.nav-section-tile:hover,
.nav-section-tile:focus-within {
    border-color: var(--rz-primary, #2196f3);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.nav-section-tile-link {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 0.9rem;
    color: inherit;
    text-decoration: none;
    border-radius: 10px;
}

.nav-section-tile-link:hover {
    color: inherit;
    text-decoration: none;
}

.nav-section-tile-icon {
    color: var(--rz-primary, #2196f3);
    font-size: 1.1rem;
}

.nav-section-tile-text {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-section-tile .app-nav-pin {
    width: 2.4rem;
    border-radius: 0 10px 10px 0;
}

.nav-section-tile:hover .app-nav-pin,
.nav-section-tile:focus-within .app-nav-pin {
    opacity: 1;
}

.nav-section-empty {
    padding: 2rem 0;
}

.nav-section-empty h2 {
    font-size: 1.2rem;
    margin: 0 0 0.5rem;
}

@media (max-width: 767.98px) {
    /* Radzen turns the sidebar into a drawer here; the nav is one column and its
       pin buttons stay visible, because there is no hover on a phone. */
    .app-nav-pin {
        opacity: 1;
    }

    .nav-section-grid {
        grid-template-columns: 1fr;
    }
}

/* ---- classic ↔ V2 rollout switch (Client/Layout/NavigationSwitcher.razor) ---- */
.nav-switch-banner {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin: 0.5rem;
    padding: 0.6rem 0.7rem;
    border-radius: 8px;
    background: var(--rz-info-lighter, #e3f2fd);
    color: var(--rz-info-darker, #0d47a1);
    font-size: 0.8rem;
    line-height: 1.35;
}

.nav-switch-button {
    align-self: flex-start;
    border: none;
    border-radius: 6px;
    padding: 0.35rem 0.7rem;
    background: var(--rz-info, #2196f3);
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.nav-switch-button:hover {
    filter: brightness(0.92);
}

.nav-switch-host {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.nav-switch-host > .app-nav {
    flex: 1 1 auto;
    min-height: 0;
}

.nav-switch-footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
    padding: 0.35rem 0.5rem;
    border-top: 1px solid var(--rz-border-color, #e3e7ec);
    background: var(--rz-base-background-color, #fff);
}

.nav-switch-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: none;
    background: transparent;
    color: var(--rz-text-secondary-color, #5f6b7a);
    font: inherit;
    font-size: 0.78rem;
    padding: 0.3rem 0.4rem;
    border-radius: 6px;
    cursor: pointer;
}

.nav-switch-link:hover {
    background: var(--rz-base-200, rgba(0, 0, 0, 0.05));
    color: var(--rz-text-color, #1f2933);
}

.nav-switch-button:focus-visible,
.nav-switch-link:focus-visible {
    outline: 2px solid var(--rz-primary, #2196f3);
    outline-offset: -2px;
}

/* Icon-only rail: the footer keeps the help button and the switch glyph, no label. */
.app-nav-sidebar-compact .nav-switch-footer {
    flex-direction: column;
}

.app-nav-sidebar-compact .nav-switch-link .app-nav-text {
    display: none;
}
