/**
 * Member profile and leaderboards
 *
 * Follows the palette and card conventions in main.css.
 */

/* ---------------------------------------------------------------- states */

.profile-state {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Sign-in / unlinked / error notice */
.profile-notice {
    max-width: 520px;
    margin: 3rem auto;
    padding: 3rem 2rem;
    text-align: center;
    background: rgba(20, 20, 20, 0.6);
    border: 1px solid var(--border);
    border-radius: 20px;
}

.profile-notice svg {
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.profile-notice h3 {
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
}

.profile-notice p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.profile-hint {
    font-size: 0.9rem;
    opacity: 0.7;
}

.profile-notice .btn {
    margin: 0 auto;
}

/* ---------------------------------------------------------------- header */

.profile-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.12) 0%, rgba(255, 140, 66, 0.05) 100%);
    border: 1px solid rgba(255, 107, 53, 0.3);
    border-radius: 20px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--primary);
    flex-shrink: 0;
}

.profile-identity h2 {
    font-size: 1.8rem;
    margin-bottom: 0.25rem;
}

.profile-meta {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.profile-sep {
    margin: 0 0.5rem;
    opacity: 0.4;
}

/* ------------------------------------------------------- headline figures */

.profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.profile-stat {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.25rem;
    background: rgba(20, 20, 20, 0.6);
    border: 1px solid var(--border);
    border-radius: 14px;
}

.profile-stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.profile-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
}

/* Decay urgency */
.profile-stat-value.is-warning { color: #f59e0b; }
.profile-stat-value.is-danger  { color: #ef4444; }

/* ---------------------------------------------------------------- panels */

.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.profile-panel {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: rgba(20, 20, 20, 0.6);
    border: 1px solid var(--border);
    border-radius: 16px;
}

.profile-grid .profile-panel {
    margin-bottom: 0;
}

.profile-panel h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.panel-header h3 {
    margin-bottom: 0;
}

/* ---------------------------------------------------------------- quests */

.quest-filter {
    display: flex;
    gap: 0.5rem;
}

.quest-filter-btn {
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.quest-filter-btn:hover {
    border-color: rgba(255, 107, 53, 0.5);
    color: var(--text);
}

.quest-filter-btn.active {
    background: rgba(255, 107, 53, 0.15);
    border-color: var(--primary);
    color: var(--primary);
}

.quest-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 600px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.quest-item {
    padding: 0.85rem 1rem;
    background: rgba(255, 107, 53, 0.04);
    border: 1px solid rgba(255, 107, 53, 0.12);
    border-radius: 10px;
}

.quest-item.quest-done {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.05);
}

.quest-item.quest-progress {
    border-color: rgba(245, 158, 11, 0.3);
}

.quest-main {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.quest-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.quest-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.quest-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 3px;
    overflow: hidden;
}

.quest-bar-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 3px;
    transition: width 0.6s ease;
}

.quest-done .quest-bar-fill {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
}

.quest-description {
    margin-top: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ---------------------------------------------------------------- tokens */

.token-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}

.token-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 107, 53, 0.05);
    border: 1px solid rgba(255, 107, 53, 0.15);
    border-radius: 10px;
}

.token-amount {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.token-name {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.2;
}

/* ---------------------------------------------------------- leaderboards */

.board-tabs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.board-tab {
    padding: 0.6rem 1.4rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.board-tab:hover {
    border-color: rgba(255, 107, 53, 0.5);
    color: var(--text);
}

.board-tab.active {
    background: rgba(255, 107, 53, 0.15);
    border-color: var(--primary);
    color: var(--primary);
}

.board-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 900px;
    margin: 0 auto;
}

.board-row {
    display: grid;
    grid-template-columns: 3rem 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    background: rgba(20, 20, 20, 0.6);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: all 0.2s ease;
}

.board-row:hover {
    border-color: rgba(255, 107, 53, 0.35);
    transform: translateX(3px);
}

/* Top three stand out */
.board-row.rank-1 { border-color: rgba(255, 215, 0, 0.5); background: rgba(255, 215, 0, 0.06); }
.board-row.rank-2 { border-color: rgba(192, 192, 192, 0.4); background: rgba(192, 192, 192, 0.05); }
.board-row.rank-3 { border-color: rgba(205, 127, 50, 0.4); background: rgba(205, 127, 50, 0.05); }

.board-rank {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.rank-1 .board-rank { color: #ffd700; }
.rank-2 .board-rank { color: #c0c0c0; }
.rank-3 .board-rank { color: #cd7f32; }

.board-player {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.board-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.board-tribe {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.board-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.board-value small {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 0.25rem;
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 768px) {
    .profile-grid {
        grid-template-columns: 1fr;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .panel-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
