/* ═══════════════════════════════════════════════════════════════
   ehr_sidebar.css — Desktop sidebar navigation
   Load order: 2
   Visible: >980px only
   ═══════════════════════════════════════════════════════════════ */

.ehr-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--ehr-sidebar-width);
    background: var(--ehr-theme-base);
    color: var(--ehr-sidebar-text);
    z-index: 1000;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform var(--ehr-transition), width var(--ehr-transition);
    transform: translateX(0);
    border-right: 1px solid var(--ehr-border);
    container-type: inline-size;
    container-name: sidebar;
}

/* Scrollbar styling */
.ehr-sidebar::-webkit-scrollbar {
    width: 4px;
}
.ehr-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
}

/* Hidden state */
.ehr-sidebar.collapsed {
    transform: translateX(calc(-1 * var(--ehr-sidebar-width)));
}

/* Logo area */
.ehr-sidebar-logo {
    padding: .5em;
    /* border-bottom: 1px solid rgba(255,255,255,0.08); */
    height: var(--ehr-header-height);
    display: flex;
    justify-content: center;
    align-self: center;
}

.ehr-sidebar-logo img {
    max-height: 40px;
    width: auto;
}

/* LOGOHOME_20261026 (run 455): the logo is a link to the front page. The link box takes the place the logo had in the flex
   row and stretches the logo to its height exactly as the row did (headless 1280: 171 x 38 at 40,7 before and after), so
   nothing moves; no underline or link colour. */
.ehr-sidebar-logo .ehr-sidebar-logo-link {
    display: flex;
    align-items: stretch;
    text-decoration: none;
    color: inherit;
}

.ehr-sidebar-logo .ehr-logo-short {
    display: none;
    background: var(--ehr-theme-accent);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 4px;
    letter-spacing: 0.5px;
}

/* Nav items */
.ehr-sidebar-nav {
  display: grid;
  gap: .75em;
  margin-top: 1em;
}

.ehr-sidebar-item {
    position: relative;
}

.ehr-sidebar-link {
    display: flex;
    align-items: flex-start;
    gap: .5em;
    justify-content: flex-start;
    padding: 10px 20px;
    color: var(--ehr-sidebar-text);
    font-size: 1.15em;
    font-weight: 600;
    transition: background var(--ehr-transition), color var(--ehr-transition);
}

.ehr-sidebar-link svg {
    width: 18px;
    height: 18px;
    opacity: 0.85;
}

.ehr-sidebar-link:focus-visible {
    background: color-mix(in srgb, var(--ehr-sidebar-text) 12%, transparent);
    color: var(--ehr-sidebar-text);
}
@media (hover: hover) {
    .ehr-sidebar-link:hover {
        background: color-mix(in srgb, var(--ehr-sidebar-text) 12%, transparent);
        color: var(--ehr-sidebar-text);
    }
}

.ehr-sidebar-link.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-left-color: var(--ehr-theme-accent);
}

/* Dropdown arrow */
.ehr-sidebar-link .ehr-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
    opacity: 0.5;
    flex-shrink: 0;
}

.ehr-sidebar-link .ehr-arrow svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.ehr-sidebar-item.open > .ehr-sidebar-link .ehr-arrow {
    transform: rotate(180deg);
    opacity: 0.8;
}

/* Submenu */
.ehr-sidebar-sub {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: var(--ehr-theme-raised);
}

.ehr-sidebar-item.open > .ehr-sidebar-sub {
    max-height: 1200px;   /* SIDEMENUFIT_20261115 (run list 705): was 500px, which cut the bottom of Misc (16 links, about 640px: YRGE, Yaps, Help, Contact Admin hidden). Room for about 30 links. */
}

.ehr-sidebar-sub a {
    display: block;
    padding: 8px 20px 8px 44px;
    color: var(--ehr-sidebar-text);
    font-size: 1.15em;
    transition: background var(--ehr-transition), color var(--ehr-transition);
}

.ehr-sidebar-sub a:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Hide sidebar on mobile */
@media (max-width: 1200px) {
    /* .ehr-sidebar {
        width: 200px;
    } */
    /* WILLMERGE_20261017: was a fixed 200px -- the sidebar is 250px again (Will and owner 10-17), which overlapped the header and the
       content by 50px at 981-1200px. The offsets follow the sidebar width now. */
    .ehr-header {
      left: var(--ehr-sidebar-width);
    }
    .ehr-page-container {
      margin-left: var(--ehr-sidebar-width);
    }
}

@media (max-width: 980px) {
    .ehr-sidebar {
        display: none !important;
    }
}
