/* ==========================================================================
   account.css — the sign-in / account panel.
   Same tokens, same card recipe, same pills and buttons as everything else.
   ========================================================================== */

.account {
    position: fixed;
    inset: 0;
    z-index: 60;              /* above the assistant sheet */
    display: grid;
    place-items: center;
    padding: var(--space-4);
    padding-top: calc(var(--safe-top) + var(--space-4));
    padding-bottom: calc(var(--safe-bottom) + var(--space-4));
}

.account[hidden] { display: none; }

.account__scrim {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.52);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.account__panel {
    position: relative;
    width: min(100%, 25rem);
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    opacity: 0;
    transform: translateY(10px) scale(0.98);
    transition: opacity var(--transition-fast), transform var(--screen-duration) var(--screen-ease);
}

.account.is-open .account__scrim { opacity: 1; }

.account.is-open .account__panel {
    opacity: 1;
    transform: none;
}

.account__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.account__close {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--glass-hairline);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.055);
    color: var(--text-secondary);
}

.account__close .icon { width: 17px; height: 17px; }

/* --------------------------------------------------------------- messages */
.account__notice,
.account__error {
    margin-bottom: var(--space-4);
    padding: var(--space-3);
    border: 1px solid var(--glass-hairline);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
    font-size: var(--fs-small);
    color: var(--text-secondary);
}

.account__error {
    border-color: rgba(191, 168, 99, 0.34);
    background: rgba(191, 168, 99, 0.10);
    color: var(--text-primary);
}

.account__error[hidden] { display: none; }

/* A way onward from a message — Google's own page, for instance. */
.account__link {
    display: inline-block;
    margin-top: var(--space-1);
    color: var(--text-primary);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(255, 255, 255, 0.35);
}

.account__notice code {
    font-size: 0.8em;
    color: var(--text-primary);
}

/* --------------------------------------------------------------- identity */
.account__identity {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.account__avatar {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    flex: none;
    overflow: hidden;
    border: 1px solid var(--glass-hairline);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-muted);
}

.account__avatar img { width: 100%; height: 100%; object-fit: cover; }
.account__avatar .icon { width: 22px; height: 22px; }

.account__username {
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.015em;
}

.account__meta {
    margin-top: var(--space-1);
    font-size: var(--fs-tiny);
    color: var(--text-muted);
}

/* ------------------------------------------------------------------ forms */
.account__form { margin-top: var(--space-4); }

.account__field + .account__field { margin-top: var(--space-3); }

.account__label {
    display: block;
    margin-bottom: var(--space-2);
    font-size: var(--fs-tiny);
    font-weight: 600;
    letter-spacing: var(--tracking-wide);
    text-transform: uppercase;
    color: var(--text-muted);
}

.account__row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.account__input,
.account__file {
    /* Full width on their own, and sharing the row when next to a button. */
    width: 100%;
    flex: 1;
    min-width: 0;
    min-height: 44px;
    padding: 0 var(--space-3);
    border: 1px solid var(--glass-border-soft);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font: inherit;
    font-size: var(--fs-label);
}

.account__file {
    padding-block: var(--space-2);
    font-size: var(--fs-small);
    color: var(--text-secondary);
}

.account__input::placeholder { color: var(--text-faint); }

.account__input:focus-visible,
.account__file:focus-visible {
    outline: none;
    border-color: rgba(60, 158, 114, 0.5);
    background: rgba(255, 255, 255, 0.07);
}

.account__submit,
.account__logout {
    width: 100%;
    margin-top: var(--space-4);
}

.account__hint {
    margin-top: var(--space-2);
    font-size: var(--fs-tiny);
    color: var(--text-muted);
}

/* ------------------------------------------------------- social sign-in
   Google is secondary here: a small mark under the form, not a full-width
   button above it. Same glass recipe as the header pills, so
   they read as part of the same kit rather than as borrowed brand chrome. */
.account__socials {
    display: flex;
    justify-content: center;
    gap: var(--space-3);
    margin-top: var(--space-4);
}

.social {
    display: grid;
    place-items: center;
    /* Small, but never below a comfortable thumb. */
    width: 46px;
    height: 46px;
    border: 1px solid var(--glass-border-soft);
    border-radius: 50%;
    background: var(--glass-soft);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    color: var(--text-primary);
    transition: transform var(--transition-fast), background-color var(--transition-fast),
        border-color var(--transition-fast);
}

.social:active:not(:disabled) {
    transform: scale(0.94);
    background: var(--glass);
}

.social:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* The Google G, at the size the glass circle was drawn around. */
.social__mark {
    width: 21px;
    height: 21px;
}

.account__hint--centred {
    margin-top: var(--space-3);
    text-align: center;
}

.account__form[data-account-form="email"] { margin-top: var(--space-4); }

/* Annuleren sits under Account aanmaken as one pair, not a second section. */
.account__form[data-account-form="google-cancel"] { margin-top: 0; }

/* The avatar slot in the header button: an icon until there is a picture. */
.pill__avatar {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 50%;
}

.pill__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ==========================================================================
   Vrienden — the panel's second page, behind the Vrienden button.
   The same fields, labels, pills and switch as the rest of the app; the only
   new shapes are a row per person and the button that leads here.
   ========================================================================== */

/* Signed in, the panel has two pages and shows one. */
.account__view[hidden] { display: none; }

/* Back sits where the title starts, and the title follows it. */
.account__back[hidden] { display: none; }
.account__back + .card__eyebrow { margin-right: auto; }

/* The way in: a field-shaped button that says where things stand. */
.account__nav {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    min-height: 44px;
    padding: 0 var(--space-3);
    border: 1px solid var(--glass-border-soft);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font: inherit;
    font-size: var(--fs-label);
    text-align: left;
    transition: background-color var(--transition-fast);
}

.account__nav:active { background: rgba(255, 255, 255, 0.08); }

.account__nav-text {
    display: flex;
    flex: 1;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
}

.account__nav-icon {
    width: 16px;
    height: 16px;
    flex: none;
    color: var(--text-muted);
}

.account__badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    margin-left: auto;
    padding: 0 var(--space-2);
    border: 1px solid color-mix(in srgb, var(--health) 42%, transparent);
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--health) 22%, transparent);
    font-size: var(--fs-tiny);
    font-weight: 600;
    white-space: nowrap;
}

/* ------------------------------------------------------------- sections */
.friends__section + .friends__section,
.friends__section + .account__toggle,
.account__toggle + .friends__section { margin-top: var(--space-5); }

.friends__add {
    width: 100%;
    gap: var(--space-2);
}

.friends__add-icon { width: 16px; height: 16px; }

.friends__search { margin-top: var(--space-4); }

.friends__error { margin: var(--space-3) 0 0; }

.friends__sublabel { margin-top: var(--space-4); }

.friends__empty { margin-top: 0; }

.friends__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.friends__list[hidden] { display: none; }

/* The one account a search found, set apart from the lists below it. */
.friends__result {
    margin-top: var(--space-3);
    padding: var(--space-3);
    border: 1px solid var(--glass-hairline);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
}

/* ---------------------------------------------------------------- person */
.friend {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    column-gap: var(--space-3);
    row-gap: var(--space-2);
}

.friend__avatar {
    width: 40px;
    height: 40px;
}

.friend__avatar .icon { width: 18px; height: 18px; }

.friend__text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.friend__name {
    overflow: hidden;
    font-size: var(--fs-label);
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.friend__status {
    margin-top: 2px;
    font-size: var(--fs-tiny);
    color: var(--text-muted);
}

.friend__status[hidden] { display: none; }

/* A refusal reads in the panel's own message colour, not as a status. */
.friend__status.is-error,
.account__toggle-note.is-error { color: var(--attention); }

.friend__actions {
    display: flex;
    gap: var(--space-2);
}

.friend__actions[hidden] { display: none; }

/* Two answers side by side, under the name rather than squeezed beside it. */
.friend__actions--wide {
    grid-column: 2 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.friend__actions--single { grid-template-columns: minmax(0, 1fr); }

/* "Verzoek verstuurd" once it is: a state, not a button. */
.friend__done {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 42px;
    padding-inline: var(--space-4);
    border: 1px solid color-mix(in srgb, var(--health) 42%, transparent);
    border-radius: var(--radius-pill);
    background: color-mix(in srgb, var(--health) 18%, transparent);
    font-size: var(--fs-small);
    font-weight: 600;
}

.friend__done .icon { width: 15px; height: 15px; }

/* Verwijderen asks first, in place. */
.friend__confirm {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-3);
    border: 1px solid var(--glass-hairline);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.04);
}

.friend__confirm[hidden] { display: none; }

.friend__confirm .friend__actions--wide { grid-column: auto; }

.friend__confirm-text {
    font-size: var(--fs-small);
    color: var(--text-secondary);
}

/* --------------------------------------------------------------- switch
   The switch itself is the one from Instellingen (.switch in settings.css). */
.account__toggle {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    min-height: 56px;
    padding: var(--space-3);
    border: 1px solid var(--glass-border-soft);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    text-align: left;
}

.account__toggle:disabled { opacity: 0.7; }

.account__toggle-text { min-width: 0; }

.account__toggle-label {
    display: block;
    font-size: var(--fs-label);
    font-weight: 500;
    color: var(--text-secondary);
}

.account__toggle-note {
    display: block;
    margin-top: 2px;
    font-size: var(--fs-tiny);
    color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
    .account__panel { transform: none; }
}
