/*
    "Pick up where you left off" — recently viewed records.

    Covers both surfaces: the dashboard StatCard (.recent-records-*) and the header dropdown
    (.recent-menu-*). Entries are stored per user in localStorage by RecentRecordsTracker.
*/

/* Dashboard card */

.recent-records-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.recent-records-item {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-light-color);
}

    .recent-records-item:last-child {
        border-bottom: 0;
    }

.recent-records-link {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    text-decoration: none;
    transition: background 150ms ease-in-out;
}

    .recent-records-link:hover {
        background: var(--color-4);
    }

.recent-records-icon {
    flex: 0 0 auto;
    width: 20px;
    color: var(--color-gray);
    font-size: 1.1rem;
    text-align: center;
}

.recent-records-text {
    display: block;
    min-width: 0;
}

.recent-records-title {
    display: block;
    color: var(--color-1);
    font-weight: 600;
    line-height: 1.3rem;
    /* Titles are user-authored and can be long; keep every row to one line. */
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.recent-records-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--color-gray);
    font-size: .8rem;
}

.recent-records-section::after {
    content: "\00b7";
    margin-left: 6px;
}

.recent-records-remove {
    flex: 0 0 auto;
    padding: 6px 8px;
    border: 0;
    background: none;
    color: var(--color-gray);
    cursor: pointer;
    opacity: 0;
    transition: opacity 150ms ease-in-out, color 150ms ease-in-out;
}

.recent-records-item:hover .recent-records-remove {
    opacity: 1;
}

.recent-records-remove:hover {
    color: var(--color-1);
}

.recent-records-remove:focus-visible {
    opacity: 1;
}

.recent-records-empty {
    padding: 30px 10px;
    color: var(--color-gray);
    text-align: center;
}

    .recent-records-empty i {
        display: block;
        margin-bottom: 8px;
        font-size: 1.8rem;
    }

    .recent-records-empty p {
        margin: 0;
    }

/* Header dropdown */

header .user .recent-menu {
    position: relative;
    display: flex;
    align-items: center;
}

/*
    Mirrors the collapsed search pill: same background, radius, icon size and colour, sized to
    match the 33px avatar so the three header controls read as one set.
*/
header .user .recent-menu .recent-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 33px;
    height: 33px;
    flex: 0 0 33px;
    box-sizing: border-box;
    background: var(--background-color);
    border-radius: 50%;
    text-decoration: none;
    cursor: pointer;
    transition: background 200ms ease-in-out;
}

    header .user .recent-menu .recent-menu-toggle i {
        font-size: 1rem;
        line-height: 1rem;
        color: var(--color-gray);
        transition: color 200ms ease-in-out;
    }

    header .user .recent-menu .recent-menu-toggle:hover {
        background: var(--color-4);
    }

        header .user .recent-menu .recent-menu-toggle:hover i,
        header .user .recent-menu .recent-menu-toggle[aria-expanded="true"] i {
            color: var(--color-dark);
        }

    /*
        Records are available: the bookmark fills in and takes the brand colour so the
        affordance reads as "there is something here" without needing a separate badge.
        font-weight 900 selects the solid face of the same glyph, so the icon shape is unchanged.
    */
    header .user .recent-menu .recent-menu-toggle.has-items i {
        font-weight: 900;
        color: var(--color-2);
    }

        header .user .recent-menu .recent-menu-toggle.has-items:hover i,
        header .user .recent-menu .recent-menu-toggle.has-items[aria-expanded="true"] i {
            color: var(--color-2);
        }

header .user .recent-menu .recent-menu-panel {
    position: absolute;
    top: 41px;
    right: 0;
    width: 320px;
    padding: 10px 0;
    background: var(--color-lightest);
    border-radius: 10px;
    box-shadow: var(--shadow-very-far);
    opacity: 0;
    visibility: hidden;
    transition: all 200ms;
}

    header .user .recent-menu .recent-menu-panel.active {
        opacity: 1;
        visibility: visible;
    }

header .user .recent-menu .recent-menu-heading {
    padding: 4px 14px 8px;
    color: var(--color-gray);
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

header .user .recent-menu .recent-menu-empty {
    margin: 0;
    padding: 4px 14px 8px;
    color: var(--color-gray);
    font-size: .9rem;
}

/*
    header .user ul is styled globally for the profile menu (absolute, hidden until .active).
    These rules re-establish normal flow inside the dropdown panel so the shared styles do not
    hide or mis-position this list.
*/
header .user .recent-menu .recent-menu-panel ul {
    position: static;
    width: auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    background: none;
    border-radius: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    list-style: none;
}

header .user .recent-menu .recent-menu-panel ul li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    color: var(--sub-text-color);
    text-decoration: none;
    white-space: normal;
}

    header .user .recent-menu .recent-menu-panel ul li a:hover {
        background: var(--color-4);
        color: var(--text-color);
    }

    header .user .recent-menu .recent-menu-panel ul li a i {
        flex: 0 0 auto;
        width: 18px;
        text-align: center;
    }

    header .user .recent-menu .recent-menu-panel ul li a > span {
        display: block;
        min-width: 0;
    }

header .user .recent-menu .recent-menu-title {
    display: block;
    font-size: .95rem;
    line-height: 1.2rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

header .user .recent-menu .recent-menu-section {
    display: block;
    color: var(--color-gray);
    font-size: .75rem;
    line-height: 1rem;
}
