/* /profile (UserProfile.razor). Lives inside .td, so sizes are in rem and the layout follows the
   page's width through container queries: a bigger browser font, zoom or a narrow window stacks the
   two columns instead of squeezing them. Sections are the dashboard's .td-panel; rows are flat (an
   avatar or icon, two lines of text, one trailing control). Content that replaces a skeleton of its
   own shape fades in (.td-reveal); rows that turn up later rise in (.pf-rise). */

.pf {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 72rem;
    padding-bottom: 2.5rem;
}

/* ── Who you are ── */
.pf-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.25rem;
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--bg-card);
}

.pf-hero-body {
    display: flex;
    flex: 1 1 14rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.375rem;
    min-width: 0;
}

.pf-name {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-strong);
}

.pf-username {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.pf-skel-avatar {
    width: 5.25rem;
    height: 5.25rem;
}

.pf-avatar {
    position: relative;
    flex: none;
    width: 5.25rem;
    height: 5.25rem;
    margin: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 160ms var(--ease-out);
}

.pf-avatar:active {
    transform: scale(0.97);
}

.pf-avatar:focus-within {
    outline: 2px solid var(--accent-text);
    outline-offset: 3px;
}

.pf-avatar-img {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border: 2px solid var(--border);
    border-radius: 50%;
    object-fit: cover;
}

.pf-initials {
    background: color-mix(in srgb, var(--accent-text) 14%, transparent);
    color: var(--accent-text);
    font-weight: 700;
    text-transform: uppercase;
}

.pf-avatar .pf-initials {
    font-size: 1.625rem;
}

.pf-avatar-camera {
    position: absolute;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    border: 2px solid var(--bg-card);
    border-radius: 50%;
    background: var(--accent);
    color: var(--on-primary);
    font-size: 0.75rem;
}

.pf-avatar-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.pf-avatar-busy {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    color: var(--on-fill);
}

/* ── Two columns on a wide page, one below another otherwise ── */
.pf-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

@container td (min-width: 56rem) {
    .pf-grid {
        grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
    }
}

.pf-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.pf-panel {
    gap: 0.25rem;
}

.pf-panel .td-panel-head h2 {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 0.25rem;
}

.pf-panel .ui-empty {
    padding-block: 1.25rem;
}

/* ── Totals ── */
.pf-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.625rem;
}

@container td (min-width: 40rem) {
    .pf-stats {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.pf-stat {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-width: 0;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-card-sm);
    background: var(--bg-secondary);
}

.pf-stat dt {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.pf-stat dt .bi {
    color: var(--accent-text);
}

.pf-stat dd {
    font-size: 1.25rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-strong);
}

.pf-skel-stat {
    width: 70%;
    margin-block: 0.125rem;
}

/* ── Bio ── */
.pf-bio {
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.pf-bio.is-empty {
    color: var(--text-muted);
}

/* ── Rows (trainers, passes, friends, account links) ── */
.pf-list {
    display: flex;
    flex-direction: column;
}

.pf-list > li + li {
    border-top: 1px solid var(--border);
}

.pf-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 3.5rem;
    padding: 0.5rem 0;
}

.pf-row-button,
.pf-link {
    width: 100%;
    margin: 0;
    border: 0;
    border-radius: var(--radius-item);
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background-color 150ms ease, transform 160ms var(--ease-out);
}

.pf-row-button {
    padding-inline: 0.5rem;
    margin-inline: -0.5rem;
    width: calc(100% + 1rem);
}

.pf-row-button:active,
.pf-link:active {
    transform: scale(0.985);
}

.pf-row-button:focus-visible,
.pf-link:focus-visible {
    outline: 2px solid var(--accent-text);
    outline-offset: -2px;
}

@media (hover: hover) and (pointer: fine) {
    .pf-row-button:hover,
    .pf-link:hover {
        background: var(--bg-secondary);
    }
}

.pf-row-avatar,
.pf-row-icon {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    object-fit: cover;
    font-size: 0.875rem;
}

.pf-row-icon {
    border-radius: var(--radius-item);
    background: var(--bg-secondary);
    color: var(--accent-text);
    font-size: 1rem;
}

.pf-row-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.pf-row-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-strong);
}

.pf-row-sub {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.pf-row-chevron {
    flex: none;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.pf-row .ui-badge {
    flex: none;
}

/* Friend requests wait above the friends, set apart by a soft tint. */
.pf-subhead {
    margin: 0.25rem 0 0;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.pf-requests {
    margin-bottom: 0.5rem;
}

.pf-request {
    align-items: flex-start;
}

.pf-request-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* Account links */
.pf-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 3rem;
    padding: 0.5rem;
    margin-inline: -0.5rem;
    width: calc(100% + 1rem);
    font-size: 0.9375rem;
    font-weight: 500;
}

.pf-link > span {
    flex: 1 1 auto;
    min-width: 0;
}

.pf-link > .bi:first-child {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

.pf-link.is-destructive,
.pf-link.is-destructive > .bi:first-child {
    color: var(--danger-text);
}

.pf-link:disabled {
    cursor: progress;
    opacity: 0.7;
}

/* A row that appeared after the first paint (an accepted request, a new pass). */
.pf-rise {
    animation: pf-rise 260ms var(--ease-out) both;
}

@keyframes pf-rise {
    from { opacity: 0; transform: translateY(0.5rem); }
}

/* ── Dialogs ── */
.pf-modal .modal-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.pf-textarea {
    min-height: 7rem;
    resize: vertical;
}

.pf-form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
    gap: 0 0.75rem;
}

.pf-gender {
    margin: 0;
    padding: 0;
    border: 0;
}

.pf-photo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin-bottom: 0.75rem;
}

.pf-photo-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    cursor: pointer;
}

.pf-info-hero {
    padding: 0.5rem 0.75rem 1rem;
    text-align: center;
}

.pf-info-hero .bi {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 2.25rem;
    color: var(--accent-text);
}

.pf-info-hero p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

.pf-info-card {
    display: flex;
    gap: 0.875rem;
    margin-bottom: 0.625rem;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-card-sm);
    background: var(--bg-secondary);
}

.pf-info-card h4 {
    margin: 0 0 0.25rem;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-strong);
}

.pf-info-card p {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

.pf-info-icon {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-item);
    font-size: 1.125rem;
}

.pf-info-icon.is-info {
    background: color-mix(in srgb, var(--accent-text) 14%, transparent);
    color: var(--accent-text);
}

.pf-info-icon.is-success {
    background: color-mix(in srgb, var(--success-text) 14%, transparent);
    color: var(--success-text);
}

.pf-info-icon.is-alert {
    background: color-mix(in srgb, var(--alert-text) 14%, transparent);
    color: var(--alert-text);
}

.pf-info-icon.is-secondary {
    background: color-mix(in srgb, var(--secondary-text) 14%, transparent);
    color: var(--secondary-text);
}

.pf-version {
    margin: 0.25rem 0 0;
    text-align: center;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

@media (prefers-reduced-motion: reduce) {
    .pf-avatar:active,
    .pf-row-button:active,
    .pf-link:active {
        transform: none;
    }

    .pf-rise {
        animation-name: td-reveal;
    }
}
