/* widgets.css - topbar user menu, field visibility, nudge page, user detail */

/* profile avatar button in the top-right */
.avatar-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: 2px solid transparent;
    background: var(--surface-container-high);
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    flex-shrink: 0;
    transition: border-color 0.15s;
}

.avatar-btn:hover {
    border-color: var(--outline-variant);
}

.avatar-btn.active {
    border-color: var(--primary);
}

.topbar-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ---- topbar user menu (name + avatar -> popout) ---- */
.user-menu {
    position: relative;
}

.user-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 4px 4px 4px 14px;
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius-full);
    background: var(--surface-container-high);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.user-chip:hover,
.user-chip.active {
    border-color: var(--primary);
}

.user-chip-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--on-surface);
}

.user-chip .topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
}

.user-popout {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 20;
    min-width: 160px;
    display: flex;
    flex-direction: column;
    padding: 6px;
    background: var(--surface-container-high);
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius-md);
    box-shadow: var(--elev-2);
}

.popout-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--on-surface);
    background: none;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: left;
}

.popout-item:hover {
    background: var(--surface-container-highest);
}

.popout-item .material-symbols-rounded {
    font-size: 20px;
    color: var(--on-surface-variant);
}

/* ---- inline per-field visibility control in the profile editor ---- */
.field-vis {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: -2px 0 6px;
    color: var(--on-surface-variant);
}

.field-vis .material-symbols-rounded {
    font-size: 18px;
}

.field-vis-label {
    font-size: 12px;
    font-weight: 500;
}

.vis-select {
    width: auto;
    padding: 6px 36px 6px 12px;
    font-size: 13px;
}

.pfield-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.pfield-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--on-surface);
}

/* grant-add row wraps instead of forcing the card wider/taller than content */
.grant-add {
    flex-wrap: wrap;
}

/* prominent new-task button pinned atop the sidebar nav */
.new-task-btn {
    justify-content: center;
}

/* full-area wizard page (the "New task" view) */
.wizard-page {
    max-width: 1100px;
}

/* nudge-link controls in the task detail (creator + timer) */
.nudge-link-box {
    display: flex;
    gap: 8px;
    align-items: center;
}

.nudge-link-box .field {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: var(--on-surface-variant);
}

/* public, login-free nudge page (opened from a shared link) */
.nudge-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--surface);
}

.nudge-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
    max-width: 420px;
    width: 100%;
    padding: 40px 32px;
    background: var(--surface-container-low);
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius-lg);
    box-shadow: var(--elev-2);
}

.nudge-icon {
    font-size: 56px;
    color: var(--primary);
}

.nudge-title {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.nudge-sub {
    margin: 0;
    color: var(--on-surface-variant);
    line-height: 1.5;
}

.nudge-duration {
    font-size: 40px;
    font-weight: 700;
    color: var(--on-surface);
    letter-spacing: 0.5px;
}

.nudge-range {
    margin: 0;
    font-size: 13px;
    color: var(--on-surface-variant);
}

.nudge-buttons {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.nudge-buttons button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.nudge-msg {
    margin: 4px 0 0;
    font-weight: 600;
    color: var(--primary);
}

/* small avatar inside a selectable list row (People / etc.) */
.row-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    object-fit: cover;
    background: var(--surface-container-high);
    flex-shrink: 0;
}

/* user profile detail (People tab) */
.user-detail-id {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.user-pronouns {
    font-size: 14px;
    color: var(--on-surface-variant);
    margin-top: 2px;
}

.user-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--on-surface-variant);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    background: var(--outline);
}

.status-dot-online {
    background: #3ba55d;
}

.status-dot-dnd {
    background: #ed4245;
}

.status-dot-offline {
    background: var(--outline);
}

/* rules tab */
.rules-page {
    max-width: 640px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* rules: imposed-rule list + assign-a-rule form */
.rule-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.rule-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--outline-variant);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
    background: var(--surface-container);
}

.rule-ico {
    font-size: 20px;
    color: var(--primary);
    flex-shrink: 0;
}

.rule-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.rule-text {
    font-size: 15px;
    color: var(--on-surface);
}

.rule-meta {
    font-size: 12px;
    color: var(--on-surface-variant);
}

.rule-assign {
    display: flex;
    gap: 8px;
    align-items: center;
}

.rule-assign .field {
    flex: 1;
}


/* UserChip / GranteeChip - avatar + name, the one way a person is shown */
.user-chip-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    font-weight: 500;
    color: var(--on-surface);
}

.user-chip-inline .uc-av {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-full);
    object-fit: cover;
    background: var(--surface-container-high);
    flex-shrink: 0;
}

.user-chip-inline.small .uc-av {
    width: 22px;
    height: 22px;
}

/* a non-photo subject (group, anyone, logged-in) uses a tinted glyph tile */
.user-chip-inline .uc-av-icon {
    display: grid;
    place-items: center;
    font-size: 15px;
    color: var(--on-primary-container);
    background: var(--primary-container);
}

.user-chip-inline.small .uc-av-icon {
    font-size: 13px;
}

.user-chip-inline .uc-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* toast notifications - failures and confirmations, bottom-right */
.toast-dock {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    box-shadow: var(--elev-2);
    border: 1px solid transparent;
    animation: toast-in 0.18s ease;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .toast {
        animation: none;
    }
}

.toast-err {
    background: var(--error-container);
    color: var(--on-error-container);
    border-color: var(--error);
}

.toast-ok {
    background: var(--primary-container);
    color: var(--on-primary-container);
    border-color: var(--primary);
}

.toast-ico {
    font-size: 20px;
    flex-shrink: 0;
    margin-top: 1px;
}

.toast-body {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    font-size: 13.5px;
}

.toast-body b {
    font-weight: 600;
}

.toast-body span {
    opacity: 0.85;
    word-break: break-word;
}

.toast-body span:empty {
    display: none;
}

.toast-x {
    margin-left: 4px;
    border: 0;
    background: transparent;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    padding: 2px;
}

.toast-x:hover {
    opacity: 1;
}

.toast-x .material-symbols-rounded {
    font-size: 18px;
}

@media (max-width: 500px) {
    .toast-dock {
        left: 14px;
        right: 14px;
        max-width: none;
    }
}

/* UserPicker - search box + placeholder inside the AssignPicker-style popover */
.picker-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--outline-variant);
    color: var(--on-surface-variant);
}

.picker-search .material-symbols-rounded {
    font-size: 18px;
}

.picker-search-input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    outline: none;
    font: inherit;
    font-size: 14px;
    color: var(--on-surface);
}

.picker-ph {
    color: var(--on-surface-variant);
}
