/**
 * Brainflood Marketing — logged-in account chip + switcher.
 * Rendered by /js/account-session.js when the visitor is logged into an app
 * environment. Uses the site theme tokens so it tracks every theme.
 */

/* Containers are injected empty + hidden; JS unhides them when authenticated. */
#nav-account[hidden],
#mobile-account[hidden] { display: none; }

/* Wrapper around the default Sign In / Join CTAs — preserves the .nav-cta-row
   gap now that the two links share a parent. Hidden by JS when logged in. */
.nav-auth-cta { display: inline-flex; align-items: center; gap: 0.6rem; }
.nav-auth-cta[hidden] { display: none; }

/* ---- desktop chip ---- */
.bf-acct-wrap {
    position: relative;
    display: inline-flex;
}

.bf-acct-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem 0.35rem 0.4rem;
    border-radius: 9999px;
    border: 1px solid var(--card-border, var(--border-color, rgba(255, 255, 255, 0.14)));
    background: var(--bg-secondary, rgba(255, 255, 255, 0.04));
    color: var(--text-primary, #e2e8f0);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.bf-acct-chip:hover {
    border-color: rgba(var(--accent-rgb, 124, 58, 237), 0.6);
    box-shadow: 0 6px 20px rgba(var(--accent-rgb, 124, 58, 237), 0.2);
}
.bf-acct-chip-name {
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bf-acct-caret { transition: transform 0.18s ease; flex: 0 0 auto; }
.bf-acct-wrap.open .bf-acct-caret { transform: rotate(180deg); }

/* ---- avatar ---- */
.bf-acct-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    flex: 0 0 auto;
    border-radius: 9999px;
    background: linear-gradient(135deg, var(--accent, #7c3aed), var(--accent-light, #a855f7));
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    text-transform: uppercase;
}
.bf-acct-avatar-sm { width: 1.9rem; height: 1.9rem; font-size: 0.85rem; }

/* ---- env badge ---- */
.bf-acct-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.05rem 0.4rem;
    border-radius: 6px;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1.4;
}
.bf-acct-badge-live {
    background: rgba(34, 197, 94, 0.16);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.4);
}
.bf-acct-badge-beta {
    background: rgba(245, 158, 11, 0.16);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

/* ---- dropdown panel ---- */
.bf-acct-panel {
    position: absolute;
    top: calc(100% + 0.6rem);
    right: 0;
    min-width: 17rem;
    padding: 0.55rem;
    border-radius: 14px;
    border: 1px solid var(--card-border, var(--border-glass, rgba(255, 255, 255, 0.12)));
    background: var(--bg-secondary, #14121c);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.45);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s;
    z-index: 1200;
}
.bf-acct-wrap.open .bf-acct-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.bf-acct-panel-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted, #94a3b8);
    padding: 0.25rem 0.5rem 0.4rem;
}

/* ---- account rows ---- */
.bf-acct-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.5rem;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-primary, #e2e8f0);
    text-align: left;
    cursor: pointer;
    transition: background 0.14s ease;
}
.bf-acct-row:hover { background: var(--card-hover-bg, rgba(255, 255, 255, 0.06)); }
.bf-acct-row.is-active { background: rgba(var(--accent-rgb, 124, 58, 237), 0.14); }
.bf-acct-row-meta { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; flex: 1 1 auto; }
.bf-acct-row-name {
    font-size: 0.9rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bf-acct-row-sub { display: flex; align-items: center; gap: 0.4rem; }
.bf-acct-row-handle {
    font-size: 0.72rem;
    color: var(--text-muted, #94a3b8);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bf-acct-check {
    flex: 0 0 auto;
    color: var(--accent-light, #a855f7);
    font-weight: 700;
    width: 1rem;
    text-align: center;
}

.bf-acct-divider {
    height: 1px;
    margin: 0.45rem 0.3rem;
    background: var(--border-color, rgba(255, 255, 255, 0.1));
}

/* ---- actions ---- */
.bf-acct-action {
    display: block;
    width: 100%;
    padding: 0.55rem 0.6rem;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-primary, #e2e8f0);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.14s ease, box-shadow 0.14s ease;
}
.bf-acct-action:hover { background: var(--card-hover-bg, rgba(255, 255, 255, 0.06)); }
.bf-acct-action-primary {
    background: linear-gradient(90deg, var(--accent, #7c3aed), var(--accent-light, #a855f7));
    color: #fff;
    text-align: center;
    margin-bottom: 0.3rem;
}
.bf-acct-action-primary:hover {
    background: linear-gradient(90deg, var(--accent, #7c3aed), var(--accent-light, #a855f7));
    box-shadow: 0 8px 24px rgba(var(--accent-rgb, 124, 58, 237), 0.35);
}
.bf-acct-action-danger { color: #f87171; }
.bf-acct-action-danger:hover { background: rgba(248, 113, 113, 0.12); }
.bf-acct-action[disabled] { opacity: 0.6; cursor: default; }

/* ---- mobile block ---- */
/* Both wrappers become single children of the flex-column .mobile-menu-cta,
   so re-establish the vertical rhythm inside them. */
#mobile-auth-cta,
.mobile-account { display: flex; flex-direction: column; gap: 0.625rem; }

.bf-acct-m-head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.2rem 0.7rem;
}
.bf-acct-m-meta { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.bf-acct-m-name { font-size: 0.95rem; font-weight: 700; color: var(--text-primary, #e2e8f0); }
.bf-acct-m-switch { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.6rem; }
.bf-acct-m-switch-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--card-border, rgba(255, 255, 255, 0.12));
    background: var(--bg-secondary, rgba(255, 255, 255, 0.04));
    color: var(--text-primary, #e2e8f0);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}
.bf-acct-m-switch-btn.is-active { border-color: rgba(var(--accent-rgb, 124, 58, 237), 0.6); background: rgba(var(--accent-rgb, 124, 58, 237), 0.14); }
.bf-acct-m-switch-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bf-acct-m-logout { min-height: 44px; }

/* ---- touch targets (WCAG 2.5.5) ---- */
@media (max-width: 700px), (hover: none) and (pointer: coarse) {
    .bf-acct-row,
    .bf-acct-action,
    .bf-acct-m-switch-btn { min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
    .bf-acct-chip,
    .bf-acct-caret,
    .bf-acct-panel,
    .bf-acct-row,
    .bf-acct-action { transition: none !important; }
}
