/* ==========================================================================
   PlanStreet site header  (Views/Shared/_Header.cshtml)
   Figma: "Untitled" > header + Case Management / EHR / Resources / About menus
   - Desktop (>= 1200px): inline links + hover/click dropdown panels
   - Below 1200px: hamburger + slide-down drawer with accordions
   Everything is scoped under .ps-header so it never touches other pages.
   ========================================================================== */

.ps-header {
    --ps-navy: #002A41;
    --ps-ink: #082131;
    --ps-green: #1B9944;
    --ps-green-soft: #40AF49;
    --ps-line: #DBE8F0;
    --ps-mint: #EAF5F9;
    --ps-h: 89px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    height: var(--ps-h);
    background: #fff;
    border-bottom: 1px solid var(--ps-line);
    font-family: Poppins, system-ui, sans-serif;
}

.ps-header,
.ps-header * {
    box-sizing: border-box;
}

.ps-header ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ps-header a,
.ps-header button {
    font-family: Poppins, system-ui, sans-serif !important;
    text-decoration: none;
}

.ps-inner {
    max-width: 1280px;
    height: 100%;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.ps-logo {
    flex: 0 0 auto;
    display: block;
    line-height: 0;
}

.ps-logo img {
    display: block;
    height: 64px;
    width: auto;
}

/* ---------- desktop links ---------- */
.ps-menu {
    display: none;
    align-items: center;
    gap: 4px;
}

.ps-item {
    position: relative;
}

.ps-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5.5px 16px 6.5px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--ps-navy) !important;
    font-size: 15px;
    font-weight: 600;
    line-height: 24px;
    white-space: nowrap;
    cursor: pointer;
    transition: color .15s ease;
}

.ps-link .ps-chev {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    transition: transform .2s ease;
}

.ps-link:hover,
.ps-item.is-open > .ps-link,
.ps-link.is-current {
    color: var(--ps-green) !important;
}

.ps-item.is-open > .ps-link .ps-chev {
    transform: rotate(180deg);
}

.ps-link:focus-visible,
.ps-demo:focus-visible,
.ps-burger:focus-visible,
.ps-dd a:focus-visible,
.ps-drawer a:focus-visible,
.ps-acc-btn:focus-visible {
    outline: 2px solid var(--ps-green);
    outline-offset: 2px;
}

/* ---------- Live Demo pill ---------- */
.ps-demo {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 999px;
    background: var(--ps-navy);
    color: #F5FCFC !important;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    white-space: nowrap;
    transition: background-color .15s ease, transform .15s ease;
}

.ps-demo:hover {
    background: #00415f;
    color: #fff !important;
}

/* ---------- dropdown panels ---------- */
.ps-dd {
    position: absolute;
    top: calc(100% + 26px);
    left: 16px;
    z-index: 10;
    min-width: 100%;
    display: flex;
    background: #fff;
    border: 1px solid var(--ps-line);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0, 42, 65, .16);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}

/* invisible bridge so the pointer can travel from the link to the panel */
.ps-dd::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -28px;
    height: 28px;
}

.ps-item.is-open > .ps-dd {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
}

.ps-dd-col {
    padding: 16px;
    min-width: 0;
}

.ps-dd-col.is-mint {
    background: var(--ps-mint);
    border-left: 1px solid var(--ps-line);
}

.ps-dd-col.is-wide {
    min-width: 270px;
}

.ps-dd a {
    display: block;
    padding: 6px 12px;
    border-radius: 10px;
    color: var(--ps-ink) !important;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    white-space: nowrap;
    transition: background-color .12s ease, color .12s ease;
}

.ps-dd a:hover,
.ps-dd a:focus-visible {
    background: rgba(64, 175, 73, .2);
    color: var(--ps-green-soft) !important;
}

.ps-dd-label {
    margin: 0;
    padding: 12px 12px 4px;
    color: var(--ps-green) !important;
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
    letter-spacing: 0;
    text-transform: uppercase;
    white-space: nowrap;
}

.ps-acc-panel .ps-dd-label {
    white-space: normal;
}

.ps-dd-label:first-child {
    padding-top: 0;
}

.ps-dd-label + a {
    margin-top: 4px;
}

/* the right-most dropdown must never run off the screen */
.ps-item.is-end > .ps-dd {
    left: auto;
    right: 0;
}

/* ---------- hamburger ---------- */
.ps-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ps-burger {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--ps-line);
    border-radius: 12px;
    background: #fff;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
}

.ps-burger span {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: var(--ps-navy);
    transition: transform .2s ease, opacity .2s ease;
}

.ps-header.is-drawer-open .ps-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.ps-header.is-drawer-open .ps-burger span:nth-child(2) { opacity: 0; }
.ps-header.is-drawer-open .ps-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- mobile / tablet drawer ---------- */
.ps-drawer {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: calc(100vh - var(--ps-h));
    max-height: calc(100dvh - var(--ps-h));
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    border-bottom: 1px solid var(--ps-line);
    box-shadow: 0 24px 60px rgba(0, 42, 65, .16);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
}

.ps-header.is-drawer-open .ps-drawer {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
}

.ps-drawer-inner {
    max-width: 720px;
    margin: 0 auto;
    padding: 8px 24px 24px;
}

.ps-acc,
.ps-drawer-link {
    border-bottom: 1px solid var(--ps-line);
}

.ps-acc-btn,
.ps-drawer-link {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 4px;
    border: 0;
    background: transparent;
    color: var(--ps-navy) !important;
    font-size: 16px;
    font-weight: 600;
    line-height: 24px;
    text-align: left;
    cursor: pointer;
}

/* must come after the shared "border: 0" rule above */
.ps-drawer .ps-drawer-link {
    border-bottom: 1px solid var(--ps-line);
}

.ps-acc-btn .ps-chev {
    width: 18px;
    height: 18px;
    transition: transform .2s ease;
}

.ps-acc.is-open > .ps-acc-btn {
    color: var(--ps-green) !important;
}

.ps-acc.is-open > .ps-acc-btn .ps-chev {
    transform: rotate(180deg);
}

.ps-acc-panel {
    display: none;
    padding: 0 0 12px;
}

.ps-acc.is-open > .ps-acc-panel {
    display: block;
}

.ps-acc-panel a {
    display: block;
    padding: 9px 12px;
    border-radius: 10px;
    color: var(--ps-ink) !important;
    font-size: 15px;
    font-weight: 500;
    line-height: 22px;
}

.ps-acc-panel a:hover {
    background: rgba(64, 175, 73, .2);
    color: var(--ps-green-soft) !important;
}

.ps-acc-panel .ps-dd-label {
    padding: 14px 12px 4px;
}

.ps-drawer-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 4px;
}

.ps-drawer-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: 1px solid var(--ps-line);
    border-radius: 999px;
    background: #fff;
    color: var(--ps-navy) !important;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}


/* ---------- phones ---------- */
@media (max-width: 575.98px) {
    .ps-header {
        --ps-h: 72px;
    }

    .ps-inner {
        padding: 0 16px;
    }

    .ps-logo img {
        height: 52px;
    }

    .ps-right {
        gap: 8px;
    }

    .ps-right .ps-demo {
        padding: 10px 16px;
        font-size: 13px;
        line-height: 18px;
    }

    .ps-burger {
        width: 40px;
        height: 40px;
    }

    .ps-drawer-inner {
        padding: 4px 16px 20px;
    }
}

/* ---------- desktop ---------- */
@media (min-width: 1200px) {
    .ps-menu {
        display: flex;
    }

    .ps-burger,
    .ps-drawer {
        display: none;
    }

    .ps-inner {
        gap: 48px;
    }
}

@media (min-width: 1200px) and (max-width: 1329.98px) {
    .ps-inner {
        gap: 20px;
    }

    .ps-link {
        padding-left: 12px;
        padding-right: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ps-dd,
    .ps-drawer,
    .ps-link .ps-chev,
    .ps-acc-btn .ps-chev,
    .ps-burger span {
        transition: none !important;
    }
}
