/* ===== NAVBAR COINS COMPONENT ===== */

/* --- Coin Icon in Navbar --- */
.nav-coins-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: #8b5cf6;
    font-size: 18px;
    background: transparent;
    border: none;
    flex-shrink: 0;
}
.nav-coins-btn:hover {
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
}
.nav-coins-btn:active {
    transform: scale(0.94);
}

/* ===== OVERLAY ===== */
.coins-overlay {
    position: fixed; inset: 0; z-index: 998;
    background: rgba(15, 23, 42, 0.25);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0; visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
}
.coins-overlay.open {
    opacity: 1; visibility: visible;
}

/* ===== POPUP PANEL ===== */
.coins-popup {
    position: fixed;
    top: 68px;
    right: 20px;
    width: 460px;
    max-height: calc(100vh - 100px);
    z-index: 999;
    background: rgba(255, 255, 255, 0.975);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 20px;
    box-shadow:
        0 24px 56px rgba(15, 23, 42, 0.14),
        0 4px 16px rgba(15, 23, 42, 0.06),
        0 0 0 0.5px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    opacity: 0; visibility: hidden;
    transform: translateY(-10px) scale(0.96);
    transform-origin: top right;
    transition:
        opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1),
        visibility 0.28s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}
.coins-popup.open {
    opacity: 1; visibility: visible;
    transform: translateY(0) scale(1);
}

/* ===== HEADER ===== */
.coins-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}
.coins-popup-title {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.01em;
}
.coins-popup-title i {
    color: #8b5cf6;
    font-size: 18px;
}
.coins-popup-close {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(203,213,225,0.4);
    background: rgba(255,255,255,0.7);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: #94a3b8; font-size: 14px;
    transition: all 0.2s ease;
}
.coins-popup-close:hover {
    background: rgba(239,68,68,0.08); color: #ef4444;
    border-color: rgba(239,68,68,0.2);
}

/* ===== BODY ===== */
.coins-popup-body {
    flex: 1; overflow-y: auto; overscroll-behavior: contain;
}
.coins-popup-body::-webkit-scrollbar { width: 4px; }
.coins-popup-body::-webkit-scrollbar-track { background: transparent; }
.coins-popup-body::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }
.coins-popup-body::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }

/* ===== HERO BALANCE CARD ===== */
.coins-hero-card {
    margin: 20px 24px;
    padding: 28px 24px;
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(139, 92, 246, 0.08), rgba(167, 139, 250, 0.03), rgba(255, 255, 255, 0.9));
    border: 1px solid rgba(139, 92, 246, 0.15);
    text-align: center;
    position: relative;
    overflow: hidden;
}
.coins-hero-card::before {
    content: '';
    position: absolute;
    top: -40px; right: -30px;
    width: 120px; height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.06), transparent 70%);
    pointer-events: none;
}
.coins-hero-icon {
    width: 44px; height: 44px; border-radius: 14px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(167, 139, 250, 0.08));
    border: 1px solid rgba(139, 92, 246, 0.15);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: #8b5cf6;
    margin: 0 auto 12px;
}
.coins-hero-value {
    font-size: 42px;
    font-weight: 800;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #7c3aed, #a78bfa, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}
.coins-hero-unit {
    font-size: 14px; font-weight: 600;
    color: #8b5cf6;
    margin-top: 4px;
}
.coins-hero-sub {
    font-size: 12px; color: #94a3b8;
    margin-top: 8px;
}

/* ===== QUICK STATS ROW ===== */
.coins-stats-row {
    display: flex; gap: 10px;
    margin: 0 24px 10px;
}
.coins-stat-card {
    flex: 1; display: flex; align-items: center; gap: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid rgba(226,232,240,0.6);
    transition: all 0.18s ease;
}
.coins-stat-card:hover {
    border-color: rgba(139, 92, 246, 0.12);
}
.coins-stat-card.earn {
    background: linear-gradient(135deg, rgba(16,185,129,0.04), rgba(16,185,129,0.01));
}
.coins-stat-card.spend {
    background: linear-gradient(135deg, rgba(239,68,68,0.04), rgba(239,68,68,0.01));
}
.coins-stat-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0;
}
.coins-stat-card.earn .coins-stat-icon {
    background: rgba(16,185,129,0.1); color: #059669;
}
.coins-stat-card.spend .coins-stat-icon {
    background: rgba(239,68,68,0.08); color: #dc2626;
}
.coins-stat-body { min-width: 0; }
.coins-stat-value {
    font-size: 17px; font-weight: 700; line-height: 1.1;
}
.coins-stat-card.earn .coins-stat-value { color: #059669; }
.coins-stat-card.spend .coins-stat-value { color: #dc2626; }
.coins-stat-label {
    font-size: 11px; color: #94a3b8; font-weight: 500;
}

/* ===== TRANSACTION LIST ===== */
.coins-tx-section-header {
    padding: 12px 28px 8px;
    font-size: 12px; font-weight: 600; color: #94a3b8;
    text-transform: uppercase; letter-spacing: 0.04em;
}

/* Date group */
.coins-tx-group {
    margin-bottom: 2px;
}
.coins-tx-group-title {
    padding: 8px 28px 4px;
    font-size: 11px; font-weight: 600; color: #cbd5e1;
    text-transform: uppercase; letter-spacing: 0.03em;
}

/* Transaction item */
.coins-tx-item {
    display: flex; align-items: center; gap: 14px;
    padding: 13px 24px;
    transition: background 0.18s ease;
    border-left: 3px solid transparent;
}
.coins-tx-item:hover {
    background: #f8fafc;
}
.coins-tx-icon {
    width: 38px; height: 38px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; flex-shrink: 0;
}
.coins-tx-icon.recharge { background: rgba(16,185,129,0.1); color: #059669; }
.coins-tx-icon.consumption { background: rgba(239,68,68,0.08); color: #dc2626; }
.coins-tx-icon.reward { background: rgba(37,99,235,0.08); color: #2563eb; }
.coins-tx-icon.daily_login { background: rgba(245,158,11,0.1); color: #d97706; }
.coins-tx-icon.refund { background: rgba(100,116,139,0.08); color: #64748b; }
.coins-tx-icon.admin_grant { background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(167,139,250,0.06)); color: #7c3aed; }

.coins-tx-info { flex: 1; min-width: 0; }
.coins-tx-desc { font-size: 14px; font-weight: 500; color: #1e293b; margin-bottom: 2px; }
.coins-tx-meta { font-size: 12px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.coins-tx-right { text-align: right; flex-shrink: 0; }
.coins-tx-amount {
    font-weight: 700; font-size: 15px; line-height: 1.2;
}
.coins-tx-amount.positive { color: #059669; }
.coins-tx-amount.negative { color: #dc2626; }
.coins-tx-balance {
    font-size: 11px; color: #94a3b8;
}

/* No transactions */
.coins-no-tx {
    display: flex; flex-direction: column;
    align-items: center;
    padding: 32px 28px;
    text-align: center;
}
.coins-no-tx-icon {
    width: 52px; height: 52px; border-radius: 15px;
    background: #f8fafc; border: 1px solid #f1f5f9;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: #cbd5e1;
    margin-bottom: 10px;
}
.coins-no-tx p { font-size: 14px; font-weight: 500; color: #64748b; margin-bottom: 4px; }
.coins-no-tx span { font-size: 12px; color: #94a3b8; }

/* Tips footer */
.coins-tips-footer {
    margin: 8px 24px 20px;
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(139,92,246,0.04);
    border: 1px solid rgba(139,92,246,0.06);
    font-size: 12px; color: #64748b;
    display: flex; align-items: flex-start; gap: 8px;
    line-height: 1.6;
}
.coins-tips-footer i { color: #8b5cf6; margin-top: 1px; flex-shrink: 0; }
.coins-tips-footer strong { color: #475569; }

/* ===== EMPTY STATE (not logged in) ===== */
.coins-empty-state {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 56px 28px; text-align: center;
}
.coins-empty-hero {
    width: 72px; height: 72px; border-radius: 22px;
    background: linear-gradient(135deg, rgba(139,92,246,0.06), rgba(167,139,250,0.03));
    border: 1px solid rgba(139,92,246,0.1);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; color: #c4b5fd;
    margin-bottom: 16px;
}
.coins-empty-state h4 {
    font-size: 15px; font-weight: 600; color: #64748b; margin-bottom: 6px;
}
.coins-empty-state p {
    font-size: 13px; color: #94a3b8; line-height: 1.5; max-width: 260px;
}

/* ===== LOADING ===== */
.coins-loading {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 56px;
    gap: 14px;
}
.coins-loading .coins-spinner {
    width: 26px; height: 26px;
    border: 2.5px solid #e2e8f0;
    border-top-color: #8b5cf6;
    border-radius: 50%;
    animation: coinsSpin 0.7s linear infinite;
}
.coins-loading p {
    font-size: 13px; color: #94a3b8;
}
@keyframes coinsSpin { to { transform: rotate(360deg); } }

@media (max-width: 520px) {
    .coins-popup {
        width: calc(100vw - 24px); right: 12px; top: 62px;
        border-radius: 16px;
    }
    .coins-hero-card { margin: 16px 16px; padding: 24px 18px; }
    .coins-stats-row { margin: 0 16px 8px; }
    .coins-hero-value { font-size: 34px; }
    .coins-tx-item { padding: 13px 16px; }
}
