/* Extracted from ui/templates/components/filter_sidebar/filter_sidebar.html. Linked via sekizai so a page loads it once,
   however many instances it renders. */

/* NYU Perstare @font-face is defined globally in ui/css/fonts.css */
.courant-filter-sidebar,
.courant-filter-sidebar * {
    box-sizing: border-box;
    font-family: "NYU Perstare", sans-serif;
}

.courant-filter-shell {
    width: 100%;
    --courant-mobile-nav-offset: 64px;
}

.courant-filter-mobile-trigger,
.courant-filter-mobile-close,
.courant-filter-mobile-backdrop {
    display: none;
}

.courant-filter-mobile-trigger {
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #161616;
    font-size: 14px;
    line-height: 18px;
    font-weight: 400;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    cursor: pointer;
}

.courant-filter-mobile-trigger svg {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
}

.courant-filter-mobile-close {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid #DBDBDB;
    border-radius: 999px;
    background: #FFFFFF;
    color: #161616;
    cursor: pointer;
}

.courant-filter-mobile-close svg {
    width: 18px;
    height: 18px;
}

.courant-filter-sidebar {
    position: relative;
    width: 100%;
    max-width: 295px;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid #DBDBDB;
    background: #FFFFFF;
    padding: 28px 24px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.courant-filter-sidebar--sticky {
    position: sticky;
    top: 120px;
    align-self: center;
}

.courant-filter-header {
    position: relative;
    min-height: 60px;
    display: flex;
    align-items: flex-end;
    margin-bottom: 24px;
}

/* Titleless variant (e.g. faculty directory): the sidebar opens straight
   into the search box, so the header collapses to nothing on desktop and
   only reserves room for the mobile close button. */
.courant-filter-header--bare {
    min-height: 0;
    margin-bottom: 0;
}

.courant-filter-title {
    position: relative;
    z-index: 2;
    margin: 0;
    color: #161616;
    font-size: 24px;
    line-height: 30px;
    font-weight: 800;
    letter-spacing: -0.03em;
    text-transform: uppercase;
}

.courant-filter-corner {
    display: none;
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    border-top: 22px solid #E8E8E8;
    border-right: 22px solid #E8E8E8;
    pointer-events: none;
    z-index: 1;
}

.courant-filter-sidebar--accent .courant-filter-corner {
    display: block;
}

.courant-filter-field {
    border-bottom: 1px solid #DBDBDB;
    padding-bottom: 24px;
    margin-bottom: 24px;
}

.courant-filter-label {
    margin: 0 0 12px;
    color: #161616;
    font-size: 13px;
    line-height: 17px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.courant-filter-input,
.courant-filter-select {
    width: 100%;
    height: 38px;
    border: 1px solid #D9D9D9;
    border-radius: 4px;
    background: #FFFFFF;
    color: #4B4B4B;
    font-size: 13px;
    line-height: 17px;
    font-weight: 400;
    outline: none;
    transition:
        border-color 180ms ease,
        box-shadow 180ms ease;
}

.courant-filter-input {
    padding: 0 40px 0 14px;
}

.courant-filter-select {
    padding: 0 12px;
    cursor: pointer;
}

.courant-filter-input::placeholder {
    color: #7A7A7A;
    opacity: 1;
}

.courant-filter-input:focus,
.courant-filter-select:focus {
    border-color: #DBDBDB;
    box-shadow: none;
    outline: none;
}

.courant-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.courant-checkbox {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
}

.courant-checkbox-main {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

/* Typeset exactly like a Section Navigation Link label (see
   sidebar/section_navigation.html), so a filter option and a nav row
   carrying the same department badge read as the same element. */
.courant-checkbox-label {
    color: #161616;
    font-size: 14px;
    line-height: 19px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    transition: color 180ms ease;
}

.courant-checkbox:hover .courant-checkbox-label {
    color: #57068C;
}

.courant-checkbox-box {
    position: relative;
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
}

.courant-checkbox-box input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.courant-checkbox-visual {
    position: absolute;
    inset: 0;
    border: 1px solid #DBDBDB;
    border-radius: 3px;
    background: #FFFFFF;
    transition:
        border-color 180ms ease,
        box-shadow 180ms ease;
}

.courant-checkbox-dot {
    position: absolute;
    left: 3px;
    top: 3px;
    width: 9px;
    height: 9px;
    border-radius: 2px;
    background: #4B4B4B;
    opacity: 0;
    transform: scale(.5);
    transition: opacity 180ms ease, transform 180ms ease;
}

.courant-checkbox:hover .courant-checkbox-visual {
    border-color: #4B4B4B;
}

.courant-checkbox-box input:focus-visible ~ .courant-checkbox-visual {
    border-color: #57068C;
    box-shadow: 0 0 0 2px rgba(87, 6, 140, 0.18);
}

.courant-checkbox-box input:checked ~ .courant-checkbox-visual {
    border-color: #4B4B4B;
}

.courant-checkbox-box input:checked ~ .courant-checkbox-dot {
    opacity: 1;
    transform: scale(1);
}

/* The badge itself is the ui_badge component at its section-navigation
   size (25px tall; department badges a fixed 44px wide, see badge.html).
   This slot only keeps it from shrinking. It used to force every chip to
   32x18 at 10px with !important, which is what clipped COURANT and made
   these chips a different size from every other department badge. */
.courant-checkbox-badge {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
}

.courant-checkbox-badge:empty {
    display: none;
}

.courant-filter-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
}

.courant-filter-button,
.courant-filter-clear {
    display: flex;
    width: 100%;
    height: 48px;
    align-items: center;
    justify-content: center;
    border: 1px solid #57068C;
    border-radius: 4px;
    font-size: 14px;
    line-height: 18px;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-align: center;
    text-decoration: none;
    transition:
        background-color 180ms ease,
        color 180ms ease,
        border-color 180ms ease;
}

.courant-filter-button {
    background: #57068C;
    color: #FFFFFF;
}

.courant-filter-button:hover {
    background: #46056F;
    border-color: #46056F;
}

.courant-filter-clear {
    background: #FFFFFF;
    color: #57068C;
}

.courant-filter-clear:hover {
    background: #F7F1FB;
}

.courant-filter-actions .button-component__wrapper {
    width: 100%;
}

.courant-filter-actions .button-component.courant-filter-clear {
    width: 100%;
    height: 48px;
    min-height: 48px;
    border-color: #57068C;
    border-radius: 4px;
    background: #FFFFFF;
    color: #57068C !important;
    font-size: 14px;
    line-height: 18px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.courant-filter-actions .button-component.courant-filter-clear:hover,
.courant-filter-actions .button-component.courant-filter-clear:focus-visible {
    border-color: #57068C;
    background: #F7F1FB;
    color: #57068C !important;
}

@media (max-width: 1023px) {
    .courant-filter-sidebar {
        max-width: none;
    }

    .courant-filter-sidebar--sticky {
        position: relative;
        top: auto;
    }
}

@media (max-width: 900px) {
    html.courant-filter-drawer-open,
    html.courant-filter-drawer-open body {
        overflow: hidden;
    }

    .courant-filter-shell {
        position: relative;
        min-height: 44px;
        margin-bottom: 8px;
    }

    .courant-filter-mobile-trigger {
        display: inline-flex;
    }

    .directory-mobile-filter-slot {
        display: inline-flex;
        align-items: center;
        flex: 0 0 auto;
    }

    .directory-mobile-filter-slot:empty {
        display: none;
    }

    .staff-grid-topbar,
    .staff-grid-toolbar,
    .staff-list-topbar,
    .staff-list-toolbar,
    .faculty-grid-topbar,
    .faculty-grid-toolbar,
    .faculty-list-topbar,
    .faculty-directory-topbar,
    .directory-topbar,
    .directory-toolbar {
        align-items: center;
        gap: 8px 14px;
    }

    .courant-filter-mobile-backdrop {
        position: fixed;
        top: var(--courant-mobile-nav-offset);
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 999;
        background: rgba(0, 0, 0, 0.38);
        opacity: 0;
        pointer-events: none;
        transition: opacity 180ms ease;
    }

    .courant-filter-sidebar {
        position: fixed;
        top: var(--courant-mobile-nav-offset);
        left: 0;
        z-index: 1000;
        width: min(340px, calc(100vw - 32px));
        max-width: none;
        height: calc(100dvh - var(--courant-mobile-nav-offset));
        margin: 0;
        padding: 28px 24px 32px;
        overflow-y: auto;
        overscroll-behavior: contain;
        transform: translateX(-105%);
        transition: transform 220ms ease;
    }

    .courant-filter-sidebar--sticky {
        position: fixed;
        top: var(--courant-mobile-nav-offset);
    }

    .courant-filter-shell.is-open .courant-filter-mobile-backdrop {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    .courant-filter-shell.is-open .courant-filter-sidebar {
        transform: translateX(0);
    }

    .courant-filter-header {
        align-items: center;
        justify-content: space-between;
        padding-right: 52px;
    }

    /* Keep room for the absolutely positioned close button in the drawer. */
    .courant-filter-header--bare {
        min-height: 40px;
        margin-bottom: 16px;
    }

    .courant-filter-mobile-close {
        display: inline-flex;
        position: absolute;
        top: 0;
        right: 0;
        z-index: 4;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
    }

    .courant-filter-sidebar--accent .courant-filter-corner {
        top: 12px;
        right: 42px;
        z-index: 1;
        width: 48px;
        height: 48px;
        border-top-width: 18px;
        border-right-width: 18px;
    }
}
