/* Community + gamification: level pills, XP bars, badges, votes, comments,
   leaderboards and celebration toasts. Built on the tokens in style.css. */

/* ---- Level pill & user link -------------------------------------------- */
.level-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.05rem 0.45rem;
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
    background: var(--accent-soft);
    color: var(--accent-text);
    border: 1px solid var(--accent-border);
    vertical-align: middle;
}
.level-pill-title { font-weight: 500; }
.level-pill.level-6, .level-pill.level-7 {
    background: rgba(245, 184, 61, 0.14);
    color: var(--premium);
    border-color: rgba(245, 184, 61, 0.45);
}
.level-pill.level-8 {
    background: var(--premium-bg);
    color: var(--premium-contrast);
    border-color: var(--premium-bg);
}
.user-link { font-weight: 600; color: var(--text); text-decoration: none; }
a.recipe-badge { text-decoration: none; }
a.recipe-badge:hover { border-color: var(--accent); }
a.user-link:hover { color: var(--accent-text); text-decoration: underline; }

/* ---- XP bar ------------------------------------------------------------ */
.xp-bar, .badge-card-progress {
    display: block;
    height: 8px;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    overflow: hidden;
}
.xp-bar > span, .badge-card-progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-text));
    transition: width 0.4s var(--ease);
}

/* ---- Nav: level summary in the user menu -------------------------------- */
.nav-level {
    padding: 0.5rem 1rem 0.65rem;
    min-width: 240px;
}
.nav-level-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    font-size: var(--text-sm);
}
.nav-level .xp-bar { height: 6px; }
.nav-level-meta { font-size: var(--text-xs); color: var(--text-muted); margin-top: 0.35rem; }

/* ---- Drink tile: community marker -------------------------------------- */
.drink-tile-community {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-pill);
    background: rgba(11, 11, 15, 0.72);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: var(--text-xs);
    font-weight: 600;
}
.drink-tile-community i { font-size: 0.7rem; color: #c4b5fd; }

/* ---- Vote box ---------------------------------------------------------- */
.vote-box {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    padding: 0.15rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface-1);
}
.vote-box button, .vote-box a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-muted);
    text-decoration: none;
    transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.vote-box button:hover, .vote-box a:hover { background: var(--surface-2); color: var(--text); }
.vote-box button:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 1px; }
.vote-box button[data-vote="1"].is-active { color: var(--accent-text); background: var(--accent-soft); }
.vote-box button[data-vote="-1"].is-active { color: var(--danger); background: rgba(220, 38, 38, 0.12); }
.vote-score {
    min-width: 2ch;
    text-align: center;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.recipe-community {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin: 0.5rem 0 0.75rem;
}
.recipe-byline { margin: 0; font-size: var(--text-sm); color: var(--text-muted); }

/* ---- Comments ---------------------------------------------------------- */
.comment-list, .comment-replies { list-style: none; margin: 0; padding: 0; }
.comment-list > li + li { border-top: 1px solid var(--border); }
.comment { padding: 0.85rem 0; }
.comment-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    font-size: var(--text-sm);
}
.comment-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.comment-body { margin: 0.35rem 0 0.35rem 2.1rem; white-space: pre-line; overflow-wrap: anywhere; }
.comment-body.is-deleted { color: var(--text-subtle); font-style: italic; }
.comment-actions { display: flex; gap: 0.25rem; margin-left: 1.6rem; }
.comment-actions .btn { min-height: 32px; padding: 0.2rem 0.5rem; font-size: var(--text-xs); }
.comment-replies {
    margin: 0.25rem 0 0 2.1rem;
    padding-left: 0.85rem;
    border-left: 2px solid var(--border);
}
.comment-replies .comment { padding: 0.6rem 0; }
.comment-form textarea { resize: vertical; }
.reply-form { margin: 0.5rem 0 0 2.1rem; }

/* ---- Badges ------------------------------------------------------------ */
.badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    list-style: none;
    margin: 0;
    padding: 0;
}
.badge-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 1rem 0.75rem;
    text-align: center;
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-lg);
    background: var(--accent-soft);
}
.badge-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-contrast);
    font-size: 1.25rem;
    box-shadow: 0 6px 18px rgba(var(--brand-primary-rgb), 0.35);
}
.badge-card-name { font-weight: 600; font-size: var(--text-sm); }
.badge-card-desc { font-size: var(--text-xs); color: var(--text-muted); }
.badge-card.is-locked { background: var(--surface-1); border-color: var(--border); }
.badge-card.is-locked .badge-card-icon {
    background: var(--surface-2);
    color: var(--text-subtle);
    box-shadow: none;
}
.badge-card.is-locked .badge-card-name { color: var(--text-muted); }
.badge-card-progress { width: 100%; height: 6px; margin-top: 0.25rem; }
.badge-card-count { font-size: var(--text-xs); color: var(--text-subtle); font-variant-numeric: tabular-nums; }

/* ---- Public profile ---------------------------------------------------- */
.profile-hero {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem 1.25rem;
    align-items: start;
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.profile-hero-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
}
.profile-hero-name { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); font-weight: 700; margin: 0; }
.profile-hero-handle { color: var(--text-muted); margin: 0.15rem 0 0.5rem; font-size: var(--text-sm); }
.profile-hero-bio { margin: 0 0 0.75rem; }
.profile-level { max-width: 420px; }
.profile-level-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; }
.profile-level-next { margin-top: 0.35rem; }
.profile-hero-actions { grid-column: 1 / -1; display: flex; gap: 0.5rem; }
@media (min-width: 768px) {
    .profile-hero { grid-template-columns: auto 1fr auto; }
    .profile-hero-actions { grid-column: auto; }
}
.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    list-style: none;
    margin: 0 0 0.5rem;
    padding: 0;
}
@media (min-width: 768px) { .profile-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.profile-stats li {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-1);
    text-align: center;
}
.profile-stats strong { font-size: var(--text-lg); font-variant-numeric: tabular-nums; }
.profile-stats span { font-size: var(--text-xs); color: var(--text-muted); }
.profile-reviews { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.profile-reviews li { padding: 0.75rem 1rem; display: grid; gap: 0.25rem; }
.profile-reviews .review-stars i { color: var(--text-subtle); font-size: 0.75rem; }
.profile-reviews .review-stars i.is-on { color: var(--star); }

/* Level row in the private profile's identity bar (auth/profile.html) */
.profile-level-row { margin-top: 0.6rem; max-width: 460px; }
.profile-level-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 0.35rem; }
.profile-level-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.9rem;
    margin: 0.4rem 0 0;
    font-size: var(--text-xs);
    color: var(--text-muted);
}
.profile-level-meta a { color: var(--accent-text); text-decoration: none; }
.profile-level-meta a:hover { text-decoration: underline; }
.saved-drink-publish {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

/* ---- Leaderboard ------------------------------------------------------- */
.lb-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 1rem; margin-bottom: 1rem; }
.lb-you { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; margin-bottom: 1rem; }
.lb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.lb-row {
    display: grid;
    grid-template-columns: 2.5rem auto 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-1);
}
.lb-row.is-you { border-color: var(--accent-border); background: var(--accent-soft); }
.lb-rank { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-muted); white-space: nowrap; }
.lb-rank i { margin-right: 0.2rem; }
.lb-top-1 .lb-rank { color: #d4a017; }
.lb-top-2 .lb-rank { color: #9ca3af; }
.lb-top-3 .lb-rank { color: #b87333; }
.lb-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.lb-thumb { width: 48px; height: 48px; border-radius: var(--radius-sm); object-fit: cover; }
.lb-thumb-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    color: var(--text-subtle);
}
.lb-name { display: flex; flex-direction: column; min-width: 0; }
.lb-name > a { font-weight: 600; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-name > a:hover { color: var(--accent-text); }
.lb-sub { font-size: var(--text-xs); color: var(--text-muted); }
.lb-value { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lb-guide-grid { display: grid; gap: 0.75rem; }
@media (min-width: 768px) { .lb-guide-grid { grid-template-columns: 3fr 2fr; } }
.lb-points, .lb-levels { list-style: none; margin: 0; padding: 0.5rem 1rem; }
.lb-points li, .lb-levels li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.4rem 0;
    font-size: var(--text-sm);
}
.lb-points li + li, .lb-levels li + li { border-top: 1px solid var(--border); }
.lb-levels li > span:nth-child(2) { flex: 1; }

/* ---- Celebration toasts (in #alerts-container) -------------------------- */
.achievement-toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    pointer-events: auto;
    background: var(--surface-raised);
    color: var(--text);
    border: 1px solid var(--accent-border);
    box-shadow: var(--shadow-2);
    animation: gm-pop 0.35s var(--ease);
}
.achievement-toast-icon {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-contrast);
}
.achievement-toast.is-achievement .achievement-toast-icon,
.achievement-toast.is-level-up .achievement-toast-icon { background: var(--premium-bg); color: var(--premium-contrast); }
.achievement-toast-body { display: flex; flex-direction: column; flex: 1; min-width: 0; font-size: var(--text-sm); }
.achievement-toast-body span { color: var(--text-muted); }
.achievement-toast .btn-close { flex: none; }
@keyframes gm-pop {
    from { transform: translateY(8px) scale(0.97); opacity: 0; }
    to { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .achievement-toast { animation: none; }
    .xp-bar > span, .badge-card-progress > span { transition: none; }
}

/* Share page (/d/<slug>): link to the drink's community catalog entry */
.shared-catalog-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-md);
    background: var(--accent-soft);
    color: var(--accent-text);
    font-weight: 600;
    font-size: var(--text-sm);
    text-decoration: none;
}
.shared-catalog-link span { flex: 1; }
.shared-catalog-link:hover { border-color: var(--accent); }

/* Bartender card: Publish button (ai-recipe-card.js) */
.creation-publish { text-decoration: none; }
.creation-publish[hidden] { display: none; }
.creation-publish.is-on { border-color: var(--accent-border); background: var(--accent-soft); color: var(--accent-text); }
.drink-tile-score { display: inline-flex; align-items: center; gap: 0.15rem; }
.drink-tile-community .drink-tile-score i { color: #fff; font-size: 0.6rem; }
