/* ============================================================
   Clinical Calm: app navigation, menus and list rows (sidebar nav,
   user menu, daily check-in, logged-today rows, notes and empty
   states). Split from ui-app.css to keep each file small.
   ============================================================ */

/* ---------- Sidebar nav ---------- */

.lg-nav__item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.625rem;
    border-radius: 0.5rem;
    color: var(--muted-foreground);
    font-weight: 500;
    font-size: 0.9375rem;
    line-height: 1.25;
    transition: color 150ms ease, background-color 150ms ease;
}

.lg-nav__item svg {
    width: 1.125rem;
    height: 1.125rem;
    flex: 0 0 auto;
    stroke-width: 1.75;
}

.lg-nav__item:hover {
    color: var(--foreground);
    background: var(--muted);
}

.lg-nav__item:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: -2px;
}

.lg-nav__item--active,
.lg-nav__item--active:hover {
    color: var(--accent-ink);
    background: var(--accent-tint);
    font-weight: 600;
}

.lg-nav__count {
    margin-left: auto;
    padding: 0 0.4rem;
    border-radius: 999px;
    background: var(--card);
    box-shadow: inset 0 0 0 1px var(--border);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--foreground);
    font-variant-numeric: tabular-nums;
}

.lg-nav__more {
    position: relative;
}

.lg-nav__chevron {
    width: 0.85rem;
    height: 0.85rem;
    flex: 0 0 auto;
    margin-left: auto;
    color: var(--muted-foreground);
    stroke-width: 2;
    transition: transform 150ms ease;
}

[aria-expanded="true"] .lg-nav__chevron {
    transform: rotate(180deg);
}

/* ---------- User card + menu ---------- */

.lg-user {
    position: relative;
}

.lg-user__card {
    display: block;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease;
}

.lg-user__card:hover {
    background: var(--card-hover);
}

.lg-user__chevron {
    flex: 0 0 auto;
    color: var(--muted-foreground);
    transition: transform 150ms ease;
}

.lg-user__card[aria-expanded="true"] .lg-user__chevron {
    transform: rotate(180deg);
}

.lg-menu {
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    z-index: 60;
    padding: 0.375rem;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: var(--popover);
}

.lg-menu[hidden] {
    display: none;
}

.lg-menu:not([hidden]) {
    animation: lgMenuIn 150ms ease-out both;
}

@keyframes lgMenuIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: none; }
}

/* Doubled class so it outranks the .lg-menu base anchoring. */
.lg-menu.lg-menu--nav {
    position: static;
    inset: auto;
    width: auto;
    margin: 0.25rem 0 0.25rem 0.75rem;
    border-color: transparent;
    border-left-color: var(--border);
    border-radius: 0;
    background: transparent;
}

.lg-menu__item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.5rem 0.625rem;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: var(--foreground);
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
    transition: background-color 120ms ease;
}

.lg-menu__item:hover,
.lg-menu__item:focus-visible {
    background: var(--muted);
    outline: none;
}

.lg-menu__item:focus-visible {
    box-shadow: inset 0 0 0 2px var(--ring);
}

.lg-menu__item svg {
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
    color: var(--muted-foreground);
    stroke-width: 1.75;
}

.lg-menu__item--danger,
.lg-menu__item--danger svg {
    color: var(--status-danger);
}

.lg-menu__item--danger:hover {
    background: var(--status-danger-tint);
}

.lg-menu__rule {
    height: 0;
    margin: 0.3rem 0.4rem;
    border: 0;
    border-top: 1px solid var(--border);
}

/* ---------- Daily check-in ----------
   checkins.js swaps bg-primary/bg-secondary and border colours, so these
   set shape and rhythm only: no background, colour or border colour. */

.checkin-rating {
    border-width: 1px;
    border-style: solid;
    border-radius: 0.5rem;
    padding-block: 0.45rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.checkin-rating:active {
    transform: translateY(1px);
}

.checkin-toggle {
    border-width: 1px;
    border-style: solid;
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

/* ---------- Logged today ---------- */

.today-logs-heading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.today-logs-heading-check {
    width: 1.125rem;
    height: 1.125rem;
    flex: 0 0 auto;
    color: var(--status-good);
}

.today-log-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 4rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
}

.today-log-dot {
    width: 0.625rem;
    height: 0.625rem;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--today-log-accent, var(--accent));
}

.today-log-body {
    min-width: 0;
    flex: 1 1 auto;
}

.today-log-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--foreground);
}

.today-log-detail {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.125rem 0.375rem;
    margin-top: 0.125rem;
    font-size: 0.8125rem;
    line-height: 1.35;
    color: var(--muted-foreground);
}

.today-log-detail .font-data {
    color: var(--foreground);
    font-weight: 600;
}

.today-log-separator {
    color: var(--border-strong);
}

.today-log-check {
    width: 1.375rem;
    height: 1.375rem;
    flex: 0 0 auto;
    color: var(--status-good);
}

/* ---------- Notes, steps, empty states ---------- */

/* An aside inside a form. */
.lg-note {
    border: 1px solid var(--accent-tint-border);
    border-radius: 0.625rem;
    background: var(--accent-tint);
}

/* Numbered marker for how-to lists inside popups. */
.lg-step {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    flex: 0 0 auto;
    border-radius: 999px;
    background: var(--accent-tint);
    color: var(--accent-ink);
    font-weight: 700;
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
}

/* The kind of a changelog entry (Added / Fixed). */
.lg-kind {
    font-weight: 600;
    color: var(--foreground);
}

.lg-kind::after {
    content: ":";
}

.lg-empty {
    text-align: center;
}

.lg-empty__title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    line-height: 1.2;
    letter-spacing: -0.015em;
    color: var(--foreground);
}

.lg-empty__sub {
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

@media (prefers-reduced-motion: reduce) {
    .lg-menu:not([hidden]) {
        animation: none;
    }

    .lg-nav__item,
    .lg-nav__chevron,
    .lg-menu__item {
        transition: none;
    }
}
