/* layout.css - app shell: sidebar, nav, leaderboard, topbar, profile/grants */

.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* top app-bar: brand | horizontal nav | new-task + user menu */
.appbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 20px;
    height: 60px;
    padding: 0 20px;
    background: var(--surface-container-low);
    border-bottom: 1px solid var(--outline-variant);
}

.appbar .brand {
    padding: 0;
    font-size: 19px;
    flex-shrink: 0;
}

.appbar .brand-icon {
    font-size: 26px;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 100%;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.topnav .nav-item {
    flex-shrink: 0;
    gap: 8px;
    padding: 8px 13px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    white-space: nowrap;
}

/* items/menu that don't fit are hidden inline and shown in the "..." menu */
.nav-hidden {
    display: none !important;
}

.nav-more {
    position: relative;
    flex-shrink: 0;
}

.nav-more-btn {
    padding: 8px 10px;
}

.nav-more-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    z-index: 30;
    min-width: 180px;
    padding: 6px;
    background: var(--surface);
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius-md);
    box-shadow: var(--elev-2);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-more-item {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 9px 11px;
    border: 0;
    background: transparent;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--on-surface-variant);
    white-space: nowrap;
    cursor: pointer;
}

.nav-more-item .material-symbols-rounded {
    font-size: 18px;
}

.nav-more-item:hover {
    background: var(--surface-container-high);
    color: var(--on-surface);
}

.nav-more-item.active {
    color: var(--primary);
    font-weight: 600;
}

.nav-more-scrim {
    position: fixed;
    inset: 0;
    z-index: 25;
}

/* current user's points, shown in the app-bar */
.points-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 13px;
    border-radius: var(--radius-full);
    background: var(--primary-container);
    color: var(--on-primary-container);
    font-weight: 700;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.points-pill .material-symbols-rounded {
    font-size: 18px;
}

.points-pill-unit {
    font-weight: 600;
    opacity: 0.75;
    font-size: 12px;
}

.topnav .nav-item .material-symbols-rounded {
    font-size: 18px;
}

.appbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.new-task-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

/* content row: main + a right leaderboard rail */
.app-body {
    display: flex;
    align-items: flex-start;
    flex: 1;
    min-height: 0;
    /* center the content column on wide screens so it doesn't hug the left with
       the leaderboard stranded in dead space */
    width: 100%;
    max-width: 1500px;
    margin-inline: auto;
}

.rail {
    flex: 0 0 272px;
    position: sticky;
    top: 60px;
    align-self: flex-start;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    /* no background or divider: the leaderboard floats as its own card, so the
       column doesn't read as a tall empty tinted strip when few players have points */
    padding: 24px 0 24px 20px;
}

.rail .leaderboard {
    margin-top: 0;
}

/* full-page centering for the logged-out card */
.login-wrap {
    flex: 1;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-brand {
    justify-content: center;
    margin-bottom: 4px;
}

@media (max-width: 900px) {
    .rail {
        display: none;
    }

    .appbar {
        gap: 12px;
    }
}

.nav-bottom {
    margin-top: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: 700;
    padding: 8px 8px 0;
    color: var(--on-surface);
}

.brand-icon {
    font-size: 30px;
    color: var(--primary);
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--radius-full);
    color: var(--on-surface-variant);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.nav-item:hover {
    background: var(--surface-container-high);
}

.nav-item.active {
    background: var(--secondary-container);
    color: var(--on-secondary-container);
}

/* template detail: access summary line */
.tpl-access {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    font-size: 14px;
    color: var(--on-surface-variant);
}

/* leaderboard card */
.leaderboard {
    background: var(--surface-container-low);
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.leaderboard-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--on-surface-variant);
    margin-bottom: 10px;
}

.leaderboard-title .material-symbols-rounded {
    font-size: 18px;
    color: var(--primary);
}

.leaderboard-empty {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--on-surface-variant);
}

.leader-rank {
    width: 18px;
    flex-shrink: 0;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--on-surface-variant);
}

.leader-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    font-size: 14px;
}

.leader-row.leader-top .leader-rank {
    color: var(--primary);
}

.leader-row.leader-top .leader-name {
    font-weight: 700;
}

.leader-row + .leader-row {
    border-top: 1px solid var(--outline-variant);
}

.leader-pfp {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    object-fit: cover;
    background: var(--surface-container-high);
    flex-shrink: 0;
}

.leader-name {
    font-weight: 500;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leader-pts {
    font-weight: 700;
    color: var(--on-primary-container);
    background: var(--primary-container);
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 13px;
}

.main {
    flex: 1;
    padding: 24px 32px;
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.add-chore {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.profile {
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--surface-container-low);
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius-lg);
    box-shadow: var(--elev-1);
    padding: 24px;
    margin-bottom: 16px;
}

.task-timer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--on-surface-variant);
}

.task-proof {
    display: flex;
    align-items: center;
    gap: 8px;
}

.proof-img {
    margin-top: 8px;
    max-width: 200px;
    max-height: 200px;
    border-radius: var(--radius-md);
    border: 1px solid var(--outline-variant);
}

.task-timer .material-symbols-rounded {
    font-size: 16px;
}

.grant-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.grant-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 4px;
    font-size: 14px;
    border-top: 1px solid var(--outline-variant);
}

.grant-row:first-child {
    border-top: none;
}

.grant-who {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.grant-perm {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--primary-container);
    color: var(--on-primary-container);
    white-space: nowrap;
}

.grant-add {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}

.grant-add .field {
    flex: 1;
}

.profile-head {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
}

.avatar-img {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    object-fit: cover;
    background: var(--surface-container-high);
    border: 1px solid var(--outline-variant);
}

.profile-headinfo {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-name {
    font-size: 20px;
    font-weight: 600;
}

.avatar-upload {
    cursor: pointer;
    align-self: flex-start;
    padding: 6px 12px;
}

.profile-section {
    margin-top: 12px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--on-surface-variant);
}

.profile-save {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

.profile-saved {
    color: var(--primary);
    font-weight: 600;
    font-size: 14px;
    animation: fadeout 3s forwards;
}

@keyframes fadeout {
    0%,
    66% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

