/* ═══════════════════════════════════════════════════════
   QuickTools — P2-C: Referral Dashboard
                P2-E: Featured Offers & Live Activity
   Append to assets/css/earn.css or tools.css
   ═══════════════════════════════════════════════════════ */

/* ═══ LIVE TICKER ═══ */
.earn-ticker {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-2) var(--space-4);
    overflow: hidden;
    margin-bottom: var(--space-4);
}
.earn-ticker__label {
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: var(--color-error-500);
    white-space: nowrap;
    animation: pulse-dot 2s ease infinite;
}
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:.4} }

.earn-ticker__track {
    flex: 1;
    overflow: hidden;
    position: relative;
    mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.earn-ticker__content {
    display: flex;
    gap: var(--space-8);
    white-space: nowrap;
    animation: ticker-scroll 30s linear infinite;
}
.earn-ticker__item {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    flex-shrink: 0;
}
.earn-ticker__item strong {
    color: var(--text-primary);
}
@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* ═══ QUICK STATS BAR ═══ */
.earn-quick-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}
.earn-quick-stat {
    text-align: center;
    padding: var(--space-3);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}
.earn-quick-stat__value {
    display: block;
    font-size: var(--font-size-xl);
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent);
}
.earn-quick-stat__label {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

/* ═══ FEATURED OFFERS ═══ */
.featured-section {
    margin-bottom: var(--space-6);
}
.featured-section__header {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.featured-section__header h2 {
    font-size: var(--font-size-lg);
    margin: 0;
}
.featured-section__subtitle {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}
.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-3);
}
.featured-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--bg-elevated);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}
.featured-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-accent);
    transform: translateY(-2px);
}
.featured-card__badge {
    position: absolute;
    top: 0;
    right: 0;
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: .5px;
    padding: 3px 10px;
    border-radius: 0 var(--radius-lg) 0 var(--radius-md);
}
.featured-card__badge--accent { background: var(--accent); color: #fff; }
.featured-card__badge--success { background: var(--color-success-500); color: #fff; }
.featured-card__badge--warning { background: var(--color-warning-500); color: #000; }
.featured-card__badge--error { background: var(--color-error-500); color: #fff; }

.featured-card__icon {
    font-size: 1.6rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    flex-shrink: 0;
}
.featured-card__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.featured-card__title {
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.featured-card__desc {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.featured-card__reward {
    flex-shrink: 0;
}
.featured-card__reward-value {
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: var(--color-success-500);
    background: var(--success-bg);
    padding: 3px 8px;
    border-radius: var(--radius-full);
    white-space: nowrap;
}
.featured-card__arrow {
    color: var(--text-tertiary);
    font-size: var(--font-size-lg);
    flex-shrink: 0;
    transition: transform var(--transition-fast);
}
.featured-card:hover .featured-card__arrow {
    transform: translateX(3px);
    color: var(--accent);
}

/* ═══ ACTIVITY FEED ═══ */
.activity-feed {
    margin-bottom: var(--space-6);
}
.activity-feed__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}
.activity-feed__header h3 {
    font-size: var(--font-size-base);
    margin: 0;
}
.activity-feed__live {
    font-size: var(--font-size-xs);
    font-weight: 700;
    color: var(--color-error-500);
    animation: pulse-dot 2s ease infinite;
}
.activity-feed__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    max-height: 380px;
    overflow-y: auto;
}
.activity-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    animation: fadeSlideIn .3s ease;
}
@keyframes fadeSlideIn { from{opacity:0;transform:translateY(-6px)} to{opacity:1;transform:none} }

.activity-row__icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}
.activity-row__info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.activity-row__info strong {
    font-size: var(--font-size-sm);
}
.activity-row__desc {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.activity-row__amount {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: var(--font-size-xs);
    color: var(--color-success-500);
    flex-shrink: 0;
}
.activity-row__time {
    font-size: .65rem;
    color: var(--text-tertiary);
    flex-shrink: 0;
    min-width: 24px;
    text-align: right;
}

/* ═══ REFERRAL DASHBOARD ═══ */
.ref-dashboard {
    margin-bottom: var(--space-6);
}
.ref-dashboard__header {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.ref-dashboard__header h2 { margin: 0; font-size: var(--font-size-lg); }
.ref-badge-pct {
    font-size: var(--font-size-xs);
    font-weight: 700;
    background: var(--accent);
    color: #fff;
    padding: 2px 10px;
    border-radius: var(--radius-full);
}

/* Invite box */
.ref-invite-box {
    background: var(--bg-secondary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}
.ref-invite-box__label {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    margin-bottom: var(--space-2);
}
.ref-invite-box__link {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}
.ref-invite-box__link .input {
    flex: 1;
    font-family: var(--font-mono);
    font-size: var(--font-size-xs);
}
.ref-invite-box__code {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    margin-bottom: var(--space-3);
}
.ref-invite-box__share {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}

/* How it works */
.ref-how {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--accent-bg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}
.ref-how__step {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
}
.ref-how__num {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    font-size: var(--font-size-xs);
    font-weight: 700;
    flex-shrink: 0;
}
.ref-how__arrow {
    color: var(--text-tertiary);
    font-size: var(--font-size-lg);
}

/* Stats grid */
.ref-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.ref-stat {
    text-align: center;
    padding: var(--space-4);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}
.ref-stat--highlight {
    background: var(--accent-bg);
    border: 1.5px solid var(--accent);
}
.ref-stat__value {
    display: block;
    font-size: var(--font-size-2xl);
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}
.ref-stat__value--active { color: var(--color-success-500); }
.ref-stat--highlight .ref-stat__value { color: var(--accent); }
.ref-stat__label {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
}

/* Periods */
.ref-periods {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}
.ref-period {
    flex: 1;
    min-width: 120px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
}
.ref-period__label { color: var(--text-tertiary); }
.ref-period__value { font-weight: 600; font-family: var(--font-mono); }

/* Network & History */
.ref-network, .ref-history {
    margin-bottom: var(--space-3);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.ref-network summary, .ref-history summary {
    padding: var(--space-3) var(--space-4);
    font-weight: 600;
    font-size: var(--font-size-sm);
    cursor: pointer;
    background: var(--bg-secondary);
}
.ref-network[open] summary, .ref-history[open] summary {
    border-bottom: 1px solid var(--border-light);
}

.ref-net-row, .ref-hist-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    border-bottom: 1px solid var(--border-light);
    font-size: var(--font-size-sm);
}
.ref-net-row:last-child, .ref-hist-row:last-child { border-bottom: none; }
.ref-net-row__status { font-size: .6rem; }
.ref-net-row__name { flex: 1; font-weight: 500; }
.ref-net-row__earned { font-family: var(--font-mono); font-weight: 600; color: var(--color-success-500); font-size: var(--font-size-xs); }

.ref-hist-row__icon { font-size: 1.1rem; }
.ref-hist-row__info { flex: 1; display: flex; flex-direction: column; gap: 1px; }
.ref-hist-row__source { font-size: var(--font-size-xs); color: var(--text-tertiary); }
.ref-hist-row__comm { font-family: var(--font-mono); font-weight: 700; color: var(--color-success-500); font-size: var(--font-size-sm); }

/* CTA login */
.ref-cta-login {
    text-align: center;
    padding: var(--space-8);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}
.ref-cta-login p {
    margin-bottom: var(--space-4);
    color: var(--text-secondary);
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 640px) {
    .featured-grid { grid-template-columns: 1fr; }
    .ref-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .earn-quick-stats { grid-template-columns: repeat(3, 1fr); gap: var(--space-2); }
    .earn-quick-stat { padding: var(--space-2); }
    .earn-quick-stat__value { font-size: var(--font-size-base); }
    .ref-how__arrow { display: none; }
    .ref-how { gap: var(--space-2); }
    .featured-card__desc { display: none; }
}
